Initial import of krecipes 1.0-beta2
@ -0,0 +1,3 @@
|
||||
Unai Garro <ugarro@users.sourceforge.net>
|
||||
Jason Kivlighn <jkivlighn@gmail.com>
|
||||
Cyril Bosselut <bosselut@b1project.com>
|
@ -0,0 +1,121 @@
|
||||
Changes from 1.0-beta1 to 1.0-beta2:
|
||||
-Fix crash with sqlite backend.
|
||||
-Fix FTBFS with GCC 4.3.
|
||||
-Add categories to desktop file.
|
||||
|
||||
Changes from 0.9 to 1.0-beta1:
|
||||
-Handbook integration: Removed context help and replaced with links to the Handbook. Also "Help" buttons have been added to some dialogs that also take users to the Handbook for more info.
|
||||
-Nutrient status indicator; while editing a recipe, lets you know whether or not nutrient information is complete for a recipe.
|
||||
-Measurement Converter tool
|
||||
-Ingredient weights, used for accurate Volume->Mass unit conversions based on the ingredient
|
||||
-Improved unit conversions; there's a separate table for mass and volume conversions and this setup avoids non-sensical conversions (i.e. 1 loaf = ? cups)
|
||||
-Optimized for quick loading and faster startup times
|
||||
-Ingredient substitutes (i.e. butter or margarine)
|
||||
-Completely re-done recipe view, based on HTML templates. This solves many layout problems and should allow creating layouts for printing to 3x5 or 4x6 cards. Generated HTML is much cleaner and compatible.
|
||||
-"Web Book" exporter - exports a collection of recipes into a series of web pagesÂ, organized by category.
|
||||
-Ingredients and properties can be split into a variable number of columns in the Page Setup.
|
||||
-Select which properties to show in the recipe view
|
||||
Notable bugs fixed:
|
||||
-Make dialog windows more KDE standards compliant.
|
||||
-Fix displaying photos when special characters are in the title of the recipe
|
||||
-Fix database backup for a non-local host
|
||||
|
||||
Changes from 0.8 to 0.9:
|
||||
-Rating support: multiple people can rate a single recipe, each rating can rate a recipe on multiple criteria (taste, ease of preparation, etc.)
|
||||
-New yield property for recipes: rather than storing the number of servings, it now stores a yield amount
|
||||
and type. The amount may also be a range.
|
||||
-Backup/restore of entire database. This is much faster than exporting/importing an database in the
|
||||
Krecipes Format and also includes nutrient info and unit ratios.
|
||||
-Ingredient amounts can be ranges
|
||||
-Recipe lists now allow selecting multiple recipes. For example, this is handy for exporting, viewing, or
|
||||
printing multiple recipes at once
|
||||
-Dialog to paste ingredients into, which Krecipes then automatically parses and adds to a recipes.
|
||||
-Allows multiple preparation methods
|
||||
-PostgreSQL backend now stable
|
||||
-Now keeps tracks of when recipes are created, modified, and last accessed.
|
||||
-'Copy to Clipboard' feature, which allows easily copying a recipe(s) directly to the clipboard in a format that can be configured. There
|
||||
is a new export format, Plain Text, that is used by default.
|
||||
-Rezkonv file format export
|
||||
|
||||
Changes from 0.7 to 0.8:
|
||||
-Redesigned advanced search: search on the "and", "or", and "not" conditions of each search term. Can now search on nearly any item possible.
|
||||
-Reduce memory requirements for large databases. Very large databases should now be possible, though work continues to be put into this. It is being tested on a database with 37,000 recipes and counting.
|
||||
-Improve recipe import speeds, keeping a fairly constant speed no matter what the size of the database.
|
||||
|
||||
Changes from 0.6 to 0.7:
|
||||
-BETA support for PostgreSQL database backend
|
||||
-Database to database transfer (Remote or local).
|
||||
-Support for grouping ingredients. Also imports group information from import formats, such as Meal-Master.
|
||||
-There's a new intermediate interface between displaying the shopping list and selecting recipes for it. Here you can add, remove, or modify ingredients used in those selected recipes.
|
||||
-Load sample recipes based on locale. If we don't currently have your locale, please submit some recipes to us!
|
||||
-Border options added to recipe display
|
||||
-Autocomplete ingredients typed in the instructions text edit
|
||||
-Updated USDA data from SR16-1 to SR17 (released September, 2004)
|
||||
-'Configure' options to disable particular backends
|
||||
-Support for drag and drop in the shopping list dialog
|
||||
-Behind the scenes, the internal structure of Krecipes has improved, quickly bringing it closer toward our 1.0 release
|
||||
-Overall, more stability, interface, and useability enhancements
|
||||
|
||||
Changes from 0.5 to 0.6:
|
||||
-Support for subcategories
|
||||
-Preparation time field for recipes
|
||||
-Rezkonv import filter
|
||||
-Eliminated the dependence on mysql.h (mysql-devel)
|
||||
-Advanced search which can search by ingredients, categories, authors, servings, and preparation time
|
||||
-Significant speed increases while navigating Krecipes due to the fact that reloading all data when switching dialogs is no longer necessary.
|
||||
-When renaming an element to something that already exists, merge the two into one
|
||||
-Provide popup menus to many listviews for easy access to common functions
|
||||
-Fix display of characters in certain locales (In particular, this fixes the problem many people had displaying umlauts)
|
||||
-Actually hide items in the Page Setup that aren't going to be shown in the recipe view
|
||||
-Allow renaming of unit and prep method once it is entered in the recipe input (from the list view)
|
||||
-Allow an empty or zero amount and an empty unit for ingredients
|
||||
-Set the cursor to change to the wait cursor for operations that could take more than a few seconds -- this makes the app seem more responsive
|
||||
-Fix some escape/encoding issues in the generated HTML
|
||||
-Support for SQLite 3
|
||||
-Add a Reload and Edit action to the menu
|
||||
-Accessibility improvements
|
||||
|
||||
|
||||
Most important changes from 0.4 to 0.5:
|
||||
|
||||
-Ingredient matcher - select what ingredients you have, and find out what you can make with them
|
||||
-A new field for ingredients: preparation method
|
||||
-Easier and faster imports
|
||||
-Load nutrient data from the USDA's nutrient database
|
||||
-Layouts can now be saved and loaded from files in the Krecipes layout format.
|
||||
-Improved locale support
|
||||
-Category and author names can now be up to 40 and 50 characters respectively (previously 20)
|
||||
-Complete keyboard navigation now possible
|
||||
|
||||
|
||||
Most important new features from 0.3 to 0.4:
|
||||
|
||||
* New Krecipes file format for recipe exchange! (.kre compressed, and .kreml
|
||||
plain XML)
|
||||
* Import Filters for other programs: MasterCook Export (mx2), MasterCook
|
||||
Export (mxp) and MealMaster
|
||||
* SQLite support as database. Much easier to setup for users.
|
||||
* Configureable layouting of the recipe display.
|
||||
* A Diet Wizard that helps creating a menu for a chosen period
|
||||
* New Tips function
|
||||
* New recipe search method
|
||||
* Much Improved GUI
|
||||
* Lots, tons, of bugfixes, improvements, speed-up, database structure
|
||||
improvements...
|
||||
|
||||
Most important changes from 0.2 to 0.3:
|
||||
|
||||
|
||||
* Recipes can be classified in categories
|
||||
* Number of servings per recipe
|
||||
* Authors support
|
||||
* New MySQL database autosetup to make setup easier
|
||||
* "In-place" creation of new ingredients and units
|
||||
* Renaming of units and ingredients
|
||||
* Resizing of photos
|
||||
* Improved shopping list presentation
|
||||
* New smaller and smarter layout for editing recipes
|
||||
* i18n: Language support: English, Spanish, French and Euskara
|
||||
* UTF support
|
||||
* Thousands of other touches and bugfixes
|
||||
* New recipe samples
|
@ -0,0 +1,167 @@
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
The file `configure.in' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.in' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes a while. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
4. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made.
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
||||
|
@ -0,0 +1,5 @@
|
||||
AUTOMAKE_OPTIONS = foreign 1.6.1
|
||||
|
||||
include admin/deps.am
|
||||
include admin/Doxyfile.am
|
||||
SUBDIRS=$(TOPSUBDIRS)
|
@ -0,0 +1,4 @@
|
||||
AUTOMAKE_OPTIONS = foreign 1.6.1
|
||||
|
||||
include admin/deps.am
|
||||
include admin/Doxyfile.am
|
@ -0,0 +1,36 @@
|
||||
Krecipes is a Recipe Book for KDE. It requires KDE 3.1 or greater (and Qt 3.1 or greater)
|
||||
|
||||
|
||||
First of all, make sure you have at least one of the three necessary databases installed: SQLite, MySQL, or PostgreSQL. In case you decide to use MySQL or PostgreSQL, make sure also that you have Qt's MySQL or PostgreSQL plugin properly installed. The program won't work without database support.
|
||||
|
||||
** Building The Latest (0.9) Release
|
||||
|
||||
Just untar the package first:
|
||||
|
||||
tar -zxf krecipes-0.9.tar.gz
|
||||
|
||||
And compile (see ./configure --help for more compile options like '--prefix' and '--with-qt-dir')
|
||||
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
|
||||
** Downloading And Compiling Through Subversion
|
||||
|
||||
The project is now being developed under extragear/utils in KDE's servers.
|
||||
|
||||
Please notice that this application is beta, meaning everything is expected to work, but the possibility is there that some things might not. Note that the more our users tells us about bugs, the faster we can find them and fix them.
|
||||
|
||||
|
||||
|
||||
To download the package, do:
|
||||
|
||||
svn co -N svn://anonsvn.kde.org/home/kde/trunk/extragear/utils krecipes-svn
|
||||
cd krecipes-svn
|
||||
svn up
|
||||
svn up krecipes
|
||||
|
||||
For documentation (optional):
|
||||
svn up -N doc
|
||||
svn up doc/krecipes
|
@ -0,0 +1,43 @@
|
||||
|
||||
jkivlighn:
|
||||
|
||||
MAJOR FEATURES:
|
||||
*Calendar for meal planning
|
||||
*Command-line interface
|
||||
*Improved printing support: I'd like to allow, for example, printing on recipe cards.
|
||||
*Handle "Cookbooks". In MySQL/PostgreSQL a cookbook would be a table, and in SQLite it would be a file.
|
||||
*Recipe revisions (planned for 1.1)
|
||||
|
||||
CONVENIENCES/MINOR FEATURES:
|
||||
*Improved navigation - add a forward and back button
|
||||
*E-mail recipe(s) option (using kapp->invokeMailer())
|
||||
*Give option to import recipe formats by pasting the recipe text into a widget
|
||||
*Allow saving and loading diet info from a file (or just store it in the database?)
|
||||
*Database maintenance options (Empty database, Remove unused elements, etc.)
|
||||
*Configurable shopping list (Maybe allow the user to select a style sheet or add a section to settings dialog... or both)
|
||||
*Let the user know when nutrient info for a recipe is incomplete (due to missing info for one or more ingredients)
|
||||
*Web album export (a spiffed-up multiple-page website ;)
|
||||
|
||||
BUGS/OTHER:
|
||||
*Disable delete when renaming an element (otherwise, it crashes)
|
||||
*Let user know when no layout file was found
|
||||
*Secure database access passwords??
|
||||
*The icons on the left menu at times will disappear... I can't seem to reproduce this, however
|
||||
*Make use of transactions in database backends where appropriate
|
||||
*Give a warning when deleting categories (such as when a recipe was a part of that category)
|
||||
*Delete the database table when deleting Krecipes
|
||||
*Give a message box when exporting recipes, letting the user know what they are exporting (Is it the whole database, just what is visible, or a specific recipe)... Make it a "Don't ask me again" dialog.
|
||||
|
||||
THOUGHTS (feel free to comment):
|
||||
*Recipe copy
|
||||
*Reference a recipe to a cookbook (title, page number, category, etc.)
|
||||
|
||||
uga:
|
||||
(I don't claim ownership of these. If you do it, I'll be happy too :) )
|
||||
|
||||
planned for 0.8:
|
||||
*Step-by-Step recipe instructions with photos
|
||||
*Check ingredients from existing kitchen resource table? Check amounts in the ingredient matcher?
|
||||
*Add an option to popup for newly created ingredients, and include the USDA nutritional info at the same time
|
||||
|
||||
|
@ -0,0 +1,863 @@
|
||||
# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_AUTOMAKE_VERSION(VERSION)
|
||||
# ----------------------------
|
||||
# Automake X.Y traces this macro to ensure aclocal.m4 has been
|
||||
# generated from the m4 files accompanying Automake X.Y.
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
|
||||
|
||||
# AM_SET_CURRENT_AUTOMAKE_VERSION
|
||||
# -------------------------------
|
||||
# Call AM_AUTOMAKE_VERSION so it can be traced.
|
||||
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.9.6])])
|
||||
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
|
||||
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
|
||||
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
|
||||
#
|
||||
# Of course, Automake must honor this variable whenever it calls a
|
||||
# tool from the auxiliary directory. The problem is that $srcdir (and
|
||||
# therefore $ac_aux_dir as well) can be either absolute or relative,
|
||||
# depending on how configure is run. This is pretty annoying, since
|
||||
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
|
||||
# source directory, any form will work fine, but in subdirectories a
|
||||
# relative path needs to be adjusted first.
|
||||
#
|
||||
# $ac_aux_dir/missing
|
||||
# fails when called from a subdirectory if $ac_aux_dir is relative
|
||||
# $top_srcdir/$ac_aux_dir/missing
|
||||
# fails if $ac_aux_dir is absolute,
|
||||
# fails when called from a subdirectory in a VPATH build with
|
||||
# a relative $ac_aux_dir
|
||||
#
|
||||
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
|
||||
# are both prefixed by $srcdir. In an in-source build this is usually
|
||||
# harmless because $srcdir is `.', but things will broke when you
|
||||
# start a VPATH build or use an absolute $srcdir.
|
||||
#
|
||||
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
|
||||
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
|
||||
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
|
||||
# and then we would define $MISSING as
|
||||
# MISSING="\${SHELL} $am_aux_dir/missing"
|
||||
# This will work as long as MISSING is not called from configure, because
|
||||
# unfortunately $(top_srcdir) has no meaning in configure.
|
||||
# However there are other variables, like CC, which are often used in
|
||||
# configure, and could therefore not use this "fixed" $ac_aux_dir.
|
||||
#
|
||||
# Another solution, used here, is to always expand $ac_aux_dir to an
|
||||
# absolute PATH. The drawback is that using absolute paths prevent a
|
||||
# configured tree to be moved without reconfiguration.
|
||||
|
||||
AC_DEFUN([AM_AUX_DIR_EXPAND],
|
||||
[dnl Rely on autoconf to set up CDPATH properly.
|
||||
AC_PREREQ([2.50])dnl
|
||||
# expand $ac_aux_dir to an absolute path
|
||||
am_aux_dir=`cd $ac_aux_dir && pwd`
|
||||
])
|
||||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 7
|
||||
|
||||
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
|
||||
# -------------------------------------
|
||||
# Define a conditional.
|
||||
AC_DEFUN([AM_CONDITIONAL],
|
||||
[AC_PREREQ(2.52)dnl
|
||||
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
|
||||
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
|
||||
AC_SUBST([$1_TRUE])
|
||||
AC_SUBST([$1_FALSE])
|
||||
if $2; then
|
||||
$1_TRUE=
|
||||
$1_FALSE='#'
|
||||
else
|
||||
$1_TRUE='#'
|
||||
$1_FALSE=
|
||||
fi
|
||||
AC_CONFIG_COMMANDS_PRE(
|
||||
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
|
||||
AC_MSG_ERROR([[conditional "$1" was never defined.
|
||||
Usually this means the macro was only invoked conditionally.]])
|
||||
fi])])
|
||||
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 8
|
||||
|
||||
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
|
||||
# written in clear, in which case automake, when reading aclocal.m4,
|
||||
# will think it sees a *use*, and therefore will trigger all it's
|
||||
# C support machinery. Also note that it means that autoscan, seeing
|
||||
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
|
||||
|
||||
|
||||
# _AM_DEPENDENCIES(NAME)
|
||||
# ----------------------
|
||||
# See how the compiler implements dependency checking.
|
||||
# NAME is "CC", "CXX", "GCJ", or "OBJC".
|
||||
# We try a few techniques and use that to set a single cache variable.
|
||||
#
|
||||
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
|
||||
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
|
||||
# dependency, and given that the user is not expected to run this macro,
|
||||
# just rely on AC_PROG_CC.
|
||||
AC_DEFUN([_AM_DEPENDENCIES],
|
||||
[AC_REQUIRE([AM_SET_DEPDIR])dnl
|
||||
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
|
||||
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
|
||||
AC_REQUIRE([AM_DEP_TRACK])dnl
|
||||
|
||||
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
|
||||
[$1], CXX, [depcc="$CXX" am_compiler_list=],
|
||||
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
|
||||
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
|
||||
[depcc="$$1" am_compiler_list=])
|
||||
|
||||
AC_CACHE_CHECK([dependency style of $depcc],
|
||||
[am_cv_$1_dependencies_compiler_type],
|
||||
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
|
||||
# We make a subdir and do the tests there. Otherwise we can end up
|
||||
# making bogus files that we don't know about and never remove. For
|
||||
# instance it was reported that on HP-UX the gcc test will end up
|
||||
# making a dummy file named `D' -- because `-MD' means `put the output
|
||||
# in D'.
|
||||
mkdir conftest.dir
|
||||
# Copy depcomp to subdir because otherwise we won't find it if we're
|
||||
# using a relative directory.
|
||||
cp "$am_depcomp" conftest.dir
|
||||
cd conftest.dir
|
||||
# We will build objects and dependencies in a subdirectory because
|
||||
# it helps to detect inapplicable dependency modes. For instance
|
||||
# both Tru64's cc and ICC support -MD to output dependencies as a
|
||||
# side effect of compilation, but ICC will put the dependencies in
|
||||
# the current directory while Tru64 will put them in the object
|
||||
# directory.
|
||||
mkdir sub
|
||||
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
if test "$am_compiler_list" = ""; then
|
||||
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
|
||||
fi
|
||||
for depmode in $am_compiler_list; do
|
||||
# Setup a source with many dependencies, because some compilers
|
||||
# like to wrap large dependency lists on column 80 (with \), and
|
||||
# we should not choose a depcomp mode which is confused by this.
|
||||
#
|
||||
# We need to recreate these files for each test, as the compiler may
|
||||
# overwrite some of them when testing with obscure command lines.
|
||||
# This happens at least with the AIX C compiler.
|
||||
: > sub/conftest.c
|
||||
for i in 1 2 3 4 5 6; do
|
||||
echo '#include "conftst'$i'.h"' >> sub/conftest.c
|
||||
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
|
||||
# Solaris 8's {/usr,}/bin/sh.
|
||||
touch sub/conftst$i.h
|
||||
done
|
||||
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
|
||||
|
||||
case $depmode in
|
||||
nosideeffect)
|
||||
# after this tag, mechanisms are not by side-effect, so they'll
|
||||
# only be used when explicitly requested
|
||||
if test "x$enable_dependency_tracking" = xyes; then
|
||||
continue
|
||||
else
|
||||
break
|
||||
fi
|
||||
;;
|
||||
none) break ;;
|
||||
esac
|
||||
# We check with `-c' and `-o' for the sake of the "dashmstdout"
|
||||
# mode. It turns out that the SunPro C++ compiler does not properly
|
||||
# handle `-M -o', and we need to detect this.
|
||||
if depmode=$depmode \
|
||||
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
|
||||
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
|
||||
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
|
||||
>/dev/null 2>conftest.err &&
|
||||
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
|
||||
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
|
||||
# icc doesn't choke on unknown options, it will just issue warnings
|
||||
# or remarks (even with -Werror). So we grep stderr for any message
|
||||
# that says an option was ignored or not supported.
|
||||
# When given -MP, icc 7.0 and 7.1 complain thusly:
|
||||
# icc: Command line warning: ignoring option '-M'; no argument required
|
||||
# The diagnosis changed in icc 8.0:
|
||||
# icc: Command line remark: option '-MP' not supported
|
||||
if (grep 'ignoring option' conftest.err ||
|
||||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
|
||||
am_cv_$1_dependencies_compiler_type=$depmode
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
cd ..
|
||||
rm -rf conftest.dir
|
||||
else
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
fi
|
||||
])
|
||||
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
|
||||
AM_CONDITIONAL([am__fastdep$1], [
|
||||
test "x$enable_dependency_tracking" != xno \
|
||||
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
|
||||
])
|
||||
|
||||
|
||||
# AM_SET_DEPDIR
|
||||
# -------------
|
||||
# Choose a directory name for dependency files.
|
||||
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
|
||||
AC_DEFUN([AM_SET_DEPDIR],
|
||||
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
|
||||
])
|
||||
|
||||
|
||||
# AM_DEP_TRACK
|
||||
# ------------
|
||||
AC_DEFUN([AM_DEP_TRACK],
|
||||
[AC_ARG_ENABLE(dependency-tracking,
|
||||
[ --disable-dependency-tracking speeds up one-time build
|
||||
--enable-dependency-tracking do not reject slow dependency extractors])
|
||||
if test "x$enable_dependency_tracking" != xno; then
|
||||
am_depcomp="$ac_aux_dir/depcomp"
|
||||
AMDEPBACKSLASH='\'
|
||||
fi
|
||||
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
|
||||
AC_SUBST([AMDEPBACKSLASH])
|
||||
])
|
||||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
#serial 3
|
||||
|
||||
# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# ------------------------------
|
||||
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[for mf in $CONFIG_FILES; do
|
||||
# Strip MF so we end up with the name of the file.
|
||||
mf=`echo "$mf" | sed -e 's/:.*$//'`
|
||||
# Check whether this is an Automake generated Makefile or not.
|
||||
# We used to match only the files named `Makefile.in', but
|
||||
# some people rename them; so instead we look at the file content.
|
||||
# Grep'ing the first line is not enough: some people post-process
|
||||
# each Makefile.in and add a new line on top of each file to say so.
|
||||
# So let's grep whole file.
|
||||
if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
|
||||
dirpart=`AS_DIRNAME("$mf")`
|
||||
else
|
||||
continue
|
||||
fi
|
||||
# Extract the definition of DEPDIR, am__include, and am__quote
|
||||
# from the Makefile without running `make'.
|
||||
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
|
||||
test -z "$DEPDIR" && continue
|
||||
am__include=`sed -n 's/^am__include = //p' < "$mf"`
|
||||
test -z "am__include" && continue
|
||||
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
|
||||
# When using ansi2knr, U may be empty or an underscore; expand it
|
||||
U=`sed -n 's/^U = //p' < "$mf"`
|
||||
# Find all dependency output files, they are included files with
|
||||
# $(DEPDIR) in their names. We invoke sed twice because it is the
|
||||
# simplest approach to changing $(DEPDIR) to its actual value in the
|
||||
# expansion.
|
||||
for file in `sed -n "
|
||||
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
|
||||
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
|
||||
# Make sure the directory exists.
|
||||
test -f "$dirpart/$file" && continue
|
||||
fdir=`AS_DIRNAME(["$file"])`
|
||||
AS_MKDIR_P([$dirpart/$fdir])
|
||||
# echo "creating $dirpart/$file"
|
||||
echo '# dummy' > "$dirpart/$file"
|
||||
done
|
||||
done
|
||||
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
|
||||
|
||||
# AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# -----------------------------
|
||||
# This macro should only be invoked once -- use via AC_REQUIRE.
|
||||
#
|
||||
# This code is only required when automatic dependency tracking
|
||||
# is enabled. FIXME. This creates each `.P' file that we will
|
||||
# need in order to bootstrap the dependency handling code.
|
||||
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AC_CONFIG_COMMANDS([depfiles],
|
||||
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
|
||||
])
|
||||
|
||||
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 8
|
||||
|
||||
# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
|
||||
AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 12
|
||||
|
||||
# This macro actually does too much. Some checks are only needed if
|
||||
# your package does certain things. But this isn't really a big deal.
|
||||
|
||||
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
|
||||
# AM_INIT_AUTOMAKE([OPTIONS])
|
||||
# -----------------------------------------------
|
||||
# The call with PACKAGE and VERSION arguments is the old style
|
||||
# call (pre autoconf-2.50), which is being phased out. PACKAGE
|
||||
# and VERSION should now be passed to AC_INIT and removed from
|
||||
# the call to AM_INIT_AUTOMAKE.
|
||||
# We support both call styles for the transition. After
|
||||
# the next Automake release, Autoconf can make the AC_INIT
|
||||
# arguments mandatory, and then we can depend on a new Autoconf
|
||||
# release and drop the old call support.
|
||||
AC_DEFUN([AM_INIT_AUTOMAKE],
|
||||
[AC_PREREQ([2.58])dnl
|
||||
dnl Autoconf wants to disallow AM_ names. We explicitly allow
|
||||
dnl the ones we care about.
|
||||
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
|
||||
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
|
||||
AC_REQUIRE([AC_PROG_INSTALL])dnl
|
||||
# test to see if srcdir already configured
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`" &&
|
||||
test -f $srcdir/config.status; then
|
||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||
fi
|
||||
|
||||
# test whether we have cygpath
|
||||
if test -z "$CYGPATH_W"; then
|
||||
if (cygpath --version) >/dev/null 2>/dev/null; then
|
||||
CYGPATH_W='cygpath -w'
|
||||
else
|
||||
CYGPATH_W=echo
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([CYGPATH_W])
|
||||
|
||||
# Define the identity of the package.
|
||||
dnl Distinguish between old-style and new-style calls.
|
||||
m4_ifval([$2],
|
||||
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
|
||||
AC_SUBST([PACKAGE], [$1])dnl
|
||||
AC_SUBST([VERSION], [$2])],
|
||||
[_AM_SET_OPTIONS([$1])dnl
|
||||
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
|
||||
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
|
||||
|
||||
_AM_IF_OPTION([no-define],,
|
||||
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
|
||||
|
||||
# Some tools Automake needs.
|
||||
AC_REQUIRE([AM_SANITY_CHECK])dnl
|
||||
AC_REQUIRE([AC_ARG_PROGRAM])dnl
|
||||
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOCONF, autoconf)
|
||||
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOHEADER, autoheader)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo)
|
||||
AM_PROG_INSTALL_SH
|
||||
AM_PROG_INSTALL_STRIP
|
||||
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
|
||||
# We need awk for the "check" target. The system "awk" is bad on
|
||||
# some platforms.
|
||||
AC_REQUIRE([AC_PROG_AWK])dnl
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
|
||||
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
|
||||
[_AM_PROG_TAR([v7])])])
|
||||
_AM_IF_OPTION([no-dependencies],,
|
||||
[AC_PROVIDE_IFELSE([AC_PROG_CC],
|
||||
[_AM_DEPENDENCIES(CC)],
|
||||
[define([AC_PROG_CC],
|
||||
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
||||
[_AM_DEPENDENCIES(CXX)],
|
||||
[define([AC_PROG_CXX],
|
||||
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
# When config.status generates a header, we must update the stamp-h file.
|
||||
# This file resides in the same directory as the config header
|
||||
# that is generated. The stamp files are numbered to have different names.
|
||||
|
||||
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
|
||||
# loop where config.status creates the headers, so we can generate
|
||||
# our stamp files there.
|
||||
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
|
||||
[# Compute $1's index in $config_headers.
|
||||
_am_stamp_count=1
|
||||
for _am_header in $config_headers :; do
|
||||
case $_am_header in
|
||||
$1 | $1:* )
|
||||
break ;;
|
||||
* )
|
||||
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
|
||||
esac
|
||||
done
|
||||
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_INSTALL_SH
|
||||
# ------------------
|
||||
# Define $install_sh.
|
||||
AC_DEFUN([AM_PROG_INSTALL_SH],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
install_sh=${install_sh-"$am_aux_dir/install-sh"}
|
||||
AC_SUBST(install_sh)])
|
||||
|
||||
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# Check whether the underlying file-system supports filenames
|
||||
# with a leading dot. For instance MS-DOS doesn't.
|
||||
AC_DEFUN([AM_SET_LEADING_DOT],
|
||||
[rm -rf .tst 2>/dev/null
|
||||
mkdir .tst 2>/dev/null
|
||||
if test -d .tst; then
|
||||
am__leading_dot=.
|
||||
else
|
||||
am__leading_dot=_
|
||||
fi
|
||||
rmdir .tst 2>/dev/null
|
||||
AC_SUBST([am__leading_dot])])
|
||||
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 3
|
||||
|
||||
# AM_MAKE_INCLUDE()
|
||||
# -----------------
|
||||
# Check to see how make treats includes.
|
||||
AC_DEFUN([AM_MAKE_INCLUDE],
|
||||
[am_make=${MAKE-make}
|
||||
cat > confinc << 'END'
|
||||
am__doit:
|
||||
@echo done
|
||||
.PHONY: am__doit
|
||||
END
|
||||
# If we don't find an include directive, just comment out the code.
|
||||
AC_MSG_CHECKING([for style of include used by $am_make])
|
||||
am__include="#"
|
||||
am__quote=
|
||||
_am_result=none
|
||||
# First try GNU make style include.
|
||||
echo "include confinc" > confmf
|
||||
# We grep out `Entering directory' and `Leaving directory'
|
||||
# messages which can occur if `w' ends up in MAKEFLAGS.
|
||||
# In particular we don't look at `^make:' because GNU make might
|
||||
# be invoked under some other name (usually "gmake"), in which
|
||||
# case it prints its new name instead of `make'.
|
||||
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
|
||||
am__include=include
|
||||
am__quote=
|
||||
_am_result=GNU
|
||||
fi
|
||||
# Now try BSD make style include.
|
||||
if test "$am__include" = "#"; then
|
||||
echo '.include "confinc"' > confmf
|
||||
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
|
||||
am__include=.include
|
||||
am__quote="\""
|
||||
_am_result=BSD
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([am__include])
|
||||
AC_SUBST([am__quote])
|
||||
AC_MSG_RESULT([$_am_result])
|
||||
rm -f confinc confmf
|
||||
])
|
||||
|
||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 4
|
||||
|
||||
# AM_MISSING_PROG(NAME, PROGRAM)
|
||||
# ------------------------------
|
||||
AC_DEFUN([AM_MISSING_PROG],
|
||||
[AC_REQUIRE([AM_MISSING_HAS_RUN])
|
||||
$1=${$1-"${am_missing_run}$2"}
|
||||
AC_SUBST($1)])
|
||||
|
||||
|
||||
# AM_MISSING_HAS_RUN
|
||||
# ------------------
|
||||
# Define MISSING if not defined so far and test if it supports --run.
|
||||
# If it does, set am_missing_run to use it, otherwise, to nothing.
|
||||
AC_DEFUN([AM_MISSING_HAS_RUN],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
|
||||
# Use eval to expand $SHELL
|
||||
if eval "$MISSING --run true"; then
|
||||
am_missing_run="$MISSING --run "
|
||||
else
|
||||
am_missing_run=
|
||||
AC_MSG_WARN([`missing' script is too old or missing])
|
||||
fi
|
||||
])
|
||||
|
||||
# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_MKDIR_P
|
||||
# ---------------
|
||||
# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
|
||||
#
|
||||
# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
|
||||
# created by `make install' are always world readable, even if the
|
||||
# installer happens to have an overly restrictive umask (e.g. 077).
|
||||
# This was a mistake. There are at least two reasons why we must not
|
||||
# use `-m 0755':
|
||||
# - it causes special bits like SGID to be ignored,
|
||||
# - it may be too restrictive (some setups expect 775 directories).
|
||||
#
|
||||
# Do not use -m 0755 and let people choose whatever they expect by
|
||||
# setting umask.
|
||||
#
|
||||
# We cannot accept any implementation of `mkdir' that recognizes `-p'.
|
||||
# Some implementations (such as Solaris 8's) are not thread-safe: if a
|
||||
# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
|
||||
# concurrently, both version can detect that a/ is missing, but only
|
||||
# one can create it and the other will error out. Consequently we
|
||||
# restrict ourselves to GNU make (using the --version option ensures
|
||||
# this.)
|
||||
AC_DEFUN([AM_PROG_MKDIR_P],
|
||||
[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
|
||||
# We used to keeping the `.' as first argument, in order to
|
||||
# allow $(mkdir_p) to be used without argument. As in
|
||||
# $(mkdir_p) $(somedir)
|
||||
# where $(somedir) is conditionally defined. However this is wrong
|
||||
# for two reasons:
|
||||
# 1. if the package is installed by a user who cannot write `.'
|
||||
# make install will fail,
|
||||
# 2. the above comment should most certainly read
|
||||
# $(mkdir_p) $(DESTDIR)$(somedir)
|
||||
# so it does not work when $(somedir) is undefined and
|
||||
# $(DESTDIR) is not.
|
||||
# To support the latter case, we have to write
|
||||
# test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
|
||||
# so the `.' trick is pointless.
|
||||
mkdir_p='mkdir -p --'
|
||||
else
|
||||
# On NextStep and OpenStep, the `mkdir' command does not
|
||||
# recognize any option. It will interpret all options as
|
||||
# directories to create, and then abort because `.' already
|
||||
# exists.
|
||||
for d in ./-p ./--version;
|
||||
do
|
||||
test -d $d && rmdir $d
|
||||
done
|
||||
# $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
|
||||
if test -f "$ac_aux_dir/mkinstalldirs"; then
|
||||
mkdir_p='$(mkinstalldirs)'
|
||||
else
|
||||
mkdir_p='$(install_sh) -d'
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([mkdir_p])])
|
||||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 3
|
||||
|
||||
# _AM_MANGLE_OPTION(NAME)
|
||||
# -----------------------
|
||||
AC_DEFUN([_AM_MANGLE_OPTION],
|
||||
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
# _AM_SET_OPTION(NAME)
|
||||
# ------------------------------
|
||||
# Set option NAME. Presently that only means defining a flag for this option.
|
||||
AC_DEFUN([_AM_SET_OPTION],
|
||||
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
|
||||
|
||||
# _AM_SET_OPTIONS(OPTIONS)
|
||||
# ----------------------------------
|
||||
# OPTIONS is a space-separated list of Automake options.
|
||||
AC_DEFUN([_AM_SET_OPTIONS],
|
||||
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
|
||||
|
||||
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
|
||||
# -------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
AC_DEFUN([_AM_IF_OPTION],
|
||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 4
|
||||
|
||||
# AM_SANITY_CHECK
|
||||
# ---------------
|
||||
AC_DEFUN([AM_SANITY_CHECK],
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftest.file
|
||||
# Do `set' in a subshell so we don't clobber the current shell's
|
||||
# arguments. Must try -L first in case configure is actually a
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
|
||||
if test "$[*]" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t $srcdir/configure conftest.file`
|
||||
fi
|
||||
rm -f conftest.file
|
||||
if test "$[*]" != "X $srcdir/configure conftest.file" \
|
||||
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
|
||||
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment])
|
||||
fi
|
||||
|
||||
test "$[2]" = conftest.file
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
AC_MSG_RESULT(yes)])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_INSTALL_STRIP
|
||||
# ---------------------
|
||||
# One issue with vendor `install' (even GNU) is that you can't
|
||||
# specify the program used to strip binaries. This is especially
|
||||
# annoying in cross-compiling environments, where the build's strip
|
||||
# is unlikely to handle the host's binaries.
|
||||
# Fortunately install-sh will honor a STRIPPROG variable, so we
|
||||
# always use install-sh in `make install-strip', and initialize
|
||||
# STRIPPROG with the value of the STRIP variable (set by the user).
|
||||
AC_DEFUN([AM_PROG_INSTALL_STRIP],
|
||||
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
|
||||
# Installed binaries are usually stripped using `strip' when the user
|
||||
# run `make install-strip'. However `strip' might not be the right
|
||||
# tool to use in cross-compilation environments, therefore Automake
|
||||
# will honor the `STRIP' environment variable to overrule this program.
|
||||
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
|
||||
if test "$cross_compiling" != no; then
|
||||
AC_CHECK_TOOL([STRIP], [strip], :)
|
||||
fi
|
||||
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# Check how to create a tarball. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# _AM_PROG_TAR(FORMAT)
|
||||
# --------------------
|
||||
# Check how to create a tarball in format FORMAT.
|
||||
# FORMAT should be one of `v7', `ustar', or `pax'.
|
||||
#
|
||||
# Substitute a variable $(am__tar) that is a command
|
||||
# writing to stdout a FORMAT-tarball containing the directory
|
||||
# $tardir.
|
||||
# tardir=directory && $(am__tar) > result.tar
|
||||
#
|
||||
# Substitute a variable $(am__untar) that extract such
|
||||
# a tarball read from stdin.
|
||||
# $(am__untar) < result.tar
|
||||
AC_DEFUN([_AM_PROG_TAR],
|
||||
[# Always define AMTAR for backward compatibility.
|
||||
AM_MISSING_PROG([AMTAR], [tar])
|
||||
m4_if([$1], [v7],
|
||||
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
|
||||
[m4_case([$1], [ustar],, [pax],,
|
||||
[m4_fatal([Unknown tar format])])
|
||||
AC_MSG_CHECKING([how to create a $1 tar archive])
|
||||
# Loop over all known methods to create a tar archive until one works.
|
||||
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
|
||||
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
|
||||
# Do not fold the above two line into one, because Tru64 sh and
|
||||
# Solaris sh will not grok spaces in the rhs of `-'.
|
||||
for _am_tool in $_am_tools
|
||||
do
|
||||
case $_am_tool in
|
||||
gnutar)
|
||||
for _am_tar in tar gnutar gtar;
|
||||
do
|
||||
AM_RUN_LOG([$_am_tar --version]) && break
|
||||
done
|
||||
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
|
||||
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
|
||||
am__untar="$_am_tar -xf -"
|
||||
;;
|
||||
plaintar)
|
||||
# Must skip GNU tar: if it does not support --format= it doesn't create
|
||||
# ustar tarball either.
|
||||
(tar --version) >/dev/null 2>&1 && continue
|
||||
am__tar='tar chf - "$$tardir"'
|
||||
am__tar_='tar chf - "$tardir"'
|
||||
am__untar='tar xf -'
|
||||
;;
|
||||
pax)
|
||||
am__tar='pax -L -x $1 -w "$$tardir"'
|
||||
am__tar_='pax -L -x $1 -w "$tardir"'
|
||||
am__untar='pax -r'
|
||||
;;
|
||||
cpio)
|
||||
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
|
||||
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
|
||||
am__untar='cpio -i -H $1 -d'
|
||||
;;
|
||||
none)
|
||||
am__tar=false
|
||||
am__tar_=false
|
||||
am__untar=false
|
||||
;;
|
||||
esac
|
||||
|
||||
# If the value was cached, stop now. We just wanted to have am__tar
|
||||
# and am__untar set.
|
||||
test -n "${am_cv_prog_tar_$1}" && break
|
||||
|
||||
# tar/untar a dummy directory, and stop if the command works
|
||||
rm -rf conftest.dir
|
||||
mkdir conftest.dir
|
||||
echo GrepMe > conftest.dir/file
|
||||
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
|
||||
rm -rf conftest.dir
|
||||
if test -s conftest.tar; then
|
||||
AM_RUN_LOG([$am__untar <conftest.tar])
|
||||
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
|
||||
fi
|
||||
done
|
||||
rm -rf conftest.dir
|
||||
|
||||
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
|
||||
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
|
||||
AC_SUBST([am__tar])
|
||||
AC_SUBST([am__untar])
|
||||
]) # _AM_PROG_TAR
|
||||
|
||||
m4_include([acinclude.m4])
|
@ -0,0 +1,259 @@
|
||||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the <Carbon/Carbon.h> header file. */
|
||||
#undef HAVE_CARBON_CARBON_H
|
||||
|
||||
/* Define if you have the CoreAudio API */
|
||||
#undef HAVE_COREAUDIO
|
||||
|
||||
/* Define to 1 if you have the <crt_externs.h> header file. */
|
||||
#undef HAVE_CRT_EXTERNS_H
|
||||
|
||||
/* Defines if your system has the crypt function */
|
||||
#undef HAVE_CRYPT
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define if you have libjpeg */
|
||||
#undef HAVE_LIBJPEG
|
||||
|
||||
/* Define if you have libpng */
|
||||
#undef HAVE_LIBPNG
|
||||
|
||||
/* Define if you have a working libpthread (will enable threaded code) */
|
||||
#undef HAVE_LIBPTHREAD
|
||||
|
||||
/* Define if you have libz */
|
||||
#undef HAVE_LIBZ
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* have MySQL */
|
||||
#undef HAVE_MYSQL
|
||||
|
||||
/* Define if your system needs _NSGetEnviron to set up the environment */
|
||||
#undef HAVE_NSGETENVIRON
|
||||
|
||||
/* have PostgreSQL */
|
||||
#undef HAVE_POSTGRESQL
|
||||
|
||||
/* Define if you have res_init */
|
||||
#undef HAVE_RES_INIT
|
||||
|
||||
/* Define if you have the res_init prototype */
|
||||
#undef HAVE_RES_INIT_PROTO
|
||||
|
||||
/* Define if you have a STL implementation by SGI */
|
||||
#undef HAVE_SGI_STL
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* have SQLite */
|
||||
#undef HAVE_SQLITE
|
||||
|
||||
/* have SQLite3 */
|
||||
#undef HAVE_SQLITE3
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define if you have strlcat */
|
||||
#undef HAVE_STRLCAT
|
||||
|
||||
/* Define if you have the strlcat prototype */
|
||||
#undef HAVE_STRLCAT_PROTO
|
||||
|
||||
/* Define if you have strlcpy */
|
||||
#undef HAVE_STRLCPY
|
||||
|
||||
/* Define if you have the strlcpy prototype */
|
||||
#undef HAVE_STRLCPY_PROTO
|
||||
|
||||
/* Define to 1 if you have the <sys/bitypes.h> header file. */
|
||||
#undef HAVE_SYS_BITYPES_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
#undef HAVE_VSNPRINTF
|
||||
|
||||
/* Suffix for lib directories */
|
||||
#undef KDELIBSUFF
|
||||
|
||||
/* Define a safe value for MAXPATHLEN */
|
||||
#undef KDEMAXPATHLEN
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* The size of `char *', as computed by sizeof. */
|
||||
#undef SIZEOF_CHAR_P
|
||||
|
||||
/* The size of `int', as computed by sizeof. */
|
||||
#undef SIZEOF_INT
|
||||
|
||||
/* The size of `long', as computed by sizeof. */
|
||||
#undef SIZEOF_LONG
|
||||
|
||||
/* The size of `short', as computed by sizeof. */
|
||||
#undef SIZEOF_SHORT
|
||||
|
||||
/* The size of `size_t', as computed by sizeof. */
|
||||
#undef SIZEOF_SIZE_T
|
||||
|
||||
/* The size of `unsigned long', as computed by sizeof. */
|
||||
#undef SIZEOF_UNSIGNED_LONG
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* If we use arts volume */
|
||||
#undef USE_ARTS
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Defined if compiling without arts */
|
||||
#undef WITHOUT_ARTS
|
||||
|
||||
/* Define to 1 if your processor stores words with the most significant byte
|
||||
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#undef WORDS_BIGENDIAN
|
||||
|
||||
/*
|
||||
* jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system
|
||||
* headers and I'm too lazy to write a configure test as long as only
|
||||
* unixware is related
|
||||
*/
|
||||
#ifdef _UNIXWARE
|
||||
#define HAVE_BOOLEAN
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* AIX defines FD_SET in terms of bzero, but fails to include <strings.h>
|
||||
* that defines bzero.
|
||||
*/
|
||||
|
||||
#if defined(_AIX)
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H)
|
||||
# include <sys/time.h>
|
||||
# include <crt_externs.h>
|
||||
# define environ (*_NSGetEnviron())
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_RES_INIT_PROTO)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
int res_init(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_STRLCAT_PROTO)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
unsigned long strlcat(char*, const char*, unsigned long);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_STRLCPY_PROTO)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
unsigned long strlcpy(char*, const char*, unsigned long);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* On HP-UX, the declaration of vsnprintf() is needed every time !
|
||||
*/
|
||||
|
||||
#if !defined(HAVE_VSNPRINTF) || defined(hpux)
|
||||
#if __STDC__
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
int vsnprintf(char *str, size_t n, char const *fmt, va_list ap);
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
int snprintf(char *str, size_t n, char const *fmt, ...);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(__SVR4) && !defined(__svr4__)
|
||||
#define __svr4__ 1
|
||||
#endif
|
||||
|
||||
|
||||
/* type to use in place of socklen_t if not defined */
|
||||
#undef kde_socklen_t
|
||||
|
||||
/* type to use in place of socklen_t if not defined (deprecated, use
|
||||
kde_socklen_t) */
|
||||
#undef ksize_t
|
@ -0,0 +1,4 @@
|
||||
./admin/configure.in.min
|
||||
configure.in.in
|
||||
./krecipes/configure.in.bot
|
||||
./krecipes/configure.in.in
|
@ -0,0 +1,346 @@
|
||||
dnl =======================================================
|
||||
dnl FILE: ./admin/configure.in.min
|
||||
dnl =======================================================
|
||||
|
||||
dnl This file is part of the KDE libraries/packages
|
||||
dnl Copyright (C) 2001 Stephan Kulow (coolo@kde.org)
|
||||
|
||||
dnl This file is free software; you can redistribute it and/or
|
||||
dnl modify it under the terms of the GNU Library General Public
|
||||
dnl License as published by the Free Software Foundation; either
|
||||
dnl version 2 of the License, or (at your option) any later version.
|
||||
|
||||
dnl This library is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
dnl Library General Public License for more details.
|
||||
|
||||
dnl You should have received a copy of the GNU Library General Public License
|
||||
dnl along with this library; see the file COPYING.LIB. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
dnl Boston, MA 02110-1301, USA.
|
||||
|
||||
# Original Author was Kalle@kde.org
|
||||
# I lifted it in some mater. (Stephan Kulow)
|
||||
# I used much code from Janos Farkas
|
||||
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_INIT(acinclude.m4) dnl a source file from your sub dir
|
||||
|
||||
dnl This is so we can use kde-common
|
||||
AC_CONFIG_AUX_DIR(admin)
|
||||
|
||||
dnl This ksh/zsh feature conflicts with `cd blah ; pwd`
|
||||
unset CDPATH
|
||||
|
||||
dnl Checking host/target/build systems, for make, install etc.
|
||||
AC_CANONICAL_SYSTEM
|
||||
dnl Perform program name transformation
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
dnl Automake doc recommends to do this only here. (Janos)
|
||||
AM_INIT_AUTOMAKE(krecipes-1.0-beta1, 1.0-beta1) dnl searches for some needed programs
|
||||
|
||||
KDE_SET_PREFIX
|
||||
|
||||
dnl generate the config header
|
||||
AM_CONFIG_HEADER(config.h) dnl at the distribution this done
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_CHECK_COMPILERS
|
||||
AC_ENABLE_SHARED(yes)
|
||||
AC_ENABLE_STATIC(no)
|
||||
KDE_PROG_LIBTOOL
|
||||
|
||||
dnl for NLS support. Call them in this order!
|
||||
dnl WITH_NLS is for the po files
|
||||
AM_KDE_WITH_NLS
|
||||
|
||||
KDE_USE_QT(3.1)
|
||||
AC_PATH_KDE
|
||||
dnl =======================================================
|
||||
dnl FILE: configure.in.in
|
||||
dnl =======================================================
|
||||
|
||||
#MIN_CONFIG(3.1)
|
||||
CXXFLAGS="$CXXFLAGS $KDE_DEFAULT_CXXFLAGS"
|
||||
|
||||
if test "$build_arts" = "yes"; then
|
||||
AC_DEFINE(USE_ARTS, 1, [If we use arts volume])
|
||||
LIB_ARTS="-lartskde"
|
||||
AC_SUBST(LIB_ARTS)
|
||||
fi
|
||||
|
||||
KDE_INIT_DOXYGEN([The API Reference], [Version $VERSION])
|
||||
|
||||
dnl =======================================================
|
||||
dnl FILE: ./krecipes/configure.in.in
|
||||
dnl =======================================================
|
||||
|
||||
#MIN_CONFIG(3.1)
|
||||
|
||||
dnl PACKAGE set before
|
||||
|
||||
#KDE_USE_QT(3.1)
|
||||
|
||||
AC_C_BIGENDIAN
|
||||
AC_CHECK_KDEMAXPATHLEN
|
||||
|
||||
AC_ARG_WITH(sqlite, AC_HELP_STRING([--without-sqlite], [Don't compile SQLite backend support]), , with_sqlite=yes)
|
||||
AC_ARG_WITH(mysql, AC_HELP_STRING([--without-mysql], [Don't compile MySQL backend support]), , with_mysql=yes)
|
||||
AC_ARG_WITH(postgresql, AC_HELP_STRING([--without-postgresql], [Don't compile PostgreSQL backend support]), , with_postgresql=yes)
|
||||
|
||||
dnl ----- Check if we should enable MySQL ------
|
||||
|
||||
if test "x$with_mysql" != "xno"; then
|
||||
AC_DEFINE(HAVE_MYSQL, 1, [have MySQL])
|
||||
have_mysql="true"
|
||||
else
|
||||
AC_DEFINE(HAVE_MYSQL, 0, [have MySQL])
|
||||
have_mysql="false"
|
||||
fi
|
||||
|
||||
|
||||
dnl ----- Check if we should enable PostgreSQL ------
|
||||
|
||||
if test "x$with_postgresql" != "xno"; then
|
||||
AC_DEFINE(HAVE_POSTGRESQL, 1, [have PostgreSQL])
|
||||
have_postgresql="true"
|
||||
else
|
||||
AC_DEFINE(HAVE_POSTGRESQL, 0, [have PostgreSQL])
|
||||
have_postgresql="false"
|
||||
fi
|
||||
|
||||
|
||||
dnl ------ Check for the SQLite headers -----
|
||||
|
||||
AC_DEFUN([AC_HAVE_SQLITE],
|
||||
[
|
||||
AC_DEFINE(HAVE_SQLITE, 1, [have SQLite])
|
||||
have_sqlite=true
|
||||
SQLITE_LIB="-lsqlite"
|
||||
AC_SUBST(SQLITE_LIB)
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_NO_SQLITE],
|
||||
[
|
||||
AC_DEFINE(HAVE_SQLITE, 0, [have SQLite])
|
||||
have_sqlite=false
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_HAVE_SQLITE3],
|
||||
[
|
||||
AC_DEFINE(HAVE_SQLITE3, 1, [have SQLite3])
|
||||
have_sqlite3=true
|
||||
AC_NO_SQLITE
|
||||
SQLITE_LIB="-lsqlite3"
|
||||
AC_SUBST(SQLITE_LIB)
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_NO_SQLITE3],
|
||||
[
|
||||
AC_DEFINE(HAVE_SQLITE3, 0, [have SQLite3])
|
||||
have_sqlite3=false
|
||||
])
|
||||
|
||||
if test "x$with_sqlite" != "xno"; then
|
||||
KDE_CHECK_HEADER(sqlite3.h,
|
||||
AC_HAVE_SQLITE3,
|
||||
AC_NO_SQLITE3
|
||||
)
|
||||
|
||||
if test "x$have_sqlite3" = "xfalse"; then
|
||||
KDE_CHECK_HEADER(sqlite.h,
|
||||
AC_HAVE_SQLITE,
|
||||
AC_NO_SQLITE
|
||||
)
|
||||
fi
|
||||
|
||||
else
|
||||
AC_NO_SQLITE
|
||||
AC_NO_SQLITE3
|
||||
fi
|
||||
|
||||
dnl ----------- Should I link or should I not link? ---------
|
||||
AM_CONDITIONAL(link_lib_MYSQL, test x$have_mysql = xtrue)
|
||||
AM_CONDITIONAL(link_lib_POSTGRESQL, test x$have_postgresql = xtrue)
|
||||
AM_CONDITIONAL(link_lib_SQLITE, test x$have_sqlite = xtrue || test x$have_sqlite3 = xtrue)
|
||||
|
||||
dnl ----------- Should Krecipes be built at all? ------------
|
||||
if test "x$have_mysql" = "xfalse" && test "x$have_postgresql" = "xfalse"; then
|
||||
if test "x$have_sqlite" = "xfalse" && test "x$have_sqlite3" = "xfalse"; then
|
||||
DO_NOT_COMPILE="$DO_NOT_COMPILE krecipes"
|
||||
will_not_build_krecipes=true
|
||||
fi
|
||||
fi
|
||||
KDE_CREATE_SUBDIRSLIST
|
||||
AM_CONDITIONAL(doc_SUBDIR_included, test "x$doc_SUBDIR_included" = xyes)
|
||||
AM_CONDITIONAL(krecipes_SUBDIR_included, test "x$krecipes_SUBDIR_included" = xyes)
|
||||
AM_CONDITIONAL(po_SUBDIR_included, test "x$po_SUBDIR_included" = xyes)
|
||||
AC_CONFIG_FILES([ Makefile ])
|
||||
AC_CONFIG_FILES([ doc/Makefile ])
|
||||
AC_CONFIG_FILES([ doc/da/Makefile ])
|
||||
AC_CONFIG_FILES([ doc/es/Makefile ])
|
||||
AC_CONFIG_FILES([ doc/et/Makefile ])
|
||||
AC_CONFIG_FILES([ doc/krecipes/Makefile ])
|
||||
AC_CONFIG_FILES([ doc/pt/Makefile ])
|
||||
AC_CONFIG_FILES([ doc/sv/Makefile ])
|
||||
AC_CONFIG_FILES([ krecipes/Makefile ])
|
||||
AC_CONFIG_FILES([ krecipes/data/Makefile ])
|
||||
AC_CONFIG_FILES([ krecipes/icons/Makefile ])
|
||||
AC_CONFIG_FILES([ krecipes/layouts/Makefile ])
|
||||
AC_CONFIG_FILES([ krecipes/pics/Makefile ])
|
||||
AC_CONFIG_FILES([ krecipes/src/Makefile ])
|
||||
AC_CONFIG_FILES([ krecipes/src/backends/Makefile ])
|
||||
AC_CONFIG_FILES([ krecipes/src/backends/MySQL/Makefile ])
|
||||
AC_CONFIG_FILES([ krecipes/src/backends/PostgreSQL/Makefile ])
|
||||
AC_CONFIG_FILES([ krecipes/src/backends/SQLite/Makefile ])
|
||||
AC_CONFIG_FILES([ krecipes/src/backends/SQLite/libqsqlite/Makefile ])
|
||||
AC_CONFIG_FILES([ krecipes/src/datablocks/Makefile ])
|
||||
AC_CONFIG_FILES([ krecipes/src/dialogs/Makefile ])
|
||||
AC_CONFIG_FILES([ krecipes/src/exporters/Makefile ])
|
||||
AC_CONFIG_FILES([ krecipes/src/importers/Makefile ])
|
||||
AC_CONFIG_FILES([ krecipes/src/tests/Makefile ])
|
||||
AC_CONFIG_FILES([ krecipes/src/widgets/Makefile ])
|
||||
AC_CONFIG_FILES([ po/Makefile ])
|
||||
AC_CONFIG_FILES([ po/az/Makefile ])
|
||||
AC_CONFIG_FILES([ po/bg/Makefile ])
|
||||
AC_CONFIG_FILES([ po/br/Makefile ])
|
||||
AC_CONFIG_FILES([ po/ca/Makefile ])
|
||||
AC_CONFIG_FILES([ po/cs/Makefile ])
|
||||
AC_CONFIG_FILES([ po/cy/Makefile ])
|
||||
AC_CONFIG_FILES([ po/da/Makefile ])
|
||||
AC_CONFIG_FILES([ po/de/Makefile ])
|
||||
AC_CONFIG_FILES([ po/el/Makefile ])
|
||||
AC_CONFIG_FILES([ po/en_GB/Makefile ])
|
||||
AC_CONFIG_FILES([ po/es/Makefile ])
|
||||
AC_CONFIG_FILES([ po/et/Makefile ])
|
||||
AC_CONFIG_FILES([ po/fi/Makefile ])
|
||||
AC_CONFIG_FILES([ po/fr/Makefile ])
|
||||
AC_CONFIG_FILES([ po/ga/Makefile ])
|
||||
AC_CONFIG_FILES([ po/gl/Makefile ])
|
||||
AC_CONFIG_FILES([ po/he/Makefile ])
|
||||
AC_CONFIG_FILES([ po/is/Makefile ])
|
||||
AC_CONFIG_FILES([ po/it/Makefile ])
|
||||
AC_CONFIG_FILES([ po/ja/Makefile ])
|
||||
AC_CONFIG_FILES([ po/ka/Makefile ])
|
||||
AC_CONFIG_FILES([ po/lt/Makefile ])
|
||||
AC_CONFIG_FILES([ po/mt/Makefile ])
|
||||
AC_CONFIG_FILES([ po/nb/Makefile ])
|
||||
AC_CONFIG_FILES([ po/nl/Makefile ])
|
||||
AC_CONFIG_FILES([ po/pl/Makefile ])
|
||||
AC_CONFIG_FILES([ po/pt/Makefile ])
|
||||
AC_CONFIG_FILES([ po/pt_BR/Makefile ])
|
||||
AC_CONFIG_FILES([ po/ro/Makefile ])
|
||||
AC_CONFIG_FILES([ po/ru/Makefile ])
|
||||
AC_CONFIG_FILES([ po/rw/Makefile ])
|
||||
AC_CONFIG_FILES([ po/sl/Makefile ])
|
||||
AC_CONFIG_FILES([ po/sr/Makefile ])
|
||||
AC_CONFIG_FILES([ po/sr@Latn/Makefile ])
|
||||
AC_CONFIG_FILES([ po/sv/Makefile ])
|
||||
AC_CONFIG_FILES([ po/ta/Makefile ])
|
||||
AC_CONFIG_FILES([ po/tr/Makefile ])
|
||||
AC_OUTPUT
|
||||
echo ""
|
||||
echo ""
|
||||
echo "----- Configure Results -----"
|
||||
echo "- -"
|
||||
|
||||
if test "x$have_mysql" = "xtrue"; then
|
||||
echo "- MySQL Support................... YES -"
|
||||
else
|
||||
echo "- MySQL Support................... NO -"
|
||||
fi
|
||||
|
||||
echo "- -"
|
||||
|
||||
if test "x$have_postgresql" = "xtrue"; then
|
||||
echo "- PostgreSQL Support.............. YES -"
|
||||
else
|
||||
echo "- PostgreSQL Support.............. NO -"
|
||||
fi
|
||||
|
||||
echo "- -"
|
||||
|
||||
if test "x$have_sqlite" = "xtrue" || test "x$have_sqlite3" = "xtrue"; then
|
||||
echo "- SQLite Found..................... YES -"
|
||||
else
|
||||
echo "- SQLite Found..................... NO -"
|
||||
fi
|
||||
echo "- -"
|
||||
echo "------------------------------------------------"
|
||||
|
||||
|
||||
if test "x$will_not_build_krecipes" = "xtrue"; then
|
||||
echo ""
|
||||
echo "*** Krecipes needs a database backend enabled. If ***"
|
||||
echo "*** you wish to use SQLite, you must have SQLite ***"
|
||||
echo "*** installed before compiling. ***"
|
||||
echo "*** KRECIPES WILL NOT BE BUILT ***"
|
||||
echo ""
|
||||
echo "You can get SQLite from: http://www.hwaci.com/sw/sqlite/"
|
||||
echo "Or MySQL from: http://www.mysql.com"
|
||||
|
||||
else if test "x$have_mysql" = "xtrue"; then
|
||||
if test "x$have_sqlite" = "xtrue" || test "x$have_sqlite3" = "xtrue"; then
|
||||
echo "- -"
|
||||
echo "- Fine, you can build Krecipes now -"
|
||||
echo "------------------------------------------------"
|
||||
else
|
||||
echo "- -"
|
||||
echo "- You don't have SQLite installed (or have -"
|
||||
echo "- chosen to disable it), but Krecipes can -"
|
||||
echo "- work just fine with another supported -"
|
||||
echo "- database. -"
|
||||
echo "- If you still want to, you can get SQLite -"
|
||||
echo "- from http://www.hwaci.com/sw/sqlite/ -"
|
||||
echo "------------------------------------------------"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
# Check if KDE_SET_PREFIX was called, and --prefix was passed to configure
|
||||
if test -n "$kde_libs_prefix" -a -n "$given_prefix"; then
|
||||
# And if so, warn when they don't match
|
||||
if test "$kde_libs_prefix" != "$given_prefix"; then
|
||||
# And if kde doesn't know about the prefix yet
|
||||
echo ":"`kde-config --path exe`":" | grep ":$given_prefix/bin/:" 2>&1 >/dev/null
|
||||
if test $? -ne 0; then
|
||||
echo ""
|
||||
echo "Warning: you chose to install this package in $given_prefix,"
|
||||
echo "but KDE was found in $kde_libs_prefix."
|
||||
echo "For this to work, you will need to tell KDE about the new prefix, by ensuring"
|
||||
echo "that KDEDIRS contains it, e.g. export KDEDIRS=$given_prefix:$kde_libs_prefix"
|
||||
echo "Then restart KDE."
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x$GXX = "xyes" -a x$kde_have_gcc_visibility = "xyes" -a x$kde_cv_val_qt_gcc_visibility_patched = "xno"; then
|
||||
echo ""
|
||||
echo "Your GCC supports symbol visibility, but the patch for Qt supporting visibility"
|
||||
echo "was not included. Therefore, GCC symbol visibility support remains disabled."
|
||||
echo ""
|
||||
echo "For better performance, consider including the Qt visibility supporting patch"
|
||||
echo "located at:"
|
||||
echo ""
|
||||
echo "http://bugs.kde.org/show_bug.cgi?id=109386"
|
||||
echo ""
|
||||
echo "and recompile all of Qt and KDE. Note, this is entirely optional and"
|
||||
echo "everything will continue to work just fine without it."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if test "$all_tests" = "bad"; then
|
||||
if test ! "$cache_file" = "/dev/null"; then
|
||||
echo ""
|
||||
echo "Please remove the file $cache_file after changing your setup"
|
||||
echo "so that configure will find the changes next time."
|
||||
echo ""
|
||||
fi
|
||||
else
|
||||
echo ""
|
||||
echo "Good - your configure finished. Start make now"
|
||||
echo ""
|
||||
fi
|
@ -0,0 +1,11 @@
|
||||
#MIN_CONFIG(3.1)
|
||||
CXXFLAGS="$CXXFLAGS $KDE_DEFAULT_CXXFLAGS"
|
||||
|
||||
if test "$build_arts" = "yes"; then
|
||||
AC_DEFINE(USE_ARTS, 1, [If we use arts volume])
|
||||
LIB_ARTS="-lartskde"
|
||||
AC_SUBST(LIB_ARTS)
|
||||
fi
|
||||
|
||||
KDE_INIT_DOXYGEN([The API Reference], [Version $VERSION])
|
||||
|
@ -0,0 +1,5 @@
|
||||
|
||||
KDE_LANG = en
|
||||
KDE_DOCS = AUTO
|
||||
SUBDIRS = $(AUTODIRS)
|
||||
|
@ -0,0 +1,2 @@
|
||||
KDE_LANG = da
|
||||
KDE_DOCS = krecipes
|
After Width: | Height: | Size: 745 B |
After Width: | Height: | Size: 791 B |
After Width: | Height: | Size: 1015 B |
After Width: | Height: | Size: 1016 B |
@ -0,0 +1,2 @@
|
||||
KDE_LANG = es
|
||||
KDE_DOCS = krecipes
|
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 862 B |
After Width: | Height: | Size: 69 KiB |
After Width: | Height: | Size: 388 B |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 84 KiB |
After Width: | Height: | Size: 865 B |
After Width: | Height: | Size: 881 B |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 841 B |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 77 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 658 B |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 748 B |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 81 KiB |
After Width: | Height: | Size: 84 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 61 KiB |
After Width: | Height: | Size: 837 B |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 849 B |
@ -0,0 +1,2 @@
|
||||
KDE_LANG = et
|
||||
KDE_DOCS = krecipes
|
After Width: | Height: | Size: 745 B |
After Width: | Height: | Size: 791 B |
After Width: | Height: | Size: 1015 B |
After Width: | Height: | Size: 1016 B |
@ -0,0 +1,2 @@
|
||||
KDE_LANG = en
|
||||
KDE_DOCS = krecipes
|
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 862 B |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 388 B |
After Width: | Height: | Size: 396 B |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 77 KiB |
After Width: | Height: | Size: 865 B |
After Width: | Height: | Size: 881 B |
After Width: | Height: | Size: 57 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 841 B |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 181 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 658 B |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 748 B |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 71 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 837 B |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 61 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 849 B |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 12 KiB |
@ -0,0 +1,2 @@
|
||||
KDE_LANG = pt
|
||||
KDE_DOCS = krecipes
|
@ -0,0 +1,2 @@
|
||||
KDE_LANG = sv
|
||||
KDE_DOCS = krecipes
|
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 9.5 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 51 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 749 B |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 33 KiB |
@ -0,0 +1,6 @@
|
||||
SUBDIRS = src icons pics data layouts
|
||||
|
||||
messages: rc.cpp
|
||||
find ./src/ -name \*.ui | xargs --no-run-if-empty $(EXTRACTRC) >> rc.cpp
|
||||
$(XGETTEXT) rc.cpp `find ./src/ -name \*.cpp` -o $(podir)/krecipes.pot
|
||||
rm -f rc.cpp
|
@ -0,0 +1,57 @@
|
||||
echo ""
|
||||
echo ""
|
||||
echo "----- Configure Results -----"
|
||||
echo "- -"
|
||||
|
||||
if test "x$have_mysql" = "xtrue"; then
|
||||
echo "- MySQL Support................... YES -"
|
||||
else
|
||||
echo "- MySQL Support................... NO -"
|
||||
fi
|
||||
|
||||
echo "- -"
|
||||
|
||||
if test "x$have_postgresql" = "xtrue"; then
|
||||
echo "- PostgreSQL Support.............. YES -"
|
||||
else
|
||||
echo "- PostgreSQL Support.............. NO -"
|
||||
fi
|
||||
|
||||
echo "- -"
|
||||
|
||||
if test "x$have_sqlite" = "xtrue" || test "x$have_sqlite3" = "xtrue"; then
|
||||
echo "- SQLite Found..................... YES -"
|
||||
else
|
||||
echo "- SQLite Found..................... NO -"
|
||||
fi
|
||||
echo "- -"
|
||||
echo "------------------------------------------------"
|
||||
|
||||
|
||||
if test "x$will_not_build_krecipes" = "xtrue"; then
|
||||
echo ""
|
||||
echo "*** Krecipes needs a database backend enabled. If ***"
|
||||
echo "*** you wish to use SQLite, you must have SQLite ***"
|
||||
echo "*** installed before compiling. ***"
|
||||
echo "*** KRECIPES WILL NOT BE BUILT ***"
|
||||
echo ""
|
||||
echo "You can get SQLite from: http://www.hwaci.com/sw/sqlite/"
|
||||
echo "Or MySQL from: http://www.mysql.com"
|
||||
|
||||
else if test "x$have_mysql" = "xtrue"; then
|
||||
if test "x$have_sqlite" = "xtrue" || test "x$have_sqlite3" = "xtrue"; then
|
||||
echo "- -"
|
||||
echo "- Fine, you can build Krecipes now -"
|
||||
echo "------------------------------------------------"
|
||||
else
|
||||
echo "- -"
|
||||
echo "- You don't have SQLite installed (or have -"
|
||||
echo "- chosen to disable it), but Krecipes can -"
|
||||
echo "- work just fine with another supported -"
|
||||
echo "- database. -"
|
||||
echo "- If you still want to, you can get SQLite -"
|
||||
echo "- from http://www.hwaci.com/sw/sqlite/ -"
|
||||
echo "------------------------------------------------"
|
||||
fi
|
||||
fi
|
||||
fi
|
@ -0,0 +1,96 @@
|
||||
#MIN_CONFIG(3.1)
|
||||
|
||||
AM_INIT_AUTOMAKE(krecipes, 0.8)
|
||||
|
||||
#KDE_USE_QT(3.1)
|
||||
|
||||
AC_C_BIGENDIAN
|
||||
AC_CHECK_KDEMAXPATHLEN
|
||||
|
||||
AC_ARG_WITH(sqlite, AC_HELP_STRING([--without-sqlite], [Don't compile SQLite backend support]), , with_sqlite=yes)
|
||||
AC_ARG_WITH(mysql, AC_HELP_STRING([--without-mysql], [Don't compile MySQL backend support]), , with_mysql=yes)
|
||||
AC_ARG_WITH(postgresql, AC_HELP_STRING([--without-postgresql], [Don't compile PostgreSQL backend support]), , with_postgresql=yes)
|
||||
|
||||
dnl ----- Check if we should enable MySQL ------
|
||||
|
||||
if test "x$with_mysql" != "xno"; then
|
||||
AC_DEFINE(HAVE_MYSQL, 1, [have MySQL])
|
||||
have_mysql="true"
|
||||
else
|
||||
AC_DEFINE(HAVE_MYSQL, 0, [have MySQL])
|
||||
have_mysql="false"
|
||||
fi
|
||||
|
||||
|
||||
dnl ----- Check if we should enable PostgreSQL ------
|
||||
|
||||
if test "x$with_postgresql" != "xno"; then
|
||||
AC_DEFINE(HAVE_POSTGRESQL, 1, [have PostgreSQL])
|
||||
have_postgresql="true"
|
||||
else
|
||||
AC_DEFINE(HAVE_POSTGRESQL, 0, [have PostgreSQL])
|
||||
have_postgresql="false"
|
||||
fi
|
||||
|
||||
|
||||
dnl ------ Check for the SQLite headers -----
|
||||
|
||||
AC_DEFUN([AC_HAVE_SQLITE],
|
||||
[
|
||||
AC_DEFINE(HAVE_SQLITE, 1, [have SQLite])
|
||||
have_sqlite=true
|
||||
SQLITE_LIB="-lsqlite"
|
||||
AC_SUBST(SQLITE_LIB)
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_NO_SQLITE],
|
||||
[
|
||||
AC_DEFINE(HAVE_SQLITE, 0, [have SQLite])
|
||||
have_sqlite=false
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_HAVE_SQLITE3],
|
||||
[
|
||||
AC_DEFINE(HAVE_SQLITE3, 1, [have SQLite3])
|
||||
have_sqlite3=true
|
||||
AC_NO_SQLITE
|
||||
SQLITE_LIB="-lsqlite3"
|
||||
AC_SUBST(SQLITE_LIB)
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_NO_SQLITE3],
|
||||
[
|
||||
AC_DEFINE(HAVE_SQLITE3, 0, [have SQLite3])
|
||||
have_sqlite3=false
|
||||
])
|
||||
|
||||
if test "x$with_sqlite" != "xno"; then
|
||||
KDE_CHECK_HEADER(sqlite3.h,
|
||||
AC_HAVE_SQLITE3,
|
||||
AC_NO_SQLITE3
|
||||
)
|
||||
|
||||
if test "x$have_sqlite3" = "xfalse"; then
|
||||
KDE_CHECK_HEADER(sqlite.h,
|
||||
AC_HAVE_SQLITE,
|
||||
AC_NO_SQLITE
|
||||
)
|
||||
fi
|
||||
|
||||
else
|
||||
AC_NO_SQLITE
|
||||
AC_NO_SQLITE3
|
||||
fi
|
||||
|
||||
dnl ----------- Should I link or should I not link? ---------
|
||||
AM_CONDITIONAL(link_lib_MYSQL, test x$have_mysql = xtrue)
|
||||
AM_CONDITIONAL(link_lib_POSTGRESQL, test x$have_postgresql = xtrue)
|
||||
AM_CONDITIONAL(link_lib_SQLITE, test x$have_sqlite = xtrue || test x$have_sqlite3 = xtrue)
|
||||
|
||||
dnl ----------- Should Krecipes be built at all? ------------
|
||||
if test "x$have_mysql" = "xfalse" && test "x$have_postgresql" = "xfalse"; then
|
||||
if test "x$have_sqlite" = "xfalse" && test "x$have_sqlite3" = "xfalse"; then
|
||||
DO_NOT_COMPILE="$DO_NOT_COMPILE krecipes"
|
||||
will_not_build_krecipes=true
|
||||
fi
|
||||
fi
|
@ -0,0 +1,5 @@
|
||||
basedir = $(kde_datadir)/krecipes/data
|
||||
base_DATA = data.sql abbrev.txt weight.txt samples-en_US.kreml samples-cs_CZ.kreml
|
||||
|
||||
mimetypedir = $(kde_mimedir)/application
|
||||
mimetype_DATA = x-krecipes-backup.desktop x-krecipes-recipes.desktop
|
@ -0,0 +1,168 @@
|
||||
INSERT INTO categories VALUES (1,'Vegetables',-1);
|
||||
INSERT INTO categories VALUES (2,'Meat',-1);
|
||||
INSERT INTO categories VALUES (3,'Fish',-1);
|
||||
INSERT INTO categories VALUES (4,'Sweets',-1);
|
||||
INSERT INTO categories VALUES (5,'Starters',-1);
|
||||
INSERT INTO categories VALUES (6,'Main Dishes',-1);
|
||||
INSERT INTO categories VALUES (7,'Desserts',-1);
|
||||
INSERT INTO categories VALUES (8,'Drinks',-1);
|
||||
INSERT INTO categories VALUES (9,'Pasta',-1);
|
||||
INSERT INTO categories VALUES (10,'Soups',-1);
|
||||
INSERT INTO units VALUES (1,'kilogram','kg','kilograms','kg',1);
|
||||
INSERT INTO units VALUES (2,'gram','g','grams','g',1);
|
||||
INSERT INTO units VALUES (3,'liter','L','liters','L',2);
|
||||
INSERT INTO units VALUES (4,'milliliter','mL','milliliters','mL',2);
|
||||
INSERT INTO units VALUES (5,'pound','lb','pounds','lbs',1);
|
||||
INSERT INTO units VALUES (6,'pint','pt','pints','pt',2);
|
||||
INSERT INTO units VALUES (7,'unit',NULL,'units',NULL,0);
|
||||
INSERT INTO units VALUES (8,'tablespoon','tbsp','tablespoons','tbsp',2);
|
||||
INSERT INTO units VALUES (9,'dash',NULL,'dashes',NULL,0);
|
||||
INSERT INTO units VALUES (10,'to taste',NULL,'to taste',NULL,0);
|
||||
INSERT INTO units VALUES (11,'fluid ounce','fl oz','fluid ounces','fl oz',2);
|
||||
INSERT INTO units VALUES (12,'clove',NULL,'cloves',NULL,0);
|
||||
INSERT INTO units VALUES (13,'cubic centimeter','cc','cubic centimeters','cc',2);
|
||||
INSERT INTO units VALUES (14,'bunch',NULL,'bunches',NULL,0);
|
||||
INSERT INTO units VALUES (15,'cup','c','cups','c',2);
|
||||
INSERT INTO units VALUES (16,'bottle',NULL,'bottles',NULL,0);
|
||||
INSERT INTO units VALUES (17,'little',NULL,'little',NULL,0);
|
||||
INSERT INTO units VALUES (18,'stick',NULL,'sticks',NULL,0);
|
||||
INSERT INTO units VALUES (19,'teaspoon','tsp','teaspoons','tsp',2);
|
||||
INSERT INTO units VALUES (20,'quart','qt','quarts','qt',2);
|
||||
INSERT INTO units VALUES (21,'gallon','gal','gallons','gal',2);
|
||||
INSERT INTO units VALUES (22,'ounce','oz','ounces','oz',1);
|
||||
INSERT INTO units VALUES (23,'square','sq','squares','sq',0);
|
||||
INSERT INTO units VALUES (24,'',NULL,'',NULL,0);
|
||||
INSERT INTO units VALUES (25,'milligram','mg','milligrams','mg',1);
|
||||
INSERT INTO rating_criteria VALUES (1,'Overall');
|
||||
INSERT INTO rating_criteria VALUES (2,'Taste');
|
||||
INSERT INTO rating_criteria VALUES (3,'Appearance');
|
||||
INSERT INTO rating_criteria VALUES (4,'Originality');
|
||||
INSERT INTO rating_criteria VALUES (5,'Ease of Preparation');
|
||||
INSERT INTO units_conversion VALUES(1, 2, 1000.0);
|
||||
INSERT INTO units_conversion VALUES(2, 1, 0.001);
|
||||
INSERT INTO units_conversion VALUES(3, 4, 1000.0);
|
||||
INSERT INTO units_conversion VALUES(4, 3, 0.001);
|
||||
INSERT INTO units_conversion VALUES(5, 1, 0.454);
|
||||
INSERT INTO units_conversion VALUES(1, 5, 2.20264);
|
||||
INSERT INTO units_conversion VALUES(6, 3, 0.473);
|
||||
INSERT INTO units_conversion VALUES(3, 6, 2.11416);
|
||||
INSERT INTO units_conversion VALUES(8, 4, 14.786);
|
||||
INSERT INTO units_conversion VALUES(4, 8, 0.0676315);
|
||||
INSERT INTO units_conversion VALUES(3, 8, 67.628);
|
||||
INSERT INTO units_conversion VALUES(8, 3, 0.0147868);
|
||||
INSERT INTO units_conversion VALUES(13, 4, 1.0);
|
||||
INSERT INTO units_conversion VALUES(4, 13, 1.0);
|
||||
INSERT INTO units_conversion VALUES(13, 3, 0.001);
|
||||
INSERT INTO units_conversion VALUES(3, 13, 1000.0);
|
||||
INSERT INTO units_conversion VALUES(8, 13, 14.786);
|
||||
INSERT INTO units_conversion VALUES(13, 8, 0.0676315);
|
||||
INSERT INTO units_conversion VALUES(8, 6, 0.03125);
|
||||
INSERT INTO units_conversion VALUES(6, 8, 32.0);
|
||||
INSERT INTO units_conversion VALUES(6, 4, 473.176);
|
||||
INSERT INTO units_conversion VALUES(4, 6, 0.00211338);
|
||||
INSERT INTO units_conversion VALUES(6, 13, 473.176);
|
||||
INSERT INTO units_conversion VALUES(13, 6, 0.00211338);
|
||||
INSERT INTO units_conversion VALUES(6, 15, 2.0);
|
||||
INSERT INTO units_conversion VALUES(15, 6, 0.5);
|
||||
INSERT INTO units_conversion VALUES(2, 5, 0.00220264);
|
||||
INSERT INTO units_conversion VALUES(5, 2, 454.0);
|
||||
INSERT INTO units_conversion VALUES(3, 15, 4.22833);
|
||||
INSERT INTO units_conversion VALUES(15, 3, 0.2365);
|
||||
INSERT INTO units_conversion VALUES(8, 15, 0.0625);
|
||||
INSERT INTO units_conversion VALUES(15, 8, 16.0);
|
||||
INSERT INTO units_conversion VALUES(4, 15, 0.00422676);
|
||||
INSERT INTO units_conversion VALUES(15, 4, 236.588);
|
||||
INSERT INTO units_conversion VALUES(13, 15, 0.00422676);
|
||||
INSERT INTO units_conversion VALUES(15, 13, 236.588);
|
||||
INSERT INTO units_conversion VALUES(20, 6, 2.0);
|
||||
INSERT INTO units_conversion VALUES(6, 20, 0.5);
|
||||
INSERT INTO units_conversion VALUES(3, 20, 1.05708);
|
||||
INSERT INTO units_conversion VALUES(20, 3, 0.946);
|
||||
INSERT INTO units_conversion VALUES(8, 20, 0.015625);
|
||||
INSERT INTO units_conversion VALUES(20, 8, 64.0);
|
||||
INSERT INTO units_conversion VALUES(4, 20, 0.00105669);
|
||||
INSERT INTO units_conversion VALUES(20, 4, 946.352);
|
||||
INSERT INTO units_conversion VALUES(13, 20, 0.00105669);
|
||||
INSERT INTO units_conversion VALUES(20, 13, 946.352);
|
||||
INSERT INTO units_conversion VALUES(15, 20, 0.25);
|
||||
INSERT INTO units_conversion VALUES(20, 15, 4.0);
|
||||
INSERT INTO units_conversion VALUES(21, 20, 4.0);
|
||||
INSERT INTO units_conversion VALUES(20, 21, 0.25);
|
||||
INSERT INTO units_conversion VALUES(6, 21, 0.125);
|
||||
INSERT INTO units_conversion VALUES(21, 6, 8.0);
|
||||
INSERT INTO units_conversion VALUES(3, 21, 0.264271);
|
||||
INSERT INTO units_conversion VALUES(21, 3, 3.784);
|
||||
INSERT INTO units_conversion VALUES(8, 21, 0.00390625);
|
||||
INSERT INTO units_conversion VALUES(21, 8, 256.0);
|
||||
INSERT INTO units_conversion VALUES(4, 21, 0.000264172);
|
||||
INSERT INTO units_conversion VALUES(21, 4, 3785.41);
|
||||
INSERT INTO units_conversion VALUES(13, 21, 0.000264172);
|
||||
INSERT INTO units_conversion VALUES(21, 13, 3785.41);
|
||||
INSERT INTO units_conversion VALUES(15, 21, 0.0625);
|
||||
INSERT INTO units_conversion VALUES(21, 15, 16.0);
|
||||
INSERT INTO units_conversion VALUES(5, 22, 16.0);
|
||||
INSERT INTO units_conversion VALUES(22, 5, 0.0625);
|
||||
INSERT INTO units_conversion VALUES(1, 22, 35.2423);
|
||||
INSERT INTO units_conversion VALUES(22, 1, 0.028375);
|
||||
INSERT INTO units_conversion VALUES(2, 22, 0.0352734);
|
||||
INSERT INTO units_conversion VALUES(22, 2, 28.35);
|
||||
INSERT INTO units_conversion VALUES(8, 19, 3.0);
|
||||
INSERT INTO units_conversion VALUES(19, 8, 0.333333);
|
||||
INSERT INTO units_conversion VALUES(4, 19, 0.202895);
|
||||
INSERT INTO units_conversion VALUES(19, 4, 4.92866);
|
||||
INSERT INTO units_conversion VALUES(3, 19, 202.884);
|
||||
INSERT INTO units_conversion VALUES(19, 3, 0.00492893);
|
||||
INSERT INTO units_conversion VALUES(13, 19, 0.202895);
|
||||
INSERT INTO units_conversion VALUES(19, 13, 4.92866);
|
||||
INSERT INTO units_conversion VALUES(6, 19, 96.0001);
|
||||
INSERT INTO units_conversion VALUES(19, 6, 0.0104167);
|
||||
INSERT INTO units_conversion VALUES(15, 19, 48.0);
|
||||
INSERT INTO units_conversion VALUES(19, 15, 0.0208333);
|
||||
INSERT INTO units_conversion VALUES(20, 19, 192.0);
|
||||
INSERT INTO units_conversion VALUES(19, 20, 0.00520833);
|
||||
INSERT INTO units_conversion VALUES(21, 19, 768.001);
|
||||
INSERT INTO units_conversion VALUES(19, 21, 0.00130208);
|
||||
INSERT INTO units_conversion VALUES(24, 4, 29.574);
|
||||
INSERT INTO units_conversion VALUES(4, 24, 0.0338135);
|
||||
INSERT INTO units_conversion VALUES(3, 24, 33.8135);
|
||||
INSERT INTO units_conversion VALUES(24, 3, 0.029574);
|
||||
INSERT INTO units_conversion VALUES(8, 24, 0.499967);
|
||||
INSERT INTO units_conversion VALUES(24, 8, 2.00013);
|
||||
INSERT INTO units_conversion VALUES(13, 24, 0.0338135);
|
||||
INSERT INTO units_conversion VALUES(24, 13, 29.574);
|
||||
INSERT INTO units_conversion VALUES(6, 24, 15.9997);
|
||||
INSERT INTO units_conversion VALUES(24, 6, 0.0625011);
|
||||
INSERT INTO units_conversion VALUES(15, 24, 7.99986);
|
||||
INSERT INTO units_conversion VALUES(24, 15, 0.125002);
|
||||
INSERT INTO units_conversion VALUES(20, 24, 31.9994);
|
||||
INSERT INTO units_conversion VALUES(24, 20, 0.0312506);
|
||||
INSERT INTO units_conversion VALUES(21, 24, 127.998);
|
||||
INSERT INTO units_conversion VALUES(24, 21, 0.00781262);
|
||||
INSERT INTO units_conversion VALUES(19, 24, 0.166655);
|
||||
INSERT INTO units_conversion VALUES(24, 19, 6.00042);
|
||||
INSERT INTO units_conversion VALUES(15, 11, 8.0);
|
||||
INSERT INTO units_conversion VALUES(11, 15, 0.125);
|
||||
INSERT INTO units_conversion VALUES(6, 11, 16.0);
|
||||
INSERT INTO units_conversion VALUES(11, 6, 0.0625);
|
||||
INSERT INTO units_conversion VALUES(3, 11, 33.8266);
|
||||
INSERT INTO units_conversion VALUES(11, 3, 0.0295625);
|
||||
INSERT INTO units_conversion VALUES(8, 11, 0.5);
|
||||
INSERT INTO units_conversion VALUES(11, 8, 2.0);
|
||||
INSERT INTO units_conversion VALUES(4, 11, 0.0338141);
|
||||
INSERT INTO units_conversion VALUES(11, 4, 29.5735);
|
||||
INSERT INTO units_conversion VALUES(13, 11, 0.0338141);
|
||||
INSERT INTO units_conversion VALUES(11, 13, 29.5735);
|
||||
INSERT INTO units_conversion VALUES(20, 11, 32.0);
|
||||
INSERT INTO units_conversion VALUES(11, 20, 0.03125);
|
||||
INSERT INTO units_conversion VALUES(21, 11, 128.0);
|
||||
INSERT INTO units_conversion VALUES(11, 21, 0.0078125);
|
||||
INSERT INTO units_conversion VALUES(19, 11, 0.166667);
|
||||
INSERT INTO units_conversion VALUES(11, 19, 6.0);
|
||||
INSERT INTO units_conversion VALUES(2, 25, 1000.0);
|
||||
INSERT INTO units_conversion VALUES(25, 2, 0.001);
|
||||
INSERT INTO units_conversion VALUES(1, 25, 1000000.0);
|
||||
INSERT INTO units_conversion VALUES(25, 1, 1.0e-06);
|
||||
INSERT INTO units_conversion VALUES(5, 25, 454001.0);
|
||||
INSERT INTO units_conversion VALUES(25, 5, 2.20264e-06);
|
||||
INSERT INTO units_conversion VALUES(22, 25, 28350.0);
|
||||
INSERT INTO units_conversion VALUES(25, 22, 3.52734e-05);
|
@ -0,0 +1,321 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<krecipes version="0.6" lang="cs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="krecipes.xsd">
|
||||
<krecipes-category-structure>
|
||||
<category name="Dezerty">
|
||||
</category>
|
||||
<category name="Maso">
|
||||
</category>
|
||||
<category name="Těstoviny">
|
||||
</category>
|
||||
<category name="Polévky">
|
||||
</category>
|
||||
<category name="Sladká jídla">
|
||||
</category>
|
||||
<category name="Zeleninová jídla">
|
||||
</category>
|
||||
</krecipes-category-structure>
|
||||
<krecipes-recipe>
|
||||
<krecipes-description>
|
||||
<title>Gateau Basque / Pastel Vasco</title>
|
||||
<author>Unai Garro</author>
|
||||
<pictures>
|
||||
</pictures>
|
||||
<category>
|
||||
<cat>Sladká jídla</cat>
|
||||
<cat>Dezerty</cat>
|
||||
</category>
|
||||
<serving>4</serving>
|
||||
<preparation-time>00:00</preparation-time>
|
||||
</krecipes-description>
|
||||
<krecipes-ingredients>
|
||||
<ingredient>
|
||||
<name>máslo</name>
|
||||
<amount>185</amount>
|
||||
<unit>g</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>mouka</name>
|
||||
<amount>425</amount>
|
||||
<unit>g</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>cukr</name>
|
||||
<amount>250</amount>
|
||||
<unit>g</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>vaječný žloutek</name>
|
||||
<amount>7</amount>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>vejce</name>
|
||||
<amount>1</amount>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>moučkový cukr</name>
|
||||
<amount>300</amount>
|
||||
<unit>g</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>skořice</name>
|
||||
<amount>1</amount>
|
||||
<unit>tyčinka</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>vanilkové lusky</name>
|
||||
<amount>1</amount>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>mandle</name>
|
||||
<amount>100</amount>
|
||||
<unit>g</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>rozinky</name>
|
||||
<amount>100</amount>
|
||||
<unit>g</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>mléko</name>
|
||||
<amount>0.5</amount>
|
||||
<unit>L</unit>
|
||||
</ingredient>
|
||||
</krecipes-ingredients>
|
||||
<krecipes-instructions>
|
||||
Nejprve si připravte těsto: do mísy dejte 375g mouky a uprostřed udělejte jamku, kam dáte povolené máslo, moučkový cukr (může být i normální), 3 žloutky a vejce. Vše důkladně zpracujte, až se všechno dobře spojí. Nechte odležet v lednici aspoň 30 minut, přikryté mikrotenovou folií.
|
||||
|
||||
Mezitím připravte krém. V kastrolu přiveďte k varu mléko, přidejte skořici a vanilkový lusk. V misce smíchejte 150 g cukru, zbytek mouky (50g), a zbývající 4 žloutky. Jakmile se mléko vaří, vyndejte z něj skořici a vanilkový lusk, a připravenou směs vlijte do mléka. Směs stále míchejte dokud nezhoustne. Když se začne vařit, přidejte předem namleté mandle, zbývajících 100 g cukru a rozinky. Připravenou směs nechte v lednici aspoň 30 minut.
|
||||
|
||||
Formu na pečení vytřete máslem a vysypte moukou (aby se dort při pečení nepřichytil k formě).
|
||||
|
||||
Těstem vyložte formu v tenké vrstvě (slabší než 5mm) po dně a po stranách. Takto vzniklou vanu z těsta vylijte krémem a uzavřete víkem z těsta.
|
||||
|
||||
Vršek moučníku potřete trochou ušlehaného vejce, a dejte péct do trouby předehřáté na 190C po dobu 30 min. Voilá! Výborný moučník je připraven k servírování.</krecipes-instructions>
|
||||
</krecipes-recipe>
|
||||
<krecipes-recipe>
|
||||
<krecipes-description>
|
||||
<title>Nádivka ze skopového</title>
|
||||
<author>Ravikiran Rajagopal</author>
|
||||
<pictures>
|
||||
</pictures>
|
||||
<category>
|
||||
<cat>Maso</cat>
|
||||
</category>
|
||||
<serving>1</serving>
|
||||
<preparation-time>00:00</preparation-time>
|
||||
</krecipes-description>
|
||||
<krecipes-ingredients>
|
||||
<ingredient>
|
||||
<name>mleté skopové</name>
|
||||
<amount>800</amount>
|
||||
<unit>g</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>jarní cibulka</name>
|
||||
<amount>3</amount>
|
||||
<unit>svazek</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>řezaný listový špenát</name>
|
||||
<amount>2</amount>
|
||||
<unit>šálek</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>zelený hrášek</name>
|
||||
<amount>0.5</amount>
|
||||
<unit>lb</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>drcený koriandr</name>
|
||||
<amount>0.5</amount>
|
||||
<unit>čajová lžička</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>drcená kůra ze skořice</name>
|
||||
<amount>0.25</amount>
|
||||
<unit>čajová lžička</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>cintronová šťáva</name>
|
||||
<amount>1</amount>
|
||||
<unit>čajová lžička</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>hořčičné semínko</name>
|
||||
<amount>5</amount>
|
||||
<unit>g</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>Římská rajčata</name>
|
||||
<amount>1</amount>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>ocet</name>
|
||||
<amount>1</amount>
|
||||
<unit>podle chuti</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>olej</name>
|
||||
<amount>1</amount>
|
||||
<unit>trochu</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>sůl</name>
|
||||
<amount>1</amount>
|
||||
<unit>trochu</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>drcený černý pepř</name>
|
||||
<amount>1</amount>
|
||||
<unit>trochu</unit>
|
||||
</ingredient>
|
||||
</krecipes-ingredients>
|
||||
<krecipes-instructions>
|
||||
Nasekejte jarní cibulku (celou od zelených lístků až ke kořeni) na kousky dlouhé 1cm. Pokud použijete rajče, nakrájejte ho na kostky. Na pánev nalijte trochu oleje, nasypte hořčičná semínka a zahřejte. Až semínka začnou praskat, přidejte nasekanou cibulku, rozmražený zelený hrášek a duste asi 2 minuty. Pak přidejte špenát, rajče a drcený koriandr, a duste dál, dokud se neodpaří většina vody. Přidejte rozmražené mleté skopové, šálek vody a míchejte dokud směs není téměř homogenní. Přidejte drcený kmín, skořici a sůl; opět důkladně promíchejte. Zvolna vyvařte většinu vody. Opepřete podle chuti. Přidejte citronovou šťávu (a ocet pro ostřejší chuť) a zamíchejte. Pepř by měl absorbovat všechnu zbývající vodu. Intenzivně míchejte asi 30 sekund a odstavte z varu.
|
||||
|
||||
Toto je skvělá nádivka pro pity. Osobně, pokud mám čas, přidám takto připravenou náplň k vlhké rýžové mouce a uvařím. Dostanu tak rýžové placky s příchutí, které je možné jíst jen tak, nebo (obvykle) s chutney z kokosu.
|
||||
|
||||
Pozn: Opatrně s přídavky kmínu a skořice. Mají sklon vytvářet hrudky. Předejdete tomu pomalým sypáním při současném míchání směsi.</krecipes-instructions>
|
||||
</krecipes-recipe>
|
||||
<krecipes-recipe>
|
||||
<krecipes-description>
|
||||
<title>Kaas, Dille, Eten</title>
|
||||
<author>Adriaan de Groot</author>
|
||||
<pictures>
|
||||
</pictures>
|
||||
<category>
|
||||
<cat>Těstoviny</cat>
|
||||
<cat>Zeleninová jídla</cat>
|
||||
</category>
|
||||
<serving>2</serving>
|
||||
<preparation-time>00:00</preparation-time>
|
||||
</krecipes-description>
|
||||
<krecipes-ingredients>
|
||||
<ingredient>
|
||||
<name>fusili</name>
|
||||
<amount>200</amount>
|
||||
<unit>g</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>cuketa</name>
|
||||
<amount>1</amount>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>žampiony</name>
|
||||
<amount>150</amount>
|
||||
<unit>g</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>smetana</name>
|
||||
<amount>100</amount>
|
||||
<unit>mL</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>červené víno</name>
|
||||
<amount>2</amount>
|
||||
<unit>čajová lžička</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>kopr</name>
|
||||
<amount>1</amount>
|
||||
<unit>čajová lžička</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>křen</name>
|
||||
<amount>1</amount>
|
||||
<unit>čajová lžička</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>petržel</name>
|
||||
<amount>1</amount>
|
||||
<unit>špetka</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>tymián</name>
|
||||
<amount>1</amount>
|
||||
<unit>špetka</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>pažitka</name>
|
||||
<amount>1</amount>
|
||||
<unit>špetka</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>pepř</name>
|
||||
<amount>1</amount>
|
||||
<unit>podle chuti</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>olivový olej</name>
|
||||
<amount>1</amount>
|
||||
<unit></unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>strouhaný sýr</name>
|
||||
<amount>100</amount>
|
||||
<unit>g</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>rajče</name>
|
||||
<amount>2</amount>
|
||||
</ingredient>
|
||||
</krecipes-ingredients>
|
||||
<krecipes-instructions>
|
||||
Přiveďte k varu 1.5 l osolené vody. Cuketu nakrájejte na tenké proužky (asi 3 mm široké). Žampiony nakrájejte nadrobno. Na železné pánvi rozpalte olivový olej, přidejte cuketu a opečte na prudkém ohni asi 3 minuty. Přidejte žampiony a víno, snižte teplotu a nechte zvolna vysmažit do zhnědnutí asi po dobu 5 minut. Mezitím by se už měla vařit voda na těstoviny. Vsypte je do vody a nechte vařit asi 10 minut, aby byly "al dente". Ke směsi cuket a žampionů přidejte smetanu, kopr, křen, koření a pepř, a zvolna vařte než budou hotové těstoviny. Těstoviny sceďte, přidejte je k zelenině a dobře promíchejte.
|
||||
Podávejte posypané nastrouhaným sýrem a po obvodu talíře obložené nakrájenými rajčaty.</krecipes-instructions>
|
||||
</krecipes-recipe>
|
||||
<krecipes-recipe>
|
||||
<krecipes-description>
|
||||
<title>Mrkvová polévka</title>
|
||||
<author>Ian Reinhart Geiser</author>
|
||||
<pictures>
|
||||
</pictures>
|
||||
<category>
|
||||
<cat>Polévky</cat>
|
||||
</category>
|
||||
<serving>2</serving>
|
||||
<preparation-time>00:00</preparation-time>
|
||||
</krecipes-description>
|
||||
<krecipes-ingredients>
|
||||
<ingredient>
|
||||
<name>zeleninový vývar</name>
|
||||
<amount>600</amount>
|
||||
<unit>ml</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>zázvor</name>
|
||||
<amount>0.25</amount>
|
||||
<unit>stroužek</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>česnek</name>
|
||||
<amount>3</amount>
|
||||
<unit>stroužek</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>cibule</name>
|
||||
<amount>1</amount>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>máslo</name>
|
||||
<amount>6</amount>
|
||||
<unit>čajová lžička</unit>
|
||||
</ingredient>
|
||||
<ingredient>
|
||||
<name>mrkev</name>
|
||||
<amount>2</amount>
|
||||
<unit>libry</unit>
|
||||
</ingredient>
|
||||
</krecipes-ingredients>
|
||||
<krecipes-instructions>
|
||||
Nasekejte na co nejjemnější kousky cibuli, česnek a zázvor, a osmahněte na másle. Nenechte ale cibuli zhnědnout, jenom změknout.
|
||||
|
||||
Oloupejte mrkev a nakrájejte ji na hrubší kousky (asi 2 cm dlouhé).
|
||||
|
||||
Přidejte zeleninový vývar a kousky mrkve. Zvolna vařte asi 45 minut. Až mrkev změkne, odstavte a nechte vychladnout.
|
||||
|
||||
Vývar s kousky mrkve nalijte do mixéru a rozmixujte do jemna. Hotovo, dobrou chuť. Můžete také přidat 2 polévkové lžíce citronové šťávy a/nebo špetku kari pro zvýraznění chuti, ale i bez toho je polévka skvělá.
|
||||
|
||||
Polévku je možné podávat horkou i studenou a je vhodná i pro vegany.</krecipes-instructions>
|
||||
</krecipes-recipe>
|
||||
</krecipes>
|
@ -0,0 +1,5 @@
|
||||
krecipesdir = $(kde_datadir)/krecipes/icons
|
||||
krecipes_ICON = AUTO
|
||||
|
||||
KDE_ICON = krecipes_file
|
||||
|
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 645 B |
After Width: | Height: | Size: 735 B |
After Width: | Height: | Size: 730 B |
After Width: | Height: | Size: 671 B |
After Width: | Height: | Size: 672 B |
After Width: | Height: | Size: 690 B |
After Width: | Height: | Size: 766 B |
After Width: | Height: | Size: 815 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 968 B |
After Width: | Height: | Size: 909 B |
After Width: | Height: | Size: 843 B |
After Width: | Height: | Size: 918 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 4.5 KiB |
@ -0,0 +1,182 @@
|
||||
<?xml version = '1.0'?>
|
||||
<kdevelop>
|
||||
<general>
|
||||
<author>Unai Garro</author>
|
||||
<email>ugarro@users.sourceforge.net</email>
|
||||
<version>0.8</version>
|
||||
<projectmanagement>KDevKDEAutoProject</projectmanagement>
|
||||
<primarylanguage>C++</primarylanguage>
|
||||
<keywords>
|
||||
<keyword>C++</keyword>
|
||||
<keyword>Code</keyword>
|
||||
<keyword>Qt</keyword>
|
||||
<keyword>KDE</keyword>
|
||||
</keywords>
|
||||
<projectdirectory>.</projectdirectory>
|
||||
<absoluteprojectpath>false</absoluteprojectpath>
|
||||
<description/>
|
||||
<ignoreparts/>
|
||||
<secondaryLanguages/>
|
||||
<versioncontrol>kdevsubversion</versioncontrol>
|
||||
</general>
|
||||
<kdevautoproject>
|
||||
<general>
|
||||
<activetarget>src/krecipes</activetarget>
|
||||
<useconfiguration>default</useconfiguration>
|
||||
</general>
|
||||
<run>
|
||||
<mainprogram>src/krecipes</mainprogram>
|
||||
<programargs/>
|
||||
<terminal>false</terminal>
|
||||
<envvars/>
|
||||
<directoryradio>executable</directoryradio>
|
||||
<customdirectory>/</customdirectory>
|
||||
<autocompile>true</autocompile>
|
||||
</run>
|
||||
<make>
|
||||
<envvars>
|
||||
<envvar value="$KDEDIR/unsermake/unsermake" name="UNSERMAKE" />
|
||||
<envvar value="1" name="WANT_AUTOCONF_2_5" />
|
||||
<envvar value="1" name="WANT_AUTOMAKE_1_7" />
|
||||
</envvars>
|
||||
<abortonerror>false</abortonerror>
|
||||
<numberofjobs>1</numberofjobs>
|
||||
<dontact>false</dontact>
|
||||
<makebin/>
|
||||
<prio>0</prio>
|
||||
</make>
|
||||
<configurations>
|
||||
<default>
|
||||
<envvars/>
|
||||
</default>
|
||||
</configurations>
|
||||
</kdevautoproject>
|
||||
<kdevfileview>
|
||||
<groups>
|
||||
<group pattern="*.cpp;*.cxx;*.h" name="Sources" />
|
||||
<group pattern="*.ui" name="User Interface" />
|
||||
<group pattern="*.png" name="Icons" />
|
||||
<group pattern="*.po;*.ts" name="Translations" />
|
||||
<group pattern="*" name="Others" />
|
||||
<hidenonprojectfiles>false</hidenonprojectfiles>
|
||||
<hidenonlocation>false</hidenonlocation>
|
||||
</groups>
|
||||
<tree>
|
||||
<hidenonprojectfiles>false</hidenonprojectfiles>
|
||||
<hidepatterns></hidepatterns>
|
||||
<showvcsfields>true</showvcsfields>
|
||||
</tree>
|
||||
</kdevfileview>
|
||||
<kdevdoctreeview>
|
||||
<ignoretocs>
|
||||
<toc>gtk</toc>
|
||||
<toc>gnustep</toc>
|
||||
<toc>python</toc>
|
||||
<toc>php</toc>
|
||||
<toc>perl</toc>
|
||||
</ignoretocs>
|
||||
<projectdoc>
|
||||
<userdocDir>/home/uga/krecipes/html/</userdocDir>
|
||||
<apidocDir>/home/uga/krecipes/html/</apidocDir>
|
||||
</projectdoc>
|
||||
<ignoreqt_xml/>
|
||||
<ignoredoxygen/>
|
||||
<ignorekdocs/>
|
||||
<ignoredevhelp/>
|
||||
</kdevdoctreeview>
|
||||
<kdevdebugger>
|
||||
<general>
|
||||
<dbgshell>/home/fungmeista/src/svn/kde/trunk/extragear/utils/libtool</dbgshell>
|
||||
<programargs/>
|
||||
<gdbpath/>
|
||||
<breakonloadinglibs>true</breakonloadinglibs>
|
||||
<separatetty>false</separatetty>
|
||||
<floatingtoolbar>false</floatingtoolbar>
|
||||
<runappinappdirectory>true</runappinappdirectory>
|
||||
<configGdbScript/>
|
||||
<runShellScript/>
|
||||
<runGdbScript/>
|
||||
</general>
|
||||
<display>
|
||||
<staticmembers>false</staticmembers>
|
||||
<demanglenames>true</demanglenames>
|
||||
<outputradix>10</outputradix>
|
||||
</display>
|
||||
</kdevdebugger>
|
||||
<kdevfilecreate>
|
||||
<filetypes/>
|
||||
<useglobaltypes>
|
||||
<type ext="ui" />
|
||||
<type ext="cpp" />
|
||||
<type ext="h" />
|
||||
</useglobaltypes>
|
||||
</kdevfilecreate>
|
||||
<kdevcvs>
|
||||
<cvsoptions>-f</cvsoptions>
|
||||
<commitoptions/>
|
||||
<updateoptions>-dP</updateoptions>
|
||||
<addoptions/>
|
||||
<removeoptions>-f</removeoptions>
|
||||
<diffoptions>-u3 -p</diffoptions>
|
||||
<logoptions/>
|
||||
<rshoptions/>
|
||||
<revertoptions>-C -d -P</revertoptions>
|
||||
</kdevcvs>
|
||||
<cppsupportpart>
|
||||
<codecompletion/>
|
||||
<filetemplates>
|
||||
<choosefiles>false</choosefiles>
|
||||
<interfaceURL/>
|
||||
<implementationURL/>
|
||||
<interfacesuffix>.h</interfacesuffix>
|
||||
<implementationsuffix>.cpp</implementationsuffix>
|
||||
<lowercasefilenames>true</lowercasefilenames>
|
||||
</filetemplates>
|
||||
</cppsupportpart>
|
||||
<kdevclassview>
|
||||
<folderhierarchy>true</folderhierarchy>
|
||||
<depthoffolders>2</depthoffolders>
|
||||
</kdevclassview>
|
||||
<kdevcppsupport>
|
||||
<codecompletion>
|
||||
<includeGlobalFunctions>true</includeGlobalFunctions>
|
||||
<includeTypes>true</includeTypes>
|
||||
<includeEnums>true</includeEnums>
|
||||
<includeTypedefs>false</includeTypedefs>
|
||||
<automaticCodeCompletion>true</automaticCodeCompletion>
|
||||
<automaticArgumentsHint>true</automaticArgumentsHint>
|
||||
<codeCompletionDelay>250</codeCompletionDelay>
|
||||
<argumentsHintDelay>400</argumentsHintDelay>
|
||||
<automaticHeaderCompletion>true</automaticHeaderCompletion>
|
||||
<headerCompletionDelay>250</headerCompletionDelay>
|
||||
</codecompletion>
|
||||
<references/>
|
||||
<creategettersetter>
|
||||
<prefixGet/>
|
||||
<prefixSet>set</prefixSet>
|
||||
<prefixVariable>m_,_</prefixVariable>
|
||||
<parameterName>theValue</parameterName>
|
||||
<inlineGet>true</inlineGet>
|
||||
<inlineSet>true</inlineSet>
|
||||
</creategettersetter>
|
||||
</kdevcppsupport>
|
||||
<kdevcvsservice>
|
||||
<recursivewhenupdate>true</recursivewhenupdate>
|
||||
<prunedirswhenupdate>true</prunedirswhenupdate>
|
||||
<createdirswhenupdate>true</createdirswhenupdate>
|
||||
<recursivewhencommitremove>true</recursivewhencommitremove>
|
||||
<revertoptions>-C</revertoptions>
|
||||
<location>ERROR-LOCATION-IS-NOT-SET-IN-PROJECT</location>
|
||||
</kdevcvsservice>
|
||||
<kdevdocumentation>
|
||||
<projectdoc>
|
||||
<docsystem/>
|
||||
<docurl/>
|
||||
<usermanualurl>/home/fungmeista/src/svn/kde/trunk/extragear/utils/doc/krecipes/index.docbook</usermanualurl>
|
||||
</projectdoc>
|
||||
</kdevdocumentation>
|
||||
<ctagspart>
|
||||
<customArguments/>
|
||||
<customTagfilePath/>
|
||||
</ctagspart>
|
||||
</kdevelop>
|
@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE krecipes-layout>
|
||||
<krecipes-layout version="0.4" >
|
||||
<authors>
|
||||
<background-color>#e1f3ff</background-color>
|
||||
<text-color>#000000</text-color>
|
||||
<font>Nimbus Sans l,12,-1,5,50,0,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2049</alignment>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
</authors>
|
||||
<background>
|
||||
<background-color>#e1f3ff</background-color>
|
||||
</background>
|
||||
<categories>
|
||||
<background-color>#e1f3ff</background-color>
|
||||
<text-color>#000000</text-color>
|
||||
<font>Nimbus Sans l,12,-1,5,50,0,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2049</alignment>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
</categories>
|
||||
<header>
|
||||
<background-color>#eeda9c</background-color>
|
||||
<text-color>#000000</text-color>
|
||||
<font>Nimbus Sans l,12,-1,5,50,0,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2050</alignment>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
</header>
|
||||
<ingredients>
|
||||
<background-color>#174667</background-color>
|
||||
<text-color>#c3c3c3</text-color>
|
||||
<font>Nimbus Sans l,12,-1,5,50,0,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2049</alignment>
|
||||
<border width="2" style="ridge" color="#203fc7" />
|
||||
</ingredients>
|
||||
<instructions>
|
||||
<background-color>#e1f3ff</background-color>
|
||||
<text-color>#000000</text-color>
|
||||
<font>Nimbus Sans l,12,-1,5,50,0,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2049</alignment>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
</instructions>
|
||||
<photo>
|
||||
<visible>true</visible>
|
||||
<border width="2" style="ridge" color="#279ac7" />
|
||||
</photo>
|
||||
<prep_time>
|
||||
<background-color>#e1f3ff</background-color>
|
||||
<text-color>#000000</text-color>
|
||||
<font>Nimbus Sans L,12,-1,5,50,0,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2624</alignment>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
</prep_time>
|
||||
<properties>
|
||||
<background-color>#d9e6ee</background-color>
|
||||
<text-color>#000000</text-color>
|
||||
<font>Nimbus Sans L,12,-1,5,50,1,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2049</alignment>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
</properties>
|
||||
<ratings>
|
||||
<background-color>#e1f3ff</background-color>
|
||||
<text-color>#000000</text-color>
|
||||
<font>Nimbus Sans l,12,-1,5,50,0,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2049</alignment>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
</ratings>
|
||||
<title>
|
||||
<background-color>#e1f3ff</background-color>
|
||||
<text-color>#174667</text-color>
|
||||
<font>Times,26,-1,5,75,0,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2052</alignment>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
</title>
|
||||
<yield>
|
||||
<background-color>#e1f3ff</background-color>
|
||||
<text-color>#000000</text-color>
|
||||
<font>Nimbus Sans l,12,-1,5,50,0,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2049</alignment>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
</yield>
|
||||
</krecipes-layout>
|
@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE krecipes-layout>
|
||||
<krecipes-layout version="0.4" >
|
||||
<authors>
|
||||
<background-color>#ffffff</background-color>
|
||||
<text-color>#000000</text-color>
|
||||
<font>Nimbus Sans l,12,-1,5,50,0,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2049</alignment>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
</authors>
|
||||
<background>
|
||||
<background-color>#ffffff</background-color>
|
||||
</background>
|
||||
<categories>
|
||||
<background-color>#ffffff</background-color>
|
||||
<text-color>#000000</text-color>
|
||||
<font>Nimbus Sans l,12,-1,5,50,0,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2049</alignment>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
</categories>
|
||||
<header>
|
||||
<background-color>#eeda9c</background-color>
|
||||
<text-color>#000000</text-color>
|
||||
<font>Nimbus Sans l,12,-1,5,50,0,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2050</alignment>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
</header>
|
||||
<ingredients>
|
||||
<background-color>#776d4e</background-color>
|
||||
<text-color>#000000</text-color>
|
||||
<font>Nimbus Sans l,12,-1,5,50,0,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2049</alignment>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
<columns>1</columns>
|
||||
</ingredients>
|
||||
<instructions>
|
||||
<background-color>#ffffff</background-color>
|
||||
<text-color>#000000</text-color>
|
||||
<font>Nimbus Sans l,12,-1,5,50,0,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2049</alignment>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
</instructions>
|
||||
<photo>
|
||||
<visible>true</visible>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
</photo>
|
||||
<prep_time>
|
||||
<background-color>#ffffff</background-color>
|
||||
<text-color>#000000</text-color>
|
||||
<font>Nimbus Sans L,12,-1,5,50,0,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2624</alignment>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
</prep_time>
|
||||
<properties>
|
||||
<background-color>#eeda9c</background-color>
|
||||
<text-color>#000000</text-color>
|
||||
<font>Nimbus Sans L,12,-1,5,50,1,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2049</alignment>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
<columns>3</columns>
|
||||
</properties>
|
||||
<ratings>
|
||||
<background-color>#ffffff</background-color>
|
||||
<text-color>#000000</text-color>
|
||||
<font>Nimbus Sans l,12,-1,5,50,0,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2049</alignment>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
</ratings>
|
||||
<title>
|
||||
<background-color>#ffffff</background-color>
|
||||
<text-color>#000000</text-color>
|
||||
<font>New Century Schoolbook,32,-1,5,75,0,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2052</alignment>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
</title>
|
||||
<yield>
|
||||
<background-color>#ffffff</background-color>
|
||||
<text-color>#000000</text-color>
|
||||
<font>Nimbus Sans l,12,-1,5,50,0,0,0,0,0</font>
|
||||
<visible>true</visible>
|
||||
<alignment>2049</alignment>
|
||||
<border width="1" style="none" color="#000000" />
|
||||
</yield>
|
||||
</krecipes-layout>
|
@ -0,0 +1,35 @@
|
||||
<table width="100%">
|
||||
<tr><td class="title" colspan="3" width="100%">**TITLE**</td></tr>
|
||||
<tr><td colspan="3"> </td></tr>
|
||||
<tr>
|
||||
<td width="20%">
|
||||
<img src="**PHOTO**" class="photo" />
|
||||
</td>
|
||||
|
||||
<td width="3%"> </td>
|
||||
|
||||
<td>
|
||||
<p class="overall_rating">**OVERALL_RATING**</p>
|
||||
<p class="categories">**CATEGORIES**</p>
|
||||
<p class="authors">**AUTHORS**</p>
|
||||
<p class="yield">**YIELD**</p>
|
||||
<p class="prep_time">**PREP_TIME**</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan="3"> </td></tr>
|
||||
|
||||
<tr><td class="ratings" colspan="3">**RATINGS**</td></tr>
|
||||
|
||||
<tr><td colspan="3"> </td></tr>
|
||||
|
||||
<tr><td valign="top" class="ingredients" colspan="3">**INGREDIENTS**</td></tr>
|
||||
|
||||
<tr><td colspan="3"> </td></tr>
|
||||
|
||||
<tr><td valign="top" class="instructions" colspan="3">**INSTRUCTIONS**</td></tr>
|
||||
|
||||
<tr><td colspan="3"> </td></tr>
|
||||
|
||||
<tr><td valign="top" class="properties" colspan="3">**PROPERTIES**</td></tr>
|
||||
</table>
|
||||
<hr size="3" />
|
@ -0,0 +1,3 @@
|
||||
basedir = $(kde_datadir)/krecipes/layouts
|
||||
base_DATA = Default.klo Blue.klo \
|
||||
Default.template Two_Column.template
|
@ -0,0 +1,34 @@
|
||||
<table width="100%">
|
||||
<tr><td class="title" colspan="3" width="100%">**TITLE**</td></tr>
|
||||
<tr><td colspan="3"> </td></tr>
|
||||
<tr>
|
||||
<td width="20%">
|
||||
<img src="**PHOTO**" class="photo" />
|
||||
</td>
|
||||
|
||||
<td width="3%"> </td>
|
||||
|
||||
<td>
|
||||
<p class="overall_ratings">**OVERALL_RATING**</p>
|
||||
<p class="categories">**CATEGORIES**</p>
|
||||
<p class="authors">**AUTHORS**</p>
|
||||
<p class="yield">**YIELD**</p>
|
||||
<p class="prep_time">**PREP_TIME**</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan="3"> </td></tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<div class="ingredients">**INGREDIENTS**</div>
|
||||
<div class="properties">**PROPERTIES**</div>
|
||||
</td>
|
||||
<td width="3%"> </td>
|
||||
<td valign="top">
|
||||
<div class="instructions">**INSTRUCTIONS**</div>
|
||||
<br />
|
||||
<div class="ratings">**RATINGS**</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="3" />
|
@ -0,0 +1,7 @@
|
||||
picsdir = $(kde_datadir)/krecipes/pics
|
||||
pics_DATA = network.png save.png wizard.png dbpermissions.png recipes.png startlogo.png menubg.png \
|
||||
star_on.png \
|
||||
star_off.png \
|
||||
star_half.png \
|
||||
rating0.png rating1.png rating2.png rating3.png rating4.png rating5.png
|
||||
|
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 319 B |
After Width: | Height: | Size: 264 B |
After Width: | Height: | Size: 319 B |
After Width: | Height: | Size: 193 KiB |
After Width: | Height: | Size: 24 KiB |
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
mysqldump -p --no-create-db --no-create-info --databases $1> $2
|
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
mysqldump --databases $1> $2
|
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
mysqldump -p --no-create-db --no-data --databases $1> $2
|
@ -0,0 +1,58 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This script will convert an SQLite 2.x database file to SQLite 3.
|
||||
#
|
||||
# Calling it without any parameters, it will convert the file specified in the
|
||||
# Krecipes configuration
|
||||
#
|
||||
# If Krecipes can't find the database file, you need to manually give
|
||||
# it on the command-line, e.g.:
|
||||
#
|
||||
# $./convert_sqlite.sh /path/to/database.file
|
||||
#
|
||||
|
||||
file=$1
|
||||
if test -z $1; then
|
||||
file=`kreadconfig --file krecipesrc --group Server --key DBFile`
|
||||
if test "$?" -ne "0"; then
|
||||
echo "Unable to find database file using 'kreadconfig'"
|
||||
echo "You need to manually specify where the SQLite 2 database file is, e.g.:"
|
||||
echo " $./convert_sqlite3.sh /path/to/database.file"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -e $file; then
|
||||
|
||||
sqlite $file .dump > /dev/null
|
||||
|
||||
if test "$?" -ne "0"; then
|
||||
echo "Conversion failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sqlite $file .dump | sqlite3 $file.new
|
||||
|
||||
if test "$?" -ne "0"; then
|
||||
echo "Conversion failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mv $file $file.sqlite2
|
||||
if test "$?" -ne "0"; then
|
||||
echo "Unable to backup old SQLite 2 file... aborting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mv $file.new $file
|
||||
if test "$?" -ne "0"; then
|
||||
echo "Created SQLite 3 database, '$file.new', but unable to copy it to $file"
|
||||
else
|
||||
echo "Conversion successful!"
|
||||
fi
|
||||
|
||||
else
|
||||
echo "Database file '$file' doesn't exist"
|
||||
echo "You need to manually specify where the SQLite 2 database file is, e.g.:"
|
||||
echo " $./convert_sqlite3.sh /path/to/database.file"
|
||||
fi
|
@ -0,0 +1,57 @@
|
||||
## Makefile.am for krecipes
|
||||
|
||||
# this is the program that gets installed. it's name is used for all
|
||||
# of the other Makefile.am variables
|
||||
bin_PROGRAMS = krecipes
|
||||
|
||||
SUBDIRS = backends importers widgets dialogs exporters datablocks tests
|
||||
|
||||
# set the include path for X, qt and KDE
|
||||
INCLUDES = -I$(srcdir) -I$(srcdir)/backends -I$(srcdir)/backends/SQLite $(all_includes)
|
||||
|
||||
# the library search path.
|
||||
krecipes_LDFLAGS = $(KDE_RPATH) $(all_libraries)
|
||||
|
||||
|
||||
# Check for optional libs
|
||||
if link_lib_SQLITE
|
||||
qsqlite_libadds = backends/SQLite/libkrecsqlite.la $(SQLITE_LIB)
|
||||
endif
|
||||
|
||||
if link_lib_MYSQL
|
||||
mysql_libadds =backends/MySQL/libkrecmysql.la
|
||||
endif
|
||||
|
||||
if link_lib_POSTGRESQL
|
||||
psql_libadds =backends/PostgreSQL/libkrecpsql.la
|
||||
endif
|
||||
|
||||
# the shared libraries to link against.
|
||||
krecipes_LDADD = \
|
||||
backends/libkrecipesdbs.la exporters/libkrecipesexporters.la \
|
||||
importers/libkrecipesimporters.la widgets/libkrecipeswidgets.la dialogs/libkrecipesdialogs.la \
|
||||
widgets/libkrecipeswidgets.la datablocks/libdatablocks.la \
|
||||
$(qsqlite_libadds) $(mysql_libadds) $(psql_libadds) $(LIB_KHTML) $(LIB_KSPELL)
|
||||
|
||||
# which sources should be compiled for krecipes
|
||||
krecipes_SOURCES = \
|
||||
main.cpp krecipes.cpp krecipesview.cpp pref.cpp \
|
||||
krecipesiface.skel krecipesdbiface.skel \
|
||||
propertycalculator.cpp setupwizard.cpp \
|
||||
shoppingcalculator.cpp kstartuplogo.cpp \
|
||||
recipeactionshandler.cpp \
|
||||
recipefilter.cpp \
|
||||
convert_sqlite3.cpp klomanager.cpp
|
||||
|
||||
# let automoc handle all of the meta source files (moc)
|
||||
METASOURCES = AUTO
|
||||
|
||||
KDE_ICON = krecipes
|
||||
|
||||
# this is where the kdelnk file will go
|
||||
kdelnkdir = $(kde_appsdir)/Utilities
|
||||
kdelnk_DATA = krecipes.desktop
|
||||
|
||||
# this is where the XML-GUI resource file goes
|
||||
rcdir = $(kde_datadir)/krecipes
|
||||
rc_DATA = krecipesui.rc
|
@ -0,0 +1,42 @@
|
||||
## Makefile.am for krecipes
|
||||
|
||||
# this is the program that gets installed. it's name is used for all
|
||||
# of the other Makefile.am variables
|
||||
|
||||
# set the include path for X, qt and KDE
|
||||
INCLUDES = -I$(srcdir) -I$(srcdir)/.. $(all_includes)
|
||||
|
||||
# Check for optional database libs
|
||||
|
||||
|
||||
if link_lib_SQLITE
|
||||
sqlite_subdirs=SQLite
|
||||
sqlite_libs=SQLite/libkrecsqlite.la
|
||||
endif
|
||||
|
||||
if link_lib_MYSQL
|
||||
mysql_subdirs=MySQL
|
||||
mysql_libs=MySQL/libkrecmysql.la
|
||||
endif
|
||||
|
||||
if link_lib_POSTGRESQL
|
||||
psql_subdirs=PostgreSQL
|
||||
psql_libs=PostgreSQL/libkrecpsql.la
|
||||
endif
|
||||
|
||||
# Optional subdirectories
|
||||
|
||||
SUBDIRS=$(sqlite_subdirs) $(mysql_subdirs) $(psql_subdirs)
|
||||
|
||||
# Instructions for building the convenience library
|
||||
noinst_LTLIBRARIES=libkrecipesdbs.la
|
||||
libkrecipesdbs_la_SOURCES=recipedb.cpp qsqlrecipedb.cpp progressinterface.cpp
|
||||
libkrecipesdbs_la_METASOURCES=AUTO
|
||||
|
||||
libkrecipesdbs_la_LIBADD= $(mysql_libs) $(sqlite_libs) $(psql_libs)
|
||||
|
||||
#the library search path.
|
||||
libkrecipesdbs_la_LDFLAGS = $(KDE_RPATH) $(all_libraries)
|
||||
|
||||
#install the following headers
|
||||
# include_HEADERS = recipedb.h
|
@ -0,0 +1,18 @@
|
||||
## Makefile.am for krecipes
|
||||
|
||||
# this is the program that gets installed. it's name is used for all
|
||||
# of the other Makefile.am variables
|
||||
|
||||
# set the include path for X, qt and KDE
|
||||
INCLUDES = -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../.. $(all_includes)
|
||||
|
||||
|
||||
# Instructions for building the convenience library
|
||||
noinst_LTLIBRARIES=libkrecmysql.la
|
||||
libkrecmysql_la_SOURCES=mysqlrecipedb.cpp
|
||||
libkrecmysql_la_METASOURCES=AUTO
|
||||
|
||||
|
||||
#the library search path.
|
||||
libkrecmysql_la_LDFLAGS = $(KDE_RPATH) $(all_libraries)
|
||||
|
@ -0,0 +1,554 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2003 by *
|
||||
* Unai Garro (ugarro@users.sourceforge.net) *
|
||||
* Cyril Bosselut (bosselut@b1project.com) *
|
||||
* Jason Kivlighn (jkivlighn@gmail.com) *
|
||||
* *
|
||||
* Copyright (C) 2006 Jason Kivlighn (jkivlighn@gmail.com) *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "mysqlrecipedb.h"
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <ktempfile.h>
|
||||
#include <klocale.h>
|
||||
#include <kconfig.h>
|
||||
#include <kglobal.h>
|
||||
|
||||
MySQLRecipeDB::MySQLRecipeDB( const QString &host, const QString &user, const QString &pass, const QString &DBname, int port ) : QSqlRecipeDB( host, user, pass, DBname, port )
|
||||
{}
|
||||
|
||||
MySQLRecipeDB::~MySQLRecipeDB()
|
||||
{}
|
||||
|
||||
void MySQLRecipeDB::createDB()
|
||||
{
|
||||
QString real_db_name = database->databaseName();
|
||||
|
||||
//we have to be connected to some database in order to create the Krecipes database
|
||||
//so long as the permissions given are allowed access to "mysql', this works
|
||||
database->setDatabaseName( "mysql" );
|
||||
if ( database->open() ) {
|
||||
// Create the Database (Note: needs permissions)
|
||||
//FIXME: I've noticed certain characters cause this to fail (such as '-'). Somehow let the user know.
|
||||
QSqlQuery query( QString( "CREATE DATABASE %1" ).arg( real_db_name ), database );
|
||||
if ( !query.isActive() )
|
||||
kdDebug() << "create query failed: " << database->lastError().databaseText() << endl;
|
||||
|
||||
database->close();
|
||||
}
|
||||
else
|
||||
kdDebug() << "create open failed: " << database->lastError().databaseText() << endl;
|
||||
|
||||
database->setDatabaseName( real_db_name );
|
||||
}
|
||||
|
||||
QStringList MySQLRecipeDB::backupCommand() const
|
||||
{
|
||||
KConfig *config = KGlobal::config();
|
||||
config->setGroup("Server");
|
||||
|
||||
QStringList command;
|
||||
command<<config->readEntry( "MySQLDumpPath", "mysqldump" )<<"-q";
|
||||
|
||||
QString pass = config->readEntry("Password", QString::null);
|
||||
if ( !pass.isEmpty() )
|
||||
command<<"-p"+pass;
|
||||
|
||||
QString user = config->readEntry("Username", QString::null);
|
||||
command<<"-u"+user;
|
||||
|
||||
command<<"-h"+config->readEntry("Host", "localhost");
|
||||
|
||||
int port = config->readNumEntry("Port", 0);
|
||||
if ( port > 0 )
|
||||
command<<"-P"+QString::number(port);
|
||||
|
||||
command<<database->databaseName();
|
||||
return command;
|
||||
}
|
||||
|
||||
QStringList MySQLRecipeDB::restoreCommand() const
|
||||
{
|
||||
KConfig *config = KGlobal::config();
|
||||
config->setGroup("Server");
|
||||
|
||||
QStringList command;
|
||||
command<<config->readEntry( "MySQLPath", "mysql" );
|
||||
|
||||
QString pass = config->readEntry("Password", QString::null);
|
||||
if ( !pass.isEmpty() )
|
||||
command<<"-p"+pass;
|
||||
|
||||
QString user = config->readEntry("Username", QString::null);
|
||||
command<<"-u"+user;
|
||||
|
||||
int port = config->readNumEntry("Port", 0);
|
||||
if ( port > 0 )
|
||||
command<<"-P"+QString::number(port);
|
||||
|
||||
command<<"-h"+config->readEntry("Host", "localhost");
|
||||
|
||||
command<<database->databaseName();
|
||||
return command;
|
||||
}
|
||||
|
||||
void MySQLRecipeDB::createTable( const QString &tableName )
|
||||
{
|
||||
|
||||
QStringList commands;
|
||||
|
||||
if ( tableName == "recipes" )
|
||||
commands << QString( "CREATE TABLE recipes (id INTEGER NOT NULL AUTO_INCREMENT,title VARCHAR(%1), yield_amount FLOAT, yield_amount_offset FLOAT, yield_type_id int(11) DEFAULT '-1', instructions TEXT, photo BLOB, prep_time TIME, ctime TIMESTAMP, mtime TIMESTAMP, atime TIMESTAMP, PRIMARY KEY (id));" ).arg( maxRecipeTitleLength() );
|
||||
|
||||
else if ( tableName == "ingredients" )
|
||||
commands << QString( "CREATE TABLE ingredients (id INTEGER NOT NULL AUTO_INCREMENT, name VARCHAR(%1), PRIMARY KEY (id));" ).arg( maxIngredientNameLength() );
|
||||
|
||||
else if ( tableName == "ingredient_list" )
|
||||
commands << "CREATE TABLE ingredient_list (id INTEGER NOT NULL AUTO_INCREMENT, recipe_id INTEGER, ingredient_id INTEGER, amount FLOAT, amount_offset FLOAT, unit_id INTEGER, order_index INTEGER, group_id INTEGER, substitute_for INTEGER, PRIMARY KEY(id), INDEX ridil_index(recipe_id), INDEX iidil_index(ingredient_id), INDEX gidil_index(group_id))";
|
||||
|
||||
else if ( tableName == "unit_list" )
|
||||
commands << "CREATE TABLE unit_list (ingredient_id INTEGER, unit_id INTEGER);";
|
||||
|
||||
else if ( tableName == "units" )
|
||||
commands << QString( "CREATE TABLE units (id INTEGER NOT NULL AUTO_INCREMENT, name VARCHAR(%1), name_abbrev VARCHAR(%2), plural VARCHAR(%3), plural_abbrev VARCHAR(%4), type INTEGER NOT NULL DEFAULT 0, PRIMARY KEY (id));" )
|
||||
.arg( maxUnitNameLength() ).arg( maxUnitNameLength() ).arg( maxUnitNameLength() ).arg( maxUnitNameLength() );
|
||||
|
||||
else if ( tableName == "prep_methods" )
|
||||
commands << QString( "CREATE TABLE prep_methods (id INTEGER NOT NULL AUTO_INCREMENT, name VARCHAR(%1), PRIMARY KEY (id));" ).arg( maxPrepMethodNameLength() );
|
||||
|
||||
else if ( tableName == "prep_method_list" )
|
||||
commands << "CREATE TABLE prep_method_list (ingredient_list_id int(11) NOT NULL,prep_method_id int(11) NOT NULL, order_index int(11), INDEX iid_index (ingredient_list_id), INDEX pid_index (prep_method_id));";
|
||||
|
||||
else if ( tableName == "ingredient_info" )
|
||||
commands << "CREATE TABLE ingredient_info (ingredient_id INTEGER, property_id INTEGER, amount FLOAT, per_units INTEGER);";
|
||||
|
||||
else if ( tableName == "ingredient_properties" )
|
||||
commands << "CREATE TABLE ingredient_properties (id INTEGER NOT NULL AUTO_INCREMENT,name VARCHAR(20), units VARCHAR(20), PRIMARY KEY (id));";
|
||||
|
||||
else if ( tableName == "ingredient_weights" )
|
||||
commands << "CREATE TABLE ingredient_weights (id INTEGER NOT NULL AUTO_INCREMENT, ingredient_id INTEGER NOT NULL, amount FLOAT, unit_id INTEGER, weight FLOAT, weight_unit_id INTEGER, prep_method_id INTEGER, PRIMARY KEY (id), INDEX(ingredient_id), INDEX(unit_id), INDEX(weight_unit_id), INDEX(prep_method_id) );";
|
||||
|
||||
else if ( tableName == "units_conversion" )
|
||||
commands << "CREATE TABLE units_conversion (unit1_id INTEGER, unit2_id INTEGER, ratio FLOAT);";
|
||||
|
||||
else if ( tableName == "categories" )
|
||||
commands << QString( "CREATE TABLE categories (id int(11) NOT NULL auto_increment, name varchar(%1) default NULL, parent_id int(11) NOT NULL default -1, PRIMARY KEY (id), INDEX parent_id_index(parent_id));" ).arg( maxCategoryNameLength() );
|
||||
|
||||
else if ( tableName == "category_list" )
|
||||
commands << "CREATE TABLE category_list (recipe_id int(11) NOT NULL,category_id int(11) NOT NULL, INDEX rid_index (recipe_id), INDEX cid_index (category_id));";
|
||||
|
||||
else if ( tableName == "authors" )
|
||||
commands << QString( "CREATE TABLE authors (id int(11) NOT NULL auto_increment, name varchar(%1) default NULL,PRIMARY KEY (id));" ).arg( maxAuthorNameLength() );
|
||||
|
||||
else if ( tableName == "author_list" )
|
||||
commands << "CREATE TABLE author_list (recipe_id int(11) NOT NULL,author_id int(11) NOT NULL);";
|
||||
|
||||
else if ( tableName == "db_info" ) {
|
||||
commands << "CREATE TABLE db_info (ver FLOAT NOT NULL,generated_by varchar(200) default NULL);";
|
||||
commands << QString( "INSERT INTO db_info VALUES(%1,'Krecipes %2');" ).arg( latestDBVersion() ).arg( krecipes_version() );
|
||||
}
|
||||
else if ( tableName == "ingredient_groups" ) {
|
||||
commands << QString( "CREATE TABLE `ingredient_groups` (`id` int(11) NOT NULL auto_increment, `name` varchar(%1), PRIMARY KEY (`id`));" ).arg( maxIngGroupNameLength() );
|
||||
}
|
||||
else if ( tableName == "yield_types" ) {
|
||||
commands << QString( "CREATE TABLE `yield_types` (`id` int(11) NOT NULL auto_increment, `name` varchar(%1), PRIMARY KEY (`id`));" ).arg( 20 );
|
||||
}
|
||||
|
||||
else if ( tableName == "ratings" )
|
||||
commands << "CREATE TABLE ratings (id INTEGER NOT NULL AUTO_INCREMENT, recipe_id int(11) NOT NULL, comment TEXT, rater TEXT, created TIMESTAMP, PRIMARY KEY (id));";
|
||||
|
||||
else if ( tableName == "rating_criteria" )
|
||||
commands << "CREATE TABLE rating_criteria (id INTEGER NOT NULL AUTO_INCREMENT, name TEXT, PRIMARY KEY (id));";
|
||||
|
||||
else if ( tableName == "rating_criterion_list" )
|
||||
commands << "CREATE TABLE rating_criterion_list (rating_id INTEGER NOT NULL, rating_criterion_id INTEGER, stars FLOAT);";
|
||||
|
||||
else
|
||||
return ;
|
||||
|
||||
QSqlQuery databaseToCreate( QString::null, database );
|
||||
|
||||
// execute the queries
|
||||
for ( QStringList::const_iterator it = commands.begin(); it != commands.end(); ++it )
|
||||
databaseToCreate.exec( ( *it ) );
|
||||
}
|
||||
|
||||
void MySQLRecipeDB::portOldDatabases( float version )
|
||||
{
|
||||
kdDebug() << "Current database version is..." << version << "\n";
|
||||
QString command;
|
||||
|
||||
// Note that version no. means the version in which this DB structure
|
||||
// was introduced. To work with SVN users, the database will be incrementally
|
||||
// upgraded for each change made between releases (e.g. 0.81, 0.82,... are
|
||||
// what will become 0.9)
|
||||
|
||||
if ( qRound(version*10) < 3 ) // The database was generated with a version older than v 0.3. First update to 0.3 version
|
||||
{
|
||||
|
||||
// Add new columns to existing tables (creating new tables is not necessary. Integrity check does that before)
|
||||
command = "ALTER TABLE recipes ADD COLUMN persons int(11) AFTER title;";
|
||||
QSqlQuery tableToAlter( command, database );
|
||||
|
||||
// Set the version to the new one (0.3)
|
||||
|
||||
command = "DELETE FROM db_info;"; // Remove previous version records if they exist
|
||||
tableToAlter.exec( command );
|
||||
command = "INSERT INTO db_info VALUES(0.3,'Krecipes 0.4');"; // Set the new version
|
||||
tableToAlter.exec( command );
|
||||
}
|
||||
|
||||
if ( qRound(version*10) < 4 ) // Upgrade to the current DB version 0.4
|
||||
{
|
||||
|
||||
// Add new columns to existing tables (creating any new tables is not necessary. Integrity check does that before)
|
||||
command = "ALTER TABLE ingredient_list ADD COLUMN order_index int(11) AFTER unit_id;";
|
||||
QSqlQuery tableToAlter( command, database );
|
||||
|
||||
// Missing indexes in the previous versions
|
||||
command = "CREATE index rid_index ON category_list(recipe_id)";
|
||||
tableToAlter.exec( command );
|
||||
|
||||
command = "CREATE index cid_index ON category_list(category_id)";
|
||||
tableToAlter.exec( command );
|
||||
|
||||
command = "CREATE index ridil_index ON ingredient_list(recipe_id)";
|
||||
tableToAlter.exec( command );
|
||||
|
||||
command = "CREATE index iidil_index ON ingredient_list(ingredient_id)";
|
||||
tableToAlter.exec( command );
|
||||
|
||||
// Port data
|
||||
|
||||
//*1:: Recipes have always category -1 to speed up searches (no JOINs needed)
|
||||
command = "SELECT r.id FROM recipes r;"; // Find all recipes
|
||||
QSqlQuery categoryToAdd( QString::null, database );
|
||||
tableToAlter.exec( command );
|
||||
if ( tableToAlter.isActive() )
|
||||
{
|
||||
while ( tableToAlter.next() ) {
|
||||
int recipeId = tableToAlter.value( 0 ).toInt();
|
||||
QString cCommand = QString( "INSERT INTO category_list VALUES (%1,-1);" ).arg( recipeId );
|
||||
categoryToAdd.exec( cCommand );
|
||||
|
||||
emit progress();
|
||||
}
|
||||
}
|
||||
|
||||
// Set the version to the new one (0.4)
|
||||
|
||||
command = "DELETE FROM db_info;"; // Remove previous version records if they exist
|
||||
tableToAlter.exec( command );
|
||||
command = "INSERT INTO db_info VALUES(0.4,'Krecipes 0.4');"; // Set the new version
|
||||
tableToAlter.exec( command );
|
||||
}
|
||||
|
||||
if ( qRound(version*10) < 5 ) {
|
||||
command = QString( "CREATE TABLE prep_methods (id INTEGER NOT NULL AUTO_INCREMENT, name VARCHAR(%1), PRIMARY KEY (id));" ).arg( maxPrepMethodNameLength() );
|
||||
QSqlQuery tableToAlter( command, database );
|
||||
|
||||
command = "ALTER TABLE ingredient_list ADD COLUMN prep_method_id int(11) AFTER unit_id;";
|
||||
tableToAlter.exec( command );
|
||||
command = "UPDATE ingredient_list SET prep_method_id=-1 WHERE prep_method_id IS NULL;";
|
||||
tableToAlter.exec( command );
|
||||
|
||||
command = "ALTER TABLE authors MODIFY name VARCHAR(50);";
|
||||
tableToAlter.exec( command );
|
||||
command = "ALTER TABLE categories MODIFY name VARCHAR(40);";
|
||||
tableToAlter.exec( command );
|
||||
|
||||
// Set the version to the new one (0.5)
|
||||
command = "DELETE FROM db_info;"; // Remove previous version records if they exist
|
||||
tableToAlter.exec( command );
|
||||
command = "INSERT INTO db_info VALUES(0.5,'Krecipes 0.5');";
|
||||
tableToAlter.exec( command );
|
||||
}
|
||||
|
||||
if ( qRound(version*10) < 6 ) {
|
||||
command = "ALTER TABLE categories ADD COLUMN parent_id int(11) NOT NULL default '-1' AFTER name;";
|
||||
QSqlQuery tableToAlter( command, database );
|
||||
|
||||
command = "DELETE FROM db_info;"; // Remove previous version records if they exist
|
||||
tableToAlter.exec( command );
|
||||
command = "INSERT INTO db_info VALUES(0.6,'Krecipes 0.6');";
|
||||
tableToAlter.exec( command );
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 61 ) {
|
||||
QString command = "ALTER TABLE `recipes` ADD COLUMN `prep_time` TIME DEFAULT NULL";
|
||||
QSqlQuery tableToAlter( command, database );
|
||||
|
||||
command = "DELETE FROM db_info;"; // Remove previous version records if they exist
|
||||
tableToAlter.exec( command );
|
||||
command = "INSERT INTO db_info VALUES(0.61,'Krecipes 0.6');";
|
||||
tableToAlter.exec( command );
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 62 ) {
|
||||
QString command = "ALTER TABLE `ingredient_list` ADD COLUMN `group_id` int(11) default '-1' AFTER order_index;";
|
||||
QSqlQuery tableToAlter( command, database );
|
||||
|
||||
command = "DELETE FROM db_info;"; // Remove previous version records if they exist
|
||||
tableToAlter.exec( command );
|
||||
command = "INSERT INTO db_info VALUES(0.62,'Krecipes 0.7');";
|
||||
tableToAlter.exec( command );
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 63 ) {
|
||||
QString command = "ALTER TABLE `units` ADD COLUMN `plural` varchar(20) DEFAULT NULL AFTER name;";
|
||||
QSqlQuery tableToAlter( command, database );
|
||||
|
||||
QSqlQuery result( "SELECT id,name FROM units WHERE plural IS NULL", database );
|
||||
if ( result.isActive() ) {
|
||||
while ( result.next() ) {
|
||||
command = "UPDATE units SET plural='" + result.value( 1 ).toString() + "' WHERE id=" + QString::number( result.value( 0 ).toInt() );
|
||||
QSqlQuery query( command, database );
|
||||
|
||||
emit progress();
|
||||
}
|
||||
}
|
||||
|
||||
command = "DELETE FROM db_info;"; // Remove previous version records if they exist
|
||||
tableToAlter.exec( command );
|
||||
command = "INSERT INTO db_info VALUES(0.63,'Krecipes 0.7');";
|
||||
tableToAlter.exec( command );
|
||||
}
|
||||
|
||||
if ( qRound(version*10) < 7 ) { //simply call 0.63 -> 0.7
|
||||
QString command = "UPDATE db_info SET ver='0.7';";
|
||||
QSqlQuery query( command, database );
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 81 ) {
|
||||
QString command = "ALTER TABLE `ingredient_list` ADD COLUMN `amount_offset` FLOAT DEFAULT '0' AFTER amount;";
|
||||
QSqlQuery tableToAlter( command, database );
|
||||
|
||||
command = "UPDATE db_info SET ver='0.81',generated_by='Krecipes SVN (20050816)';";
|
||||
tableToAlter.exec( command );
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 82 ) {
|
||||
QString command = "ALTER TABLE `recipes` ADD COLUMN `yield_amount` FLOAT DEFAULT '0' AFTER persons;";
|
||||
QSqlQuery tableToAlter( command, database );
|
||||
|
||||
command = "ALTER TABLE `recipes` ADD COLUMN `yield_amount_offset` FLOAT DEFAULT '0' AFTER yield_amount;";
|
||||
tableToAlter.exec(command);
|
||||
|
||||
command = "ALTER TABLE `recipes` ADD COLUMN `yield_type_id` INTEGER DEFAULT '-1' AFTER yield_amount_offset;";
|
||||
tableToAlter.exec(command);
|
||||
|
||||
QSqlQuery result( "SELECT id,persons FROM recipes", database );
|
||||
if ( result.isActive() ) {
|
||||
while ( result.next() ) {
|
||||
command = "UPDATE recipes SET yield_amount='" + QString::number( result.value( 1 ).toInt() ) + "' WHERE id=" + QString::number( result.value( 0 ).toInt() );
|
||||
QSqlQuery query( command, database );
|
||||
|
||||
emit progress();
|
||||
}
|
||||
}
|
||||
|
||||
command = "ALTER TABLE `recipes` DROP COLUMN `persons`;";
|
||||
tableToAlter.exec( command );
|
||||
|
||||
command = "UPDATE db_info SET ver='0.82',generated_by='Krecipes SVN (20050902)';";
|
||||
tableToAlter.exec( command );
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 83 ) {
|
||||
database->transaction();
|
||||
|
||||
//====add a id columns to 'ingredient_list' to identify it for the prep method list
|
||||
database->exec( "RENAME TABLE ingredient_list TO ingredient_list_copy;" );
|
||||
database->exec( "CREATE TABLE ingredient_list (id INTEGER NOT NULL AUTO_INCREMENT, recipe_id INTEGER, ingredient_id INTEGER, amount FLOAT, amount_offset FLOAT, unit_id INTEGER, order_index INTEGER, group_id INTEGER, PRIMARY KEY(id), INDEX ridil_index(recipe_id), INDEX iidil_index(ingredient_id));" );
|
||||
|
||||
QSqlQuery copyQuery = database->exec( "SELECT recipe_id,ingredient_id,amount,amount_offset,unit_id,prep_method_id,order_index,group_id FROM ingredient_list_copy" );
|
||||
if ( copyQuery.isActive() ) {
|
||||
while ( copyQuery.next() ) {
|
||||
QSqlQuery query(QString::null,database);
|
||||
query.prepare( "INSERT INTO ingredient_list VALUES (NULL, ?, ?, ?, ?, ?, ?, ?)" );
|
||||
query.addBindValue( copyQuery.value( 0 ) );
|
||||
query.addBindValue( copyQuery.value( 1 ) );
|
||||
query.addBindValue( copyQuery.value( 2 ) );
|
||||
query.addBindValue( copyQuery.value( 3 ) );
|
||||
query.addBindValue( copyQuery.value( 4 ) );
|
||||
query.addBindValue( copyQuery.value( 6 ) );
|
||||
query.addBindValue( copyQuery.value( 7 ) );
|
||||
query.exec();
|
||||
|
||||
int prep_method_id = copyQuery.value( 5 ).toInt();
|
||||
if ( prep_method_id != -1 ) {
|
||||
query.prepare( "INSERT INTO prep_method_list VALUES (?, ?, ?);" );
|
||||
query.addBindValue( lastInsertID() );
|
||||
query.addBindValue( prep_method_id );
|
||||
query.addBindValue( 1 );
|
||||
query.exec();
|
||||
}
|
||||
|
||||
emit progress();
|
||||
}
|
||||
}
|
||||
database->exec( "DROP TABLE ingredient_list_copy" );
|
||||
|
||||
database->exec( "UPDATE db_info SET ver='0.83',generated_by='Krecipes SVN (20050909)';" );
|
||||
|
||||
if ( !database->commit() )
|
||||
kdDebug()<<"Update to 0.83 failed. Maybe you should try again."<<endl;
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 84 ) {
|
||||
database->transaction();
|
||||
|
||||
database->exec( "ALTER TABLE recipes ADD COLUMN ctime TIMESTAMP;" );
|
||||
database->exec( "ALTER TABLE recipes ADD COLUMN mtime TIMESTAMP;" );
|
||||
database->exec( "ALTER TABLE recipes ADD COLUMN atime TIMESTAMP;" );
|
||||
|
||||
database->exec( "UPDATE recipes SET ctime=CURRENT_TIMESTAMP, mtime=CURRENT_TIMESTAMP, atime=CURRENT_TIMESTAMP;" );
|
||||
|
||||
database->exec( "UPDATE db_info SET ver='0.84',generated_by='Krecipes SVN (20050913)';" );
|
||||
|
||||
if ( !database->commit() )
|
||||
kdDebug()<<"Update to 0.84 failed. Maybe you should try again."<<endl;
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 85 ) {
|
||||
database->transaction();
|
||||
|
||||
QSqlQuery query( "SELECT id,photo FROM recipes", database );
|
||||
|
||||
if ( query.isActive() ) {
|
||||
while ( query.next() ) {
|
||||
storePhoto( query.value(0).toInt(), query.value(1).toByteArray() );
|
||||
|
||||
emit progress();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
database->exec( "UPDATE db_info SET ver='0.85',generated_by='Krecipes SVN (20050926)';" );
|
||||
if ( !database->commit() )
|
||||
kdDebug()<<"Update to 0.85 failed. Maybe you should try again."<<endl;
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 86 ) {
|
||||
database->transaction();
|
||||
|
||||
database->exec( "ALTER TABLE ingredient_list ADD INDEX (group_id)" );
|
||||
|
||||
QSqlQuery query( "SELECT id,name FROM ingredient_groups ORDER BY name", database );
|
||||
|
||||
QString last;
|
||||
int lastID;
|
||||
if ( query.isActive() ) {
|
||||
while ( query.next() ) {
|
||||
QString name = query.value(1).toString();
|
||||
int id = query.value(0).toInt();
|
||||
if ( last == name ) {
|
||||
QString command = QString("UPDATE ingredient_list SET group_id=%1 WHERE group_id=%2").arg(lastID).arg(id);
|
||||
database->exec(command);
|
||||
|
||||
command = QString("DELETE FROM ingredient_groups WHERE id=%1").arg(id);
|
||||
database->exec(command);
|
||||
}
|
||||
last = name;
|
||||
lastID = id;
|
||||
|
||||
emit progress();
|
||||
}
|
||||
}
|
||||
|
||||
database->exec( "UPDATE db_info SET ver='0.86',generated_by='Krecipes SVN (20050928)';" );
|
||||
if ( !database->commit() )
|
||||
kdDebug()<<"Update to 0.86 failed. Maybe you should try again."<<endl;
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 87 ) {
|
||||
//Load this default data so the user knows what rating criteria is
|
||||
database->exec( QString("INSERT INTO rating_criteria VALUES (1,'%1')").arg(i18n("Overall")) );
|
||||
database->exec( QString("INSERT INTO rating_criteria VALUES (2,'%1')").arg(i18n("Taste") ) );
|
||||
database->exec( QString("INSERT INTO rating_criteria VALUES (3,'%1')").arg(i18n("Appearance") ) );
|
||||
database->exec( QString("INSERT INTO rating_criteria VALUES (4,'%1')").arg(i18n("Originality") ) );
|
||||
database->exec( QString("INSERT INTO rating_criteria VALUES (5,'%1')").arg(i18n("Ease of Preparation") ) );
|
||||
|
||||
database->exec( "UPDATE db_info SET ver='0.87',generated_by='Krecipes SVN (20051014)'" );
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 90 ) {
|
||||
database->exec("UPDATE db_info SET ver='0.9',generated_by='Krecipes 0.9'");
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 91 ) {
|
||||
database->exec("CREATE index parent_id_index ON categories(parent_id)");
|
||||
database->exec("UPDATE db_info SET ver='0.91',generated_by='Krecipes SVN (20060526)'");
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 92 ) {
|
||||
database->transaction();
|
||||
|
||||
database->exec( "ALTER TABLE units ADD COLUMN name_abbrev VARCHAR(20) AFTER name");
|
||||
database->exec( "ALTER TABLE units ADD COLUMN plural_abbrev VARCHAR(20) AFTER plural");
|
||||
|
||||
database->exec("UPDATE db_info SET ver='0.92',generated_by='Krecipes SVN (20060609)'");
|
||||
if ( !database->commit() )
|
||||
kdDebug()<<"Update to 0.92 failed. Maybe you should try again."<<endl;
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 93 ) {
|
||||
database->transaction();
|
||||
|
||||
database->exec( "ALTER TABLE ingredient_list ADD COLUMN substitute_for INTEGER AFTER group_id");
|
||||
|
||||
database->exec("UPDATE db_info SET ver='0.93',generated_by='Krecipes SVN (20060615)'");
|
||||
if ( !database->commit() )
|
||||
kdDebug()<<"Update to 0.93 failed. Maybe you should try again."<<endl;
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 94 ) {
|
||||
database->transaction();
|
||||
|
||||
database->exec( "ALTER TABLE units ADD COLUMN type INTEGER NOT NULL DEFAULT 0 AFTER plural_abbrev");
|
||||
|
||||
database->exec("UPDATE db_info SET ver='0.94',generated_by='Krecipes SVN (20060712)'");
|
||||
if ( !database->commit() )
|
||||
kdDebug()<<"Update to 0.94 failed. Maybe you should try again."<<endl;
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 95 ) {
|
||||
database->exec( "DROP TABLE ingredient_weights" );
|
||||
createTable( "ingredient_weights" );
|
||||
database->exec( "UPDATE db_info SET ver='0.95',generated_by='Krecipes SVN (20060726)'" );
|
||||
}
|
||||
}
|
||||
|
||||
int MySQLRecipeDB::lastInsertID()
|
||||
{
|
||||
QSqlQuery lastInsertID( "SELECT LAST_INSERT_ID();", database );
|
||||
|
||||
int id = -1;
|
||||
if ( lastInsertID.isActive() && lastInsertID.next() )
|
||||
id = lastInsertID.value( 0 ).toInt();
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
void MySQLRecipeDB::givePermissions( const QString &dbName, const QString &username, const QString &password, const QString &clientHost )
|
||||
{
|
||||
QString command;
|
||||
|
||||
if ( !password.isEmpty() )
|
||||
command = QString( "GRANT ALL ON %1.* TO '%2'@'%3' IDENTIFIED BY '%4';" ).arg( dbName ).arg( username ).arg( clientHost ).arg( password );
|
||||
else
|
||||
command = QString( "GRANT ALL ON %1.* TO '%2'@'%3';" ).arg( dbName ).arg( username ).arg( clientHost );
|
||||
|
||||
kdDebug() << "I'm doing the query to setup permissions\n";
|
||||
|
||||
QSqlQuery permissionsToSet( command, database );
|
||||
}
|
||||
|
||||
#include "mysqlrecipedb.moc"
|
@ -0,0 +1,56 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2003 by *
|
||||
* Unai Garro (ugarro@users.sourceforge.net) *
|
||||
* Cyril Bosselut (bosselut@b1project.com) *
|
||||
* Jason Kivlighn (jkivlighn@gmail.com) *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef MYSQLRECIPEDB_H
|
||||
#define MYSQLRECIPEDB_H
|
||||
|
||||
#define MYSQL_DRIVER "QMYSQL3"
|
||||
|
||||
#include "qsqlrecipedb.h"
|
||||
|
||||
/**
|
||||
@author Unai Garro
|
||||
*/
|
||||
class MySQLRecipeDB : public QSqlRecipeDB
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
void createDB( void );
|
||||
|
||||
public:
|
||||
MySQLRecipeDB( const QString &host, const QString &user = QString::null, const QString &pass = QString::null, const QString &DBName = DEFAULT_DB_NAME, int port = 0 );
|
||||
~MySQLRecipeDB( void );
|
||||
|
||||
int lastInsertID();
|
||||
|
||||
void createTable( const QString &tableName );
|
||||
void givePermissions( const QString &dbName, const QString &username, const QString &password = QString::null, const QString &clientHost = "localhost" );
|
||||
|
||||
protected:
|
||||
QString qsqlDriverPlugin() const
|
||||
{
|
||||
return MYSQL_DRIVER;
|
||||
}
|
||||
|
||||
private:
|
||||
void portOldDatabases( float version );
|
||||
QStringList backupCommand() const;
|
||||
QStringList restoreCommand() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,17 @@
|
||||
## Makefile.am for krecipes
|
||||
|
||||
# this is the program that gets installed. it's name is used for all
|
||||
# of the other Makefile.am variables
|
||||
|
||||
# set the include path for X, qt and KDE
|
||||
INCLUDES = -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../.. $(all_includes)
|
||||
|
||||
|
||||
# Instructions for building the convenience library
|
||||
noinst_LTLIBRARIES=libkrecpsql.la
|
||||
libkrecpsql_la_SOURCES=psqlrecipedb.cpp
|
||||
libkrecpsql_la_METASOURCES=AUTO
|
||||
|
||||
|
||||
#the library search path.
|
||||
libkrecpsql_la_LDFLAGS = $(KDE_RPATH) $(all_libraries)
|
@ -0,0 +1,560 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2003 by *
|
||||
* Unai Garro (ugarro@users.sourceforge.net) *
|
||||
* Cyril Bosselut (bosselut@b1project.com) *
|
||||
* Jason Kivlighn (jkivlighn@gmail.com) *
|
||||
* *
|
||||
* Copyright (C) 2006 Jason Kivlighn (jkivlighn@gmail.com) *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "psqlrecipedb.h"
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <ktempfile.h>
|
||||
#include <klocale.h>
|
||||
#include <kconfig.h>
|
||||
|
||||
#include <qvariant.h>
|
||||
|
||||
//Note: PostgreSQL's database names are always lowercase
|
||||
PSqlRecipeDB::PSqlRecipeDB( const QString& host, const QString& user, const QString& pass, const QString& DBname, int port ) : QSqlRecipeDB( host, user, pass, DBname.lower(), port )
|
||||
{}
|
||||
|
||||
PSqlRecipeDB::~PSqlRecipeDB()
|
||||
{}
|
||||
|
||||
void PSqlRecipeDB::createDB()
|
||||
{
|
||||
QString real_db_name = database->databaseName();
|
||||
|
||||
//we have to be connected to some database in order to create the Krecipes database
|
||||
//so long as the permissions given are allowed access to "template1', this works
|
||||
database->setDatabaseName( "template1" );
|
||||
if ( database->open() ) {
|
||||
QSqlQuery query( QString( "CREATE DATABASE %1" ).arg( real_db_name ), database );
|
||||
if ( !query.isActive() )
|
||||
kdDebug() << "create query failed: " << database->lastError().databaseText() << endl;
|
||||
|
||||
database->close();
|
||||
}
|
||||
else
|
||||
kdDebug() << "create open failed: " << database->lastError().databaseText() << endl;
|
||||
|
||||
database->setDatabaseName( real_db_name );
|
||||
}
|
||||
|
||||
QStringList PSqlRecipeDB::backupCommand() const
|
||||
{
|
||||
KConfig *config = KGlobal::config();
|
||||
config->setGroup("Server");
|
||||
|
||||
QStringList command;
|
||||
command<<config->readEntry( "PgDumpPath", "pg_dump" )<<"-d"<<database->databaseName()
|
||||
<<"-U"<<config->readEntry( "Username" );
|
||||
|
||||
int port = config->readNumEntry( "Port", 0 );
|
||||
if ( port > 0 )
|
||||
command<<"-p"<<QString::number(port);
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
QStringList PSqlRecipeDB::restoreCommand() const
|
||||
{
|
||||
KConfig *config = KGlobal::config();
|
||||
config->setGroup("Server");
|
||||
|
||||
QStringList command;
|
||||
command<<config->readEntry( "PsqlPath", "psql" )<<database->databaseName()
|
||||
<<"-U"<<config->readEntry( "Username" );
|
||||
|
||||
int port = config->readNumEntry( "Port", 0 );
|
||||
if ( port > 0 )
|
||||
command<<"-p"<<QString::number(port);
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
void PSqlRecipeDB::createTable( const QString &tableName )
|
||||
{
|
||||
|
||||
QStringList commands;
|
||||
|
||||
if ( tableName == "recipes" )
|
||||
commands << "CREATE TABLE recipes (id SERIAL NOT NULL PRIMARY KEY,title CHARACTER VARYING, yield_amount FLOAT, yield_amount_offset FLOAT, yield_type_id INTEGER DEFAULT '-1', instructions TEXT, photo TEXT, prep_time TIME, ctime TIMESTAMP, mtime TIMESTAMP, atime TIMESTAMP );";
|
||||
|
||||
else if ( tableName == "ingredients" )
|
||||
commands << "CREATE TABLE ingredients (id SERIAL NOT NULL PRIMARY KEY, name CHARACTER VARYING);";
|
||||
|
||||
else if ( tableName == "ingredient_list" ) {
|
||||
commands << "CREATE TABLE ingredient_list (id SERIAL NOT NULL PRIMARY KEY, recipe_id INTEGER, ingredient_id INTEGER, amount FLOAT, amount_offset FLOAT, unit_id INTEGER, order_index INTEGER, group_id INTEGER, substitute_for INTEGER);";
|
||||
commands << "CREATE INDEX ridil_index ON ingredient_list USING BTREE (recipe_id);";
|
||||
commands << "CREATE INDEX iidil_index ON ingredient_list USING BTREE (ingredient_id);";
|
||||
commands << "CREATE INDEX gidil_index ON ingredient_list USING BTREE (group_id);";
|
||||
}
|
||||
|
||||
else if ( tableName == "unit_list" )
|
||||
commands << "CREATE TABLE unit_list (ingredient_id INTEGER, unit_id INTEGER);";
|
||||
|
||||
else if ( tableName == "units" )
|
||||
commands << "CREATE TABLE units (id SERIAL NOT NULL PRIMARY KEY, name CHARACTER VARYING, name_abbrev CHARACTER VARYING, plural CHARACTER VARYING, plural_abbrev CHARACTER VARYING, type INTEGER NOT NULL DEFAULT '0' );";
|
||||
|
||||
else if ( tableName == "prep_methods" )
|
||||
commands << "CREATE TABLE prep_methods (id SERIAL NOT NULL PRIMARY KEY, name CHARACTER VARYING);";
|
||||
else if ( tableName == "prep_method_list" ) {
|
||||
commands << "CREATE TABLE prep_method_list (ingredient_list_id INTEGER NOT NULL,prep_method_id INTEGER NOT NULL, order_index INTEGER);";
|
||||
commands << "CREATE INDEX iid_index ON prep_method_list USING BTREE (ingredient_list_id);";
|
||||
commands << "CREATE INDEX pid_index ON prep_method_list USING BTREE (prep_method_id);";
|
||||
}
|
||||
else if ( tableName == "ingredient_info" )
|
||||
commands << "CREATE TABLE ingredient_info (ingredient_id INTEGER, property_id INTEGER, amount FLOAT, per_units INTEGER);";
|
||||
|
||||
else if ( tableName == "ingredient_properties" )
|
||||
commands << "CREATE TABLE ingredient_properties (id SERIAL NOT NULL,name CHARACTER VARYING, units CHARACTER VARYING);";
|
||||
|
||||
else if ( tableName == "ingredient_weights" ) {
|
||||
commands << "CREATE TABLE ingredient_weights (id SERIAL NOT NULL PRIMARY KEY, ingredient_id INTEGER NOT NULL, amount FLOAT, unit_id INTEGER, weight FLOAT, weight_unit_id INTEGER, prep_method_id INTEGER );"
|
||||
<< "CREATE INDEX weight_wid_index ON ingredient_weights USING BTREE (weight_unit_id)"
|
||||
<< "CREATE INDEX weight_pid_index ON ingredient_weights USING BTREE (prep_method_id)"
|
||||
<< "CREATE INDEX weight_uid_index ON ingredient_weights USING BTREE (unit_id)"
|
||||
<< "CREATE INDEX weight_iid_index ON ingredient_weights USING BTREE (ingredient_id)";
|
||||
}
|
||||
|
||||
else if ( tableName == "units_conversion" )
|
||||
commands << "CREATE TABLE units_conversion (unit1_id INTEGER, unit2_id INTEGER, ratio FLOAT);";
|
||||
|
||||
else if ( tableName == "categories" ) {
|
||||
commands << "CREATE TABLE categories (id SERIAL NOT NULL PRIMARY KEY, name CHARACTER VARYING default NULL, parent_id INTEGER NOT NULL default -1);";
|
||||
commands << "CREATE index parent_id_index ON categories USING BTREE(parent_id);";
|
||||
}
|
||||
else if ( tableName == "category_list" ) {
|
||||
commands << "CREATE TABLE category_list (recipe_id INTEGER NOT NULL,category_id INTEGER NOT NULL);";
|
||||
commands << "CREATE INDEX rid_index ON category_list USING BTREE (recipe_id);";
|
||||
commands << "CREATE INDEX cid_index ON category_list USING BTREE (category_id);";
|
||||
}
|
||||
|
||||
else if ( tableName == "authors" )
|
||||
commands << "CREATE TABLE authors (id SERIAL NOT NULL PRIMARY KEY, name CHARACTER VARYING default NULL);";
|
||||
|
||||
else if ( tableName == "author_list" )
|
||||
commands << "CREATE TABLE author_list (recipe_id INTEGER NOT NULL,author_id INTEGER NOT NULL);";
|
||||
|
||||
else if ( tableName == "db_info" ) {
|
||||
commands << "CREATE TABLE db_info (ver FLOAT NOT NULL,generated_by CHARACTER VARYING default NULL);";
|
||||
commands << QString( "INSERT INTO db_info VALUES(%1,'Krecipes %2');" ).arg( latestDBVersion() ).arg( krecipes_version() );
|
||||
}
|
||||
else if ( tableName == "ingredient_groups" ) {
|
||||
commands << "CREATE TABLE ingredient_groups (id SERIAL NOT NULL PRIMARY KEY, name CHARACTER VARYING);";
|
||||
}
|
||||
else if ( tableName == "yield_types" ) {
|
||||
commands << "CREATE TABLE yield_types (id SERIAL NOT NULL PRIMARY KEY, name CHARACTER VARYING);";
|
||||
}
|
||||
|
||||
else if ( tableName == "ratings" )
|
||||
commands << "CREATE TABLE ratings (id SERIAL NOT NULL PRIMARY KEY, recipe_id INTEGER NOT NULL, comment CHARACTER VARYING, rater CHARACTER VARYING, created TIMESTAMP);";
|
||||
|
||||
else if ( tableName == "rating_criteria" )
|
||||
commands << "CREATE TABLE rating_criteria (id SERIAL NOT NULL PRIMARY KEY, name CHARACTER VARYING);";
|
||||
|
||||
else if ( tableName == "rating_criterion_list" )
|
||||
commands << "CREATE TABLE rating_criterion_list (rating_id INTEGER NOT NULL, rating_criterion_id INTEGER, stars FLOAT);";
|
||||
else
|
||||
return ;
|
||||
|
||||
QSqlQuery databaseToCreate( QString::null, database );
|
||||
|
||||
// execute the queries
|
||||
for ( QStringList::const_iterator it = commands.begin(); it != commands.end(); ++it )
|
||||
databaseToCreate.exec( *it );
|
||||
}
|
||||
|
||||
void PSqlRecipeDB::initializeData()
|
||||
{
|
||||
QSqlRecipeDB::initializeData();
|
||||
|
||||
QSqlQuery updateSeq( "SELECT setval('units_id_seq',(SELECT COUNT(1) FROM units))", database );
|
||||
updateSeq.exec( "SELECT setval('categories_id_seq',(SELECT COUNT(1) FROM categories))" );
|
||||
}
|
||||
|
||||
void PSqlRecipeDB::portOldDatabases( float version )
|
||||
{
|
||||
kdDebug() << "Current database version is..." << version << "\n";
|
||||
QString command;
|
||||
|
||||
if ( qRound(version*10) < 7 ) {
|
||||
//version added
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 81 ) {
|
||||
database->transaction();
|
||||
|
||||
addColumn("CREATE TABLE %1 (recipe_id INTEGER, ingredient_id INTEGER, amount FLOAT, %2 unit_id INTEGER, prep_method_id INTEGER, order_index INTEGER, group_id INTEGER);","amount_offset FLOAT","'0'","ingredient_list",3);
|
||||
|
||||
QSqlQuery query(QString::null,database);
|
||||
query.exec( "CREATE INDEX ridil_index ON ingredient_list USING BTREE (recipe_id);" );
|
||||
query.exec( "CREATE INDEX iidil_index ON ingredient_list USING BTREE (ingredient_id);");
|
||||
|
||||
query.exec( "UPDATE db_info SET ver='0.81',generated_by='Krecipes SVN (20050816)';" );
|
||||
|
||||
if ( !database->commit() )
|
||||
kdDebug()<<"Update to 0.81 failed. Maybe you should try again."<<endl;
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 82 ) {
|
||||
database->transaction();
|
||||
|
||||
//==================add a columns to 'recipes' to allow yield range + yield type
|
||||
database->exec( "CREATE TABLE recipes_copy (id SERIAL NOT NULL PRIMARY KEY,title CHARACTER VARYING, persons INTEGER, instructions TEXT, photo TEXT, prep_time TIME);" );
|
||||
QSqlQuery copyQuery = database->exec( "SELECT id,title,persons,instructions,photo,prep_time FROM recipes;" );
|
||||
if ( copyQuery.isActive() ) {
|
||||
while ( copyQuery.next() ) {
|
||||
QSqlQuery query(QString::null,database);
|
||||
query.prepare( "INSERT INTO recipes_copy VALUES (?, ?, ?, ?, ?, ?)" );
|
||||
query.addBindValue( copyQuery.value( 0 ) );
|
||||
query.addBindValue( copyQuery.value( 1 ) );
|
||||
query.addBindValue( copyQuery.value( 2 ) );
|
||||
query.addBindValue( copyQuery.value( 3 ) );
|
||||
query.addBindValue( copyQuery.value( 4 ) );
|
||||
query.addBindValue( copyQuery.value( 5 ) );
|
||||
query.exec();
|
||||
|
||||
emit progress();
|
||||
}
|
||||
}
|
||||
database->exec( "DROP TABLE recipes" );
|
||||
database->exec( "CREATE TABLE recipes (id SERIAL NOT NULL PRIMARY KEY,title CHARACTER VARYING, yield_amount FLOAT, yield_amount_offset FLOAT, yield_type_id INTEGER DEFAULT '-1', instructions TEXT, photo TEXT, prep_time TIME);" );
|
||||
copyQuery = database->exec( "SELECT id,title,persons,instructions,photo,prep_time FROM recipes_copy" );
|
||||
if ( copyQuery.isActive() ) {
|
||||
while ( copyQuery.next() ) {
|
||||
QSqlQuery query(QString::null,database);
|
||||
query.prepare( "INSERT INTO recipes VALUES (?, ?, ?, ?, ?, ?, ?, ?)" );
|
||||
query.addBindValue( copyQuery.value( 0 ) ); //id
|
||||
query.addBindValue( copyQuery.value( 1 ) ); //title
|
||||
query.addBindValue( copyQuery.value( 2 ) ); //persons, now yield_amount
|
||||
query.addBindValue( 0 ); //yield_amount_offset
|
||||
query.addBindValue( -1 ); //yield_type_id
|
||||
query.addBindValue( copyQuery.value( 3 ) ); //instructions
|
||||
query.addBindValue( copyQuery.value( 4 ) ); //photo
|
||||
query.addBindValue( copyQuery.value( 5 ) ); //prep_time
|
||||
query.exec();
|
||||
|
||||
emit progress();
|
||||
}
|
||||
}
|
||||
database->exec( "DROP TABLE recipes_copy" );
|
||||
|
||||
database->exec( "UPDATE db_info SET ver='0.82',generated_by='Krecipes SVN (20050902)';" );
|
||||
|
||||
if ( !database->commit() )
|
||||
kdDebug()<<"Update to 0.82 failed. Maybe you should try again."<<endl;
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 83 ) {
|
||||
database->transaction();
|
||||
|
||||
//====add a id columns to 'ingredient_list' to identify it for the prep method list
|
||||
database->exec( "ALTER TABLE ingredient_list RENAME TO ingredient_list_copy;" );
|
||||
|
||||
database->exec( "CREATE TABLE ingredient_list (id SERIAL NOT NULL PRIMARY KEY, recipe_id INTEGER, ingredient_id INTEGER, amount FLOAT, amount_offset FLOAT, unit_id INTEGER, order_index INTEGER, group_id INTEGER);" );
|
||||
|
||||
QSqlQuery copyQuery = database->exec( "SELECT recipe_id,ingredient_id,amount,amount_offset,unit_id,prep_method_id,order_index,group_id FROM ingredient_list_copy" );
|
||||
if ( copyQuery.isActive() ) {
|
||||
while ( copyQuery.next() ) {
|
||||
int ing_list_id = getNextInsertID("ingredient_list","id");
|
||||
|
||||
QSqlQuery query(QString::null,database);
|
||||
query.prepare( "INSERT INTO ingredient_list VALUES (?, ?, ?, ?, ?, ?, ?, ?)" );
|
||||
query.addBindValue( ing_list_id );
|
||||
query.addBindValue( copyQuery.value( 0 ) );
|
||||
query.addBindValue( copyQuery.value( 1 ) );
|
||||
query.addBindValue( copyQuery.value( 2 ) );
|
||||
query.addBindValue( copyQuery.value( 3 ) );
|
||||
query.addBindValue( copyQuery.value( 4 ) );
|
||||
query.addBindValue( copyQuery.value( 6 ) );
|
||||
query.addBindValue( copyQuery.value( 7 ) );
|
||||
query.exec();
|
||||
|
||||
int prep_method_id = copyQuery.value( 5 ).toInt();
|
||||
if ( prep_method_id != -1 ) {
|
||||
query.prepare( "INSERT INTO prep_method_list VALUES (?, ?, ?);" );
|
||||
query.addBindValue( ing_list_id );
|
||||
query.addBindValue( prep_method_id );
|
||||
query.addBindValue( 1 );
|
||||
query.exec();
|
||||
}
|
||||
|
||||
emit progress();
|
||||
}
|
||||
}
|
||||
database->exec( "DROP TABLE ingredient_list_copy" );
|
||||
|
||||
database->exec( "CREATE INDEX ridil_index ON ingredient_list USING BTREE (recipe_id);" );
|
||||
database->exec( "CREATE INDEX iidil_index ON ingredient_list USING BTREE (ingredient_id);" );
|
||||
|
||||
database->exec( "UPDATE db_info SET ver='0.83',generated_by='Krecipes SVN (20050909)';" );
|
||||
|
||||
if ( !database->commit() ) {
|
||||
kdDebug()<<"Update to 0.83 failed. Maybe you should try again."<<endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 84 ) {
|
||||
database->transaction();
|
||||
|
||||
database->exec( "ALTER TABLE recipes ADD COLUMN ctime TIMESTAMP" );
|
||||
database->exec( "ALTER TABLE recipes ADD COLUMN mtime TIMESTAMP" );
|
||||
database->exec( "ALTER TABLE recipes ADD COLUMN atime TIMESTAMP" );
|
||||
|
||||
database->exec( "UPDATE recipes SET ctime=CURRENT_TIMESTAMP, mtime=CURRENT_TIMESTAMP, atime=CURRENT_TIMESTAMP;" );
|
||||
|
||||
database->exec( "UPDATE db_info SET ver='0.84',generated_by='Krecipes SVN (20050913)';" );
|
||||
|
||||
if ( !database->commit() ) {
|
||||
kdDebug()<<"Update to 0.84 failed. Maybe you should try again."<<endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 85 ) { //this change altered the photo format, but this backend already used the newer format
|
||||
database->transaction();
|
||||
|
||||
database->exec( "UPDATE db_info SET ver='0.85',generated_by='Krecipes SVN (20050926)';" );
|
||||
|
||||
if ( !database->commit() ) {
|
||||
kdDebug()<<"Update to 0.85 failed. Maybe you should try again."<<endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 86 ) {
|
||||
database->transaction();
|
||||
|
||||
database->exec( "CREATE INDEX gidil_index ON ingredient_list USING BTREE (group_id);" );
|
||||
|
||||
QSqlQuery query( "SELECT id,name FROM ingredient_groups ORDER BY name", database );
|
||||
|
||||
QString last;
|
||||
int lastID;
|
||||
if ( query.isActive() ) {
|
||||
while ( query.next() ) {
|
||||
QString name = query.value(1).toString();
|
||||
int id = query.value(0).toInt();
|
||||
if ( last == name ) {
|
||||
QString command = QString("UPDATE ingredient_list SET group_id=%1 WHERE group_id=%2").arg(lastID).arg(id);
|
||||
database->exec(command);
|
||||
|
||||
command = QString("DELETE FROM ingredient_groups WHERE id=%1").arg(id);
|
||||
database->exec(command);
|
||||
}
|
||||
last = name;
|
||||
lastID = id;
|
||||
|
||||
emit progress();
|
||||
}
|
||||
}
|
||||
|
||||
database->exec( "UPDATE db_info SET ver='0.86',generated_by='Krecipes SVN (20050928)';" );
|
||||
if ( !database->commit() )
|
||||
kdDebug()<<"Update to 0.86 failed. Maybe you should try again."<<endl;
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 87 ) {
|
||||
//Load this default data so the user knows what rating criteria is
|
||||
database->exec( QString("INSERT INTO rating_criteria VALUES (1,'%1')").arg(i18n("Overall")) );
|
||||
database->exec( QString("INSERT INTO rating_criteria VALUES (2,'%1')").arg(i18n("Taste") ) );
|
||||
database->exec( QString("INSERT INTO rating_criteria VALUES (3,'%1')").arg(i18n("Appearance") ) );
|
||||
database->exec( QString("INSERT INTO rating_criteria VALUES (4,'%1')").arg(i18n("Originality") ) );
|
||||
database->exec( QString("INSERT INTO rating_criteria VALUES (5,'%1')").arg(i18n("Ease of Preparation") ) );
|
||||
|
||||
database->exec( "UPDATE db_info SET ver='0.87',generated_by='Krecipes SVN (20051014)'" );
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 90 ) {
|
||||
database->exec("UPDATE db_info SET ver='0.9',generated_by='Krecipes 0.9'");
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 91 ) {
|
||||
database->exec("CREATE index parent_id_index ON categories USING BTREE(parent_id)");
|
||||
database->exec("UPDATE db_info SET ver='0.91',generated_by='Krecipes SVN (20060526)'");
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 92 ) {
|
||||
database->transaction();
|
||||
|
||||
//==================add a columns to 'units' to allow unit abbreviations
|
||||
database->exec( "ALTER TABLE units RENAME TO units_copy" );
|
||||
|
||||
int nextval = -1;
|
||||
QSqlQuery getID( "SELECT nextval('units_id_seq')", database );
|
||||
if ( getID.isActive() && getID.first() )
|
||||
nextval = getID.value( 0 ).toInt();
|
||||
if ( nextval == -1 )
|
||||
kdDebug() << "Database update failed! Unable to update units sequence." << endl;
|
||||
|
||||
database->exec( "CREATE TABLE units (id SERIAL NOT NULL PRIMARY KEY, name CHARACTER VARYING, name_abbrev CHARACTER VARYING, plural CHARACTER VARYING, plural_abbrev CHARACTER VARYING )" );
|
||||
QSqlQuery copyQuery = database->exec( "SELECT id,name,plural FROM units_copy" );
|
||||
if ( copyQuery.isActive() ) {
|
||||
while ( copyQuery.next() ) {
|
||||
QSqlQuery query(QString::null,database);
|
||||
query.prepare( "INSERT INTO units VALUES(?, ?, ?, ?, ?)" );
|
||||
query.addBindValue( copyQuery.value( 0 ) );
|
||||
query.addBindValue( copyQuery.value( 1 ) );
|
||||
query.addBindValue( QVariant() );
|
||||
query.addBindValue( copyQuery.value( 2 ) );
|
||||
query.addBindValue( QVariant() );
|
||||
query.exec();
|
||||
|
||||
emit progress();
|
||||
}
|
||||
}
|
||||
database->exec( "DROP TABLE units_copy" );
|
||||
|
||||
database->exec( "ALTER TABLE units_id_seq1 RENAME TO units_id_seq" );
|
||||
database->exec( "ALTER SEQUENCE units_id_seq RESTART WITH "+QString::number(nextval) );
|
||||
|
||||
database->exec("UPDATE db_info SET ver='0.92',generated_by='Krecipes SVN (20060609)'");
|
||||
if ( !database->commit() )
|
||||
kdDebug()<<"Update to 0.92 failed. Maybe you should try again."<<endl;
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 93 ) {
|
||||
database->transaction();
|
||||
|
||||
database->exec( "ALTER TABLE ingredient_list ADD COLUMN substitute_for INTEGER" );
|
||||
|
||||
database->exec("UPDATE db_info SET ver='0.93',generated_by='Krecipes SVN (20060616)'");
|
||||
if ( !database->commit() )
|
||||
kdDebug()<<"Update to 0.93 failed. Maybe you should try again."<<endl;
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 94 ) {
|
||||
database->transaction();
|
||||
|
||||
database->exec( "ALTER TABLE units ADD COLUMN type INTEGER NOT NULL DEFAULT '0'" );
|
||||
|
||||
database->exec("UPDATE db_info SET ver='0.94',generated_by='Krecipes SVN (20060712)'");
|
||||
if ( !database->commit() )
|
||||
kdDebug()<<"Update to 0.94 failed. Maybe you should try again."<<endl;
|
||||
}
|
||||
|
||||
if ( qRound(version*100) < 95 ) {
|
||||
database->exec( "DROP TABLE ingredient_weights" );
|
||||
createTable( "ingredient_weights" );
|
||||
database->exec( "UPDATE db_info SET ver='0.95',generated_by='Krecipes SVN (20060726)'" );
|
||||
}
|
||||
}
|
||||
|
||||
void PSqlRecipeDB::addColumn( const QString &new_table_sql, const QString &new_col_info, const QString &default_value, const QString &table_name, int col_index )
|
||||
{
|
||||
QString command;
|
||||
|
||||
command = QString(new_table_sql).arg(table_name+"_copy").arg(QString::null);
|
||||
kdDebug()<<"calling: "<<command<<endl;
|
||||
QSqlQuery query( command, database );
|
||||
|
||||
command = "SELECT * FROM "+table_name+";";
|
||||
query.exec( command );
|
||||
if ( query.isActive() ) {
|
||||
while ( query.next() ) {
|
||||
QStringList dataList;
|
||||
for ( int i = 0 ;; ++i ) {
|
||||
QVariant variant = query.value(i);
|
||||
if ( variant.type() == QVariant::Invalid ) break;
|
||||
|
||||
dataList << "'"+variant.toString()+"'";
|
||||
}
|
||||
command = "INSERT INTO "+table_name+"_copy VALUES("+dataList.join(",")+");";
|
||||
kdDebug()<<"calling: "<<command<<endl;
|
||||
QSqlQuery insert_query( command, database );
|
||||
|
||||
emit progress();
|
||||
}
|
||||
}
|
||||
query.exec( "DROP TABLE "+table_name+";" );
|
||||
query.exec( QString(new_table_sql).arg(table_name).arg(new_col_info+",") );
|
||||
query.exec( "SELECT * FROM "+table_name+"_copy;" );
|
||||
if ( query.isActive() ) {
|
||||
while ( query.next() ) {
|
||||
QStringList dataList;
|
||||
for ( int i = 0 ;; ++i ) {
|
||||
if ( i == col_index )
|
||||
dataList << default_value;
|
||||
|
||||
QVariant variant = query.value(i);
|
||||
if ( variant.type() == QVariant::Invalid ) break;
|
||||
|
||||
dataList << "'"+variant.toString()+"'";
|
||||
}
|
||||
command = "INSERT INTO "+table_name+" VALUES(" +dataList.join(",")+");";
|
||||
QSqlQuery insert_query( command, database );
|
||||
kdDebug()<<"calling: "<<command<<endl;
|
||||
|
||||
emit progress();
|
||||
}
|
||||
}
|
||||
query.exec( "DROP TABLE "+table_name+"_copy;" );
|
||||
}
|
||||
|
||||
int PSqlRecipeDB::lastInsertID()
|
||||
{
|
||||
return last_insert_id;
|
||||
}
|
||||
|
||||
int PSqlRecipeDB::getNextInsertID( const QString &table, const QString &column )
|
||||
{
|
||||
QString command = QString( "SELECT nextval('%1_%2_seq');" ).arg( table ).arg( column );
|
||||
QSqlQuery getID( command, database );
|
||||
|
||||
if ( getID.isActive() && getID.first() ) {
|
||||
last_insert_id = getID.value( 0 ).toInt();
|
||||
}
|
||||
else
|
||||
last_insert_id = -1;
|
||||
|
||||
return last_insert_id;
|
||||
}
|
||||
|
||||
void PSqlRecipeDB::givePermissions( const QString & /*dbName*/, const QString &username, const QString &password, const QString & /*clientHost*/ )
|
||||
{
|
||||
QStringList tables;
|
||||
tables << "ingredient_info" << "ingredient_list" << "ingredient_properties" << "ingredients" << "recipes" << "unit_list" << "units" << "units_conversion" << "categories" << "category_list" << "authors" << "author_list" << "prep_methods" << "db_info" << "ingredient_groups" << "ingredient_weights" << "prep_method_list" << "yield_types" << "ratings" << "rating_criteria" << "rating_criterion_list";
|
||||
|
||||
//we also have to grant permissions on the sequences created
|
||||
tables << "authors_id_seq" << "categories_id_seq" << "ingredient_properties_id_seq" << "ingredient_weights_id_seq" << "ingredients_id_seq" << "prep_methods_id_seq" << "recipes_id_seq" << "units_id_seq" << "ingredient_groups_id_seq" << "yield_types_id_seq" << "ingredient_list_id_seq" << "ratings_id_seq" << "rating_criteria_id_seq";
|
||||
|
||||
QString command;
|
||||
|
||||
kdDebug() << "I'm doing the query to create the new user" << endl;
|
||||
command = "CREATE USER " + username;
|
||||
if ( !password.isEmpty() )
|
||||
command.append( "WITH PASSWORD '" + password + "'" );
|
||||
command.append( ";" );
|
||||
QSqlQuery permissionsToSet( command, database );
|
||||
|
||||
kdDebug() << "I'm doing the query to setup permissions\n";
|
||||
command = QString( "GRANT ALL ON %1 TO %2;" ).arg( tables.join( "," ) ).arg( username );
|
||||
permissionsToSet.exec( command );
|
||||
}
|
||||
|
||||
void PSqlRecipeDB::empty( void )
|
||||
{
|
||||
QSqlRecipeDB::empty();
|
||||
|
||||
QStringList tables;
|
||||
tables << "authors_id_seq" << "categories_id_seq" << "ingredient_properties_id_seq" << "ingredient_weights_id_seq" << "ingredients_id_seq" << "prep_methods_id_seq" << "recipes_id_seq" << "units_id_seq" << "ingredient_groups_id_seq" << "yield_types_id_seq" << "ingredient_list_id_seq" << "prep_method_list_id_seq" << "ratings_id_seq" << "rating_criteria_id_seq";
|
||||
|
||||
QSqlQuery tablesToEmpty( QString::null, database );
|
||||
for ( QStringList::Iterator it = tables.begin(); it != tables.end(); ++it ) {
|
||||
QString command = QString( "DELETE FROM %1;" ).arg( *it );
|
||||
tablesToEmpty.exec( command );
|
||||
}
|
||||
}
|
||||
|
||||
#include "psqlrecipedb.moc"
|
@ -0,0 +1,64 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2003 by *
|
||||
* Unai Garro (ugarro@users.sourceforge.net) *
|
||||
* Cyril Bosselut (bosselut@b1project.com) *
|
||||
* Jason Kivlighn (jkivlighn@gmail.com) *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef PSQLRECIPEDB_H
|
||||
#define PSQLRECIPEDB_H
|
||||
|
||||
#define PSQL_DRIVER "QPSQL7"
|
||||
|
||||
#include "qsqlrecipedb.h"
|
||||
|
||||
/**
|
||||
@author Jason Kivlighn
|
||||
*/
|
||||
class PSqlRecipeDB : public QSqlRecipeDB
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
void createDB( void );
|
||||
|
||||
public:
|
||||
PSqlRecipeDB( const QString& host, const QString& user = QString::null, const QString& pass = QString::null, const QString& DBName = DEFAULT_DB_NAME, int port = 0 );
|
||||
~PSqlRecipeDB( void );
|
||||
|
||||
int lastInsertID();
|
||||
void initializeData();
|
||||
|
||||
void createTable( const QString &tableName );
|
||||
void givePermissions( const QString &dbName, const QString &username, const QString &password, const QString &clientHost );
|
||||
|
||||
protected:
|
||||
virtual QString qsqlDriverPlugin() const
|
||||
{
|
||||
return PSQL_DRIVER;
|
||||
}
|
||||
virtual int getNextInsertID( const QString &table, const QString &column );
|
||||
|
||||
virtual void empty( void );
|
||||
|
||||
private:
|
||||
void portOldDatabases( float version );
|
||||
QStringList backupCommand() const;
|
||||
QStringList restoreCommand() const;
|
||||
|
||||
void addColumn( const QString &new_table_sql, const QString &new_col_info, const QString &default_value, const QString &table_name, int col_index );
|
||||
|
||||
int last_insert_id;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,19 @@
|
||||
## Makefile.am for krecipes
|
||||
|
||||
# this is the program that gets installed. it's name is used for all
|
||||
# of the other Makefile.am variables
|
||||
|
||||
# set the include path for X, qt and KDE
|
||||
INCLUDES = -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../.. $(all_includes)
|
||||
|
||||
SUBDIRS = libqsqlite
|
||||
|
||||
# Instructions for building the convenience library
|
||||
noinst_LTLIBRARIES=libkrecsqlite.la
|
||||
libkrecsqlite_la_SOURCES=literecipedb.cpp qsql_sqlite.cpp
|
||||
libkrecsqlite_la_METASOURCES=AUTO
|
||||
|
||||
libkrecsqlite_la_LIBADD=libqsqlite/libkrecqsqlite.la
|
||||
|
||||
#the library search path.
|
||||
libkrecsqlite_la_LDFLAGS = $(KDE_RPATH) $(all_libraries)
|
@ -0,0 +1,17 @@
|
||||
## Makefile.am for krecipes
|
||||
|
||||
# this is the program that gets installed. it's name is used for all
|
||||
# of the other Makefile.am variables
|
||||
|
||||
# set the include path for X, qt and KDE
|
||||
INCLUDES = $(all_includes)
|
||||
|
||||
#building the library
|
||||
|
||||
noinst_LTLIBRARIES=libkrecqsqlite.la
|
||||
libkrecqsqlite_la_SOURCES=krecqsqlitedb.cpp krecqsqliteresult.cpp
|
||||
libkrecqsqlite_la_METASOURCES=AUTO
|
||||
|
||||
#the library search path.
|
||||
libkrecqsqlite_la_LDFLAGS = $(KDE_RPATH) $(all_libraries)
|
||||
|
@ -0,0 +1,171 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2003 *
|
||||
* by Unai Garro (ugarro@users.sourceforge.net) *
|
||||
* Martin Imobersteg <imm@gmx.ch> *
|
||||
* and opie project *
|
||||
* *
|
||||
* *
|
||||
* This code was originally developed by the opie project, on which *
|
||||
* Martin Imobersteg based his work. *
|
||||
* This file is adds a small extension, necessary to perform some minimum *
|
||||
* SQL actions *
|
||||
* *
|
||||
* (this project is different from that in qsqlite.sf.net) *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "krecqsqlitedb.h"
|
||||
#include "krecqsqliteresult.h"
|
||||
|
||||
#include <qvaluelist.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#if HAVE_SQLITE
|
||||
#include <sqlite.h>
|
||||
#elif HAVE_SQLITE3
|
||||
#include <sqlite3.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
QSQLiteDB::QSQLiteDB( QObject *, const char * )
|
||||
{}
|
||||
|
||||
bool QSQLiteDB::open( const QString &dbname )
|
||||
{
|
||||
char * errmsg = 0;
|
||||
|
||||
#if HAVE_SQLITE
|
||||
|
||||
m_db = sqlite_open( dbname.latin1(), 0, &errmsg );
|
||||
#elif HAVE_SQLITE3
|
||||
|
||||
int res = sqlite3_open( dbname.latin1(), &m_db );
|
||||
|
||||
if ( res != SQLITE_OK )
|
||||
return false;
|
||||
#endif
|
||||
|
||||
if ( m_db == 0L ) {
|
||||
#if HAVE_SQLITE
|
||||
sqlite_freemem( errmsg );
|
||||
#elif HAVE_SQLITE3
|
||||
sqlite3_free( errmsg );
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
int func_res;
|
||||
#if HAVE_SQLITE
|
||||
func_res = sqlite_create_function(m_db,"lastInsertID",0,&lastInsertID,m_db );
|
||||
#elif HAVE_SQLITE3
|
||||
func_res = sqlite3_create_function(m_db,"lastInsertID",0,SQLITE_ANY,m_db,
|
||||
&lastInsertID, 0, 0 );
|
||||
#endif
|
||||
|
||||
return func_res == 0;
|
||||
}
|
||||
|
||||
void QSQLiteDB::close()
|
||||
{
|
||||
if ( m_db ) {
|
||||
#if HAVE_SQLITE
|
||||
sqlite_close( m_db );
|
||||
#elif HAVE_SQLITE3
|
||||
|
||||
sqlite3_close( m_db );
|
||||
#endif
|
||||
|
||||
m_db = 0L;
|
||||
}
|
||||
}
|
||||
|
||||
QSQLiteResult QSQLiteDB::executeQuery( const QString &query, int *lastID )
|
||||
{
|
||||
QSQLiteResult res;
|
||||
if ( !m_db ) {
|
||||
return res;
|
||||
}
|
||||
|
||||
char *errmsg = 0;
|
||||
#if HAVE_SQLITE
|
||||
|
||||
if ( sqlite_exec( m_db, query.latin1(), &call_back, &res, &errmsg ) > 0 )
|
||||
#elif HAVE_SQLITE3
|
||||
|
||||
if ( sqlite3_exec( m_db, query.latin1(), &call_back, &res, &errmsg ) > 0 )
|
||||
#endif
|
||||
|
||||
{
|
||||
kdDebug() << "SQLite error: " << errmsg << endl <<
|
||||
"\t (Query: " << query << ")" << endl;
|
||||
res.setError( errmsg );
|
||||
res.setStatus( QSQLiteResult::Failure );
|
||||
#if HAVE_SQLITE
|
||||
sqlite_freemem( errmsg );
|
||||
#elif HAVE_SQLITE3
|
||||
sqlite3_free( errmsg );
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( lastID ) {
|
||||
#if HAVE_SQLITE
|
||||
* lastID = sqlite_last_insert_rowid( m_db );
|
||||
#elif HAVE_SQLITE3
|
||||
|
||||
*lastID = sqlite3_last_insert_rowid( m_db );
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
res.setStatus( QSQLiteResult::Success );
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int QSQLiteDB::call_back( void* result, int argc, char** argv, char** columns )
|
||||
{
|
||||
QSQLiteResult * res = ( QSQLiteResult* ) result;
|
||||
|
||||
QMap<QString, QCString> tableString;
|
||||
QMap<int, QCString> tableInt;
|
||||
|
||||
for ( int i = 0; i < argc; i++ ) {
|
||||
tableInt.insert( i, argv[ i ] );
|
||||
tableString.insert( columns[ i ],
|
||||
argv[ i ] );
|
||||
}
|
||||
|
||||
QSQLiteResultRow row( tableString, tableInt );
|
||||
res->addRow( row );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if HAVE_SQLITE
|
||||
void QSQLiteDB::lastInsertID(sqlite_func *context,int argc,const char**)
|
||||
{
|
||||
Q_ASSERT( argc==0 );
|
||||
|
||||
void *db = sqlite_user_data(context);
|
||||
sqlite_set_result_int(context, sqlite_last_insert_rowid( (sqlite*)db ) );
|
||||
}
|
||||
#elif HAVE_SQLITE3
|
||||
void QSQLiteDB::lastInsertID( sqlite3_context *context, int argc, sqlite3_value ** )
|
||||
{
|
||||
Q_ASSERT( argc==0 );
|
||||
|
||||
void *db = sqlite3_user_data(context);
|
||||
sqlite3_result_int(context, sqlite3_last_insert_rowid( (sqlite3*)db ) );
|
||||
}
|
||||
#endif
|
||||
|
@ -0,0 +1,59 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2003 *
|
||||
* by Unai Garro (ugarro@users.sourceforge.net) *
|
||||
* Martin Imobersteg <imm@gmx.ch> *
|
||||
* and opie project *
|
||||
* *
|
||||
* *
|
||||
* This code was originally developed by the opie project, on which *
|
||||
* Martin Imobersteg based his work. *
|
||||
* This file is adds a small extension, necessary to perform some minimum *
|
||||
* SQL actions *
|
||||
* *
|
||||
* (this project is different from that in qsqlite.sf.net) *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef QSQLITEDB_H
|
||||
#define QSQLITEDB_H
|
||||
|
||||
#include <qvaluelist.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qobject.h>
|
||||
|
||||
#include "config.h"
|
||||
#if HAVE_SQLITE
|
||||
#include <sqlite.h>
|
||||
#elif HAVE_SQLITE3
|
||||
#include <sqlite3.h>
|
||||
#endif
|
||||
|
||||
#include "krecqsqliteresult.h"
|
||||
|
||||
|
||||
class QSQLiteDB
|
||||
{
|
||||
public:
|
||||
QSQLiteDB( QObject *parent = 0, const char *name = 0 );
|
||||
bool open( const QString &dbname );
|
||||
void close();
|
||||
QSQLiteResult executeQuery( const QString &query, int *lastID = 0 );
|
||||
int size(); //Returns the number of rows returned
|
||||
|
||||
private:
|
||||
static int call_back( void* res, int argc, char** argv, char** columns );
|
||||
|
||||
#if HAVE_SQLITE
|
||||
static void lastInsertID(sqlite_func*,int,const char**);
|
||||
sqlite *m_db;
|
||||
#elif HAVE_SQLITE3
|
||||
static void lastInsertID(sqlite3_context *context, int argc, sqlite3_value **argv);
|
||||
sqlite3 *m_db;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,197 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2003 *
|
||||
* by Unai Garro (ugarro@users.sourceforge.net) *
|
||||
* Martin Imobersteg <imm@gmx.ch> *
|
||||
* and opie project *
|
||||
* *
|
||||
* *
|
||||
* This code was originally developed by the opie project, on which *
|
||||
* Martin Imobersteg based his work. *
|
||||
* This file is adds a small extension, necessary to perform some minimum *
|
||||
* SQL actions *
|
||||
* *
|
||||
* (this project is different from that in qsqlite.sf.net) *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "krecqsqliteresult.h"
|
||||
|
||||
QSQLiteResultRow::QSQLiteResultRow( const TableString& string, const TableInt& Int )
|
||||
: m_string( string ), m_int( Int )
|
||||
{}
|
||||
|
||||
QSQLiteResultRow::~QSQLiteResultRow()
|
||||
{}
|
||||
|
||||
QSQLiteResultRow::QSQLiteResultRow( const QSQLiteResultRow& item )
|
||||
{
|
||||
*this = item;
|
||||
}
|
||||
|
||||
QSQLiteResultRow &QSQLiteResultRow::operator=( const QSQLiteResultRow& other )
|
||||
{
|
||||
m_string = other.m_string;
|
||||
m_int = other.m_int;
|
||||
return *this;
|
||||
}
|
||||
|
||||
QSQLiteResultRow::TableString QSQLiteResultRow::tableString() const
|
||||
{
|
||||
return m_string;
|
||||
}
|
||||
|
||||
QSQLiteResultRow::TableInt QSQLiteResultRow::tableInt() const
|
||||
{
|
||||
return m_int;
|
||||
}
|
||||
|
||||
QCString QSQLiteResultRow::data( const QString& columnName, bool *ok )
|
||||
{
|
||||
TableString::Iterator it = m_string.find( columnName );
|
||||
|
||||
/* if found */
|
||||
if ( it != m_string.end() ) {
|
||||
if ( ok )
|
||||
* ok = true;
|
||||
return it.data();
|
||||
}
|
||||
else {
|
||||
if ( ok )
|
||||
* ok = false;
|
||||
return QCString(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QCString QSQLiteResultRow::data( int column, bool *ok )
|
||||
{
|
||||
TableInt::Iterator it = m_int.find( column );
|
||||
|
||||
// if found
|
||||
if ( it != m_int.end() ) {
|
||||
if ( ok )
|
||||
* ok = true;
|
||||
return it.data();
|
||||
}
|
||||
else {
|
||||
if ( ok )
|
||||
* ok = false;
|
||||
return QCString(0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* DateFormat is 'YYYY-MM-DD'
|
||||
*/
|
||||
QDate QSQLiteResultRow::dataToDate( const QString& column, bool *ok )
|
||||
{
|
||||
QDate date = QDate::currentDate();
|
||||
QString str = data( column, ok );
|
||||
if ( !str.isEmpty() ) {
|
||||
; // convert
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
QDate QSQLiteResultRow::dataToDate( int column, bool *ok )
|
||||
{
|
||||
QDate date = QDate::currentDate();
|
||||
QString str = data( column, ok );
|
||||
if ( !str.isEmpty() ) {
|
||||
; // convert
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
QDateTime QSQLiteResultRow::dataToDateTime( const QString& column )
|
||||
{
|
||||
QDateTime time = QDateTime::currentDateTime();
|
||||
return time;
|
||||
}
|
||||
|
||||
QDateTime QSQLiteResultRow::dataToDateTime( int column )
|
||||
{
|
||||
QDateTime time = QDateTime::currentDateTime();
|
||||
return time;
|
||||
}
|
||||
|
||||
QSQLiteResult::QSQLiteResult( enum Status status,
|
||||
const QSQLiteResult::Columns& list,
|
||||
const QString &error )
|
||||
: m_status( status ), m_list( list ), m_error( error )
|
||||
{}
|
||||
|
||||
QSQLiteResult::~QSQLiteResult()
|
||||
{}
|
||||
|
||||
QSQLiteResult::Status QSQLiteResult::getStatus() const
|
||||
{
|
||||
return m_status;
|
||||
}
|
||||
|
||||
void QSQLiteResult::setStatus( QSQLiteResult::Status status )
|
||||
{
|
||||
m_status = status;
|
||||
}
|
||||
|
||||
QSQLiteResult::Columns QSQLiteResult::getResults() const
|
||||
{
|
||||
return m_list;
|
||||
}
|
||||
|
||||
void QSQLiteResult::setResults( const QSQLiteResult::Columns& result )
|
||||
{
|
||||
m_list = result;
|
||||
}
|
||||
|
||||
void QSQLiteResult::addRow( QSQLiteResultRow row )
|
||||
{
|
||||
m_list.append( row );
|
||||
}
|
||||
|
||||
QString QSQLiteResult::getError() const
|
||||
{
|
||||
return m_error;
|
||||
}
|
||||
|
||||
void QSQLiteResult::setError( const QString &error )
|
||||
{
|
||||
m_error = error;
|
||||
}
|
||||
|
||||
QSQLiteResultRow QSQLiteResult::first()
|
||||
{
|
||||
it = m_list.begin();
|
||||
return ( *it );
|
||||
}
|
||||
|
||||
QSQLiteResultRow QSQLiteResult::next()
|
||||
{
|
||||
++it;
|
||||
return ( *it );
|
||||
}
|
||||
|
||||
bool QSQLiteResult::atEnd()
|
||||
{
|
||||
if ( it == m_list.end() ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QSQLiteResult::Columns::ConstIterator QSQLiteResult::iterator() const
|
||||
{
|
||||
QSQLiteResult::Columns::ConstIterator it;
|
||||
it = m_list.begin();
|
||||
return it;
|
||||
}
|
||||
|
||||
int QSQLiteResult::size() const
|
||||
{
|
||||
return ( m_list.size() );
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2003 *
|
||||
* by Unai Garro (ugarro@users.sourceforge.net) *
|
||||
* Martin Imobersteg <imm@gmx.ch> *
|
||||
* and opie project *
|
||||
* *
|
||||
* *
|
||||
* This code was originally developed by the opie project, on which *
|
||||
* Martin Imobersteg based his work. *
|
||||
* This file is adds a small extension, necessary to perform some minimum *
|
||||
* SQL actions *
|
||||
* *
|
||||
* (this project is different from that in qsqlite.sf.net) *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef QSQLITERESULT_H
|
||||
#define QSQLITERESULT_H
|
||||
|
||||
#include <qdatetime.h>
|
||||
#include <qmap.h>
|
||||
#include <qvaluelist.h>
|
||||
|
||||
/**
|
||||
* ResultRow represents one row of the resulting answer
|
||||
*/
|
||||
class QSQLiteResultRow
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* TableString is used to establish the relations
|
||||
* between the column name and the real item
|
||||
*/
|
||||
typedef QMap<QString, QCString> TableString;
|
||||
|
||||
/**
|
||||
* TableInt is used to establish a relation between a
|
||||
* position of a column and the row value
|
||||
*/
|
||||
typedef QMap<int, QCString> TableInt;
|
||||
|
||||
/**
|
||||
* Default c'tor. It has a TableString and a TableInt
|
||||
*/
|
||||
QSQLiteResultRow( const TableString& = TableString(),
|
||||
const TableInt& = TableInt() );
|
||||
QSQLiteResultRow( const QSQLiteResultRow& );
|
||||
~QSQLiteResultRow();
|
||||
QSQLiteResultRow &operator=( const QSQLiteResultRow& );
|
||||
|
||||
/**
|
||||
* returns the TableString
|
||||
*/
|
||||
TableString tableString() const;
|
||||
|
||||
/**
|
||||
* returns the TableInt
|
||||
*/
|
||||
TableInt tableInt() const;
|
||||
|
||||
/**
|
||||
* retrieves the Data from columnName
|
||||
*
|
||||
*/
|
||||
QCString data( const QString& columnName, bool *ok = 0 );
|
||||
|
||||
/**
|
||||
* QString for column number
|
||||
*/
|
||||
QCString data( int columnNumber, bool *ok = 0 );
|
||||
|
||||
/**
|
||||
* Date conversion from columnName
|
||||
*/
|
||||
QDate dataToDate( const QString& columnName, bool *ok = 0 );
|
||||
|
||||
/**
|
||||
* Date conversion from column-number
|
||||
*/
|
||||
QDate dataToDate( int columnNumber, bool *ok = 0 );
|
||||
|
||||
QDateTime dataToDateTime( const QString& columName );
|
||||
QDateTime dataToDateTime( int columnNumber );
|
||||
|
||||
private:
|
||||
TableString m_string;
|
||||
TableInt m_int;
|
||||
};
|
||||
|
||||
/**
|
||||
* the QSQLiteResult
|
||||
* either a SQL statusment failed or succeeded
|
||||
*/
|
||||
class QSQLiteResult
|
||||
{
|
||||
|
||||
public:
|
||||
typedef QValueList<QSQLiteResultRow> Columns;
|
||||
|
||||
/** The Status of a Result */
|
||||
enum Status{ Success = 0, Failure, Undefined };
|
||||
|
||||
/**
|
||||
* default c'tor
|
||||
* @param status The Status of the Result
|
||||
* @param r ResultItems
|
||||
* @param error Error Message
|
||||
*/
|
||||
QSQLiteResult( enum Status status = Undefined,
|
||||
const Columns &r = Columns(),
|
||||
const QString &error = 0L );
|
||||
~QSQLiteResult();
|
||||
|
||||
Status getStatus() const;
|
||||
Columns getResults() const;
|
||||
QString getError() const;
|
||||
|
||||
void setStatus( enum Status status );
|
||||
void setResults( const Columns &result );
|
||||
void setError( const QString &error );
|
||||
|
||||
void addRow( QSQLiteResultRow row );
|
||||
|
||||
QSQLiteResultRow first();
|
||||
QSQLiteResultRow next();
|
||||
bool atEnd();
|
||||
|
||||
Columns::ConstIterator iterator() const;
|
||||
int size() const;
|
||||
|
||||
private:
|
||||
enum Status m_status;
|
||||
Columns m_list;
|
||||
QString m_error;
|
||||
Columns::Iterator it;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,60 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2003-2004 by *
|
||||
* Unai Garro (ugarro@users.sourceforge.net) *
|
||||
* Jason Kivlighn (jkivlighn@gmail.com) *
|
||||
* Cyril Bosselut (bosselut@b1project.com) *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef LITERECIPEDB_H
|
||||
#define LITERECIPEDB_H
|
||||
|
||||
#include "backends/qsqlrecipedb.h"
|
||||
|
||||
#include <qstring.h>
|
||||
|
||||
#include "qsql_sqlite.h"
|
||||
|
||||
#define SQLITE_DRIVER "KRESQLITE"
|
||||
|
||||
class LiteRecipeDB : public QSqlRecipeDB
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
void createDB( void );
|
||||
|
||||
public:
|
||||
LiteRecipeDB( const QString &DBName = DEFAULT_DB_NAME );
|
||||
~LiteRecipeDB( void );
|
||||
|
||||
virtual int lastInsertID();
|
||||
|
||||
virtual void createTable( const QString &tableName );
|
||||
virtual void givePermissions(const QString&, const QString&, const QString&, const QString&){} //no permissions in this backend
|
||||
|
||||
protected:
|
||||
virtual QSqlDriver *qsqlDriver() const
|
||||
{
|
||||
return new KreSQLiteDriver();
|
||||
}
|
||||
|
||||
virtual QString escapeAndEncode( const QString &s ) const;
|
||||
|
||||
private:
|
||||
virtual void portOldDatabases( float version );
|
||||
virtual QStringList backupCommand() const;
|
||||
virtual QStringList restoreCommand() const;
|
||||
|
||||
void addColumn( const QString &new_table_sql, const QString &new_col_info, const QString &default_value, const QString &table_name, int col_index );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,459 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2005 by *
|
||||
* Jason Kivlighn (jkivlighn@gmail.com) *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "qsql_sqlite.h"
|
||||
|
||||
#include <qdatetime.h>
|
||||
#include <qregexp.h>
|
||||
#include <qfile.h>
|
||||
|
||||
#include <qptrvector.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
#include "libqsqlite/krecqsqlitedb.h"
|
||||
#include "libqsqlite/krecqsqliteresult.h"
|
||||
|
||||
#define QSQLITE_DRIVER_NAME "KRE_QSQLITE"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#if HAVE_SQLITE3
|
||||
#include <sqlite3.h>
|
||||
#define sqlite_free sqlite3_free
|
||||
#elif HAVE_SQLITE
|
||||
#include <sqlite.h>
|
||||
#endif
|
||||
|
||||
class KreSQLiteResult : public QSqlResult
|
||||
{
|
||||
public:
|
||||
KreSQLiteResult( const KreSQLiteDriver *d ): QSqlResult( d )
|
||||
{
|
||||
db = d->db;
|
||||
}
|
||||
~KreSQLiteResult() {}
|
||||
protected:
|
||||
QVariant data( int );
|
||||
bool reset ( const QString& );
|
||||
bool fetch( int );
|
||||
bool fetchFirst();
|
||||
bool fetchNext();
|
||||
bool fetchLast();
|
||||
bool isNull( int );
|
||||
QSqlRecord record();
|
||||
int size();
|
||||
int numRowsAffected();
|
||||
|
||||
private:
|
||||
QSQLiteResult result;
|
||||
QSQLiteResultRow row;
|
||||
|
||||
QSQLiteDB *db;
|
||||
};
|
||||
|
||||
|
||||
QVariant KreSQLiteResult::data( int field )
|
||||
{
|
||||
if ( !isSelect() ) {
|
||||
//qWarning( "KreSQLiteResult::data: column %d out of range", field );
|
||||
qWarning( "KreSQLiteResult::data: not a select statement" );
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
return QVariant(row.data(field));
|
||||
}
|
||||
|
||||
bool KreSQLiteResult::fetch( int i )
|
||||
{
|
||||
kdDebug()<<"fetch_i"<<endl;
|
||||
if ( isForwardOnly() ) { // fake a forward seek
|
||||
if ( at() < i ) {
|
||||
int x = i - at();
|
||||
while ( --x && fetchNext() );
|
||||
return fetchNext();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ( at() == i )
|
||||
return true;
|
||||
|
||||
row = result.first();
|
||||
for ( int j = 0; j < i; ++j ) {
|
||||
if ( result.atEnd() )
|
||||
return false;
|
||||
|
||||
row = result.next();
|
||||
}
|
||||
|
||||
setAt( i );
|
||||
return true;
|
||||
}
|
||||
|
||||
bool KreSQLiteResult::fetchNext()
|
||||
{
|
||||
row = result.next();
|
||||
|
||||
if ( result.atEnd() )
|
||||
return false;
|
||||
|
||||
setAt( at() + 1 );
|
||||
return true;
|
||||
}
|
||||
|
||||
bool KreSQLiteResult::fetchFirst()
|
||||
{
|
||||
row = result.first();
|
||||
|
||||
if ( result.atEnd() )
|
||||
return false;
|
||||
|
||||
setAt(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool KreSQLiteResult::fetchLast()
|
||||
{kdDebug()<<"fetchlast"<<endl;
|
||||
if ( isForwardOnly() ) { // fake this since MySQL can't seek on forward only queries
|
||||
bool success = fetchNext(); // did we move at all?
|
||||
while ( fetchNext() );
|
||||
return success;
|
||||
}
|
||||
int numRows = size();
|
||||
if ( !numRows )
|
||||
return false;
|
||||
return fetch( numRows - 1 );
|
||||
}
|
||||
|
||||
bool KreSQLiteResult::isNull( int i )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QSqlRecord KreSQLiteResult::record()
|
||||
{kdDebug()<<"record"<<endl;
|
||||
return QSqlRecord();
|
||||
}
|
||||
|
||||
int KreSQLiteResult::size()
|
||||
{
|
||||
//kdDebug()<<"size: "<<result.size()<<endl;
|
||||
return result.size();
|
||||
}
|
||||
|
||||
int KreSQLiteResult::numRowsAffected()
|
||||
{kdDebug()<<"numrowsaffected"<<endl;
|
||||
return 1;/*sqlite3_changes(db)*/
|
||||
}
|
||||
|
||||
/*
|
||||
Execute \a query.
|
||||
*/
|
||||
bool KreSQLiteResult::reset(const QString& query)
|
||||
{
|
||||
// this is where we build a query.
|
||||
if (!driver())
|
||||
return false;
|
||||
if (!driver()-> isOpen() || driver()->isOpenError())
|
||||
return false;
|
||||
|
||||
//cleanup
|
||||
setAt( -1 );
|
||||
|
||||
setSelect(true);
|
||||
|
||||
|
||||
result = db->executeQuery( query );
|
||||
int res = result.getStatus();
|
||||
|
||||
if (res != SQLITE_OK ) {
|
||||
setLastError(QSqlError("Unable to execute statement", result.getError(), QSqlError::Statement, res));
|
||||
}
|
||||
|
||||
setActive(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
KreSQLiteDriver::KreSQLiteDriver(QObject * parent, const char * name)
|
||||
: QSqlDriver(parent, name ? name : QSQLITE_DRIVER_NAME)
|
||||
{
|
||||
}
|
||||
|
||||
KreSQLiteDriver::KreSQLiteDriver(QSQLiteDB *connection, QObject *parent, const char *name)
|
||||
: QSqlDriver(parent, name ? name : QSQLITE_DRIVER_NAME)
|
||||
{
|
||||
db = connection;
|
||||
setOpen(true);
|
||||
setOpenError(false);
|
||||
}
|
||||
|
||||
|
||||
KreSQLiteDriver::~KreSQLiteDriver()
|
||||
{
|
||||
}
|
||||
|
||||
bool KreSQLiteDriver::hasFeature(DriverFeature f) const
|
||||
{
|
||||
switch (f) {
|
||||
case QuerySize:
|
||||
case Transactions:
|
||||
return true;
|
||||
// case BLOB:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
SQLite dbs have no user name, passwords, hosts or ports.
|
||||
just file names.
|
||||
*/
|
||||
bool KreSQLiteDriver::open(const QString & file, const QString &, const QString &, const QString &, int)
|
||||
{
|
||||
if (isOpen())
|
||||
close();
|
||||
|
||||
if (file.isEmpty())
|
||||
return false;
|
||||
|
||||
db = new QSQLiteDB;
|
||||
if ( !db->open(QFile::encodeName(file)) ) {
|
||||
setLastError(QSqlError("Error to open database", 0, QSqlError::Connection));
|
||||
setOpenError(true);
|
||||
setOpen(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
setOpen(true);
|
||||
setOpenError(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void KreSQLiteDriver::close()
|
||||
{
|
||||
if (isOpen()) {
|
||||
db->close();
|
||||
delete db; db = 0;
|
||||
setOpen(false);
|
||||
setOpenError(false);
|
||||
}
|
||||
}
|
||||
|
||||
QSqlQuery KreSQLiteDriver::createQuery() const
|
||||
{
|
||||
return QSqlQuery(new KreSQLiteResult(this));
|
||||
}
|
||||
|
||||
bool KreSQLiteDriver::beginTransaction()
|
||||
{
|
||||
if (!isOpen() || isOpenError())
|
||||
return false;
|
||||
|
||||
QSQLiteResult result = db->executeQuery( "BEGIN" );
|
||||
int status = result.getStatus();
|
||||
if (status == QSQLiteResult::Success)
|
||||
return true;
|
||||
|
||||
setLastError(QSqlError("Unable to begin transaction", result.getError(), QSqlError::Transaction, status));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool KreSQLiteDriver::commitTransaction()
|
||||
{
|
||||
if (!isOpen() || isOpenError())
|
||||
return false;
|
||||
|
||||
QSQLiteResult result = db->executeQuery( "COMMIT" );
|
||||
int status = result.getStatus();
|
||||
if (status == QSQLiteResult::Success)
|
||||
return true;
|
||||
|
||||
setLastError(QSqlError("Unable to commit transaction", result.getError(), QSqlError::Transaction, status));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool KreSQLiteDriver::rollbackTransaction()
|
||||
{
|
||||
if (!isOpen() || isOpenError())
|
||||
return false;
|
||||
|
||||
QSQLiteResult result = db->executeQuery( "ROLLBACK" );
|
||||
int status = result.getStatus();
|
||||
if (status == SQLITE_OK)
|
||||
return true;
|
||||
|
||||
setLastError(QSqlError("Unable to rollback transaction", result.getError(), QSqlError::Transaction, status));
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList KreSQLiteDriver::tables(const QString &typeName) const
|
||||
{
|
||||
QStringList res;
|
||||
if (!isOpen())
|
||||
return res;
|
||||
|
||||
int type = typeName.toInt();
|
||||
|
||||
QSqlQuery q = createQuery();
|
||||
q.setForwardOnly(true);
|
||||
#if (QT_VERSION-0 >= 0x030000)
|
||||
if ((type & (int)QSql::Tables) && (type & (int)QSql::Views))
|
||||
q.exec("SELECT name FROM sqlite_master WHERE type='table' OR type='view'");
|
||||
else if (typeName.isEmpty() || (type & (int)QSql::Tables))
|
||||
q.exec("SELECT name FROM sqlite_master WHERE type='table'");
|
||||
else if (type & (int)QSql::Views)
|
||||
q.exec("SELECT name FROM sqlite_master WHERE type='view'");
|
||||
#else
|
||||
q.exec("SELECT name FROM sqlite_master WHERE type='table' OR type='view'");
|
||||
#endif
|
||||
|
||||
if (q.isActive()) {
|
||||
while(q.next()) {
|
||||
res.append(q.value(0).toString());
|
||||
}
|
||||
}
|
||||
|
||||
#if (QT_VERSION-0 >= 0x030000)
|
||||
if (type & (int)QSql::SystemTables) {
|
||||
// there are no internal tables beside this one:
|
||||
res.append("sqlite_master");
|
||||
}
|
||||
#endif
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
QSqlIndex KreSQLiteDriver::primaryIndex(const QString &tblname) const
|
||||
{
|
||||
QSqlRecordInfo rec(recordInfo(tblname)); // expensive :(
|
||||
|
||||
if (!isOpen())
|
||||
return QSqlIndex();
|
||||
|
||||
QSqlQuery q = createQuery();
|
||||
q.setForwardOnly(true);
|
||||
// finrst find a UNIQUE INDEX
|
||||
q.exec("PRAGMA index_list('" + tblname + "');");
|
||||
QString indexname;
|
||||
while(q.next()) {
|
||||
if (q.value(2).toInt()==1) {
|
||||
indexname = q.value(1).toString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (indexname.isEmpty())
|
||||
return QSqlIndex();
|
||||
|
||||
q.exec("PRAGMA index_info('" + indexname + "');");
|
||||
|
||||
QSqlIndex index(tblname, indexname);
|
||||
while(q.next()) {
|
||||
QString name = q.value(2).toString();
|
||||
QSqlVariant::Type type = QSqlVariant::Invalid;
|
||||
if (rec.contains(name))
|
||||
type = rec.find(name).type();
|
||||
index.append(QSqlField(name, type));
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
#if 0
|
||||
QSqlRecordInfo KreSQLiteDriver::recordInfo(const QString &tbl) const
|
||||
{
|
||||
if (!isOpen())
|
||||
return QSqlRecordInfo();
|
||||
|
||||
QSqlQuery q = createQuery();
|
||||
q.setForwardOnly(true);
|
||||
q.exec("SELECT * FROM " + tbl + " LIMIT 1");
|
||||
return QSqlRecordInfo();
|
||||
// return recordInfo(q);
|
||||
}
|
||||
|
||||
QSqlRecord KreSQLiteDriver::record(const QString &tblname) const
|
||||
{
|
||||
if (!isOpen())
|
||||
return QSqlRecord();
|
||||
|
||||
return recordInfo(tblname).toRecord();
|
||||
}
|
||||
|
||||
QSqlRecord KreSQLiteDriver::record(const QSqlQuery& query) const
|
||||
{
|
||||
if (query.isActive() && query.driver() == this) {
|
||||
KreSQLiteResult* result = (KreSQLiteResult*)query.result();
|
||||
return result->rInf.toRecord();
|
||||
}
|
||||
return QSqlRecord();
|
||||
}
|
||||
|
||||
QSqlRecordInfo KreSQLiteDriver::recordInfo(const QSqlQuery& query) const
|
||||
{
|
||||
if (query.isActive() && query.driver() == this) {
|
||||
KreSQLiteResult* result = (KreSQLiteResult*)query.result();
|
||||
return result->rInf;
|
||||
}
|
||||
return QSqlRecordInfo();
|
||||
}
|
||||
|
||||
//this would be used below in formatValue()
|
||||
static QString escape( const QString &s )
|
||||
{
|
||||
QString s_escaped = s;
|
||||
|
||||
if ( !s_escaped.isEmpty() ) { //###: sqlite_mprintf() seems to fill an empty string with garbage
|
||||
// Escape using SQLite's function
|
||||
#if HAVE_SQLITE
|
||||
char * escaped = sqlite_mprintf( "%q", s.latin1() ); // Escape the string(allocates memory)
|
||||
#elif HAVE_SQLITE3
|
||||
char * escaped = sqlite3_mprintf( "%q", s.latin1() ); // Escape the string(allocates memory)
|
||||
#endif
|
||||
s_escaped = escaped;
|
||||
#if HAVE_SQLITE
|
||||
sqlite_freemem( escaped ); // free allocated memory
|
||||
#elif HAVE_SQLITE3
|
||||
sqlite3_free( escaped ); // free allocated memory
|
||||
#endif
|
||||
}
|
||||
|
||||
return ( s_escaped );
|
||||
}
|
||||
|
||||
|
||||
// Everything is considered a string given the implementation of this driver (we don't have field info). This would ruin a QByteArray (for the photo).
|
||||
QString KreSQLiteDriver::formatValue( const QSqlField* field, bool trimStrings ) const
|
||||
{
|
||||
QString r;
|
||||
if ( field->isNull() ) {
|
||||
r = nullText();
|
||||
} else {
|
||||
switch( field->type() ) {
|
||||
case QVariant::String:
|
||||
case QVariant::CString: {
|
||||
// Escape '\' characters
|
||||
r = QSqlDriver::formatValue( field );
|
||||
//r = escape(r);
|
||||
//kdDebug()<<"escaping sqlite string: "<<r<<endl;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
r = QSqlDriver::formatValue( field, trimStrings );
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
@ -0,0 +1,53 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2005 by *
|
||||
* Jason Kivlighn (jkivlighn@gmail.com) *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef QSQL_SQLITE_H
|
||||
#define QSQL_SQLITE_H
|
||||
|
||||
#include <qsqldriver.h>
|
||||
#include <qsqlresult.h>
|
||||
#include <qsqlrecord.h>
|
||||
#include <qsqlindex.h>
|
||||
|
||||
typedef QVariant QSqlVariant;
|
||||
|
||||
class QSQLiteDB;
|
||||
|
||||
class KreSQLiteDriver : public QSqlDriver
|
||||
{
|
||||
public:
|
||||
KreSQLiteDriver(QObject * parent = 0, const char * name = 0);
|
||||
KreSQLiteDriver(QSQLiteDB *connection, QObject *parent = 0, const char *name = 0);
|
||||
~KreSQLiteDriver();
|
||||
|
||||
bool hasFeature( DriverFeature ) const;
|
||||
bool open( const QString&,
|
||||
const QString&,
|
||||
const QString&,
|
||||
const QString&,
|
||||
int );
|
||||
void close();
|
||||
QSqlQuery createQuery() const;
|
||||
|
||||
bool beginTransaction();
|
||||
bool commitTransaction();
|
||||
bool rollbackTransaction();
|
||||
QStringList tables(const QString &typeName) const;
|
||||
QSqlIndex primaryIndex(const QString &tblname) const;
|
||||
//QSqlRecordInfo recordInfo(const QString &tbl) const;
|
||||
//QSqlRecord record(const QString &tblname) const;
|
||||
//QString formatValue( const QSqlField* field, bool trimStrings ) const;
|
||||
|
||||
private:
|
||||
friend class KreSQLiteResult;
|
||||
|
||||
QSQLiteDB *db;
|
||||
};
|
||||
#endif
|
@ -0,0 +1,79 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2005 by *
|
||||
* Jason Kivlighn (jkivlighn@gmail.com) *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "progressinterface.h"
|
||||
|
||||
#include <qapplication.h>
|
||||
|
||||
#include <kprogress.h>
|
||||
|
||||
#include "recipedb.h"
|
||||
|
||||
ProgressInterface::ProgressInterface( QWidget *parent ) : progress_dlg(0), database(0), m_rate(1), m_rate_at(0)
|
||||
{
|
||||
slot_obj = new ProgressSlotObject(parent,this);
|
||||
}
|
||||
|
||||
ProgressInterface::~ProgressInterface()
|
||||
{
|
||||
listenOn(0);
|
||||
delete slot_obj;
|
||||
}
|
||||
|
||||
void ProgressInterface::progressBegin( int steps, const QString &caption, const QString &text, int rate )
|
||||
{
|
||||
m_rate = rate;
|
||||
|
||||
progress_dlg = new KProgressDialog((QWidget*)slot_obj->parent(),0,caption,text,true);
|
||||
|
||||
if ( steps == 0 )
|
||||
progress_dlg->progressBar()->setPercentageVisible(false);
|
||||
progress_dlg->progressBar()->setTotalSteps( steps );
|
||||
}
|
||||
|
||||
void ProgressInterface::progressDone()
|
||||
{
|
||||
delete progress_dlg;
|
||||
progress_dlg = 0;
|
||||
|
||||
m_rate_at = 0;
|
||||
}
|
||||
|
||||
void ProgressInterface::progress()
|
||||
{
|
||||
if ( progress_dlg->wasCancelled() ) {
|
||||
database->cancelOperation();
|
||||
}
|
||||
else {
|
||||
++m_rate_at;
|
||||
|
||||
if ( m_rate_at % m_rate == 0 ) {
|
||||
progress_dlg->progressBar()->advance(1);
|
||||
m_rate_at = 0;
|
||||
}
|
||||
qApp->processEvents();
|
||||
}
|
||||
}
|
||||
|
||||
void ProgressInterface::listenOn( RecipeDB *db )
|
||||
{
|
||||
if ( database)
|
||||
database->disconnect(slot_obj);
|
||||
|
||||
if ( db ) {
|
||||
slot_obj->connect( db, SIGNAL(progressBegin(int,const QString&,const QString&,int)), slot_obj, SLOT(progressBegin(int,const QString&,const QString&,int)) );
|
||||
slot_obj->connect( db, SIGNAL(progressDone()), slot_obj, SLOT(progressDone()) );
|
||||
slot_obj->connect( db, SIGNAL(progress()), slot_obj, SLOT(progress()) );
|
||||
}
|
||||
|
||||
database = db;
|
||||
}
|
||||
|
||||
#include "progressinterface.moc"
|
@ -0,0 +1,70 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2005 by *
|
||||
* Jason Kivlighn (jkivlighn@gmail.com) *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef PROGRESSINTERFACE_H
|
||||
#define PROGRESSINTERFACE_H
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
class KProgressDialog;
|
||||
|
||||
class RecipeDB;
|
||||
class ProgressSlotObject;
|
||||
|
||||
/** This class is used to monitor events from the database that may take
|
||||
* awhile. Before a potentially long operation, the database will
|
||||
* call progressBegin(), progress() a number of times, and then progressDone().
|
||||
*
|
||||
* This class may be subclassed to perform certain operations during long
|
||||
* operations by implementing the three virtual functions. The default
|
||||
* implementation displays a progress bar dialog.
|
||||
*/
|
||||
class ProgressInterface
|
||||
{
|
||||
public:
|
||||
ProgressInterface( QWidget *parent );
|
||||
~ProgressInterface();
|
||||
|
||||
void listenOn( RecipeDB* );
|
||||
|
||||
protected:
|
||||
friend class ProgressSlotObject;
|
||||
|
||||
virtual void progressBegin(int,const QString &caption,const QString &text,int rate);
|
||||
virtual void progressDone();
|
||||
virtual void progress();
|
||||
|
||||
private:
|
||||
ProgressSlotObject *slot_obj;
|
||||
KProgressDialog *progress_dlg;
|
||||
RecipeDB *database;
|
||||
|
||||
int m_rate;
|
||||
int m_rate_at;
|
||||
};
|
||||
|
||||
class ProgressSlotObject : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ProgressSlotObject( QWidget*parent, ProgressInterface *p ) : QObject(parent), pInterface(p){}
|
||||
|
||||
public slots:
|
||||
void progressBegin(int i,const QString &caption=QString::null,const QString &text=QString::null,int rate=1){ pInterface->progressBegin(i,caption,text,rate); }
|
||||
void progressDone(){ pInterface->progressDone(); }
|
||||
void progress(){ pInterface->progress(); }
|
||||
|
||||
private:
|
||||
ProgressInterface *pInterface;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,228 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2004 by *
|
||||
* Unai Garro (ugarro@users.sourceforge.net) *
|
||||
* Cyril Bosselut (bosselut@b1project.com) *
|
||||
* Jason Kivlighn (jkivlighn@gmail.com) *
|
||||
* *
|
||||
* Copyright (C) 2006 Jason Kivlighn (jkivlighn@gmail.com) *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef QSQLRECIPEDB_H
|
||||
#define QSQLRECIPEDB_H
|
||||
|
||||
#include "backends/recipedb.h"
|
||||
|
||||
#include <qglobal.h>
|
||||
#include <qobject.h>
|
||||
#include <qsqldatabase.h>
|
||||
#include <qimage.h>
|
||||
#include <qfileinfo.h>
|
||||
#include <qregexp.h>
|
||||
#include <qstring.h>
|
||||
|
||||
#include "datablocks/recipe.h"
|
||||
#include "datablocks/elementlist.h"
|
||||
#include "datablocks/ingredientpropertylist.h"
|
||||
#include "datablocks/unitratiolist.h"
|
||||
|
||||
/**
|
||||
@author Unai Garro, Jason Kivlighn
|
||||
*/
|
||||
class QSqlRecipeDB : public RecipeDB
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
virtual QString qsqlDriverPlugin() const { return QString::null; }
|
||||
virtual QSqlDriver *qsqlDriver() const { return 0; }
|
||||
virtual void createDB( void ) = 0;
|
||||
|
||||
virtual void portOldDatabases( float version );
|
||||
virtual void storePhoto( int recipeID, const QByteArray &data );
|
||||
virtual void loadPhoto( int recipeID, QPixmap &photo );
|
||||
void loadRecipeMetadata( Recipe *recipe );
|
||||
|
||||
void search( RecipeList *list, int items, const RecipeSearchParameters & );
|
||||
|
||||
/** Return the next id for the given table and column.
|
||||
* If the database supports getting this afterwards,
|
||||
* leave the default implementation which returns -1.
|
||||
*
|
||||
* Note: Only call when an insert is actually going to take place.
|
||||
* This function will increment the sequence counter.
|
||||
*/
|
||||
virtual int getNextInsertID( const QString & /*table*/, const QString & /*column*/ )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||