rev 5377 - in kde-extras/strigi/trunk/debian: . patches
Fathi Boudra
fboudra-guest at alioth.debian.org
Fri Jan 19 19:35:00 CET 2007
Author: fboudra-guest
Date: 2007-01-19 19:34:59 +0100 (Fri, 19 Jan 2007)
New Revision: 5377
Added:
kde-extras/strigi/trunk/debian/libsearchclient-dev.install
kde-extras/strigi/trunk/debian/libsearchclient0.install
kde-extras/strigi/trunk/debian/libstreamindexer-dev.install
kde-extras/strigi/trunk/debian/libstreamindexer0.install
kde-extras/strigi/trunk/debian/libstreams-dev.install
kde-extras/strigi/trunk/debian/libstreams0.install
kde-extras/strigi/trunk/debian/libstrigiqtdbusclient-dev.install
kde-extras/strigi/trunk/debian/libstrigiqtdbusclient0.install
kde-extras/strigi/trunk/debian/patches/01_strigi_branch_r623754.diff
kde-extras/strigi/trunk/debian/strigi-utils.install
Removed:
kde-extras/strigi/trunk/debian/patches/10_ftbfs_amd64.diff
kde-extras/strigi/trunk/debian/strigi-daemon.lintian-overrides
Modified:
kde-extras/strigi/trunk/debian/changelog
kde-extras/strigi/trunk/debian/control
kde-extras/strigi/trunk/debian/libstrigihtmlgui-dev.install
kde-extras/strigi/trunk/debian/rules
kde-extras/strigi/trunk/debian/strigi-daemon.install
Log:
prepare strigi 0.3.11, split strigi-daemon
Modified: kde-extras/strigi/trunk/debian/changelog
===================================================================
--- kde-extras/strigi/trunk/debian/changelog 2007-01-19 16:13:58 UTC (rev 5376)
+++ kde-extras/strigi/trunk/debian/changelog 2007-01-19 18:34:59 UTC (rev 5377)
@@ -1,3 +1,16 @@
+strigi (0.3.11-1) experimental; urgency=low
+
+ * New upstream release (Closes: #407394)
+ * Remove 10_ftbfs_amd64 patch, merged upstream.
+ * Add branch pull patch to r623754.
+ * Split strigi-daemon package (Closes: #407398).
+ * Add libsearchclient, libstreamindexer, libstreams,
+ libstrigiqtdbusclient and strigi-utils packages.
+ * Add strigi-plugins to strigi-daeamon Suggests. (Closes: #406694)
+ * Remove lintian override.
+
+ -- Fathi Boudra <fboudra at free.fr> Fri, 19 Jan 2007 15:02:14 +0100
+
strigi (0.3.10-1) experimental; urgency=low
[ Fathi Boudra ]
Modified: kde-extras/strigi/trunk/debian/control
===================================================================
--- kde-extras/strigi/trunk/debian/control 2007-01-19 16:13:58 UTC (rev 5376)
+++ kde-extras/strigi/trunk/debian/control 2007-01-19 18:34:59 UTC (rev 5377)
@@ -12,6 +12,7 @@
Architecture: any
Section: utils
Depends: ${shlibs:Depends}, ${misc:Depends}, poppler-utils, wv
+Suggests: strigi-plugins
Description: fast indexing and searching tool for your personal data (daemon)
Strigi is a program for fast indexing and searching your personal data. It can
gather and index informations from files in the filesystem even if they are
@@ -34,7 +35,7 @@
* calculation of sha1 for every file crawled (allows fast finding of
duplicates)
.
- This package contains strigi daemon and libsearch
+ This package contains the Strigi daemon
.
Homepage: http://www.vandenoever.info/software/strigi
@@ -51,6 +52,106 @@
.
Homepage: http://www.vandenoever.info/software/strigi
+Package: strigi-utils
+Architecture: any
+Section: utils
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Replaces: strigi-daemon (<< 0.3.11-1)
+Description: command-line tools for Strigi Desktop Search
+ This package is part of Strigi Desktop Search, it contains utilities powered
+ by Strigi:
+ * deepfind, an enhanced version of find. It lists files embedded in other
+ files like .deb, .rpm, .tar.gz, email attachments, and other files.
+ * deepgrep, an enhanced version of grep. It searches in binary files like
+ OpenOffice files, mp3s, Microsoft office files, pdfs and also in files
+ embedded in other files like .deb, .rpm, .tar.gz, email attachments, pdf
+ and other files.
+ * xmlindexer, a program that outputs the file parsing results as xml.
+ It walks through a directory and outputs an XML file containing all
+ the metadata and text it can extract from the the files it encounters.
+ This means that the Strigi's powers of data extraction are now available
+ to all applications that can parse XML simply by calling xmlindexer and
+ parsing the output.
+ .
+ See the 'strigi-daemon' package for more informations.
+ .
+ Homepage: http://www.vandenoever.info/software/strigi
+
+Package: libstreams0
+Architecture: any
+Section: libs
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Replaces: strigi-daemon (<< 0.3.11-1)
+Description: streams library for for Strigi Desktop Search
+ This package is part of Strigi Desktop Search, it contains a library for
+ writing clients using libstreams.
+ .
+ See the 'strigi-daemon' package for more informations.
+ .
+ Homepage: http://www.vandenoever.info/software/strigi
+
+Package: libstreams-dev
+Architecture: any
+Section: libdevel
+Depends: libstreams0 (= ${Source-Version}), libstdc++-dev
+Description: development files for libstreams
+ This package is part of Strigi Desktop Search, it contains the Strigi
+ development files for libstreams.
+ .
+ See the 'strigi-daemon' package for more informations.
+ .
+ Homepage: http://www.vandenoever.info/software/strigi
+
+Package: libstreamindexer0
+Architecture: any
+Section: libs
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Replaces: strigi-daemon (<< 0.3.11-1)
+Description: streamindexer library for Strigi Desktop Search
+ This package is part of Strigi Desktop Search, it contains a library for
+ writing clients using libstreamindexer.
+ .
+ See the 'strigi-daemon' package for more informations.
+ .
+ Homepage: http://www.vandenoever.info/software/strigi
+
+Package: libstreamindexer-dev
+Architecture: any
+Section: libdevel
+Depends: libstreamindexer0 (= ${Source-Version}), libstreams-dev
+Description: development files for libstreamsindexe
+ This package is part of Strigi Desktop Search, it contains the Strigi
+ development files for libstreamindexer.
+ .
+ See the 'strigi-daemon' package for more informations.
+ .
+ Homepage: http://www.vandenoever.info/software/strigi
+
+Package: libsearchclient0
+Architecture: any
+Section: libs
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Replaces: strigi-daemon (<< 0.3.11-1)
+Description: searchclient library for Strigi Desktop Search
+ This package is part of Strigi Desktop Search, it contains a library for
+ writing clients.
+ .
+ See the 'strigi-daemon' package for more informations.
+ .
+ Homepage: http://www.vandenoever.info/software/strigi
+
+Package: libsearchclient-dev
+Architecture: any
+Section: libdevel
+Depends: libsearchclient0 (= ${Source-Version}), libstreamindexer-dev
+Description: development files for libsearchclient
+ This package is part of Strigi Desktop Search, it contains the Strigi
+ development files for libsearchclient.
+ .
+ See the 'strigi-daemon' package for more informations.
+ .
+ Homepage: http://www.vandenoever.info/software/strigi
+
Package: libstrigihtmlgui0
Architecture: any
Section: libs
@@ -66,11 +167,35 @@
Package: libstrigihtmlgui-dev
Architecture: any
Section: libdevel
-Depends: ${shlibs:Depends}, ${misc:Depends}, libstrigihtmlgui0 (= ${Source-Version})
-Description: development files for Strigi Desktop Search
+Depends: libstrigihtmlgui0 (= ${Source-Version}), libsearchclient-dev
+Description: development files for libstrigihtmlgui
This package is part of Strigi Desktop Search, it contains the Strigi
- development files.
+ development files for libstrigihtmlgui.
.
See the 'strigi-daemon' package for more informations.
.
Homepage: http://www.vandenoever.info/software/strigi
+
+Package: libstrigiqtdbusclient0
+Architecture: any
+Section: libs
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: library for writing D-Bus clients for Strigi Desktop Search
+ This package is part of Strigi Desktop Search, it contains a library for
+ writing Qt D-Bus clients for strigi.
+ .
+ See the 'strigi-daemon' package for more informations.
+ .
+ Homepage: http://www.vandenoever.info/software/strigi
+
+Package: libstrigiqtdbusclient-dev
+Architecture: any
+Section: libdevel
+Depends: libstrigiqtdbusclient0 (= ${Source-Version}), libqt4-dev
+Description: development files for libstrigiqtdbusclient
+ This package is part of Strigi Desktop Search, it contains the Strigi
+ development files for libstrigiqtdbusclient.
+ .
+ See the 'strigi-daemon' package for more informations.
+ .
+ Homepage: http://www.vandenoever.info/software/strigi
Added: kde-extras/strigi/trunk/debian/libsearchclient-dev.install
===================================================================
--- kde-extras/strigi/trunk/debian/libsearchclient-dev.install 2007-01-19 16:13:58 UTC (rev 5376)
+++ kde-extras/strigi/trunk/debian/libsearchclient-dev.install 2007-01-19 18:34:59 UTC (rev 5377)
@@ -0,0 +1,4 @@
+usr/include/asyncsocketclient.h
+usr/include/asyncsocket.h
+usr/include/clientinterface.h
+usr/lib/libsearchclient.so
Added: kde-extras/strigi/trunk/debian/libsearchclient0.install
===================================================================
--- kde-extras/strigi/trunk/debian/libsearchclient0.install 2007-01-19 16:13:58 UTC (rev 5376)
+++ kde-extras/strigi/trunk/debian/libsearchclient0.install 2007-01-19 18:34:59 UTC (rev 5377)
@@ -0,0 +1 @@
+usr/lib/libsearchclient.so.*
Added: kde-extras/strigi/trunk/debian/libstreamindexer-dev.install
===================================================================
--- kde-extras/strigi/trunk/debian/libstreamindexer-dev.install 2007-01-19 16:13:58 UTC (rev 5376)
+++ kde-extras/strigi/trunk/debian/libstreamindexer-dev.install 2007-01-19 18:34:59 UTC (rev 5377)
@@ -0,0 +1,10 @@
+usr/include/strigi/indexeddocument.h
+usr/include/strigi/indexable.h
+usr/include/strigi/analyzerplugin.h
+usr/include/strigi/streamthroughanalyzer.h
+usr/include/strigi/streamendanalyzer.h
+usr/include/strigi/analyzerfactoryfactory.h
+usr/include/strigi/indexerconfiguration.h
+usr/include/strigi/indexwriter.h
+usr/include/strigi/streamindexer.h
+usr/lib/libstreamindexer.so
Added: kde-extras/strigi/trunk/debian/libstreamindexer0.install
===================================================================
--- kde-extras/strigi/trunk/debian/libstreamindexer0.install 2007-01-19 16:13:58 UTC (rev 5376)
+++ kde-extras/strigi/trunk/debian/libstreamindexer0.install 2007-01-19 18:34:59 UTC (rev 5377)
@@ -0,0 +1,2 @@
+usr/lib/libstreamindexer.so.*
+usr/lib/strigi/strigita_*
Added: kde-extras/strigi/trunk/debian/libstreams-dev.install
===================================================================
--- kde-extras/strigi/trunk/debian/libstreams-dev.install 2007-01-19 16:13:58 UTC (rev 5376)
+++ kde-extras/strigi/trunk/debian/libstreams-dev.install 2007-01-19 18:34:59 UTC (rev 5377)
@@ -0,0 +1,16 @@
+usr/include/strigi/fileinputstream.h
+usr/include/strigi/substreamprovider.h
+usr/include/strigi/substreamproviderprovider.h
+usr/include/strigi/bufferedstream.h
+usr/include/strigi/streambase.h
+usr/include/strigi/inputstreambuffer.h
+usr/include/strigi/inputstream.h
+usr/include/strigi/archivereader.h
+usr/include/strigi/inputstreamreader.h
+usr/include/strigi/stringreader.h
+usr/include/strigi/jstreamsconfig.h
+usr/include/strigi/timeofday.h
+usr/include/strigi/strigi_fnmatch.h
+usr/include/strigi/strigi_thread.h
+usr/include/strigi/stgdirent.h
+usr/lib/libstreams.so
Added: kde-extras/strigi/trunk/debian/libstreams0.install
===================================================================
--- kde-extras/strigi/trunk/debian/libstreams0.install 2007-01-19 16:13:58 UTC (rev 5376)
+++ kde-extras/strigi/trunk/debian/libstreams0.install 2007-01-19 18:34:59 UTC (rev 5377)
@@ -0,0 +1 @@
+usr/lib/libstreams.so.*
Modified: kde-extras/strigi/trunk/debian/libstrigihtmlgui-dev.install
===================================================================
--- kde-extras/strigi/trunk/debian/libstrigihtmlgui-dev.install 2007-01-19 16:13:58 UTC (rev 5376)
+++ kde-extras/strigi/trunk/debian/libstrigihtmlgui-dev.install 2007-01-19 18:34:59 UTC (rev 5377)
@@ -1,2 +1,2 @@
-usr/include/*.h
+usr/include/strigihtmlgui.h
usr/lib/libstrigihtmlgui.so
Added: kde-extras/strigi/trunk/debian/libstrigiqtdbusclient-dev.install
===================================================================
--- kde-extras/strigi/trunk/debian/libstrigiqtdbusclient-dev.install 2007-01-19 16:13:58 UTC (rev 5376)
+++ kde-extras/strigi/trunk/debian/libstrigiqtdbusclient-dev.install 2007-01-19 18:34:59 UTC (rev 5377)
@@ -0,0 +1,5 @@
+usr/include/strigi/qtdbus/strigiasyncclient.h
+usr/include/strigi/qtdbus/strigiclient.h
+usr/include/strigi/qtdbus/strigidbus.h
+usr/include/strigi/qtdbus/strigitypes.h
+usr/lib/libstrigiqtdbusclient.so
Added: kde-extras/strigi/trunk/debian/libstrigiqtdbusclient0.install
===================================================================
--- kde-extras/strigi/trunk/debian/libstrigiqtdbusclient0.install 2007-01-19 16:13:58 UTC (rev 5376)
+++ kde-extras/strigi/trunk/debian/libstrigiqtdbusclient0.install 2007-01-19 18:34:59 UTC (rev 5377)
@@ -0,0 +1 @@
+usr/lib/libstrigiqtdbusclient.so.*
Added: kde-extras/strigi/trunk/debian/patches/01_strigi_branch_r623754.diff
===================================================================
--- kde-extras/strigi/trunk/debian/patches/01_strigi_branch_r623754.diff 2007-01-19 16:13:58 UTC (rev 5376)
+++ kde-extras/strigi/trunk/debian/patches/01_strigi_branch_r623754.diff 2007-01-19 18:34:59 UTC (rev 5377)
@@ -0,0 +1,5067 @@
+diff -Nur strigi-0.3.11/cmake/FindHyperEstraier.cmake strigi-0.3.11.new/cmake/FindHyperEstraier.cmake
+--- strigi-0.3.11/cmake/FindHyperEstraier.cmake 2006-12-12 23:50:15.000000000 +0100
++++ strigi-0.3.11.new/cmake/FindHyperEstraier.cmake 2006-12-13 21:08:33.000000000 +0100
+@@ -23,7 +23,7 @@
+ # print status message
+ IF(HyperEstraier_FOUND)
+ IF(NOT HyperEstraier_FIND_QUIETLY)
+- MESSAGE(STATUS "Found HyperEstraier: ${CLUCENE_LIBRARY}")
++ MESSAGE(STATUS "Found HyperEstraier: ${ESTCONFIG}")
+ ENDIF(NOT HyperEstraier_FIND_QUIETLY)
+ ELSE(HyperEstraier_FOUND)
+ IF(HyperEstraier_FIND_REQUIRED)
+diff -Nur strigi-0.3.11/cmake/FindQt4.cmake strigi-0.3.11.new/cmake/FindQt4.cmake
+--- strigi-0.3.11/cmake/FindQt4.cmake 1970-01-01 01:00:00.000000000 +0100
++++ strigi-0.3.11.new/cmake/FindQt4.cmake 2007-01-13 17:08:59.000000000 +0100
+@@ -0,0 +1,1081 @@
++# - Find QT 4
++# This module can be used to find Qt4.
++# The most important issue is that the Qt4 qmake is available via the system path.
++# This qmake is then used to detect basically everything else.
++# This module defines a number of key variables and macros. First is
++# QT_USE_FILE which is the path to a CMake file that can be included to compile
++# Qt 4 applications and libraries. By default, the QtCore and QtGui
++# libraries are loaded. This behavior can be changed by setting one or more
++# of the following variables to true:
++# QT_DONT_USE_QTCORE
++# QT_DONT_USE_QTGUI
++# QT_USE_QT3SUPPORT
++# QT_USE_QTASSISTANT
++# QT_USE_QTDESIGNER
++# QT_USE_QTMOTIF
++# QT_USE_QTMAIN
++# QT_USE_QTNETWORK
++# QT_USE_QTNSPLUGIN
++# QT_USE_QTOPENGL
++# QT_USE_QTSQL
++# QT_USE_QTXML
++# QT_USE_QTSVG
++# QT_USE_QTTEST
++# QT_USE_QTUITOOLS
++# QT_USE_QTDBUS
++#
++# All the libraries required are stored in a variable called QT_LIBRARIES.
++# Add this variable to your TARGET_LINK_LIBRARIES.
++#
++# macro QT4_WRAP_CPP(outfiles inputfile ... )
++# macro QT4_WRAP_UI(outfiles inputfile ... )
++# macro QT4_ADD_RESOURCE(outfiles inputfile ... )
++# macro QT4_AUTOMOC(inputfile ... )
++# macro QT4_GENERATE_MOC(inputfile outputfile )
++#
++# macro QT4_ADD_DBUS_INTERFACE(outfiles interface basename)
++# create a the interface header and implementation files with the
++# given basename from the given interface xml file and add it to
++# the list of sources
++#
++# macro QT4_ADD_DBUS_INTERFACES(outfiles inputfile ... )
++# create the interface header and implementation files
++# for all listed interface xml files
++# the name will be automatically determined from the name of the xml file
++#
++# macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname [basename] )
++# create a dbus adaptor (header and implementation file) from the xml file
++# describing the interface, and add it to the list of sources. The adaptor
++# forwards the calls to a parent class, defined in parentheader and named
++# parentclassname. The name of the generated files will be
++# <basename>adaptor.{cpp,h} where basename is the basename of the xml file.
++#
++# macro QT4_GENERATE_DBUS_INTERFACE( header [interfacename] )
++# generate the xml interface file from the given header.
++# If the optional argument interfacename is omitted, the name of the
++# interface file is constructed from the basename of the header with
++# the suffix .xml appended.
++#
++# QT_FOUND If false, don't try to use Qt.
++# QT4_FOUND If false, don't try to use Qt 4.
++#
++# QT_QTCORE_FOUND True if QtCore was found.
++# QT_QTGUI_FOUND True if QtGui was found.
++# QT_QT3SUPPORT_FOUND True if Qt3Support was found.
++# QT_QTASSISTANT_FOUND True if QtAssistant was found.
++# QT_QTDBUS_FOUND True if QtDBus was found.
++# QT_QTDESIGNER_FOUND True if QtDesigner was found.
++# QT_QTDESIGNERCOMPONENTS True if QtDesignerComponents was found.
++# QT_QTMOTIF_FOUND True if QtMotif was found.
++# QT_QTNETWORK_FOUND True if QtNetwork was found.
++# QT_QTNSPLUGIN_FOUND True if QtNsPlugin was found.
++# QT_QTOPENGL_FOUND True if QtOpenGL was found.
++# QT_QTSQL_FOUND True if QtSql was found.
++# QT_QTXML_FOUND True if QtXml was found.
++# QT_QTSVG_FOUND True if QtSvg was found.
++# QT_QTTEST_FOUND True if QtTest was found.
++# QT_QTUITOOLS_FOUND True if QtUiTools was found.
++#
++# QT_DEFINITIONS Definitions to use when compiling code that uses Qt.
++#
++# QT_INCLUDES List of paths to all include directories of
++# Qt4 QT_INCLUDE_DIR and QT_QTCORE_INCLUDE_DIR are
++# always in this variable even if NOTFOUND,
++# all other INCLUDE_DIRS are
++# only added if they are found.
++#
++# QT_INCLUDE_DIR Path to "include" of Qt4
++# QT_QT_INCLUDE_DIR Path to "include/Qt"
++# QT_QT3SUPPORT_INCLUDE_DIR Path to "include/Qt3Support"
++# QT_QTASSISTANT_INCLUDE_DIR Path to "include/QtAssistant"
++# QT_QTCORE_INCLUDE_DIR Path to "include/QtCore"
++# QT_QTDESIGNER_INCLUDE_DIR Path to "include/QtDesigner"
++# QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR Path to "include/QtDesigner"
++# QT_QTDBUS_INCLUDE_DIR Path to "include/QtDBus"
++# QT_QTGUI_INCLUDE_DIR Path to "include/QtGui"
++# QT_QTMOTIF_INCLUDE_DIR Path to "include/QtMotif"
++# QT_QTNETWORK_INCLUDE_DIR Path to "include/QtNetwork"
++# QT_QTNSPLUGIN_INCLUDE_DIR Path to "include/QtNsPlugin"
++# QT_QTOPENGL_INCLUDE_DIR Path to "include/QtOpenGL"
++# QT_QTSQL_INCLUDE_DIR Path to "include/QtSql"
++# QT_QTXML_INCLUDE_DIR Path to "include/QtXml"
++# QT_QTSVG_INCLUDE_DIR Path to "include/QtSvg"
++# QT_QTTEST_INCLUDE_DIR Path to "include/QtTest"
++#
++# QT_LIBRARY_DIR Path to "lib" of Qt4
++#
++# QT_PLUGINS_DIR Path to "plugins" for Qt4
++#
++# For every library of Qt, a QT_QTFOO_LIBRARY variable is defined, with the full path to the library.
++#
++# So there are the following variables:
++# The Qt3Support library: QT_QT3SUPPORT_LIBRARY
++#
++# The QtAssistant library: QT_QTASSISTANT_LIBRARY
++#
++# The QtCore library: QT_QTCORE_LIBRARY
++#
++# The QtDBus library: QT_QTDBUS_LIBRARY
++#
++# The QtDesigner library: QT_QTDESIGNER_LIBRARY
++#
++# The QtDesignerComponents library: QT_QTDESIGNERCOMPONENTS_LIBRARY
++#
++# The QtGui library: QT_QTGUI_LIBRARY
++#
++# The QtMotif library: QT_QTMOTIF_LIBRARY
++#
++# The QtNetwork library: QT_QTNETWORK_LIBRARY
++#
++# The QtNsPLugin library: QT_QTNSPLUGIN_LIBRARY
++#
++# The QtOpenGL library: QT_QTOPENGL_LIBRARY
++#
++# The QtSql library: QT_QTSQL_LIBRARY
++#
++# The QtXml library: QT_QTXML_LIBRARY
++#
++# The QtSvg library: QT_QTSVG_LIBRARY
++#
++# The QtTest library: QT_QTTEST_LIBRARY
++#
++# The qtmain library for Windows QT_QTMAIN_LIBRARY
++#
++# The QtUiTools library: QT_QTUITOOLS_LIBRARY
++#
++# also defined, but NOT for general use are
++# QT_MOC_EXECUTABLE Where to find the moc tool.
++# QT_UIC_EXECUTABLE Where to find the uic tool.
++# QT_UIC3_EXECUTABLE Where to find the uic3 tool.
++# QT_RCC_EXECUTABLE Where to find the rcc tool
++# QT_DBUSCPP2XML_EXECUTABLE Where to find the qdbuscpp2xml tool.
++# QT_DBUSXML2CPP_EXECUTABLE Where to find the qdbusxml2cpp tool.
++#
++# QT_DOC_DIR Path to "doc" of Qt4
++# QT_MKSPECS_DIR Path to "mkspecs" of Qt4
++#
++#
++# These are around for backwards compatibility
++# they will be set
++# QT_WRAP_CPP Set true if QT_MOC_EXECUTABLE is found
++# QT_WRAP_UI Set true if QT_UIC_EXECUTABLE is found
++#
++# These variables do _NOT_ have any effect anymore (compared to FindQt.cmake)
++# QT_MT_REQUIRED Qt4 is now always multithreaded
++#
++# These variables are set to "" Because Qt structure changed
++# (They make no sense in Qt4)
++# QT_QT_LIBRARY Qt-Library is now split
++
++# Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
++# See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
++
++
++INCLUDE(CheckSymbolExists)
++INCLUDE(MacroAddFileDependencies)
++
++SET(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake)
++
++SET( QT_DEFINITIONS "")
++
++IF (WIN32)
++ SET(QT_DEFINITIONS -DQT_DLL)
++ENDIF(WIN32)
++
++SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE)
++
++# macro for asking qmake to process pro files
++MACRO(QT_QUERY_QMAKE outvar invar)
++ FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake/tmp.pro
++ "message(CMAKE_MESSAGE<$$${invar}>)")
++
++ EXECUTE_PROCESS(COMMAND ${QT_QMAKE_EXECUTABLE}
++ WORKING_DIRECTORY
++ ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake
++ OUTPUT_VARIABLE _qmake_query_output
++ ERROR_VARIABLE _qmake_query_output )
++
++ FILE(REMOVE_RECURSE
++ "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake")
++
++ STRING(REGEX REPLACE ".*CMAKE_MESSAGE<([^>]*).*" "\\1" ${outvar} "${_qmake_query_output}")
++ENDMACRO(QT_QUERY_QMAKE)
++
++# check for qmake
++FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake4 qmake-qt4 PATHS
++ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
++ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
++ $ENV{QTDIR}/bin
++)
++
++IF (QT_QMAKE_EXECUTABLE)
++
++ SET(QT4_QMAKE_FOUND FALSE)
++
++ EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION)
++
++ # check for qt3 qmake and then try and find qmake4 or qmake-qt4 in the path
++ IF("${QTVERSION}" MATCHES "Unknown")
++ SET(QT_QMAKE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE)
++ FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 PATHS
++ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
++ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
++ $ENV{QTDIR}/bin
++ )
++ IF(QT_QMAKE_EXECUTABLE)
++ EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE}
++ ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION)
++ ENDIF(QT_QMAKE_EXECUTABLE)
++ ENDIF("${QTVERSION}" MATCHES "Unknown")
++
++ # check that we found the Qt4 qmake, Qt3 qmake output won't match here
++ STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" qt_version_tmp "${QTVERSION}")
++ IF (qt_version_tmp)
++
++ # we need at least version 4.0.0
++ IF (NOT QT_MIN_VERSION)
++ SET(QT_MIN_VERSION "4.0.0")
++ ENDIF (NOT QT_MIN_VERSION)
++
++ #now parse the parts of the user given version string into variables
++ STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" req_qt_major_vers "${QT_MIN_VERSION}")
++ IF (NOT req_qt_major_vers)
++ MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT_MIN_VERSION}\", expected e.g. \"4.0.1\"")
++ ENDIF (NOT req_qt_major_vers)
++
++ # now parse the parts of the user given version string into variables
++ STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" req_qt_major_vers "${QT_MIN_VERSION}")
++ STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" req_qt_minor_vers "${QT_MIN_VERSION}")
++ STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_qt_patch_vers "${QT_MIN_VERSION}")
++
++ IF (NOT req_qt_major_vers EQUAL 4)
++ MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT_MIN_VERSION}\", major version 4 is required, e.g. \"4.0.1\"")
++ ENDIF (NOT req_qt_major_vers EQUAL 4)
++
++ # and now the version string given by qmake
++ STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" found_qt_major_vers "${QTVERSION}")
++ STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" found_qt_minor_vers "${QTVERSION}")
++ STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" found_qt_patch_vers "${QTVERSION}")
++
++ # compute an overall version number which can be compared at once
++ MATH(EXPR req_vers "${req_qt_major_vers}*10000 + ${req_qt_minor_vers}*100 + ${req_qt_patch_vers}")
++ MATH(EXPR found_vers "${found_qt_major_vers}*10000 + ${found_qt_minor_vers}*100 + ${found_qt_patch_vers}")
++
++ IF (found_vers LESS req_vers)
++ SET(QT4_QMAKE_FOUND FALSE)
++ SET(QT4_INSTALLED_VERSION_TOO_OLD TRUE)
++ ELSE (found_vers LESS req_vers)
++ SET(QT4_QMAKE_FOUND TRUE)
++ ENDIF (found_vers LESS req_vers)
++ ENDIF (qt_version_tmp)
++
++ENDIF (QT_QMAKE_EXECUTABLE)
++
++IF (QT4_QMAKE_FOUND)
++
++ # ask qmake for the library dir
++ # Set QT_LIBRARY_DIR
++ IF (NOT QT_LIBRARY_DIR)
++ EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
++ ARGS "-query QT_INSTALL_LIBS"
++ OUTPUT_VARIABLE QT_LIBRARY_DIR_TMP )
++ IF(EXISTS "${QT_LIBRARY_DIR_TMP}")
++ SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE PATH "Qt library dir")
++ ELSE(EXISTS "${QT_LIBRARY_DIR_TMP}")
++ MESSAGE("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_LIBS as ${QT_LIBRARY_DIR_TMP}")
++ MESSAGE("Warning: ${QT_LIBRARY_DIR_TMP} does NOT exist, Qt must NOT be installed correctly.")
++ ENDIF(EXISTS "${QT_LIBRARY_DIR_TMP}")
++ ENDIF(NOT QT_LIBRARY_DIR)
++
++ IF (APPLE)
++ IF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)
++ SET(QT_USE_FRAMEWORKS ON
++ CACHE BOOL "Set to ON if Qt build uses frameworks.")
++ ELSE (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)
++ SET(QT_USE_FRAMEWORKS OFF
++ CACHE BOOL "Set to ON if Qt build uses frameworks.")
++ ENDIF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)
++
++ MARK_AS_ADVANCED(QT_USE_FRAMEWORKS)
++ ENDIF (APPLE)
++
++ # ask qmake for the binary dir
++ IF (NOT QT_BINARY_DIR)
++ EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE}
++ ARGS "-query QT_INSTALL_BINS"
++ OUTPUT_VARIABLE qt_bins )
++ SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "")
++ ENDIF (NOT QT_BINARY_DIR)
++
++ # ask qmake for the include dir
++ IF (NOT QT_HEADERS_DIR)
++ EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
++ ARGS "-query QT_INSTALL_HEADERS"
++ OUTPUT_VARIABLE qt_headers )
++ SET(QT_HEADERS_DIR ${qt_headers} CACHE INTERNAL "")
++ ENDIF(NOT QT_HEADERS_DIR)
++
++
++ # ask qmake for the documentation directory
++ IF (NOT QT_DOC_DIR)
++ EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
++ ARGS "-query QT_INSTALL_DOCS"
++ OUTPUT_VARIABLE qt_doc_dir )
++ SET(QT_DOC_DIR ${qt_doc_dir} CACHE PATH "The location of the Qt docs")
++ ENDIF (NOT QT_DOC_DIR)
++
++ # ask qmake for the mkspecs directory
++ IF (NOT QT_MKSPECS_DIR)
++ EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
++ ARGS "-query QMAKE_MKSPECS"
++ OUTPUT_VARIABLE qt_mkspecs_dir )
++ SET(QT_MKSPECS_DIR ${qt_mkspecs_dir} CACHE PATH "The location of the Qt mkspecs")
++ ENDIF (NOT QT_MKSPECS_DIR)
++
++ # ask qmake for the plugins directory
++ IF (NOT QT_PLUGINS_DIR)
++ EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
++ ARGS "-query QT_INSTALL_PLUGINS"
++ OUTPUT_VARIABLE qt_plugins_dir )
++ SET(QT_PLUGINS_DIR ${qt_plugins_dir} CACHE PATH "The location of the Qt plugins")
++ ENDIF (NOT QT_PLUGINS_DIR)
++ ########################################
++ #
++ # Setting the INCLUDE-Variables
++ #
++ ########################################
++
++ FIND_PATH(QT_QTCORE_INCLUDE_DIR QtGlobal
++ ${QT_HEADERS_DIR}/QtCore
++ ${QT_LIBRARY_DIR}/QtCore.framework/Headers
++ NO_DEFAULT_PATH
++ )
++
++ # Set QT_INCLUDE_DIR by removine "/QtCore" in the string ${QT_QTCORE_INCLUDE_DIR}
++ IF( QT_QTCORE_INCLUDE_DIR AND NOT QT_INCLUDE_DIR)
++ IF (QT_USE_FRAMEWORKS)
++ SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR})
++ ELSE (QT_USE_FRAMEWORKS)
++ STRING( REGEX REPLACE "/QtCore$" "" qt4_include_dir ${QT_QTCORE_INCLUDE_DIR})
++ SET( QT_INCLUDE_DIR ${qt4_include_dir} CACHE PATH "")
++ ENDIF (QT_USE_FRAMEWORKS)
++ ENDIF( QT_QTCORE_INCLUDE_DIR AND NOT QT_INCLUDE_DIR)
++
++ IF( NOT QT_INCLUDE_DIR)
++ IF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED)
++ MESSAGE( FATAL_ERROR "Could NOT find QtGlobal header")
++ ENDIF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED)
++ ENDIF( NOT QT_INCLUDE_DIR)
++
++ #############################################
++ #
++ # Find out what window system we're using
++ #
++ #############################################
++ # Save required includes variable
++ SET(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
++ # Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES
++ SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_INCLUDE_DIR}")
++ # Check for Window system symbols (note: only one should end up being set)
++ CHECK_SYMBOL_EXISTS(Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11)
++ CHECK_SYMBOL_EXISTS(Q_WS_MAC "QtCore/qglobal.h" Q_WS_MAC)
++ CHECK_SYMBOL_EXISTS(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN)
++
++ IF (QT_QTCOPY_REQUIRED)
++ CHECK_SYMBOL_EXISTS(QT_IS_QTCOPY "QtCore/qglobal.h" QT_KDE_QT_COPY)
++ IF (NOT QT_IS_QTCOPY)
++ MESSAGE(FATAL_ERROR "qt-copy is required, but hasn't been found")
++ ENDIF (NOT QT_IS_QTCOPY)
++ ENDIF (QT_QTCOPY_REQUIRED)
++
++ # Restore CMAKE_REQUIRED_INCLUDES variable
++ SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
++ #
++ #############################################
++
++ IF (QT_USE_FRAMEWORKS)
++ SET(QT_DEFINITIONS ${QT_DEFINITIONS} -F${QT_LIBRARY_DIR} -L${QT_LIBRARY_DIR} )
++ ENDIF (QT_USE_FRAMEWORKS)
++
++ # Set QT_QT3SUPPORT_INCLUDE_DIR
++ FIND_PATH(QT_QT3SUPPORT_INCLUDE_DIR Qt3Support
++ PATHS
++ ${QT_INCLUDE_DIR}/Qt3Support
++ ${QT_LIBRARY_DIR}/Qt3Support.framework/Headers
++ NO_DEFAULT_PATH
++ )
++
++ # Set QT_QT_INCLUDE_DIR
++ FIND_PATH(QT_QT_INCLUDE_DIR qglobal.h
++ PATHS
++ ${QT_INCLUDE_DIR}/Qt
++ ${QT_LIBRARY_DIR}/QtCore.framework/Headers
++ NO_DEFAULT_PATH
++ )
++
++ # Set QT_QTGUI_INCLUDE_DIR
++ FIND_PATH(QT_QTGUI_INCLUDE_DIR QtGui
++ PATHS
++ ${QT_INCLUDE_DIR}/QtGui
++ ${QT_LIBRARY_DIR}/QtGui.framework/Headers
++ NO_DEFAULT_PATH
++ )
++
++ # Set QT_QTSVG_INCLUDE_DIR
++ FIND_PATH(QT_QTSVG_INCLUDE_DIR QtSvg
++ PATHS
++ ${QT_INCLUDE_DIR}/QtSvg
++ ${QT_LIBRARY_DIR}/QtSvg.framework/Headers
++ NO_DEFAULT_PATH
++ )
++
++ # Set QT_QTTEST_INCLUDE_DIR
++ FIND_PATH(QT_QTTEST_INCLUDE_DIR QtTest
++ PATHS
++ ${QT_INCLUDE_DIR}/QtTest
++ ${QT_LIBRARY_DIR}/QtTest.framework/Headers
++ NO_DEFAULT_PATH
++ )
++
++ # Set QT_QTUITOOLS_INCLUDE_DIR
++ FIND_PATH(QT_QTUITOOLS_INCLUDE_DIR QtUiTools
++ PATHS
++ ${QT_INCLUDE_DIR}/QtUiTools
++ ${QT_LIBRARY_DIR}/QtUiTools.framework/Headers
++ NO_DEFAULT_PATH
++ )
++
++
++
++ # Set QT_QTMOTIF_INCLUDE_DIR
++ IF(Q_WS_X11)
++ FIND_PATH(QT_QTMOTIF_INCLUDE_DIR QtMotif PATHS ${QT_INCLUDE_DIR}/QtMotif NO_DEFAULT_PATH )
++ ENDIF(Q_WS_X11)
++
++ # Set QT_QTNETWORK_INCLUDE_DIR
++ FIND_PATH(QT_QTNETWORK_INCLUDE_DIR QtNetwork
++ PATHS
++ ${QT_INCLUDE_DIR}/QtNetwork
++ ${QT_LIBRARY_DIR}/QtNetwork.framework/Headers
++ NO_DEFAULT_PATH
++ )
++
++ # Set QT_QTNSPLUGIN_INCLUDE_DIR
++ FIND_PATH(QT_QTNSPLUGIN_INCLUDE_DIR QtNsPlugin
++ PATHS
++ ${QT_INCLUDE_DIR}/QtNsPlugin
++ ${QT_LIBRARY_DIR}/QtNsPlugin.framework/Headers
++ NO_DEFAULT_PATH
++ )
++
++ # Set QT_QTOPENGL_INCLUDE_DIR
++ FIND_PATH(QT_QTOPENGL_INCLUDE_DIR QtOpenGL
++ PATHS
++ ${QT_INCLUDE_DIR}/QtOpenGL
++ ${QT_LIBRARY_DIR}/QtOpenGL.framework/Headers
++ NO_DEFAULT_PATH
++ )
++
++ # Set QT_QTSQL_INCLUDE_DIR
++ FIND_PATH(QT_QTSQL_INCLUDE_DIR QtSql
++ PATHS
++ ${QT_INCLUDE_DIR}/QtSql
++ ${QT_LIBRARY_DIR}/QtSql.framework/Headers
++ NO_DEFAULT_PATH
++ )
++
++ # Set QT_QTXML_INCLUDE_DIR
++ FIND_PATH(QT_QTXML_INCLUDE_DIR QtXml
++ PATHS
++ ${QT_INCLUDE_DIR}/QtXml
++ ${QT_LIBRARY_DIR}/QtXml.framework/Headers
++ NO_DEFAULT_PATH
++ )
++
++ # Set QT_QTASSISTANT_INCLUDE_DIR
++ FIND_PATH(QT_QTASSISTANT_INCLUDE_DIR QtAssistant
++ PATHS
++ ${QT_INCLUDE_DIR}/QtAssistant
++ ${QT_HEADERS_DIR}/QtAssistant
++ NO_DEFAULT_PATH
++ )
++
++ # Set QT_QTDESIGNER_INCLUDE_DIR
++ FIND_PATH(QT_QTDESIGNER_INCLUDE_DIR QDesignerComponents
++ PATHS
++ ${QT_INCLUDE_DIR}/QtDesigner
++ ${QT_HEADERS_DIR}/QtDesigner
++ NO_DEFAULT_PATH
++ )
++
++ # Set QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR
++ FIND_PATH(QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR QDesignerComponents
++ PATHS
++ ${QT_INCLUDE_DIR}/QtDesigner
++ ${QT_HEADERS_DIR}/QtDesigner
++ NO_DEFAULT_PATH
++ )
++
++
++ # Set QT_QTDBUS_INCLUDE_DIR
++ FIND_PATH(QT_QTDBUS_INCLUDE_DIR QtDBus
++ PATHS
++ ${QT_INCLUDE_DIR}/QtDBus
++ ${QT_HEADERS_DIR}/QtDBus
++ NO_DEFAULT_PATH
++ )
++
++ # Make variables changeble to the advanced user
++ MARK_AS_ADVANCED( QT_LIBRARY_DIR QT_INCLUDE_DIR QT_QT_INCLUDE_DIR QT_DOC_DIR QT_MKSPECS_DIR QT_PLUGINS_DIR)
++
++ # Set QT_INCLUDES
++ SET( QT_INCLUDES ${QT_INCLUDE_DIR} ${QT_QT_INCLUDE_DIR} ${QT_MKSPECS_DIR}/default )
++
++
++ ########################################
++ #
++ # Setting the LIBRARY-Variables
++ #
++ ########################################
++
++ IF (QT_USE_FRAMEWORKS)
++ # If FIND_LIBRARY found libraries in Apple frameworks, we would NOT have
++ # to jump through these hoops.
++ SET(QT_QTCORE_LIBRARY "-F${QT_LIBRARY_DIR} -framework QtCore" CACHE STRING "The QtCore library.")
++ SET(QT_QT3SUPPORT_LIBRARY "-framework Qt3Support" CACHE STRING "The Qt3Support library.")
++ SET(QT_QTGUI_LIBRARY "-framework QtGui" CACHE STRING "The QtGui library.")
++ SET(QT_QTNETWORK_LIBRARY "-framework QtNetwork" CACHE STRING "The QtNetwork library.")
++ SET(QT_QTOPENGL_LIBRARY "-framework QtOpenGL" CACHE STRING "The QtOpenGL library.")
++ SET(QT_QTSQL_LIBRARY "-framework QtSql" CACHE STRING "The QtSql library.")
++ SET(QT_QTXML_LIBRARY "-framework QtXml" CACHE STRING "The QtXml library.")
++ SET(QT_QTSVG_LIBRARY "-framework QtSvg" CACHE STRING "The QtSvg library.")
++ SET(QT_QTDBUS_LIBRARY "-framework QtDBus" CACHE STRING "The QtDBus library.")
++ SET(QT_QTTEST_LIBRARY "-framework QtTest" CACHE STRING "The QtTest library.")
++
++ # WTF? why don't we have frameworks? :P
++ SET(QT_QTUITOOLS_LIBRARY "-L${QT_LIBRARY_DIR} -lQtUiTools" CACHE STRING "The QtUiTools library.")
++
++ ELSE (QT_USE_FRAMEWORKS)
++
++ # Set QT_QTCORE_LIBRARY by searching for a lib with "QtCore." as part of the filename
++ FIND_LIBRARY(QT_QTCORE_LIBRARY NAMES QtCore QtCore4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH )
++
++ # Set QT_QT3SUPPORT_LIBRARY
++ FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY NAMES Qt3Support Qt3Support4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++
++ # Set QT_QTGUI_LIBRARY
++ FIND_LIBRARY(QT_QTGUI_LIBRARY NAMES QtGui QtGui4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++
++ # Set QT_QTMOTIF_LIBRARY
++ IF(Q_WS_X11)
++ FIND_LIBRARY(QT_QTMOTIF_LIBRARY NAMES QtMotif PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++ ENDIF(Q_WS_X11)
++
++ # Set QT_QTNETWORK_LIBRARY
++ FIND_LIBRARY(QT_QTNETWORK_LIBRARY NAMES QtNetwork QtNetwork4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++
++ # Set QT_QTNSPLUGIN_LIBRARY
++ FIND_LIBRARY(QT_QTNSPLUGIN_LIBRARY NAMES QtNsPlugin PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++
++ # Set QT_QTOPENGL_LIBRARY
++ FIND_LIBRARY(QT_QTOPENGL_LIBRARY NAMES QtOpenGL QtOpenGL4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++
++ # Set QT_QTSQL_LIBRARY
++ FIND_LIBRARY(QT_QTSQL_LIBRARY NAMES QtSql QtSql4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++
++ # Set QT_QTXML_LIBRARY
++ FIND_LIBRARY(QT_QTXML_LIBRARY NAMES QtXml QtXml4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++
++ # Set QT_QTSVG_LIBRARY
++ FIND_LIBRARY(QT_QTSVG_LIBRARY NAMES QtSvg QtSvg4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++
++ # Set QT_QTUITOOLS_LIBRARY
++ FIND_LIBRARY(QT_QTUITOOLS_LIBRARY NAMES QtUiTools QtUiTools4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++
++ # Set QT_QTTEST_LIBRARY
++ FIND_LIBRARY(QT_QTTEST_LIBRARY NAMES QtTest QtTest4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++
++ FIND_LIBRARY(QT_QTDBUS_LIBRARY NAMES QtDBus QtDBus4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++
++ IF(MSVC)
++ FIND_LIBRARY(QT_QTCORE_LIBRARY_DEBUG NAMES QtCored4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++ FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY_DEBUG NAMES Qt3Supportd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++ FIND_LIBRARY(QT_QTGUI_LIBRARY_DEBUG NAMES QtGuid4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++ FIND_LIBRARY(QT_QTNETWORK_LIBRARY_DEBUG NAMES QtNetworkd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++ FIND_LIBRARY(QT_QTOPENGL_LIBRARY_DEBUG NAMES QtOpenGLd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++ FIND_LIBRARY(QT_QTSQL_LIBRARY_DEBUG NAMES QtSqld4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++ FIND_LIBRARY(QT_QTXML_LIBRARY_DEBUG NAMES QtXmld4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++ FIND_LIBRARY(QT_QTSVG_LIBRARY_DEBUG NAMES QtSvgd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++ FIND_LIBRARY(QT_QTUITOOLS_LIBRARY_DEBUG NAMES QtUiToolsd QtUiToolsd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++ FIND_LIBRARY(QT_QTTEST_LIBRARY_DEBUG NAMES QtTestd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++ FIND_LIBRARY(QT_QTDBUS_LIBRARY_DEBUG NAMES QtDBusd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++ FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistantClientd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++ FIND_LIBRARY(QT_QTMAIN_LIBRARY_DEBUG NAMES qtmaind PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++ ENDIF(MSVC)
++
++ ENDIF (QT_USE_FRAMEWORKS)
++
++ IF( NOT QT_QTCORE_LIBRARY )
++ IF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED)
++ MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check CMakeFiles/CMakeError.log for more details.")
++ ENDIF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED)
++ ENDIF( NOT QT_QTCORE_LIBRARY )
++
++ # Set QT_QTASSISTANT_LIBRARY
++ FIND_LIBRARY(QT_QTASSISTANT_LIBRARY NAMES QtAssistantClient QtAssistantClient4 QtAssistant QtAssistant4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++
++ # Set QT_QTDESIGNER_LIBRARY
++ FIND_LIBRARY(QT_QTDESIGNER_LIBRARY NAMES QtDesigner QtDesigner4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++
++ # Set QT_QTDESIGNERCOMPONENTS_LIBRARY
++ FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY NAMES QtDesignerComponents QtDesignerComponents4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++
++ # Set QT_QTMAIN_LIBRARY
++ IF(WIN32)
++ FIND_LIBRARY(QT_QTMAIN_LIBRARY NAMES qtmain PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
++ ENDIF(WIN32)
++
++ ############################################
++ #
++ # Check the existence of the libraries.
++ #
++ ############################################
++
++ MACRO (_QT4_ADJUST_LIB_VARS basename)
++ IF (QT_${basename}_LIBRARY OR QT_${basename}_LIBRARY_DEBUG)
++
++ IF(MSVC)
++
++ # Both set
++ IF (QT_${basename}_LIBRARY AND QT_${basename}_LIBRARY_DEBUG)
++ SET(QT_${basename}_LIBRARY optimized ${QT_${basename}_LIBRARY} debug ${QT_${basename}_LIBRARY_DEBUG})
++ ENDIF (QT_${basename}_LIBRARY AND QT_${basename}_LIBRARY_DEBUG)
++
++ # Only debug was found
++ IF (NOT QT_${basename}_LIBRARY AND QT_${basename}_LIBRARY_DEBUG)
++ SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_DEBUG})
++ ENDIF (NOT QT_${basename}_LIBRARY AND QT_${basename}_LIBRARY_DEBUG)
++
++ # Hmm, is this used anywhere ? Yes, in UseQt4.cmake. We are currently incompatible :-(
++ SET(QT_${basename}_LIBRARIES optimized ${QT_${basename}_LIBRARY} debug ${QT_${basename}_LIBRARY_DEBUG})
++
++ ENDIF(MSVC)
++
++ SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE FILEPATH "The Qt ${basename} library")
++
++ IF (QT_${basename}_LIBRARY)
++ SET(QT_${basename}_FOUND 1)
++ ENDIF (QT_${basename}_LIBRARY)
++
++ ENDIF (QT_${basename}_LIBRARY OR QT_${basename}_LIBRARY_DEBUG)
++
++ IF (QT_${basename}_INCLUDE_DIR)
++ #add the include directory to QT_INCLUDES
++ SET(QT_INCLUDES ${QT_INCLUDES} "${QT_${basename}_INCLUDE_DIR}")
++ ENDIF (QT_${basename}_INCLUDE_DIR)
++
++ # Make variables changeble to the advanced user
++ MARK_AS_ADVANCED(QT_${basename}_LIBRARY QT_${basename}_INCLUDE_DIR)
++ ENDMACRO (_QT4_ADJUST_LIB_VARS)
++
++
++ # Set QT_xyz_LIBRARY variable and add
++ # library include path to QT_INCLUDES
++ _QT4_ADJUST_LIB_VARS(QTCORE)
++ _QT4_ADJUST_LIB_VARS(QTGUI)
++ _QT4_ADJUST_LIB_VARS(QT3SUPPORT)
++ _QT4_ADJUST_LIB_VARS(QTASSISTANT)
++ _QT4_ADJUST_LIB_VARS(QTDESIGNER)
++ _QT4_ADJUST_LIB_VARS(QTDESIGNERCOMPONENTS)
++ _QT4_ADJUST_LIB_VARS(QTNETWORK)
++ _QT4_ADJUST_LIB_VARS(QTNSPLUGIN)
++ _QT4_ADJUST_LIB_VARS(QTOPENGL)
++ _QT4_ADJUST_LIB_VARS(QTSQL)
++ _QT4_ADJUST_LIB_VARS(QTXML)
++ _QT4_ADJUST_LIB_VARS(QTSVG)
++ _QT4_ADJUST_LIB_VARS(QTUITOOLS)
++ _QT4_ADJUST_LIB_VARS(QTTEST)
++ _QT4_ADJUST_LIB_VARS(QTDBUS)
++
++
++ # platform dependent libraries
++ IF(Q_WS_X11)
++ _QT4_ADJUST_LIB_VARS(QTMOTIF)
++ ENDIF(Q_WS_X11)
++ IF(WIN32)
++ _QT4_ADJUST_LIB_VARS(QTMAIN)
++ ENDIF(WIN32)
++
++
++ #######################################
++ #
++ # Check the executables of Qt
++ # ( moc, uic, rcc )
++ #
++ #######################################
++
++
++ # find moc and uic using qmake
++ QT_QUERY_QMAKE(QT_MOC_EXECUTABLE_INTERNAL "QMAKE_MOC")
++ QT_QUERY_QMAKE(QT_UIC_EXECUTABLE_INTERNAL "QMAKE_UIC")
++
++ FILE(TO_CMAKE_PATH
++ "${QT_MOC_EXECUTABLE_INTERNAL}" QT_MOC_EXECUTABLE_INTERNAL)
++ FILE(TO_CMAKE_PATH
++ "${QT_UIC_EXECUTABLE_INTERNAL}" QT_UIC_EXECUTABLE_INTERNAL)
++
++ SET(QT_MOC_EXECUTABLE
++ ${QT_MOC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The moc executable")
++ SET(QT_UIC_EXECUTABLE
++ ${QT_UIC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The uic executable")
++
++ FIND_PROGRAM(QT_UIC3_EXECUTABLE
++ NAMES uic3
++ PATHS ${QT_BINARY_DIR}
++ NO_DEFAULT_PATH
++ )
++
++ FIND_PROGRAM(QT_RCC_EXECUTABLE
++ NAMES rcc
++ PATHS ${QT_BINARY_DIR}
++ NO_DEFAULT_PATH
++ )
++
++ FIND_PROGRAM(QT_DBUSCPP2XML_EXECUTABLE
++ NAMES qdbuscpp2xml
++ PATHS ${QT_BINARY_DIR}
++ NO_DEFAULT_PATH
++ )
++
++ FIND_PROGRAM(QT_DBUSXML2CPP_EXECUTABLE
++ NAMES qdbusxml2cpp
++ PATHS ${QT_BINARY_DIR}
++ NO_DEFAULT_PATH
++ )
++
++ IF (QT_MOC_EXECUTABLE)
++ SET(QT_WRAP_CPP "YES")
++ ENDIF (QT_MOC_EXECUTABLE)
++
++ IF (QT_UIC_EXECUTABLE)
++ SET(QT_WRAP_UI "YES")
++ ENDIF (QT_UIC_EXECUTABLE)
++
++
++
++ MARK_AS_ADVANCED( QT_UIC_EXECUTABLE QT_UIC3_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_DBUSXML2CPP_EXECUTABLE QT_DBUSCPP2XML_EXECUTABLE)
++
++ ######################################
++ #
++ # Macros for building Qt files
++ #
++ ######################################
++
++ MACRO (QT4_GET_MOC_INC_DIRS _moc_INC_DIRS)
++ SET(${_moc_INC_DIRS})
++ GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES)
++
++ FOREACH(_current ${_inc_DIRS})
++ SET(${_moc_INC_DIRS} ${${_moc_INC_DIRS}} "-I" ${_current})
++ ENDFOREACH(_current ${_inc_DIRS})
++ ENDMACRO(QT4_GET_MOC_INC_DIRS)
++
++
++ MACRO (QT4_GENERATE_MOC infile outfile )
++ # get include dirs
++ QT4_GET_MOC_INC_DIRS(moc_includes)
++
++ GET_FILENAME_COMPONENT(abs_infile ${infile} ABSOLUTE)
++
++ ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
++ COMMAND ${QT_MOC_EXECUTABLE}
++ ARGS ${moc_includes} -o ${outfile} ${abs_infile}
++ DEPENDS ${abs_infile})
++
++ SET_SOURCE_FILES_PROPERTIES(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # dont run automoc on this file
++
++ MACRO_ADD_FILE_DEPENDENCIES(${abs_infile} ${outfile})
++ ENDMACRO (QT4_GENERATE_MOC)
++
++
++ # QT4_WRAP_CPP(outfiles inputfile ... )
++ # TODO perhaps add support for -D, -U and other minor options
++
++ MACRO (QT4_WRAP_CPP outfiles )
++ # get include dirs
++ QT4_GET_MOC_INC_DIRS(moc_includes)
++
++ FOREACH (it ${ARGN})
++ GET_FILENAME_COMPONENT(it ${it} ABSOLUTE)
++ GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
++
++ SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/moc_${outfile}.cxx)
++ ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
++ COMMAND ${QT_MOC_EXECUTABLE}
++ ARGS ${moc_includes} -o ${outfile} ${it}
++ DEPENDS ${it})
++ SET(${outfiles} ${${outfiles}} ${outfile})
++ ENDFOREACH(it)
++
++ ENDMACRO (QT4_WRAP_CPP)
++
++
++ # QT4_WRAP_UI(outfiles inputfile ... )
++
++ MACRO (QT4_WRAP_UI outfiles )
++
++ FOREACH (it ${ARGN})
++ GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
++ GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
++ SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h)
++ ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
++ COMMAND ${QT_UIC_EXECUTABLE}
++ ARGS -o ${outfile} ${infile}
++ MAIN_DEPENDENCY ${infile})
++ SET(${outfiles} ${${outfiles}} ${outfile})
++ ENDFOREACH (it)
++
++ ENDMACRO (QT4_WRAP_UI)
++
++
++ # QT4_ADD_RESOURCE(outfiles inputfile ... )
++ # TODO perhaps consider adding support for compression and root options to rcc
++
++ MACRO (QT4_ADD_RESOURCES outfiles )
++
++ FOREACH (it ${ARGN})
++ GET_FILENAME_COMPONENT(outfilename ${it} NAME_WE)
++ GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
++ GET_FILENAME_COMPONENT(rc_path ${infile} PATH)
++ SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx)
++ # parse file for dependencies
++ FILE(READ "${infile}" _RC_FILE_CONTENTS)
++ STRING(REGEX MATCHALL "<file>[^<]*" _RC_FILES "${_RC_FILE_CONTENTS}")
++ SET(_RC_DEPENDS)
++ FOREACH(_RC_FILE ${_RC_FILES})
++ STRING(REGEX REPLACE "^<file>" "" _RC_FILE "${_RC_FILE}")
++ SET(_RC_DEPENDS ${_RC_DEPENDS} "${rc_path}/${_RC_FILE}")
++ ENDFOREACH(_RC_FILE)
++ ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
++ COMMAND ${QT_RCC_EXECUTABLE}
++ ARGS -name ${outfilename} -o ${outfile} ${infile}
++ MAIN_DEPENDENCY ${infile}
++ DEPENDS ${_RC_DEPENDS})
++ SET(${outfiles} ${${outfiles}} ${outfile})
++ ENDFOREACH (it)
++
++ ENDMACRO (QT4_ADD_RESOURCES)
++
++ MACRO(QT4_ADD_DBUS_INTERFACE _sources _interface _basename)
++ GET_FILENAME_COMPONENT(_infile ${_interface} ABSOLUTE)
++ SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
++ SET(_impl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
++ SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc)
++
++ ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header}
++ COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -p ${_basename} ${_infile}
++ DEPENDS ${_infile})
++
++ SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE)
++
++ QT4_GENERATE_MOC(${_header} ${_moc})
++
++ SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc})
++ MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc})
++
++ ENDMACRO(QT4_ADD_DBUS_INTERFACE)
++
++
++ MACRO(QT4_ADD_DBUS_INTERFACES _sources)
++ FOREACH (_current_FILE ${ARGN})
++ GET_FILENAME_COMPONENT(_infile ${_current_FILE} ABSOLUTE)
++
++ # get the part before the ".xml" suffix
++ STRING(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2" _basename ${_current_FILE})
++ STRING(TOLOWER ${_basename} _basename)
++
++ QT4_ADD_DBUS_INTERFACE(${_sources} ${_infile} ${_basename}interface)
++ ENDFOREACH (_current_FILE)
++ ENDMACRO(QT4_ADD_DBUS_INTERFACES)
++
++
++ MACRO(QT4_GENERATE_DBUS_INTERFACE _header) # _customName )
++ SET(_customName "${ARGV1}")
++ GET_FILENAME_COMPONENT(_in_file ${_header} ABSOLUTE)
++ GET_FILENAME_COMPONENT(_basename ${_header} NAME_WE)
++
++ IF (_customName)
++ SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_customName})
++ ELSE (_customName)
++ SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.xml)
++ ENDIF (_customName)
++
++ ADD_CUSTOM_COMMAND(OUTPUT ${_target}
++ COMMAND ${QT_DBUSCPP2XML_EXECUTABLE} ${_in_file} > ${_target}
++ DEPENDS ${_in_file}
++ )
++ ENDMACRO(QT4_GENERATE_DBUS_INTERFACE)
++
++
++ MACRO(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optionalBasename )
++ GET_FILENAME_COMPONENT(_infile ${_xml_file} ABSOLUTE)
++
++ SET(_optionalBasename "${ARGV4}")
++ IF (_optionalBasename)
++ SET(_basename ${_optionalBasename} )
++ ELSE (_optionalBasename)
++ STRING(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2adaptor" _basename ${_infile})
++ STRING(TOLOWER ${_basename} _basename)
++ ENDIF (_optionalBasename)
++
++ SET(_optionalClassName "${ARGV5}")
++ SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
++ SET(_impl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
++ SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc)
++
++ IF(_optionalClassName)
++ ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header}
++ COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -c ${_optionalClassName} -i ${_include} -l ${_parentClass} ${_infile}
++ DEPENDS ${_infile}
++ )
++ ELSE(_optionalClassName)
++ ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header}
++ COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -i ${_include} -l ${_parentClass} ${_infile}
++ DEPENDS ${_infile}
++ )
++ ENDIF(_optionalClassName)
++
++ QT4_GENERATE_MOC(${_header} ${_moc})
++ SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE)
++ MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc})
++
++ SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc})
++ ENDMACRO(QT4_ADD_DBUS_ADAPTOR)
++
++ MACRO(QT4_AUTOMOC)
++ QT4_GET_MOC_INC_DIRS(_moc_INCS)
++
++ SET(_matching_FILES )
++ FOREACH (_current_FILE ${ARGN})
++
++ GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE)
++ # if "SKIP_AUTOMOC" is set to true, we will not handle this file here.
++ # here. this is required to make bouic work correctly:
++ # we need to add generated .cpp files to the sources (to compile them),
++ # but we cannot let automoc handle them, as the .cpp files don't exist yet when
++ # cmake is run for the very first time on them -> however the .cpp files might
++ # exist at a later run. at that time we need to skip them, so that we don't add two
++ # different rules for the same moc file
++ GET_SOURCE_FILE_PROPERTY(_skip ${_abs_FILE} SKIP_AUTOMOC)
++
++ IF ( NOT _skip AND EXISTS ${_abs_FILE} )
++
++ FILE(READ ${_abs_FILE} _contents)
++
++ GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH)
++
++ STRING(REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _match "${_contents}")
++ IF(_match)
++ FOREACH (_current_MOC_INC ${_match})
++ STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}")
++
++ GET_filename_component(_basename ${_current_MOC} NAME_WE)
++ # SET(_header ${CMAKE_CURRENT_SOURCE_DIR}/${_basename}.h)
++ SET(_header ${_abs_PATH}/${_basename}.h)
++ SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC})
++ ADD_CUSTOM_COMMAND(OUTPUT ${_moc}
++ COMMAND ${QT_MOC_EXECUTABLE}
++ ARGS ${_moc_INCS} ${_header} -o ${_moc}
++ DEPENDS ${_header}
++ )
++
++ MACRO_ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc})
++ ENDFOREACH (_current_MOC_INC)
++ ENDIF(_match)
++ ENDIF ( NOT _skip AND EXISTS ${_abs_FILE} )
++ ENDFOREACH (_current_FILE)
++ ENDMACRO(QT4_AUTOMOC)
++
++
++
++ ######################################
++ #
++ # decide if Qt got found
++ #
++ ######################################
++
++ # if the includes,libraries,moc,uic and rcc are found then we have it
++ IF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE)
++ SET( QT4_FOUND "YES" )
++ IF( NOT Qt4_FIND_QUIETLY)
++ MESSAGE(STATUS "Found Qt-Version ${QTVERSION}")
++ ENDIF( NOT Qt4_FIND_QUIETLY)
++ ELSE( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE)
++ SET( QT4_FOUND "NO")
++ SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE)
++ IF( Qt4_FIND_REQUIRED)
++ IF ( NOT QT_LIBRARY_DIR )
++ MESSAGE(STATUS "Qt libraries NOT found!")
++ ENDIF(NOT QT_LIBRARY_DIR )
++ IF ( NOT QT_INCLUDE_DIR )
++ MESSAGE(STATUS "Qt includes NOT found!")
++ ENDIF( NOT QT_INCLUDE_DIR )
++ IF ( NOT QT_MOC_EXECUTABLE )
++ MESSAGE(STATUS "Qt's moc NOT found!")
++ ENDIF( NOT QT_MOC_EXECUTABLE )
++ IF ( NOT QT_UIC_EXECUTABLE )
++ MESSAGE(STATUS "Qt's uic NOT found!")
++ ENDIF( NOT QT_UIC_EXECUTABLE )
++ IF ( NOT QT_RCC_EXECUTABLE )
++ MESSAGE(STATUS "Qt's rcc NOT found!")
++ ENDIF( NOT QT_RCC_EXECUTABLE )
++ MESSAGE( FATAL_ERROR "Qt libraries, includes, moc, uic or/and rcc NOT found!")
++ ENDIF( Qt4_FIND_REQUIRED)
++ ENDIF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE)
++ SET(QT_FOUND ${QT4_FOUND})
++
++
++ #######################################
++ #
++ # System dependent settings
++ #
++ #######################################
++ # for unix add X11 stuff
++ IF(UNIX)
++ # on OS X X11 may not be required
++ IF (Q_WS_X11)
++ FIND_PACKAGE(X11)
++ ENDIF (Q_WS_X11)
++ FIND_PACKAGE(Threads)
++ SET(QT_QTCORE_LIBRARY ${QT_QTCORE_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
++ ENDIF(UNIX)
++
++
++ #######################################
++ #
++ # compatibility settings
++ #
++ #######################################
++ # Backwards compatibility for CMake1.4 and 1.2
++ SET (QT_MOC_EXE ${QT_MOC_EXECUTABLE} )
++ SET (QT_UIC_EXE ${QT_UIC_EXECUTABLE} )
++
++ SET( QT_QT_LIBRARY "")
++
++ELSE(QT4_QMAKE_FOUND)
++
++ SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE)
++ IF(Qt4_FIND_REQUIRED)
++ IF(QT4_INSTALLED_VERSION_TOO_OLD)
++ MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too old, at least version ${QT_MIN_VERSION} is required")
++ ELSE(QT4_INSTALLED_VERSION_TOO_OLD)
++ MESSAGE( FATAL_ERROR "Qt qmake not found!")
++ ENDIF(QT4_INSTALLED_VERSION_TOO_OLD)
++ ELSE(Qt4_FIND_REQUIRED)
++ IF(QT4_INSTALLED_VERSION_TOO_OLD AND NOT Qt4_FIND_QUIETLY)
++ MESSAGE(STATUS "The installed Qt version ${QTVERSION} is too old, at least version ${QT_MIN_VERSION} is required")
++ ENDIF(QT4_INSTALLED_VERSION_TOO_OLD AND NOT Qt4_FIND_QUIETLY)
++ ENDIF(Qt4_FIND_REQUIRED)
++
++ENDIF (QT4_QMAKE_FOUND)
++
+diff -Nur strigi-0.3.11/CMakeLists.txt strigi-0.3.11.new/CMakeLists.txt
+--- strigi-0.3.11/CMakeLists.txt 2006-12-12 23:50:34.000000000 +0100
++++ strigi-0.3.11.new/CMakeLists.txt 2007-01-15 13:47:51.000000000 +0100
+@@ -23,7 +23,15 @@
+ SET ( STRIGI_EXTRA_LIB_DIRECTORY "" CACHE STRING "Extra library directories to search in" )
+ SET (CMAKE_INCLUDE_PATH "${STRIGI_EXTRA_INC_DIRECTORY};${CMAKE_INCLUDE_PATH}")
+ SET (CMAKE_LIBRARY_PATH "${STRIGI_EXTRA_LIB_DIRECTORY};${CMAKE_LIBRARY_PATH}")
+-SET (LIB_DESTINATION "lib" CACHE STRING "Library directory suffix")
++set (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
++SET (LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Library directory name" FORCE)
++# Always include srcdir and builddir in include path
++# This saves typing ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY} in about every subdir
++# since cmake 2.4.0
++set(CMAKE_INCLUDE_CURRENT_DIR ON)
++
++set( KDELIBSUFF ${LIB_SUFFIX} )
++set( LIBINSTALLDIR ${LIB_DESTINATION})
+
+ IF(MSVC)
+ ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
+@@ -45,6 +53,8 @@
+ "enable dbus support"
+ ON)
+
++OPTION(ENABLE_SQLITE "enable sqlite support" OFF)
++
+ OPTION(ENABLE_LOG4CXX
+ "enable log4cxx support for advanced logging"
+ OFF)
+@@ -63,7 +73,9 @@
+ find_package(XERCESC)
+ find_package(Magic REQUIRED)
+ find_package(HyperEstraier)
+-find_package(SQLite)
++if(ENABLE_SQLITE)
++ find_package(SQLite)
++endif(ENABLE_SQLITE)
+ find_package(Libxml2)
+ find_package(XAttr)
+ set(QT_MIN_VERSION "4.2.0")
+@@ -84,6 +96,8 @@
+ find_package (Log4cxx)
+ endif (ENABLE_LOG4CXX)
+
++configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
++include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
+
+ CONFIGURE_FILE(
+ "${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in"
+diff -Nur strigi-0.3.11/config.h.cmake strigi-0.3.11.new/config.h.cmake
+--- strigi-0.3.11/config.h.cmake 1970-01-01 01:00:00.000000000 +0100
++++ strigi-0.3.11.new/config.h.cmake 2007-01-14 08:55:14.000000000 +0100
+@@ -0,0 +1,5 @@
++/* config.h. Generated by cmake from config.h.cmake */
++
++#define KDELIBSUFF "${KDELIBSUFF}"
++
++#define LIBINSTALLDIR "${LIBINSTALLDIR}"
+diff -Nur strigi-0.3.11/src/archivereader/archivecat.cpp strigi-0.3.11.new/src/archivereader/archivecat.cpp
+--- strigi-0.3.11/src/archivereader/archivecat.cpp 2006-12-12 23:50:23.000000000 +0100
++++ strigi-0.3.11.new/src/archivereader/archivecat.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Ben van Klinken <bvklinken at gmail.com>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "jstreamsconfig.h"
+ #include "archivereader.h"
+ #include "fileinputstream.h"
+@@ -7,45 +26,6 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+
+-class FileStreamOpener : public StreamOpener {
+-public:
+- ~FileStreamOpener() {}
+- StreamBase<char>* openStream(const string& url);
+- int stat(const string& url, EntryInfo& e);
+-};
+-StreamBase<char>*
+-FileStreamOpener::openStream(const string& url) {
+- StreamBase<char>* stream = new FileInputStream(url.c_str());
+- if (stream->getStatus() != Ok) {
+- delete stream;
+- stream = 0;
+- }
+- return stream;
+-}
+-int
+-FileStreamOpener::stat(const string& url, EntryInfo& e) {
+- struct stat s;
+- if (::stat(url.c_str(), &s) == -1) {
+- return -1;
+- }
+- if (S_ISREG(s.st_mode)) {
+- e.type = EntryInfo::File;
+- } else if (S_ISDIR(s.st_mode)) {
+- e.type = EntryInfo::Dir;
+- } else {
+- e.type = EntryInfo::Unknown;
+- }
+- e.size = s.st_size;
+- e.mtime = s.st_mtime;
+- size_t p = url.rfind('/');
+- if (p == string::npos) {
+- e.filename = url;
+- } else {
+- e.filename = url.substr(p+1);
+- }
+-
+- return 0;
+-}
+ int
+ main(int argc, char** argv) {
+ EntryInfo e;
+@@ -60,10 +40,10 @@
+ printf("could not read %s\n", argv[i]);
+ continue;
+ }
+- printf("file: %s\n", e.filename.c_str());
++ printf("file: %i %s\n", e.type, e.filename.c_str());
+ DirLister dl = reader.getDirEntries(argv[i]);
+ while (dl.nextEntry(e)) {
+- printf("%s\n", e.filename.c_str());
++ printf("%i %s\n", e.type, e.filename.c_str());
+ }
+ StreamBase<char>* s = 0;
+ if (e.type & EntryInfo::File) {
+diff -Nur strigi-0.3.11/src/archivereader/qclient/archiveenginehandler.cpp strigi-0.3.11.new/src/archivereader/qclient/archiveenginehandler.cpp
+--- strigi-0.3.11/src/archivereader/qclient/archiveenginehandler.cpp 2006-12-12 23:50:23.000000000 +0100
++++ strigi-0.3.11.new/src/archivereader/qclient/archiveenginehandler.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Ben van Klinken <bvklinken at gmail.com>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "archiveenginehandler.h"
+ #include "fsfileinputstream.h"
+ #include "archivereader.h"
+diff -Nur strigi-0.3.11/src/combinedindexer/CMakeLists.txt strigi-0.3.11.new/src/combinedindexer/CMakeLists.txt
+--- strigi-0.3.11/src/combinedindexer/CMakeLists.txt 2006-12-12 23:50:19.000000000 +0100
++++ strigi-0.3.11.new/src/combinedindexer/CMakeLists.txt 2006-12-22 21:03:35.000000000 +0100
+@@ -16,6 +16,12 @@
+ include_directories( ../estraierindexer )
+ endif (HyperEstraier_FOUND)
+
++if (SQLite_FOUND)
++ add_definitions(-DHAVE_SQLITE)
++ set(combinedindex_LIBS ${combinedindex_LIBS} sqliteindex)
++ include_directories( ../sqliteindexer )
++endif (SQLite_FOUND)
++
+ add_library(combinedindex combinedindexmanager.cpp)
+
+ target_link_libraries(combinedindex streamindexer ${combinedindex_LIBS})
+diff -Nur strigi-0.3.11/src/daemon/eventlistener/inotifylistener.cpp strigi-0.3.11.new/src/daemon/eventlistener/inotifylistener.cpp
+--- strigi-0.3.11/src/daemon/eventlistener/inotifylistener.cpp 2006-12-12 23:50:20.000000000 +0100
++++ strigi-0.3.11.new/src/daemon/eventlistener/inotifylistener.cpp 2007-01-06 17:40:55.000000000 +0100
+@@ -610,7 +610,7 @@
+ string newdirs ("|");
+
+ for (set<string>::iterator iter = fixedDirs.begin(); iter != fixedDirs.end(); iter++)
+- newdirs += (*iter + "|");
++ newdirs += (*iter + '|');
+
+ STRIGI_LOG_DEBUG ("strigi.InotifyListener.setIndexedDirectories", "new indexed dirs: " + newdirs)
+ }
+@@ -823,7 +823,7 @@
+ if (it == m_oldDirs.end())
+ {
+ newIndexedDirs.insert (*iter);
+- strNewIndexedDirs += (*iter + "|");
++ strNewIndexedDirs += (*iter + '|');
+ }
+ }
+
+@@ -834,7 +834,7 @@
+ if (it == m_newDirs.end())
+ {
+ m_nomoreIndexedDirs.insert (*iter);
+- strNomoreIndexedDirs += (*iter + "|");
++ strNomoreIndexedDirs += (*iter + '|');
+ }
+ }
+
+diff -Nur strigi-0.3.11/src/daemon/events/inotifytest.cpp strigi-0.3.11.new/src/daemon/events/inotifytest.cpp
+--- strigi-0.3.11/src/daemon/events/inotifytest.cpp 2006-12-12 23:50:21.000000000 +0100
++++ strigi-0.3.11.new/src/daemon/events/inotifytest.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include <sys/inotify.h>
+ #include <list>
+ #include <string>
+diff -Nur strigi-0.3.11/src/daemon/indexscheduler.cpp strigi-0.3.11.new/src/daemon/indexscheduler.cpp
+--- strigi-0.3.11/src/daemon/indexscheduler.cpp 2006-12-12 23:50:21.000000000 +0100
++++ strigi-0.3.11.new/src/daemon/indexscheduler.cpp 2007-01-14 14:47:27.000000000 +0100
+@@ -111,8 +111,7 @@
+ IndexScheduler::index() {
+ IndexReader* reader = indexmanager->getIndexReader();
+ IndexWriter* writer = indexmanager->getIndexWriter();
+- StreamIndexer* streamindexer = new StreamIndexer(*writer,
+- *m_indexerconfiguration);
++ StreamIndexer* streamindexer = new StreamIndexer(*m_indexerconfiguration);
+
+ if (dbfiles.size() == 0 && toindex.size() == 0) {
+ // retrieve the list of real files currently in the database
+@@ -149,7 +148,7 @@
+
+ it = toindex.begin();
+ while (getState() == Working && it != toindex.end()) {
+- streamindexer->indexFile(it->first);
++ streamindexer->indexFile(it->first, *writer);
+ if (writer->itemsInCache() > 10000) {
+ writer->commit();
+ }
+@@ -168,7 +167,7 @@
+ IndexReader* reader = indexmanager->getIndexReader();
+ IndexWriter* writer = indexmanager->getIndexWriter();
+ IndexerConfiguration ic;
+- StreamIndexer* streamindexer = new StreamIndexer(*writer, ic);
++ StreamIndexer* streamindexer = new StreamIndexer(ic);
+
+ vector<string> toDelete;
+
+@@ -209,7 +208,7 @@
+ map<string, time_t>::iterator it = toindex.begin();
+ while (it != toindex.end())
+ {
+- streamindexer->indexFile(it->first);
++ streamindexer->indexFile(it->first, *writer);
+ if (writer->itemsInCache() > 10000) {
+ writer->commit();
+ }
+diff -Nur strigi-0.3.11/src/daemon/interface.cpp strigi-0.3.11.new/src/daemon/interface.cpp
+--- strigi-0.3.11/src/daemon/interface.cpp 2006-12-12 23:50:21.000000000 +0100
++++ strigi-0.3.11.new/src/daemon/interface.cpp 2007-01-14 14:47:27.000000000 +0100
+@@ -146,7 +146,7 @@
+ paths.push_back(path);
+ writer->deleteEntries(paths);
+ IndexerConfiguration ic;
+- StreamIndexer streamindexer(*writer, ic);
++ StreamIndexer streamindexer(ic);
+ StringReader<char> sr(&content[0], content.size(), false);
+ Indexable idx(path, mtime, *writer, streamindexer);
+ idx.index(sr);
+diff -Nur strigi-0.3.11/src/daemon/xsd/daemonconfigurator.cpp strigi-0.3.11.new/src/daemon/xsd/daemonconfigurator.cpp
+--- strigi-0.3.11/src/daemon/xsd/daemonconfigurator.cpp 2006-12-12 23:50:21.000000000 +0100
++++ strigi-0.3.11.new/src/daemon/xsd/daemonconfigurator.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -144,7 +144,7 @@
+ if (match == e_repository.end())
+ {
+ STRIGI_LOG_WARNING ("DaemonConfigurator.getIndexedDirs",
+- "cannot find repository name: |" + repositoryName + "|")
++ "cannot find repository name: |" + repositoryName + '|')
+ return dirs;
+ }
+
+diff -Nur strigi-0.3.11/src/daemon/xsd/daemonconfigurator.h strigi-0.3.11.new/src/daemon/xsd/daemonconfigurator.h
+--- strigi-0.3.11/src/daemon/xsd/daemonconfigurator.h 2006-12-12 23:50:21.000000000 +0100
++++ strigi-0.3.11.new/src/daemon/xsd/daemonconfigurator.h 2007-01-05 10:53:01.000000000 +0100
+@@ -28,7 +28,7 @@
+
+ class DaemonConfigurator : public StrigiDaemonConfiguration {
+ public:
+- DaemonConfigurator (const std::string& confFile);
++ explicit DaemonConfigurator (const std::string& confFile);
+
+ void setIndexedDirectories(std::set<std::string>& dirs,
+ const std::string& repositoryName = "localhost", bool merge = false);
+diff -Nur strigi-0.3.11/src/dummyindexer/dummyindexwriter.h strigi-0.3.11.new/src/dummyindexer/dummyindexwriter.h
+--- strigi-0.3.11/src/dummyindexer/dummyindexwriter.h 2006-12-12 23:50:27.000000000 +0100
++++ strigi-0.3.11.new/src/dummyindexer/dummyindexwriter.h 2007-01-14 19:15:14.000000000 +0100
+@@ -51,7 +51,7 @@
+ text);
+ }
+ }
+- void setField(const jstreams::Indexable* idx, const std::string &fieldname,
++ void addField(const jstreams::Indexable* idx, const std::string &fieldname,
+ const std::string& value) {
+ if (verbosity > 1) {
+ printf("%s: setField '%s': '%s'\n", idx->getPath().c_str(),
+@@ -61,6 +61,8 @@
+ *s = value;
+ }
+ }
++ void addField(const jstreams::Indexable* idx, const std::string &fieldname,
++ const unsigned char* data, int32_t size) {}
+ public:
+ DummyIndexWriter(int v = 0) {
+ verbosity = v;
+diff -Nur strigi-0.3.11/src/dummyindexer/grepindexwriter.cpp strigi-0.3.11.new/src/dummyindexer/grepindexwriter.cpp
+--- strigi-0.3.11/src/dummyindexer/grepindexwriter.cpp 2006-12-12 23:50:27.000000000 +0100
++++ strigi-0.3.11.new/src/dummyindexer/grepindexwriter.cpp 2007-01-14 19:15:14.000000000 +0100
+@@ -61,7 +61,7 @@
+ }
+ }
+ void
+-GrepIndexWriter::setField(const jstreams::Indexable* idx,
++GrepIndexWriter::addField(const jstreams::Indexable* idx,
+ const std::string &fieldname, const std::string& value) {
+ if (regexec(®ex, value.c_str(), 0, 0, 0) == 0) {
+ printf("%s:%s:%s\n", idx->getPath().c_str(), fieldname.c_str(),
+diff -Nur strigi-0.3.11/src/dummyindexer/grepindexwriter.h strigi-0.3.11.new/src/dummyindexer/grepindexwriter.h
+--- strigi-0.3.11/src/dummyindexer/grepindexwriter.h 2006-12-12 23:50:27.000000000 +0100
++++ strigi-0.3.11.new/src/dummyindexer/grepindexwriter.h 2007-01-14 19:15:14.000000000 +0100
+@@ -31,10 +31,12 @@
+ void finishIndexable(const jstreams::Indexable* idx);
+ void addText(const jstreams::Indexable* idx, const char* text,
+ int32_t length);
+- void setField(const jstreams::Indexable* idx, const std::string &fieldname,
++ void addField(const jstreams::Indexable* idx, const std::string &fieldname,
+ const std::string& value);
++ void addField(const jstreams::Indexable* idx, const std::string &fieldname,
++ const unsigned char* data, int32_t size) {}
+ public:
+- GrepIndexWriter(const char* re);
++ explicit GrepIndexWriter(const char* re);
+ ~GrepIndexWriter();
+ void commit() {}
+ void deleteEntries(const std::vector<std::string>& entries) {}
+diff -Nur strigi-0.3.11/src/dummyindexer/indexer.cpp strigi-0.3.11.new/src/dummyindexer/indexer.cpp
+--- strigi-0.3.11/src/dummyindexer/indexer.cpp 2006-12-12 23:50:27.000000000 +0100
++++ strigi-0.3.11.new/src/dummyindexer/indexer.cpp 2007-01-14 14:47:27.000000000 +0100
+@@ -28,7 +28,7 @@
+ Indexer *Indexer::workingIndexer;
+
+ Indexer::Indexer(jstreams::IndexWriter& w, jstreams::IndexerConfiguration& c)
+- : m_indexer(w, c) {
++ : m_writer(w), m_indexer(c) {
+ m_lister = new FileLister(c);
+ }
+ Indexer::~Indexer() {
+@@ -65,5 +65,5 @@
+ }
+ void
+ Indexer::doFile(const char* filepath) {
+- m_indexer.indexFile(filepath);
++ m_indexer.indexFile(filepath, m_writer);
+ }
+diff -Nur strigi-0.3.11/src/dummyindexer/indexer.h strigi-0.3.11.new/src/dummyindexer/indexer.h
+--- strigi-0.3.11/src/dummyindexer/indexer.h 2006-12-12 23:50:27.000000000 +0100
++++ strigi-0.3.11.new/src/dummyindexer/indexer.h 2007-01-14 14:47:27.000000000 +0100
+@@ -22,12 +22,14 @@
+
+ #include <string>
+ #include "streamindexer.h"
++//#include "indexwriter.h"
+
+ class FileLister;
+
+ class Indexer {
+ private:
+ FileLister* m_lister;
++ jstreams::IndexWriter& m_writer;
+ jstreams::StreamIndexer m_indexer;
+
+ static void addFileCallback(const char* fullpath, uint dirlen,
+diff -Nur strigi-0.3.11/src/htmlgui/CMakeLists.txt strigi-0.3.11.new/src/htmlgui/CMakeLists.txt
+--- strigi-0.3.11/src/htmlgui/CMakeLists.txt 2006-12-12 23:50:24.000000000 +0100
++++ strigi-0.3.11.new/src/htmlgui/CMakeLists.txt 2007-01-13 17:22:01.000000000 +0100
+@@ -8,6 +8,6 @@
+
+ target_link_libraries(strigihtmlgui searchclient streamindexer)
+
+-install(TARGETS strigihtmlgui DESTINATION lib)
++install(TARGETS strigihtmlgui DESTINATION ${LIB_DESTINATION})
+ install(FILES strigihtmlgui.h
+ DESTINATION include)
+diff -Nur strigi-0.3.11/src/indexertests/indexmanagertests.cpp strigi-0.3.11.new/src/indexertests/indexmanagertests.cpp
+--- strigi-0.3.11/src/indexertests/indexmanagertests.cpp 2006-12-12 23:50:17.000000000 +0100
++++ strigi-0.3.11.new/src/indexertests/indexmanagertests.cpp 2007-01-14 14:47:27.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Ben van Klinken <bvklinken at gmail.com>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "jstreamsconfig.h"
+ #include "indexmanagertests.h"
+ #include "indexreader.h"
+@@ -22,14 +41,14 @@
+ public:
+ IndexManagerTester(IndexManager* m, IndexerConfiguration& ic)
+ : manager(m), writer(manager->getIndexWriter()),
+- si(*writer, ic) {
++ si(ic) {
+ reader = manager->getIndexReader();
+ }
+ ~IndexManagerTester() {
+ }
+ void runUnthreadedTests();
+ void runThreadedTests();
+- void addAndCount();
++ void addAndCount(int m = 20);
+ void testNumberQuery();
+ };
+ void
+@@ -47,9 +66,10 @@
+ testNumberQuery();
+ }
+ void
+-IndexManagerTester::addAndCount() {
++IndexManagerTester::addAndCount(int m) {
++ VERIFY(writer);
++ if (writer == 0) return;
+ writer->deleteAllEntries();
+- int m = 20;
+ ostringstream str;
+ for (int i=0; i<m; ++i) {
+ str << "/" << i;
+@@ -64,6 +84,8 @@
+ }
+ void
+ IndexManagerTester::testNumberQuery() {
++ VERIFY(writer);
++ if (writer == 0) return;
+ writer->deleteAllEntries();
+ // add numbers to the database
+ int m = 200;
+diff -Nur strigi-0.3.11/src/indexertests/indexmanagertests.h strigi-0.3.11.new/src/indexertests/indexmanagertests.h
+--- strigi-0.3.11/src/indexertests/indexmanagertests.h 2006-12-12 23:50:17.000000000 +0100
++++ strigi-0.3.11.new/src/indexertests/indexmanagertests.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Ben van Klinken <bvklinken at gmail.com>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #ifndef INDEXMANAGERTESTS_H
+ #define INDEXMANAGERTESTS_H
+
+diff -Nur strigi-0.3.11/src/indexertests/indexreadertests.cpp strigi-0.3.11.new/src/indexertests/indexreadertests.cpp
+--- strigi-0.3.11/src/indexertests/indexreadertests.cpp 2006-12-12 23:50:17.000000000 +0100
++++ strigi-0.3.11.new/src/indexertests/indexreadertests.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Ben van Klinken <bvklinken at gmail.com>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "jstreamsconfig.h"
+ #include "indexreadertests.h"
+ #include "indexreader.h"
+@@ -7,8 +26,10 @@
+ private:
+ IndexReader* reader;
+ public:
+- IndexReaderTester(IndexReader* w) :reader(w) {}
++ IndexReaderTester(IndexReader* r) :reader(r) {}
+ int getFiles(char depth) {
++ VERIFY(reader);
++ if (reader == 0) return 1;
+ reader->getFiles(depth);
+ return 0;
+ }
+diff -Nur strigi-0.3.11/src/indexertests/indexreadertests.h strigi-0.3.11.new/src/indexertests/indexreadertests.h
+--- strigi-0.3.11/src/indexertests/indexreadertests.h 2006-12-12 23:50:17.000000000 +0100
++++ strigi-0.3.11.new/src/indexertests/indexreadertests.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Ben van Klinken <bvklinken at gmail.com>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #ifndef INDEXREADERTESTS_H
+ #define INDEXREADERTESTS_H
+
+diff -Nur strigi-0.3.11/src/indexertests/indexwritertests.cpp strigi-0.3.11.new/src/indexertests/indexwritertests.cpp
+--- strigi-0.3.11/src/indexertests/indexwritertests.cpp 2006-12-12 23:50:17.000000000 +0100
++++ strigi-0.3.11.new/src/indexertests/indexwritertests.cpp 2007-01-14 14:47:27.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Ben van Klinken <bvklinken at gmail.com>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "jstreamsconfig.h"
+ #include "indexwritertests.h"
+ #include "indexwriter.h"
+@@ -7,22 +26,26 @@
+
+ class IndexWriterTester {
+ private:
+- IndexWriter& writer;
++ IndexWriter* writer;
+ StreamIndexer si;
+ public:
+ IndexWriterTester(IndexWriter& w, IndexerConfiguration& ic)
+- :writer(w), si(w, ic) {
++ :writer(&w), si(ic) {
+ }
+ int optimize() {
+- writer.optimize();
++ VERIFY(writer);
++ if (writer == 0) return 1;
++ writer->optimize();
+ return 0;
+ }
+ int add() {
++ VERIFY(writer);
++ if (writer == 0) return 1;
+ std::string s("a"); // we must pass a string, not a const char*
+ {
+- Indexable i(s, 0, writer, si);
++ Indexable i(s, 0, *writer, si);
+ }
+- writer.commit();
++ writer->commit();
+
+ return 0;
+ }
+diff -Nur strigi-0.3.11/src/indexertests/indexwritertests.h strigi-0.3.11.new/src/indexertests/indexwritertests.h
+--- strigi-0.3.11/src/indexertests/indexwritertests.h 2006-12-12 23:50:17.000000000 +0100
++++ strigi-0.3.11.new/src/indexertests/indexwritertests.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Ben van Klinken <bvklinken at gmail.com>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #ifndef INDEXWRITERTESTS_H
+ #define INDEXWRITERTESTS_H
+
+diff -Nur strigi-0.3.11/src/indexertests/verify.h strigi-0.3.11.new/src/indexertests/verify.h
+--- strigi-0.3.11/src/indexertests/verify.h 2006-12-12 23:50:17.000000000 +0100
++++ strigi-0.3.11.new/src/indexertests/verify.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Ben van Klinken <bvklinken at gmail.com>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #ifndef VERIFY_H
+ #define VERIFY_H
+
+diff -Nur strigi-0.3.11/src/luceneindexer/cluceneindexreader.cpp strigi-0.3.11.new/src/luceneindexer/cluceneindexreader.cpp
+--- strigi-0.3.11/src/luceneindexer/cluceneindexreader.cpp 2006-12-12 23:50:18.000000000 +0100
++++ strigi-0.3.11.new/src/luceneindexer/cluceneindexreader.cpp 2006-12-16 11:06:58.000000000 +0100
+@@ -72,6 +72,7 @@
+ }
+ void
+ CLuceneIndexReader::openReader() {
++ closeReader();
+ doccount = -1;
+ wordcount = -1;
+ try {
+diff -Nur strigi-0.3.11/src/luceneindexer/cluceneindexwriter.cpp strigi-0.3.11.new/src/luceneindexer/cluceneindexwriter.cpp
+--- strigi-0.3.11/src/luceneindexer/cluceneindexwriter.cpp 2006-12-12 23:50:18.000000000 +0100
++++ strigi-0.3.11.new/src/luceneindexer/cluceneindexwriter.cpp 2007-01-14 19:15:14.000000000 +0100
+@@ -88,37 +88,37 @@
+ }
+ }
+ void
+-CLuceneIndexWriter::setField(const Indexable* idx,
++CLuceneIndexWriter::addField(const Indexable* idx,
+ IndexerConfiguration::FieldType type, const TCHAR* name,
+ const TCHAR* value) {
+ CLuceneDocData* doc = static_cast<CLuceneDocData*>(idx->getWriterData());
+ Field* field = new Field(name, value,
+ type & IndexerConfiguration::Stored,
+- type & IndexerConfiguration::Indexed,
+- type & IndexerConfiguration::Tokenized);
++ type & IndexerConfiguration::Indexed, false);
++ // type & IndexerConfiguration::Tokenized);
+ doc->doc.add(*field);
+ }
+ void
+-CLuceneIndexWriter::setField(const Indexable* idx,
++CLuceneIndexWriter::addField(const Indexable* idx,
+ IndexerConfiguration::FieldType type, const TCHAR* fn,
+ const std::string& value) {
+ #if defined(_UCS2)
+- setField(idx, type, CLuceneIndexWriter::mapId(fn),
++ addField(idx, type, CLuceneIndexWriter::mapId(fn),
+ utf8toucs2(value).c_str());
+ #else
+- setField(idx, type, CLuceneIndexWriter::mapId(fn), value.c_str());
++ addField(idx, type, CLuceneIndexWriter::mapId(fn), value.c_str());
+ #endif
+ }
+ void
+-CLuceneIndexWriter::setField(const Indexable* idx, const string& fieldname,
++CLuceneIndexWriter::addField(const Indexable* idx, const string& fieldname,
+ const string& value) {
+ IndexerConfiguration::FieldType type
+ = idx->config().getIndexType(fieldname);
+ if (type == IndexerConfiguration::None) return;
+ #if defined(_UCS2)
+- setField(idx, type, utf8toucs2(fieldname).c_str(), value);
++ addField(idx, type, utf8toucs2(fieldname).c_str(), value);
+ #else
+- setField(idx, type, fieldname.c_str(), value);
++ addField(idx, type, fieldname.c_str(), value);
+ #endif
+ }
+ void
+@@ -132,18 +132,18 @@
+ */
+ void
+ CLuceneIndexWriter::finishIndexable(const Indexable* idx) {
+- setField(idx, "path", idx->getPath());
++ addField(idx, "path", idx->getPath());
+ string field = idx->getEncoding();
+- if (field.length()) setField(idx, "encoding", field);
++ if (field.length()) addField(idx, "encoding", field);
+ field = idx->getMimeType();
+- if (field.length()) setField(idx, "mimetype", field);
++ if (field.length()) addField(idx, "mimetype", field);
+ field = idx->getFileName();
+- if (field.length()) setField(idx, "filename", field);
++ if (field.length()) addField(idx, "filename", field);
+ field = idx->getExtension();
+- if (field.length()) setField(idx, "ext", field);
++ if (field.length()) addField(idx, "ext", field);
+ ostringstream o;
+ o << (int)idx->getDepth();
+- setField(idx, "depth", o.str());
++ addField(idx, "depth", o.str());
+ o.str("");
+ {
+ char tmp[100];
+@@ -151,7 +151,7 @@
+ o << tmp;
+ }
+ CLuceneDocData* doc = static_cast<CLuceneDocData*>(idx->getWriterData());
+- setField(idx, "mtime", o.str());
++ addField(idx, "mtime", o.str());
+ wstring c(utf8toucs2(doc->content));
+ StringReader<char>* sr = NULL; //we use this for compressed streams
+
+@@ -228,8 +228,12 @@
+ CLuceneIndexWriter::deleteAllEntries() {
+ manager->deleteIndex();
+ }
++void
++CLuceneIndexWriter::commit() {
++ manager->closeWriter();
++}
+
+-//this function is in 0.9.17, which we dont have yet...
++//this function is in 0.9.17, which we do not have yet...
+ bool isLuceneFile(const char* filename){
+ if ( !filename )
+ return false;
+diff -Nur strigi-0.3.11/src/luceneindexer/cluceneindexwriter.h strigi-0.3.11.new/src/luceneindexer/cluceneindexwriter.h
+--- strigi-0.3.11/src/luceneindexer/cluceneindexwriter.h 2006-12-12 23:50:18.000000000 +0100
++++ strigi-0.3.11.new/src/luceneindexer/cluceneindexwriter.h 2007-01-14 19:15:14.000000000 +0100
+@@ -34,18 +34,20 @@
+ void startIndexable(jstreams::Indexable*);
+ void finishIndexable(const jstreams::Indexable*);
+ void addText(const jstreams::Indexable*, const char* text, int32_t length);
+- static void setField(const jstreams::Indexable* idx,
++ static void addField(const jstreams::Indexable* idx,
+ jstreams::IndexerConfiguration::FieldType type, const TCHAR* name,
+ const TCHAR* value);
+- static void setField(const jstreams::Indexable* idx,
++ static void addField(const jstreams::Indexable* idx,
+ jstreams::IndexerConfiguration::FieldType type, const TCHAR* name,
+ const std::string& value);
+- void setField(const jstreams::Indexable*,
++ void addField(const jstreams::Indexable*,
+ const std::string& fieldname, const std::string& value);
++ void addField(const jstreams::Indexable*, const std::string& fieldname,
++ const unsigned char* data, int32_t size) {}
+ public:
+- CLuceneIndexWriter(CLuceneIndexManager* m);
++ explicit CLuceneIndexWriter(CLuceneIndexManager* m);
+ ~CLuceneIndexWriter();
+- void commit() {};
++ void commit();
+
+ /** cleanup clucene files. this is run when clucene starts up */
+ void cleanUp();
+diff -Nur strigi-0.3.11/src/luceneindexer/indexdump/indexdump.cpp strigi-0.3.11.new/src/luceneindexer/indexdump/indexdump.cpp
+--- strigi-0.3.11/src/luceneindexer/indexdump/indexdump.cpp 2006-12-12 23:50:18.000000000 +0100
++++ strigi-0.3.11.new/src/luceneindexer/indexdump/indexdump.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include <CLucene.h>
+ #include <CLucene/search/QueryFilter.h>
+ #include <sstream>
+diff -Nur strigi-0.3.11/src/luceneindexer/indexer.cpp strigi-0.3.11.new/src/luceneindexer/indexer.cpp
+--- strigi-0.3.11/src/luceneindexer/indexer.cpp 2006-12-12 23:50:18.000000000 +0100
++++ strigi-0.3.11.new/src/luceneindexer/indexer.cpp 2007-01-14 14:47:27.000000000 +0100
+@@ -31,7 +31,7 @@
+
+ Indexer::Indexer(const char *indexdir, IndexerConfiguration& ic)
+ : m_indexdir(indexdir), m_manager(indexdir), m_writer(&m_manager),
+- m_indexer(m_writer, ic)
++ m_indexer(ic)
+ {
+ m_lister = new FileLister(ic);
+ }
+@@ -63,5 +63,5 @@
+ }
+ void
+ Indexer::doFile(const char* filepath) {
+- m_indexer.indexFile(filepath);
++ m_indexer.indexFile(filepath, m_writer);
+ }
+diff -Nur strigi-0.3.11/src/luceneindexer/PrefixFilter.cpp strigi-0.3.11.new/src/luceneindexer/PrefixFilter.cpp
+--- strigi-0.3.11/src/luceneindexer/PrefixFilter.cpp 2006-12-12 23:50:18.000000000 +0100
++++ strigi-0.3.11.new/src/luceneindexer/PrefixFilter.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,5 +1,6 @@
+ /*------------------------------------------------------------------------------
+ * Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
++* <bvanklinken at gmail.com>
+ *
+ * Distributable under the terms of either the Apache License (Version 2.0) or
+ * the GNU Lesser General Public License, as specified in the COPYING file.
+diff -Nur strigi-0.3.11/src/luceneindexer/PrefixFilter.h strigi-0.3.11.new/src/luceneindexer/PrefixFilter.h
+--- strigi-0.3.11/src/luceneindexer/PrefixFilter.h 2006-12-12 23:50:18.000000000 +0100
++++ strigi-0.3.11.new/src/luceneindexer/PrefixFilter.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,5 +1,6 @@
+ /*------------------------------------------------------------------------------
+ * Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
++* <bvanklinken at gmail.com>
+ *
+ * Distributable under the terms of either the Apache License (Version 2.0) or
+ * the GNU Lesser General Public License, as specified in the COPYING file.
+diff -Nur strigi-0.3.11/src/searchclient/dlgfilters.cpp strigi-0.3.11.new/src/searchclient/dlgfilters.cpp
+--- strigi-0.3.11/src/searchclient/dlgfilters.cpp 2006-12-12 23:50:23.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/dlgfilters.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "dlgfilters.h"
+ #include "filterwidget.h"
+
+diff -Nur strigi-0.3.11/src/searchclient/dlgfilters.h strigi-0.3.11.new/src/searchclient/dlgfilters.h
+--- strigi-0.3.11/src/searchclient/dlgfilters.h 2006-12-12 23:50:23.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/dlgfilters.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #ifndef DLGFILTERS_H
+ #define DLGFILTERS_H
+
+diff -Nur strigi-0.3.11/src/searchclient/filterwidget/filtermodel.cpp strigi-0.3.11.new/src/searchclient/filterwidget/filtermodel.cpp
+--- strigi-0.3.11/src/searchclient/filterwidget/filtermodel.cpp 2006-12-12 23:50:22.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/filterwidget/filtermodel.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,11 +1,38 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "filtermodel.h"
+ #include <QDebug>
+ using namespace std;
+
+ void
+ FilterModel::addFilter(const QModelIndex& index, bool state) {
+- int r = (index.isValid()) ?index.row() :filters.size();
+- beginInsertRows(QModelIndex(), r-1, r);
++
++ int r = 1;
++
++ if ( index.isValid() ) {
++ r = index.row();
++ } else if ( filters.size() > 0 ) {
++ r = filters.size();
++ }
++
++ beginInsertRows(QModelIndex(),r-1, r);
+ filters.insert(filters.begin()+r, qMakePair(state,
+ tr("<double-click to edit>")));
+ endInsertRows();
+diff -Nur strigi-0.3.11/src/searchclient/filterwidget/filtermodel.h strigi-0.3.11.new/src/searchclient/filterwidget/filtermodel.h
+--- strigi-0.3.11/src/searchclient/filterwidget/filtermodel.h 2006-12-12 23:50:22.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/filterwidget/filtermodel.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,9 +1,28 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include <QAbstractListModel>
+ #include <QPair>
+
+ class FilterModel : public QAbstractListModel {
+ public:
+- FilterModel(QObject* parent) : QAbstractListModel(parent) {}
++ explicit FilterModel(QObject* parent) : QAbstractListModel(parent) {}
+ int rowCount(const QModelIndex &parent = QModelIndex()) const {
+ return (parent.isValid())?0:filters.size();
+ }
+diff -Nur strigi-0.3.11/src/searchclient/filterwidget/filterwidget.cpp strigi-0.3.11.new/src/searchclient/filterwidget/filterwidget.cpp
+--- strigi-0.3.11/src/searchclient/filterwidget/filterwidget.cpp 2006-12-12 23:50:22.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/filterwidget/filterwidget.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "filterwidget.h"
+ #include "filtermodel.h"
+ #include <QListView>
+diff -Nur strigi-0.3.11/src/searchclient/filterwidget/filterwidget.h strigi-0.3.11.new/src/searchclient/filterwidget/filterwidget.h
+--- strigi-0.3.11/src/searchclient/filterwidget/filterwidget.h 2006-12-12 23:50:22.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/filterwidget/filterwidget.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include <QWidget>
+
+ class QListView;
+diff -Nur strigi-0.3.11/src/searchclient/filterwidget/filterwidgettest.cpp strigi-0.3.11.new/src/searchclient/filterwidget/filterwidgettest.cpp
+--- strigi-0.3.11/src/searchclient/filterwidget/filterwidgettest.cpp 2006-12-12 23:50:22.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/filterwidget/filterwidgettest.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "filterwidget.h"
+ #include <QApplication>
+ using namespace std;
+diff -Nur strigi-0.3.11/src/searchclient/histogram.cpp strigi-0.3.11.new/src/searchclient/histogram.cpp
+--- strigi-0.3.11/src/searchclient/histogram.cpp 2006-12-12 23:50:23.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/histogram.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "histogram.h"
+ #include <QPainter>
+ #include <QMouseEvent>
+@@ -223,5 +242,5 @@
+ int offset = entry*(barwidth+margin);
+ p.fillRect(QRectF(0, offset, bh, barwidth), palette().highlight());
+ p.drawText(QRectF(margin, offset, barheight, barwidth), Qt::AlignVCenter,
+- data[entry].first + ":" + QString::number(data[entry].second));
++ data[entry].first + ':' + QString::number(data[entry].second));
+ }
+diff -Nur strigi-0.3.11/src/searchclient/histogram.h strigi-0.3.11.new/src/searchclient/histogram.h
+--- strigi-0.3.11/src/searchclient/histogram.h 2006-12-12 23:50:23.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/histogram.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #ifndef HISTOGRAM_H
+ #define HISTOGRAM_H
+
+diff -Nur strigi-0.3.11/src/searchclient/qtdbus/CMakeLists.txt strigi-0.3.11.new/src/searchclient/qtdbus/CMakeLists.txt
+--- strigi-0.3.11/src/searchclient/qtdbus/CMakeLists.txt 2006-12-12 23:50:23.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/qtdbus/CMakeLists.txt 2007-01-13 17:14:54.000000000 +0100
+@@ -13,7 +13,8 @@
+ add_library(strigiqtdbusclient SHARED ${strigiqtdbusclient_SRCS}
+ ${strigiqtdbusclient_MOC_SRCS})
+
+- target_link_libraries(strigiqtdbusclient ${QT_QTCORE_LIBRARY} QtDBus)
++ target_link_libraries(strigiqtdbusclient ${QT_QTDBUS_LIBRARY})
++ set_target_properties(strigiqtdbusclient PROPERTIES VERSION ${STRIGI_VERSION} SOVERSION ${STRIGI_VERSION_MAJOR})
+
+ install(TARGETS strigiqtdbusclient LIBRARY DESTINATION ${LIB_DESTINATION})
+ install(FILES strigiasyncclient.h strigiclient.h strigidbus.h strigitypes.h
+diff -Nur strigi-0.3.11/src/searchclient/qtdbus/strigiasyncclient.cpp strigi-0.3.11.new/src/searchclient/qtdbus/strigiasyncclient.cpp
+--- strigi-0.3.11/src/searchclient/qtdbus/strigiasyncclient.cpp 2006-12-12 23:50:23.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/qtdbus/strigiasyncclient.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "strigiasyncclient.h"
+ #include "strigidbus.h"
+ #include <QDebug>
+diff -Nur strigi-0.3.11/src/searchclient/qtdbus/strigiasyncclient.h strigi-0.3.11.new/src/searchclient/qtdbus/strigiasyncclient.h
+--- strigi-0.3.11/src/searchclient/qtdbus/strigiasyncclient.h 2006-12-12 23:50:23.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/qtdbus/strigiasyncclient.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #ifndef STRIGIASYNCCLIENT
+ #define STRIGIASYNCCLIENT
+ #include "strigitypes.h"
+diff -Nur strigi-0.3.11/src/searchclient/qtdbus/strigiasynctest.cpp strigi-0.3.11.new/src/searchclient/qtdbus/strigiasynctest.cpp
+--- strigi-0.3.11/src/searchclient/qtdbus/strigiasynctest.cpp 2006-12-12 23:50:23.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/qtdbus/strigiasynctest.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "strigiasyncwidget.h"
+ #include <QApplication>
+ #include <QDebug>
+diff -Nur strigi-0.3.11/src/searchclient/qtdbus/strigiasyncwidget.cpp strigi-0.3.11.new/src/searchclient/qtdbus/strigiasyncwidget.cpp
+--- strigi-0.3.11/src/searchclient/qtdbus/strigiasyncwidget.cpp 2006-12-12 23:50:23.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/qtdbus/strigiasyncwidget.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "strigiasyncwidget.h"
+ #include <QLineEdit>
+ #include <QListWidget>
+diff -Nur strigi-0.3.11/src/searchclient/qtdbus/strigiasyncwidget.h strigi-0.3.11.new/src/searchclient/qtdbus/strigiasyncwidget.h
+--- strigi-0.3.11/src/searchclient/qtdbus/strigiasyncwidget.h 2006-12-12 23:50:23.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/qtdbus/strigiasyncwidget.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #ifndef STRIGIASYNCWIDGET_H
+ #define STRIGIASYNCWIDGET_H
+
+diff -Nur strigi-0.3.11/src/searchclient/qtdbus/strigiclient.cpp strigi-0.3.11.new/src/searchclient/qtdbus/strigiclient.cpp
+--- strigi-0.3.11/src/searchclient/qtdbus/strigiclient.cpp 2006-12-12 23:50:23.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/qtdbus/strigiclient.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "strigiclient.h"
+ #include "strigidbus.h"
+
+diff -Nur strigi-0.3.11/src/searchclient/qtdbus/strigiclient.h strigi-0.3.11.new/src/searchclient/qtdbus/strigiclient.h
+--- strigi-0.3.11/src/searchclient/qtdbus/strigiclient.h 2006-12-12 23:50:23.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/qtdbus/strigiclient.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #ifndef STRIGICLIENT
+ #define STRIGICLIENT
+ #include "strigitypes.h"
+diff -Nur strigi-0.3.11/src/searchclient/qtdbus/strigiqtdbustest.cpp strigi-0.3.11.new/src/searchclient/qtdbus/strigiqtdbustest.cpp
+--- strigi-0.3.11/src/searchclient/qtdbus/strigiqtdbustest.cpp 2006-12-12 23:50:23.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/qtdbus/strigiqtdbustest.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "strigiclient.h"
+ #include "strigiasyncclient.h"
+ #include <QCoreApplication>
+diff -Nur strigi-0.3.11/src/searchclient/qtdbus/strigitypes.cpp strigi-0.3.11.new/src/searchclient/qtdbus/strigitypes.cpp
+--- strigi-0.3.11/src/searchclient/qtdbus/strigitypes.cpp 2006-12-12 23:50:23.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/qtdbus/strigitypes.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "strigitypes.h"
+ #include <QtCore/QDebug>
+
+diff -Nur strigi-0.3.11/src/searchclient/qtdbus/strigitypes.h strigi-0.3.11.new/src/searchclient/qtdbus/strigitypes.h
+--- strigi-0.3.11/src/searchclient/qtdbus/strigitypes.h 2006-12-12 23:50:23.000000000 +0100
++++ strigi-0.3.11.new/src/searchclient/qtdbus/strigitypes.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #ifndef STRIGITYPES_H
+ #define STRIGITYPES_H
+
+diff -Nur strigi-0.3.11/src/sqliteindexer/CMakeLists.txt strigi-0.3.11.new/src/sqliteindexer/CMakeLists.txt
+--- strigi-0.3.11/src/sqliteindexer/CMakeLists.txt 2006-12-12 23:50:17.000000000 +0100
++++ strigi-0.3.11.new/src/sqliteindexer/CMakeLists.txt 2006-12-22 21:03:35.000000000 +0100
+@@ -1,3 +1,5 @@
++subdirs(tests)
++
+ include_directories( ../streamindexer ../streams ../streams/compat
+ ${SQLITE_LIBRARY_DIR} ${SQLITE_INCLUDE_DIR}
+ ${strigi_BINARY_DIR}/src/streams/compat)
+@@ -5,7 +7,7 @@
+ add_library(sqliteindex sqliteindexwriter.cpp sqliteindexmanager.cpp
+ sqliteindexreader.cpp)
+
+-target_link_libraries(sqliteindex streamindexer ${SQLITE_LIBRARY})
++target_link_libraries(sqliteindex streamindexer ${SQLITE_LIBRARIES})
+
+ add_executable(sqliteindexer sqliteindexer.cpp indexer.cpp)
+ target_link_libraries(sqliteindexer sqliteindex sqlite3)
+diff -Nur strigi-0.3.11/src/sqliteindexer/indexer.cpp strigi-0.3.11.new/src/sqliteindexer/indexer.cpp
+--- strigi-0.3.11/src/sqliteindexer/indexer.cpp 2006-12-12 23:50:17.000000000 +0100
++++ strigi-0.3.11.new/src/sqliteindexer/indexer.cpp 2007-01-14 19:15:14.000000000 +0100
+@@ -27,8 +27,7 @@
+ Indexer *Indexer::workingIndexer;
+
+ Indexer::Indexer(const char *indexdir, jstreams::IndexerConfiguration& ic)
+- : m_indexdir(indexdir), m_manager(indexdir),
+- m_indexer(*m_manager.getIndexWriter(), ic)
++ : m_indexdir(indexdir), m_manager(indexdir), m_indexer(ic)
+ {
+ m_lister = new FileLister(ic);
+ }
+@@ -57,5 +56,5 @@
+ }
+ void
+ Indexer::doFile(const std::string &filepath) {
+- m_indexer.indexFile(filepath.c_str());
++ m_indexer.indexFile(filepath.c_str(), *m_manager.getIndexWriter());
+ }
+diff -Nur strigi-0.3.11/src/sqliteindexer/sqliteindexmanager.cpp strigi-0.3.11.new/src/sqliteindexer/sqliteindexmanager.cpp
+--- strigi-0.3.11/src/sqliteindexer/sqliteindexmanager.cpp 2006-12-12 23:50:17.000000000 +0100
++++ strigi-0.3.11.new/src/sqliteindexer/sqliteindexmanager.cpp 2006-12-22 21:03:35.000000000 +0100
+@@ -51,12 +51,12 @@
+ }
+ sqlite3*
+ SqliteIndexManager::opendb(const char* path) {
+- printf("opening db\n");
++ fprintf(stderr, "opening db\n");
+ sqlite3* db;
+ int r = sqlite3_open(path, &db);
+ // any value other than SQLITE_OK is an error
+ if (r != SQLITE_OK) {
+- printf("could not open db\n");
++ fprintf(stderr, "could not open db %s: %s\n", path, sqlite3_errmsg(db));
+ return 0;
+ }
+ // speed up by being unsafe and keeping temp tables in memory
+@@ -64,7 +64,7 @@
+ "PRAGMA auto_vacuum = 1;"
+ "PRAGMA temp_store = MEMORY;", 0, 0, 0);
+ if (r != SQLITE_OK) {
+- printf("could not speed up database\n");
++ fprintf(stderr, "could not speed up database\n");
+ }
+ // create the tables required
+ const char* sql;
+@@ -86,7 +86,8 @@
+ ;
+ r = sqlite3_exec(db, sql, 0, 0, 0);
+ if (r != SQLITE_OK) {
+- printf("could not create table %i %s\n", r, sqlite3_errmsg(db));
++ fprintf(stderr, "could not create table %i %s\n", r,
++ sqlite3_errmsg(db));
+ exit(1);
+ }
+
+@@ -100,7 +101,8 @@
+ ;
+ r = sqlite3_exec(db, sql, 0,0,0);
+ if (r != SQLITE_OK) {
+- printf("could not init writer: %i %s\n", r, sqlite3_errmsg(db));
++ fprintf(stderr, "could not init writer: %i %s\n", r,
++ sqlite3_errmsg(db));
+ }
+ return db;
+ }
+@@ -111,7 +113,9 @@
+ sqlite3* db = dbs[self];
+ if (db == 0) {
+ db = opendb(dbfile.c_str());
+- dbs[self] = db;
++ if (db) {
++ dbs[self] = db;
++ }
+ }
+ return db;
+ }
+@@ -124,9 +128,11 @@
+ pthread_t self = pthread_self();
+ SqliteIndexReader* r = readers[self];
+ if (r == 0) {
+- r = new SqliteIndexReader(this);
+- ref();
+- readers[self] = r;
++ sqlite3* db = ref();
++ if (db) {
++ r = new SqliteIndexReader(this);
++ readers[self] = r;
++ }
+ deref();
+ }
+ return r;
+@@ -136,9 +142,11 @@
+ pthread_t self = pthread_self();
+ SqliteIndexWriter* w = writers[self];
+ if (w == 0) {
+- w = new SqliteIndexWriter(this);
+- ref();
+- writers[self] = w;
++ sqlite3* db = ref();
++ if (db) {
++ w = new SqliteIndexWriter(this, db);
++ writers[self] = w;
++ }
+ deref();
+ }
+ return w;
+diff -Nur strigi-0.3.11/src/sqliteindexer/sqliteindexwriter.cpp strigi-0.3.11.new/src/sqliteindexer/sqliteindexwriter.cpp
+--- strigi-0.3.11/src/sqliteindexer/sqliteindexwriter.cpp 2006-12-12 23:50:17.000000000 +0100
++++ strigi-0.3.11.new/src/sqliteindexer/sqliteindexwriter.cpp 2007-01-14 19:15:14.000000000 +0100
+@@ -26,13 +26,12 @@
+ using namespace std;
+ using namespace jstreams;
+
+-SqliteIndexWriter::SqliteIndexWriter(SqliteIndexManager *m)
++SqliteIndexWriter::SqliteIndexWriter(SqliteIndexManager *m, sqlite3* db)
+ : manager(m) {
+ temprows = 0;
+
+ // prepare the sql statements
+ const char* sql;
+- sqlite3* db = manager->ref();
+ dbcheck = db;
+ sql = "insert into tempidx (fileid, name, value) values(?, ?, ?)";
+ prepareStmt(db, insertvaluestmt, sql, strlen(sql));
+@@ -40,10 +39,9 @@
+ prepareStmt(db, getfilestmt, sql, strlen(sql));
+ sql = "update files set mtime = ?;";
+ prepareStmt(db, updatefilestmt, sql, strlen(sql));
+- sql = "insert into files (path, mtime, depth) values(?, ?, ?);'";
++ sql = "insert into files (path, mtime, depth) values(?, ?, ?);";
+ prepareStmt(db, insertfilestmt, sql, strlen(sql));
+- printf("opened db %p %p\n", db, insertfilestmt);
+- manager->deref();
++ fprintf(stderr, "opened db %p %p\n", db, insertfilestmt);
+ }
+ SqliteIndexWriter::~SqliteIndexWriter() {
+ commit();
+@@ -57,9 +55,9 @@
+ void
+ SqliteIndexWriter::prepareStmt(sqlite3* db, sqlite3_stmt*& stmt,
+ const char* sql, int sqllength) {
+- int r = sqlite3_prepare(db, sql, sqllength,& stmt, 0);
++ int r = sqlite3_prepare(db, sql, sqllength, &stmt, 0);
+ if (r != SQLITE_OK) {
+- printf("could not prepare statement '%s': %s\n", sql,
++ fprintf(stderr, "could not prepare statement '%s': %s\n", sql,
+ sqlite3_errmsg(db));
+ stmt = 0;
+ }
+@@ -70,7 +68,8 @@
+ int r = sqlite3_finalize(stmt);
+ stmt = 0;
+ if (r != SQLITE_OK) {
+- printf("could not prepare statement: %s\n", sqlite3_errmsg(db));
++ fprintf(stderr, "could not prepare statement: %s\n",
++ sqlite3_errmsg(db));
+ }
+ }
+ }
+@@ -109,7 +108,7 @@
+ }
+ }
+ void
+-SqliteIndexWriter::setField(const Indexable* idx, const string &fieldname,
++SqliteIndexWriter::addField(const Indexable* idx, const string &fieldname,
+ const string& value) {
+ int64_t id = idx->getId();
+ //id = -1; // debug
+@@ -123,12 +122,14 @@
+ SQLITE_STATIC);
+ int r = sqlite3_step(insertvaluestmt);
+ if (r != SQLITE_DONE) {
+- printf("could not write into database: %i %s\n", r, sqlite3_errmsg(db));
+- exit(1);
++ fprintf(stderr, "could not write into database: %i %s\n", r,
++ sqlite3_errmsg(db));
++ //exit(1);
+ }
+ r = sqlite3_reset(insertvaluestmt);
+ if (r != SQLITE_OK) {
+- printf("could not reset statement: %i %s\n", r, sqlite3_errmsg(db));
++ fprintf(stderr, "could not reset statement: %i %s\n", r,
++ sqlite3_errmsg(db));
+ }
+ temprows++;
+ manager->deref();
+@@ -150,12 +151,13 @@
+ sqlite3_bind_text(insertfilestmt, 1, name, namelen, SQLITE_STATIC);
+ sqlite3_bind_int64(insertfilestmt, 2, idx->getMTime());
+ sqlite3_bind_int(insertfilestmt, 3, idx->getDepth());
+-// printf("'%s', %i, %i %p %p\n", name, idx->getMTime(), idx->getDepth(), db, insertfilestmt);
++// printf("'%s', %i %p %p\n", name, idx->getDepth(), db, insertfilestmt);
+ int r = sqlite3_step(insertfilestmt);
+ if (r != SQLITE_DONE) {
+- if (r == SQLITE_ERROR) printf("error!\n");
+- printf("error in adding file %i %s\n", r, sqlite3_errmsg(db));
+- exit(1);
++ if (r == SQLITE_ERROR) fprintf(stderr, "error!\n");
++ fprintf(stderr, "error in adding file %i %s (%i)\n", r,
++ sqlite3_errmsg(db), r);
++ //exit(1);
+ }
+ id = sqlite3_last_insert_rowid(db);
+ sqlite3_reset(insertfilestmt);
+@@ -184,7 +186,8 @@
+ if (idx->getDepth() == 0) {
+ sqlite3_exec(db, "rollback; ", 0, 0, 0);
+ }
+- printf("could not prepare temp insert sql %s\n", sqlite3_errmsg(db));
++ fprintf(stderr, "could not prepare temp insert sql %s\n",
++ sqlite3_errmsg(db));
+ content.erase(m->first);
+ manager->deref();
+ return;
+@@ -198,7 +201,7 @@
+ sqlite3_bind_int(stmt, 3, i->second);
+ r = sqlite3_step(stmt);
+ if (r != 21) { // what is 21?
+- printf("could not write content into database: %i %s\n", r,
++ fprintf(stderr, "could not write content into database: %i %s\n", r,
+ sqlite3_errmsg(db));
+ }
+ r = sqlite3_reset(stmt);
+@@ -210,7 +213,7 @@
+ }
+ void
+ SqliteIndexWriter::commit() {
+- printf("start commit\n");
++ fprintf(stderr, "start commit\n");
+ // move the data from the temp tables into the index
+
+ const char* sql = "replace into words (wordid, word, count) "
+@@ -229,10 +232,10 @@
+ sqlite3* db = manager->ref();
+ int r = sqlite3_exec(db, sql, 0, 0, 0);
+ if (r != SQLITE_OK) {
+- printf("could not store new data: %s\n", sqlite3_errmsg(db));
++ fprintf(stderr, "could not store new data: %s\n", sqlite3_errmsg(db));
+ }
+ manager->deref();
+- printf("end commit of %i rows\n", temprows);
++ fprintf(stderr, "end commit of %i rows\n", temprows);
+ temprows = 0;
+ }
+ /**
+@@ -241,27 +244,23 @@
+ void
+ SqliteIndexWriter::deleteEntries(const std::vector<std::string>& entries) {
+ sqlite3* db = manager->ref();
+- // turn on case sensitivity
+- sqlite3_exec(db, "PRAGMA case_sensitive_like = 1", 0, 0, 0);
+
+ sqlite3_stmt* delstmt;
+- const char* delsql = "delete from files where path like ?;";
++ const char* delsql = "delete from files where path glob ?;";
+ prepareStmt(db, delstmt, delsql, strlen(delsql));
+ vector<string>::const_iterator i;
+ for (i = entries.begin(); i != entries.end(); ++i) {
+- string f = *i+'%';
++ string f = *i+'*';
+ sqlite3_bind_text(delstmt, 1, f.c_str(), f.length(), SQLITE_STATIC);
+ int r = sqlite3_step(delstmt);
+ if (r != SQLITE_DONE) {
+- printf("could not delete file %s: %s\n", i->c_str(),
+- sqlite3_errmsg(db));
++ fprintf(stderr, "could not delete file %s: %s (%i)\n", i->c_str(),
++ sqlite3_errmsg(db), r);
+ }
+- printf("removed entry '%s'\n", f.c_str());
++// fprintf(stderr, "removed entry '%s'\n", f.c_str());
+ sqlite3_reset(delstmt);
+ }
+ sqlite3_finalize(delstmt);
+- // turn off case sensitivity
+- sqlite3_exec(db, "PRAGMA case_sensitive_like = 0", 0, 0, 0);
+
+ // remove all information that now is orphaned
+ int r = sqlite3_exec(db,
+@@ -272,7 +271,7 @@
+ "delete from words where count is null or count = 0;"
+ , 0, 0, 0);
+ if (r != SQLITE_OK) {
+- printf("could not delete associated information: %s\n",
++ fprintf(stderr, "could not delete associated information: %s\n",
+ sqlite3_errmsg(db));
+ }
+ manager->deref();
+diff -Nur strigi-0.3.11/src/sqliteindexer/sqliteindexwriter.h strigi-0.3.11.new/src/sqliteindexer/sqliteindexwriter.h
+--- strigi-0.3.11/src/sqliteindexer/sqliteindexwriter.h 2006-12-12 23:50:17.000000000 +0100
++++ strigi-0.3.11.new/src/sqliteindexer/sqliteindexwriter.h 2007-01-14 19:15:14.000000000 +0100
+@@ -46,9 +46,11 @@
+ void finishIndexable(const jstreams::Indexable*);
+ void addText(const jstreams::Indexable* idx, const char* text,
+ int32_t length);
+- void setField(const jstreams::Indexable* idx, const std::string &fieldname,
++ void addField(const jstreams::Indexable* idx, const std::string &fieldname,
+ const std::string& value);
+- explicit SqliteIndexWriter(SqliteIndexManager*);
++ void addField(const jstreams::Indexable* idx, const std::string &fieldname,
++ const unsigned char* data, int32_t size) {}
++ SqliteIndexWriter(SqliteIndexManager*, sqlite3*);
+ ~SqliteIndexWriter();
+ public:
+ void commit();
+diff -Nur strigi-0.3.11/src/sqliteindexer/tests/CMakeLists.txt strigi-0.3.11.new/src/sqliteindexer/tests/CMakeLists.txt
+--- strigi-0.3.11/src/sqliteindexer/tests/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100
++++ strigi-0.3.11.new/src/sqliteindexer/tests/CMakeLists.txt 2007-01-05 10:07:35.000000000 +0100
+@@ -0,0 +1,15 @@
++include_directories(.. ../../indexertests)
++
++CREATE_TEST_SOURCELIST(Tests testrunner.cpp SqliteTest.cpp simpletest.cpp)
++
++ADD_EXECUTABLE(sqlitetest ${Tests} )
++target_link_libraries(sqlitetest streams sqliteindex indexertests)
++
++SET (TestsToRun ${Tests})
++REMOVE (TestsToRun testrunner.cpp)
++
++FOREACH (test ${TestsToRun})
++ GET_FILENAME_COMPONENT(TName ${test} NAME_WE)
++ ADD_TEST(${TName} sqlitetest ${TName} ${strigi_SOURCE_DIR}/testdata/data)
++ENDFOREACH (test)
++
+diff -Nur strigi-0.3.11/src/sqliteindexer/tests/simpletest.cpp strigi-0.3.11.new/src/sqliteindexer/tests/simpletest.cpp
+--- strigi-0.3.11/src/sqliteindexer/tests/simpletest.cpp 1970-01-01 01:00:00.000000000 +0100
++++ strigi-0.3.11.new/src/sqliteindexer/tests/simpletest.cpp 2007-01-14 19:15:14.000000000 +0100
+@@ -0,0 +1,56 @@
++#include "jstreamsconfig.h"
++#include "sqliteindexmanager.h"
++#include "indexwriter.h"
++#include "indexreader.h"
++#include "indexerconfiguration.h"
++#include "indexable.h"
++#include <sstream>
++#include <sys/stat.h>
++#include <sys/types.h>
++using namespace std;
++using namespace jstreams;
++
++int
++addAndCount(IndexWriter* writer, IndexReader* reader, int m) {
++ if (writer == 0) return 1;
++ writer->deleteAllEntries();
++ IndexerConfiguration ic;
++ StreamIndexer si(ic);
++ ostringstream str;
++ for (int i=0; i<m; ++i) {
++ str << "/" << i;
++ string s(str.str());
++ { Indexable idx(s, 0, *writer, si); }
++ str.str("");
++ }
++ writer->commit();
++ return 0;
++/* int n = reader->countDocuments();
++ if (n != m) fprintf(stderr, "%i != %i\n", n, m);
++ return m - n;*/
++}
++
++int
++simpletest(int argc, char**argv) {
++ const char* path = "testsqliteindex";
++
++ // initialize a directory for writing and an indexmanager
++ mkdir(path, S_IRUSR|S_IWUSR|S_IXUSR);
++ string p(path);
++ p += "/test.db";
++ IndexManager* manager = createSqliteIndexManager(p.c_str());
++ IndexWriter* writer = manager->getIndexWriter();
++ IndexReader* reader = manager->getIndexReader();
++ addAndCount(writer, reader, 1);
++
++ // close and clean up the manager
++ delete manager;
++
++ // clean up data
++/* std::string cmd = "rm -r ";
++ cmd += path;
++ system(cmd.c_str());
++ fprintf(stderr, "bye\n");
++*/
++ return 1;
++}
+diff -Nur strigi-0.3.11/src/sqliteindexer/tests/SqliteTest.cpp strigi-0.3.11.new/src/sqliteindexer/tests/SqliteTest.cpp
+--- strigi-0.3.11/src/sqliteindexer/tests/SqliteTest.cpp 1970-01-01 01:00:00.000000000 +0100
++++ strigi-0.3.11.new/src/sqliteindexer/tests/SqliteTest.cpp 2007-01-05 10:07:35.000000000 +0100
+@@ -0,0 +1,46 @@
++#include "jstreamsconfig.h"
++#include "sqliteindexmanager.h"
++#include "indexmanagertests.h"
++#include "indexwritertests.h"
++#include "indexreadertests.h"
++#include "indexerconfiguration.h"
++#include <sys/stat.h>
++#include <sys/types.h>
++using namespace std;
++
++StrigiMutex errorlock;
++int founderrors = 0;
++int
++SqliteTest(int argc, char**argv) {
++ const char* path = "testsqliteindex";
++
++ // initialize a directory for writing and an indexmanager
++ mkdir(path, S_IRUSR|S_IWUSR|S_IXUSR);
++ string p(path);
++ p += "/test.db";
++ jstreams::IndexManager* manager = createSqliteIndexManager(p.c_str());
++
++ jstreams::IndexerConfiguration ic;
++ IndexManagerTests tests(manager, ic);
++ tests.testAll();
++/* tests.testAllInThreads(20);
++
++ jstreams::IndexWriter* writer = manager->getIndexWriter();
++ IndexWriterTests wtests(*writer, ic);
++ wtests.testAll();
++
++ jstreams::IndexReader* reader = manager->getIndexReader();
++ IndexReaderTests rtests(reader);
++ rtests.testAll();
++*/
++ // close and clean up the manager
++ delete manager;
++
++ // clean up data
++ std::string cmd = "rm -r ";
++ cmd += path;
++ system(cmd.c_str());
++ fprintf(stderr, "bye\n");
++
++ return founderrors;
++}
+diff -Nur strigi-0.3.11/src/streamindexer/analyzerfactoryfactory.h strigi-0.3.11.new/src/streamindexer/analyzerfactoryfactory.h
+--- strigi-0.3.11/src/streamindexer/analyzerfactoryfactory.h 2006-12-12 23:50:27.000000000 +0100
++++ strigi-0.3.11.new/src/streamindexer/analyzerfactoryfactory.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include <list>
+
+ namespace jstreams {
+diff -Nur strigi-0.3.11/src/streamindexer/analyzerloader.cpp strigi-0.3.11.new/src/streamindexer/analyzerloader.cpp
+--- strigi-0.3.11/src/streamindexer/analyzerloader.cpp 2006-12-12 23:50:27.000000000 +0100
++++ strigi-0.3.11.new/src/streamindexer/analyzerloader.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "analyzerloader.h"
+ #include "analyzerfactoryfactory.h"
+ #include <string>
+diff -Nur strigi-0.3.11/src/streamindexer/analyzerloader.h strigi-0.3.11.new/src/streamindexer/analyzerloader.h
+--- strigi-0.3.11/src/streamindexer/analyzerloader.h 2006-12-12 23:50:27.000000000 +0100
++++ strigi-0.3.11.new/src/streamindexer/analyzerloader.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "jstreamsconfig.h"
+ #include <list>
+ #include <map>
+diff -Nur strigi-0.3.11/src/streamindexer/analyzerplugin.h strigi-0.3.11.new/src/streamindexer/analyzerplugin.h
+--- strigi-0.3.11/src/streamindexer/analyzerplugin.h 2006-12-12 23:50:27.000000000 +0100
++++ strigi-0.3.11.new/src/streamindexer/analyzerplugin.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "analyzerfactoryfactory.h"
+
+ #ifdef STRIGI_IMPORT_API
+diff -Nur strigi-0.3.11/src/streamindexer/CMakeLists.txt strigi-0.3.11.new/src/streamindexer/CMakeLists.txt
+--- strigi-0.3.11/src/streamindexer/CMakeLists.txt 2006-12-12 23:50:27.000000000 +0100
++++ strigi-0.3.11.new/src/streamindexer/CMakeLists.txt 2007-01-14 00:18:33.000000000 +0100
+@@ -4,7 +4,7 @@
+ include_directories( ./ ../streams ${BZIP2_INCLUDE_DIR}
+ ${SHA_INCLUDE_DIR} ${ICONV_INCLUDE_DIR}
+ ${strigi_BINARY_DIR}/src/streams/compat
+- ${strigi_SOURCE_DIR}/src/streams/compat)
++ ${strigi_SOURCE_DIR}/src/streams/compat ${CMAKE_BINARY_DIR} )
+
+ set(streamindexer_SRCS bz2endanalyzer.cpp digestthroughanalyzer.cpp
+ textendanalyzer.cpp streamendanalyzer.cpp zipendanalyzer.cpp
+@@ -42,9 +42,10 @@
+
+ target_link_libraries(streamindexer streams ${streamindex_LIBS})
+
+-install(FILES indexeddocument.h indexable.h analyzerplugin.h
++install(FILES indexeddocument.h indexable.h analyzerplugin.h streamindexer.h
+ streamthroughanalyzer.h streamendanalyzer.h analyzerfactoryfactory.h
+- DESTINATION include)
++ indexwriter.h indexerconfiguration.h
++ DESTINATION include/strigi)
+
+
+ # test executable
+diff -Nur strigi-0.3.11/src/streamindexer/filelister.cpp strigi-0.3.11.new/src/streamindexer/filelister.cpp
+--- strigi-0.3.11/src/streamindexer/filelister.cpp 2006-12-12 23:50:27.000000000 +0100
++++ strigi-0.3.11.new/src/streamindexer/filelister.cpp 2006-12-15 00:37:19.000000000 +0100
+@@ -38,19 +38,19 @@
+
+ string fixPath (string path)
+ {
+- if ( path.c_str() == NULL || path.length() == 0 )
+- return "";
++ if ( path.c_str() == NULL || path.length() == 0 )
++ return "";
+
+ string temp(path);
+
+ #ifdef HAVE_WINDOWS_H
+- size_t l= temp.length();
+- char* t = (char*)temp.c_str();
+- for (size_t i=0;i<l;i++){
+- if ( t[i] == '\\' )
+- t[i] = '/';
+- }
+- temp[0] = tolower(temp.at(0));
++ size_t l= temp.length();
++ char* t = (char*)temp.c_str();
++ for (size_t i=0;i<l;i++){
++ if ( t[i] == '\\' )
++ t[i] = '/';
++ }
++ temp[0] = tolower(temp.at(0));
+ #endif
+
+ char separator = '/';
+@@ -66,6 +66,8 @@
+ m_dirCallback = 0;
+ path = 0;
+ length = 0;
++ uid = geteuid();
++ gid = getegid();
+ }
+ FileLister::~FileLister() {
+ if (length) {
+@@ -75,7 +77,7 @@
+ void
+ FileLister::listFiles(const char *dir, time_t oldestdate) {
+ if (m_fileCallback == 0) return;
+- printf("listFiles %s\n", dir);
++ fprintf(stderr, "listFiles %s\n", dir);
+ m_oldestdate = oldestdate;
+ int len = strlen(dir);
+ resize(len+2);
+@@ -154,7 +156,9 @@
+ path = resize(l+1);
+ strcpy(path+len, subdir->d_name);
+ // check if the file is a normal file (use lstat, NOT stat)
+- if (lstat(path, &dirstat) == 0) {
++ if (lstat(path, &dirstat) == 0 && (S_IROTH & dirstat.st_mode
++ || (uid == dirstat.st_uid && S_IRUSR & dirstat.st_mode)
++ || (gid == dirstat.st_uid && S_IRGRP & dirstat.st_mode))) {
+ if (S_ISREG(dirstat.st_mode) && dirstat.st_mtime >= m_oldestdate) {
+ if (m_config.indexFile(path, path+len)) {
+ m_fileCallback(path, len, l, dirstat.st_mtime);
+diff -Nur strigi-0.3.11/src/streamindexer/filelister.h strigi-0.3.11.new/src/streamindexer/filelister.h
+--- strigi-0.3.11/src/streamindexer/filelister.h 2006-12-12 23:50:27.000000000 +0100
++++ strigi-0.3.11.new/src/streamindexer/filelister.h 2006-12-13 19:55:04.000000000 +0100
+@@ -43,6 +43,8 @@
+ private:
+ char* path;
+ uint length;
++ uid_t uid;
++ gid_t gid;
+ time_t m_oldestdate;
+ void (*m_fileCallback)(const char* fullpath, uint dirlen, uint len,
+ time_t mtime);
+diff -Nur strigi-0.3.11/src/streamindexer/ifilterendanalyzer.cpp strigi-0.3.11.new/src/streamindexer/ifilterendanalyzer.cpp
+--- strigi-0.3.11/src/streamindexer/ifilterendanalyzer.cpp 2006-12-12 23:50:27.000000000 +0100
++++ strigi-0.3.11.new/src/streamindexer/ifilterendanalyzer.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Ben van Klinken <bvklinken at gmail.com>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ /*
+ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_SP2003_ta/html/ODC_HowToWriteaFilter.asp
+
+diff -Nur strigi-0.3.11/src/streamindexer/ifilterendanalyzer.h strigi-0.3.11.new/src/streamindexer/ifilterendanalyzer.h
+--- strigi-0.3.11/src/streamindexer/ifilterendanalyzer.h 2006-12-12 23:50:27.000000000 +0100
++++ strigi-0.3.11.new/src/streamindexer/ifilterendanalyzer.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Ben van Klinken <bvklinken at gmail.com>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #ifndef IFILTERENDANALYZER
+ #define IFILTERENDANALYZER
+
+diff -Nur strigi-0.3.11/src/streamindexer/indexwriter.cpp strigi-0.3.11.new/src/streamindexer/indexwriter.cpp
+--- strigi-0.3.11/src/streamindexer/indexwriter.cpp 2006-12-12 23:50:27.000000000 +0100
++++ strigi-0.3.11.new/src/streamindexer/indexwriter.cpp 2007-01-14 19:15:14.000000000 +0100
+@@ -46,6 +46,6 @@
+ return;
+ }
+ if (strchr(fieldname.c_str(), '/') == 0) {
+- writer.setField(this, fieldname, value);
++ writer.addField(this, fieldname, value);
+ }
+ }
+diff -Nur strigi-0.3.11/src/streamindexer/indexwriter.h strigi-0.3.11.new/src/streamindexer/indexwriter.h
+--- strigi-0.3.11/src/streamindexer/indexwriter.h 2006-12-12 23:50:27.000000000 +0100
++++ strigi-0.3.11.new/src/streamindexer/indexwriter.h 2007-01-14 19:15:14.000000000 +0100
+@@ -53,10 +53,10 @@
+ protected:
+ virtual void startIndexable(Indexable*) = 0;
+ virtual void addText(const Indexable*, const char* text, int32_t length)=0;
+- virtual void setField(const Indexable*, const std::string &fieldname,
++ virtual void addField(const Indexable*, const std::string &fieldname,
+ const std::string& value) = 0;
+-// virtual void setField(const Indexable*, const std::string &fieldname,
+-// int64_t value) = 0;
++ virtual void addField(const Indexable*, const std::string &fieldname,
++ const unsigned char* data, int32_t size)=0;
+ virtual void finishIndexable(const Indexable*) = 0;
+ public:
+ virtual ~IndexWriter() {}
+diff -Nur strigi-0.3.11/src/streamindexer/mailendanalyzer.cpp strigi-0.3.11.new/src/streamindexer/mailendanalyzer.cpp
+--- strigi-0.3.11/src/streamindexer/mailendanalyzer.cpp 2006-12-12 23:50:27.000000000 +0100
++++ strigi-0.3.11.new/src/streamindexer/mailendanalyzer.cpp 2006-12-16 18:04:36.000000000 +0100
+@@ -36,14 +36,14 @@
+ error = mail.getError();
+ return -1;
+ }
+- if (s == 0) {
++/* if (s == 0) {
+ error = "mail contains no body";
+ return -1;
+- }
++ }*/
+ idx.setField("title", mail.getSubject());
+ idx.setField("contenttype", mail.getContentType());
+ TextEndAnalyzer tea;
+- if (tea.analyze(idx, s) != 0) {
++ if (s != 0 && tea.analyze(idx, s) != 0) {
+ error = "Error reading mail body.";
+ return -1;
+ }
+diff -Nur strigi-0.3.11/src/streamindexer/streamindexer.cpp strigi-0.3.11.new/src/streamindexer/streamindexer.cpp
+--- strigi-0.3.11/src/streamindexer/streamindexer.cpp 2006-12-12 23:50:27.000000000 +0100
++++ strigi-0.3.11.new/src/streamindexer/streamindexer.cpp 2007-01-14 14:47:27.000000000 +0100
+@@ -39,27 +39,28 @@
+ #include "indexable.h"
+ #include "indexerconfiguration.h"
+ #include "textutils.h"
++#include "analyzerloader.h"
+ #include <sys/stat.h>
+ #ifdef WIN32
+ #include "ifilterendanalyzer.h"
+ #endif
++#include <config.h>
+
+ using namespace std;
+ using namespace jstreams;
+
+-StreamIndexer::StreamIndexer(IndexWriter& w, IndexerConfiguration& c)
+- :writer(w), conf(c) {
++StreamIndexer::StreamIndexer(IndexerConfiguration& c)
++ :conf(c) {
++ moduleLoader = new AnalyzerLoader();
+
+- moduleLoader.loadPlugins("/usr/local/lib/strigi");
+- moduleLoader.loadPlugins("/usr/lib/strigi");
+- moduleLoader.loadPlugins("/lib/strigi");
++ moduleLoader->loadPlugins( LIBINSTALLDIR "/strigi");
+
+ // todo: remove this
+- moduleLoader.loadPlugins("D:\\clients\\strigi_svn\\win\\out\\Debug");
++ moduleLoader->loadPlugins("D:\\clients\\strigi_svn\\win\\out\\Debug");
+ if ( getenv("HOME") != NULL ){
+ string homedir = getenv("HOME");
+ homedir += "/testinstall/lib/strigi";
+- moduleLoader.loadPlugins(homedir.c_str());
++ moduleLoader->loadPlugins(homedir.c_str());
+ }
+ initializeThroughFactories();
+ initializeEndFactories();
+@@ -89,14 +90,15 @@
+ delete *e;
+ }
+ }
++ delete moduleLoader;
+ }
+ char
+-StreamIndexer::indexFile(const char *filepath, IndexerConfiguration* ic) {
++StreamIndexer::indexFile(const char *filepath, IndexWriter& writer) {
+ std::string path(filepath);
+- return indexFile(path);
++ return indexFile(path, writer);
+ }
+ char
+-StreamIndexer::indexFile(const std::string& filepath){
++StreamIndexer::indexFile(const std::string& filepath, IndexWriter& writer) {
+ if (!checkUtf8(filepath.c_str())) {
+ return 1;
+ }
+@@ -120,7 +122,7 @@
+ void
+ StreamIndexer::initializeThroughFactories() {
+ list<StreamThroughAnalyzerFactory*> plugins
+- = moduleLoader.getStreamThroughAnalyzerFactories();
++ = moduleLoader->getStreamThroughAnalyzerFactories();
+ list<StreamThroughAnalyzerFactory*>::iterator i;
+ for (i = plugins.begin(); i != plugins.end(); ++i) {
+ addFactory(*i);
+@@ -143,7 +145,7 @@
+ void
+ StreamIndexer::initializeEndFactories() {
+ list<StreamEndAnalyzerFactory*> plugins
+- = moduleLoader.getStreamEndAnalyzerFactories();
++ = moduleLoader->getStreamEndAnalyzerFactories();
+ list<StreamEndAnalyzerFactory*>::iterator i;
+ for (i = plugins.begin(); i != plugins.end(); ++i) {
+ addFactory(*i);
+@@ -231,8 +233,7 @@
+ "%lli to 0 after reading with %s: %s\n",
+ idx.getPath().c_str(), input->getPosition(),
+ sea->getName(), sea->getError().c_str());
+- removeIndexable(idx.getDepth());
+- return -2;
++ finished = true;
+ }
+ } else {
+ finished = true;
+diff -Nur strigi-0.3.11/src/streamindexer/streamindexer.h strigi-0.3.11.new/src/streamindexer/streamindexer.h
+--- strigi-0.3.11/src/streamindexer/streamindexer.h 2006-12-12 23:50:27.000000000 +0100
++++ strigi-0.3.11.new/src/streamindexer/streamindexer.h 2007-01-14 14:47:27.000000000 +0100
+@@ -21,13 +21,15 @@
+ #define STREAMINDEXER_H
+
+ #include <vector>
+-#include "analyzerloader.h"
+
+ namespace jstreams {
+ class StreamEndAnalyzer;
+ class StreamThroughAnalyzer;
++class StreamThroughAnalyzerFactory;
++class StreamEndAnalyzerFactory;
+ class IndexWriter;
+ class Indexable;
++class AnalyzerLoader;
+ class IndexerConfiguration;
+ template <class T> class StreamBase;
+ /**
+@@ -44,14 +46,14 @@
+ **/
+ class StreamIndexer {
+ private:
+- IndexWriter& writer;
++ //IndexWriter& writer;
+ IndexerConfiguration& conf;
+ std::vector<jstreams::StreamThroughAnalyzerFactory*> throughfactories;
+ std::vector<jstreams::StreamEndAnalyzerFactory*> endfactories;
+ std::vector<std::vector<jstreams::StreamEndAnalyzer*> > end;
+ std::vector<std::vector<jstreams::StreamThroughAnalyzer*> > through;
+
+- AnalyzerLoader moduleLoader;
++ AnalyzerLoader* moduleLoader;
+ void initializeThroughFactories();
+ void initializeEndFactories();
+ void addFactory(StreamThroughAnalyzerFactory* f);
+@@ -60,10 +62,10 @@
+ void addEndAnalyzers();
+ void removeIndexable(uint depth);
+ public:
+- StreamIndexer(IndexWriter& w, IndexerConfiguration& conf);
++ StreamIndexer(IndexerConfiguration& c);
+ ~StreamIndexer();
+- char indexFile(const char *filepath, IndexerConfiguration* ic=0);
+- char indexFile(const std::string& filepath);
++ char indexFile(const char *filepath, IndexWriter& writer);
++ char indexFile(const std::string& filepath, IndexWriter& writer);
+ char analyze(Indexable& idx, jstreams::StreamBase<char> *input);
+ IndexerConfiguration& getConfiguration() const { return conf; }
+ };
+diff -Nur strigi-0.3.11/src/streamindexer/tests/CMakeLists.txt strigi-0.3.11.new/src/streamindexer/tests/CMakeLists.txt
+--- strigi-0.3.11/src/streamindexer/tests/CMakeLists.txt 2006-12-12 23:50:26.000000000 +0100
++++ strigi-0.3.11.new/src/streamindexer/tests/CMakeLists.txt 2006-12-13 19:55:04.000000000 +0100
+@@ -5,7 +5,7 @@
+ target_link_libraries(streamindexertest streamindexer)
+
+ SET (TestsToRun ${Tests})
+-REMOVE (TestsToRun testrunner.cpp)
++REMOVE (TestsToRun streamindexertests.cpp)
+
+ FOREACH (test ${TestsToRun})
+ GET_FILENAME_COMPONENT(TName ${test} NAME_WE)
+diff -Nur strigi-0.3.11/src/streams/archivereader.cpp strigi-0.3.11.new/src/streams/archivereader.cpp
+--- strigi-0.3.11/src/streams/archivereader.cpp 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/archivereader.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "jstreamsconfig.h"
+ #include "archivereader.h"
+ #include "substreamprovider.h"
+@@ -24,26 +43,15 @@
+ class ArchiveEntryCache {
+ public:
+ class SubEntry {
+- private:
+-// SubEntry(const SubEntry&);
+-// void operator=(const SubEntry&);
+ public:
+ jstreams::EntryInfo entry;
+ //can't define staticly constructed object while object is being defined
+ std::map<std::string, SubEntry> entries;
+ int32_t getCount() const;
+- SubEntry() {
+-// entries = new std::map<std::string, SubEntry>;
+- }
+- virtual ~SubEntry() {
+-// printf("ms %i\n", entries.size());
+-// delete entries;
+- };
++ SubEntry() { }
++ virtual ~SubEntry() {}
+ };
+ class RootSubEntry : public SubEntry {
+- private:
+-// RootSubEntry(const RootSubEntry&);
+-// void operator=(const RootSubEntry&);
+ public:
+ RootSubEntry() :SubEntry() {}
+ bool indexed;
+@@ -82,7 +90,6 @@
+ map<string, ArchiveEntryCache::RootSubEntry>::const_iterator
+ ArchiveEntryCache::findRootEntry(const string& url) const {
+ string n = url;
+- //const SubEntry* e;
+ size_t p = n.size();
+ do {
+ map<string, RootSubEntry>::const_iterator i = cache.find(n);
+@@ -137,8 +144,8 @@
+ jstreams::StreamBase<char>* stream;
+ jstreams::SubStreamProvider* provider;
+ StreamPtr() :stream(0), provider(0) {}
+- StreamPtr(jstreams::StreamBase<char>*s) :stream(s), provider(0) {}
+- StreamPtr(jstreams::SubStreamProvider*p) :stream(0), provider(p) {}
++ StreamPtr(jstreams::StreamBase<char>* s) :stream(s), provider(0) {}
++ StreamPtr(jstreams::SubStreamProvider* p) :stream(0), provider(p) {}
+ void free();
+ };
+ typedef std::map<jstreams::StreamBase<char>*,
+@@ -341,7 +348,7 @@
+ s->reset(0);
+ }
+ }
+-
++ free(streams);
+ return 0;
+ }
+ int
+@@ -366,10 +373,13 @@
+ addEntry(e, se);
+ if (nsubentries) {
+ nentries += nsubentries;
+- e.entry.type = (EntryInfo::Type)(e.entry.type|EntryInfo::Dir);
+ }
++ nentries++;
+ } while (p->nextEntry());
+ free(streams);
++ if (nentries) {
++ e.entry.type = (EntryInfo::Type)(e.entry.type|EntryInfo::Dir);
++ }
+ return nentries;
+ }
+ ArchiveReader::ArchiveReader() {
+@@ -384,7 +394,7 @@
+ if (localStat(url, e) == 0) return 0;
+
+ // check the cache (this assumes getDirEntries was already called)
+- const ArchiveEntryCache::SubEntry *subentry = p->cache.findEntry(url);
++ const ArchiveEntryCache::SubEntry* subentry = p->cache.findEntry(url);
+ if (subentry) {
+ e = subentry->entry;
+ return 0;
+diff -Nur strigi-0.3.11/src/streams/archivereader.h strigi-0.3.11.new/src/streams/archivereader.h
+--- strigi-0.3.11/src/streams/archivereader.h 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/archivereader.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #ifndef ARCHIVEREADER_H
+ #define ARCHIVEREADER_H
+
+@@ -24,6 +43,11 @@
+ bool nextEntry(jstreams::EntryInfo& e);
+ };
+
++/**
++ * Abstract class that defines an interface for opening streams and statting
++ * files. The class ArchiveReader uses instances of this class to access
++ * streams.
++ **/
+ class StreamOpener {
+ public:
+ virtual ~StreamOpener() {}
+@@ -50,6 +74,13 @@
+ bool canHandle(const std::string& url);
+ };
+
++class FileStreamOpener : public StreamOpener {
++public:
++ ~FileStreamOpener() {}
++ jstreams::StreamBase<char>* openStream(const std::string& url);
++ int stat(const std::string& url, jstreams::EntryInfo& e);
++};
++
+ } // end namespace jstreams
+
+ #endif
+diff -Nur strigi-0.3.11/src/streams/CMakeLists.txt strigi-0.3.11.new/src/streams/CMakeLists.txt
+--- strigi-0.3.11/src/streams/CMakeLists.txt 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/CMakeLists.txt 2007-01-14 16:23:37.000000000 +0100
+@@ -7,12 +7,12 @@
+
+ set(streams_SRCS bz2inputstream.cpp
+ digestinputstream.cpp fileinputstream.cpp gzipinputstream.cpp
+- gzipcompressstream.cpp inputstreamreader.cpp filereader.cpp kmpsearcher.cpp
++ gzipcompressstream.cpp inputstreamreader.cpp filereader.cpp
+ subinputstream.cpp mailinputstream.cpp stringterminatedsubstream.cpp
+ tarinputstream.cpp zipinputstream.cpp base64inputstream.cpp
+ dostime.cpp substreamproviderprovider.cpp arinputstream.cpp
+ rpminputstream.cpp archivereader.cpp processinputstream.cpp
+- textutils.cpp)
++ textutils.cpp kmpsearcher.cpp filestreamopener.cpp)
+
+ #add the compatibility files
+ set(streams_SRCS ${streams_SRCS} compat/compat.cpp compat/fnmatch.cpp compat/stgdirent.cpp)
+@@ -36,7 +36,7 @@
+ archivereader.h inputstreamreader.h stringreader.h
+ ${strigi_BINARY_DIR}/src/streams/compat/jstreamsconfig.h
+ compat/timeofday.h compat/strigi_fnmatch.h compat/strigi_thread.h compat/stgdirent.h
+- DESTINATION include)
++ DESTINATION include/strigi)
+
+ add_executable(testpt testpt.cpp processinputstream.cpp)
+
+diff -Nur strigi-0.3.11/src/streams/compat/fnmatch.cpp strigi-0.3.11.new/src/streams/compat/fnmatch.cpp
+--- strigi-0.3.11/src/streams/compat/fnmatch.cpp 2006-12-12 23:50:30.000000000 +0100
++++ strigi-0.3.11.new/src/streams/compat/fnmatch.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -3,7 +3,7 @@
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+- * Guido van Rossum.
++ * Guido van Rossum <guido at python.org>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+diff -Nur strigi-0.3.11/src/streams/compat/stgdirent.cpp strigi-0.3.11.new/src/streams/compat/stgdirent.cpp
+--- strigi-0.3.11/src/streams/compat/stgdirent.cpp 2006-12-12 23:50:30.000000000 +0100
++++ strigi-0.3.11.new/src/streams/compat/stgdirent.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*------------------------------------------------------------------------------
+-* Copyright (C) 2003-2006 Matt J. Weinstein
++* Copyright (C) 2003-2006 Matt J. Weinstein <weinstein at macalester.edu>
+ *
+ * Distributable under the terms of either the Apache License (Version 2.0) or
+ * the GNU Lesser General Public License, as specified in the COPYING file.
+diff -Nur strigi-0.3.11/src/streams/compat/stgdirent.h strigi-0.3.11.new/src/streams/compat/stgdirent.h
+--- strigi-0.3.11/src/streams/compat/stgdirent.h 2006-12-12 23:50:30.000000000 +0100
++++ strigi-0.3.11.new/src/streams/compat/stgdirent.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*------------------------------------------------------------------------------
+-* Copyright (C) 2003-2006 Matt J. Weinstein
++* Copyright (C) 2003-2006 Matt J. Weinstein <weinstein at macalester.edu>
+ *
+ * Distributable under the terms of either the Apache License (Version 2.0) or
+ * the GNU Lesser General Public License, as specified in the COPYING file.
+diff -Nur strigi-0.3.11/src/streams/compat/strigi_fnmatch.h strigi-0.3.11.new/src/streams/compat/strigi_fnmatch.h
+--- strigi-0.3.11/src/streams/compat/strigi_fnmatch.h 2006-12-12 23:50:30.000000000 +0100
++++ strigi-0.3.11.new/src/streams/compat/strigi_fnmatch.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Ben van Klinken <bvklinken at gmail.com>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #if defined(HAVE_FNMATCH_H)
+
+ #elif !defined(STRIGI_FNMATCH_H_)
+diff -Nur strigi-0.3.11/src/streams/compat/timeofday.h strigi-0.3.11.new/src/streams/compat/timeofday.h
+--- strigi-0.3.11/src/streams/compat/timeofday.h 2006-12-12 23:50:30.000000000 +0100
++++ strigi-0.3.11.new/src/streams/compat/timeofday.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,7 +1,7 @@
+ /*
+ * Defines gettimeofday
+ *
+-* Based on timeval.h by Wu Yongwei
++* Based on timeval.h by Wu Yongwei <wuyongwei at gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+diff -Nur strigi-0.3.11/src/streams/decodebase64.cpp strigi-0.3.11.new/src/streams/decodebase64.cpp
+--- strigi-0.3.11/src/streams/decodebase64.cpp 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/decodebase64.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "base64inputstream.h"
+ #include <stdio.h>
+ using namespace jstreams;
+diff -Nur strigi-0.3.11/src/streams/dostime.cpp strigi-0.3.11.new/src/streams/dostime.cpp
+--- strigi-0.3.11/src/streams/dostime.cpp 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/dostime.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,22 +1,3 @@
+-/* This file is part of Strigi Desktop Search
+- *
+- * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
+- *
+- * This library is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU Library General Public
+- * License as published by the Free Software Foundation; either
+- * version 2 of the License, or (at your option) any later version.
+- *
+- * This library is distributed in the hope that it will be useful,
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+- * Library General Public License for more details.
+- *
+- * You should have received a copy of the GNU Library General Public License
+- * along with this library; see the file COPYING.LIB. If not, write to
+- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+- * Boston, MA 02110-1301, USA.
+- */
+ /* dostime.c - convert dos time to/from time_t.
+
+ Copyright (C) 2002 Free Software Foundation
+diff -Nur strigi-0.3.11/src/streams/dostime.h strigi-0.3.11.new/src/streams/dostime.h
+--- strigi-0.3.11/src/streams/dostime.h 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/dostime.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,25 +1,6 @@
+-/* This file is part of Strigi Desktop Search
+- *
+- * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
+- *
+- * This library is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU Library General Public
+- * License as published by the Free Software Foundation; either
+- * version 2 of the License, or (at your option) any later version.
+- *
+- * This library is distributed in the hope that it will be useful,
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+- * Library General Public License for more details.
+- *
+- * You should have received a copy of the GNU Library General Public License
+- * along with this library; see the file COPYING.LIB. If not, write to
+- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+- * Boston, MA 02110-1301, USA.
+- */
+ /*
+ dostime.h - function prototypes
+- Copyright (C) 1999, 2002 Bryan Burns
++ Copyright (C) 1999, 2002 Bryan Burns <wizard.rb at gmail.com>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+diff -Nur strigi-0.3.11/src/streams/filestreamopener.cpp strigi-0.3.11.new/src/streams/filestreamopener.cpp
+--- strigi-0.3.11/src/streams/filestreamopener.cpp 1970-01-01 01:00:00.000000000 +0100
++++ strigi-0.3.11.new/src/streams/filestreamopener.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -0,0 +1,61 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Ben van Klinken <bvklinken at gmail.com>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
++#include "archivereader.h"
++#include "fileinputstream.h"
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <unistd.h>
++
++using namespace jstreams;
++using namespace std;
++
++StreamBase<char>*
++FileStreamOpener::openStream(const string& url) {
++ StreamBase<char>* stream = new FileInputStream(url.c_str());
++ if (stream->getStatus() != Ok) {
++ delete stream;
++ stream = 0;
++ }
++ return stream;
++}
++int
++FileStreamOpener::stat(const string& url, EntryInfo& e) {
++ struct stat s;
++ if (::stat(url.c_str(), &s) == -1) {
++ return -1;
++ }
++ if (S_ISREG(s.st_mode)) {
++ e.type = EntryInfo::File;
++ } else if (S_ISDIR(s.st_mode)) {
++ e.type = EntryInfo::Dir;
++ } else {
++ e.type = EntryInfo::Unknown;
++ }
++ e.size = s.st_size;
++ e.mtime = s.st_mtime;
++ size_t p = url.rfind('/');
++ if (p == string::npos) {
++ e.filename = url;
++ } else {
++ e.filename = url.substr(p+1);
++ }
++
++ return 0;
++}
+diff -Nur strigi-0.3.11/src/streams/gzipcompressstream.cpp strigi-0.3.11.new/src/streams/gzipcompressstream.cpp
+--- strigi-0.3.11/src/streams/gzipcompressstream.cpp 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/gzipcompressstream.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Ben van Klinken <bvklinken at gmail.com>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "jstreamsconfig.h"
+ #include "gzipcompressstream.h"
+ #include <zlib.h>
+diff -Nur strigi-0.3.11/src/streams/mailinputstream.cpp strigi-0.3.11.new/src/streams/mailinputstream.cpp
+--- strigi-0.3.11/src/streams/mailinputstream.cpp 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/mailinputstream.cpp 2006-12-16 18:04:36.000000000 +0100
+@@ -27,6 +27,82 @@
+ using namespace jstreams;
+ using namespace std;
+
++char
++decodeHex(char h) {
++ if (h >= 'A' && h <= 'F') return 10+h-'A';
++ if (h >= 'a' && h <= 'f') return 10+h-'a';
++ return h - '0';
++}
++string
++decodeQuotedPrintable(const char* v, int32_t len) {
++ string decoded;
++ decoded.reserve(len);
++ const char* pos = v;
++ const char* end = v + len;
++ char c;
++ while (v < end) {
++ if (*v == '=' && end - v > 2 && isxdigit(v[1]) && isxdigit(v[2])) {
++ decoded.append(pos, v - pos);
++ c = decodeHex(v[1])*16 + decodeHex(v[2]);
++ decoded.append(&c, 1);
++ pos = v = v + 3;
++ } else if (*v == '_') {
++ decoded.append(pos, v - pos);
++ decoded.append(" ");
++ v++;
++ } else {
++ v++;
++ }
++ }
++ if (pos < end) {
++ decoded.append(pos, end-pos);
++ }
++ return decoded;
++}
++/**
++ * This function can decode a mail header if it contains utf8 encoded in base64.
++ **/
++string
++getDecodedHeaderValue(const char* v, int32_t len) {
++ string decoded;
++ decoded.reserve(len*2);
++ const char* s = v;
++ const char* p = v;
++ const char* e = s + len;
++ while (s < e) {
++ if (*s == '=' && e-s >= 12 && strncasecmp("?utf-8?", s+1, 7) == 0) {
++ if (strncasecmp("b?", s+8, 2) == 0) {
++ const char* ec = s + 10;
++ while (ec < e && *ec != '?') ec += 4;
++ if (ec < e - 1) {
++ decoded.append(p, s-p);
++ decoded.append(Base64InputStream::decode(s+10, ec-10-s));
++ s = p = ec + 2;
++ } else {
++ s++;
++ }
++ } else if (strncasecmp("q?", s+8, 2) == 0) {
++ const char* ec = s + 10;
++ while (ec < e && *ec != '?') ++ec;
++ if (ec < e -1) {
++ decoded.append(p, s-p);
++ decoded.append(decodeQuotedPrintable(s+10, ec-10-s));
++ s = p = ec + 2;
++ } else {
++ s++;
++ }
++ } else {
++ s++;
++ }
++ } else {
++ s++;
++ }
++ }
++ if (p < e) {
++ decoded.append(p, e-p);
++ }
++ return decoded;
++}
+ bool
+ checkHeaderKey(const char* data, int32_t left) {
+ if (left >= 9 && strncasecmp("Received:", data, 9) == 0) {
+@@ -100,90 +176,114 @@
+ }
+ MailInputStream::MailInputStream(StreamBase<char>* input)
+ : SubStreamProvider(input), substream(0) {
+-// printf("%p\n", input);
+ entrynumber = 0;
+ linenum = 0;
+- skipHeader();
+- if (bufstart == 0) {
++ nextLineStartPosition = 0;
++ // parse the header and store the imporant header fields
++ readHeader();
++ if (status != Ok) {
+ fprintf(stderr, "no valid header\n");
+ return;
+ }
+-
+- // get the boundary
+- boundary = getValue("boundary", contenttype);
+ }
+ MailInputStream::~MailInputStream() {
+ if (substream && substream != entrystream) {
+ delete substream;
+ }
+ }
++/**
++ * This function read the input until the end of a header line.
++ * A header line can span multiple normal lines. All normal lines after the
++ * first normal line start with a whitespace.
++ * This means a header line is ended by on of these patterns (where \S is
++ * a non-whitespace character).
++ * '\r\S', '\n\S', '\r\n\S', '\r\r', '\n\n', '\r\n\r'
++ **/
+ void
+-MailInputStream::readLine() {
+- if (bufstart == 0) return;
+- linenum++;
+- linestart = lineend;
+- bool backslashr = false;
+- if (eol) {
+- linestart++; // skip \r or \n
+- backslashr = *lineend == '\r';
+- //printf("%p %p %p %p\n", linestart, lineend, bufstart, bufend);
+-// if (backslashr && linestart != bufend) printf("%i\n", *linestart);
+- if (backslashr && linestart != bufend && *linestart == '\n') {
+- // skip \n of \r\n
+- linestart++;
+- }
+- lineend = linestart;
+- }
+- while (lineend != bufend && *lineend != '\n' && *lineend != '\r') {
+- lineend++;
+- }
+- eol = true;
+- if (lineend == bufend) {
+- rewindToLineStart();
+- fillBuffer();
+- if (bufstart == 0) {
+- // the input has been exhausted
++MailInputStream::readHeaderLine() {
++ // state: 0 -> ok, 1 -> '\r', 2 -> '\n', 3 -> '\r\n'
++ char state = 0;
++ int32_t nread;
++ int32_t linepos = 0;
++ bool completeLine = false;
++ char c = 0;
++
++ input->reset(nextLineStartPosition);
++ do {
++ nread = input->read(linestart, linepos+1, maxlinesize);
++ if (nread < linepos+1) {
++ completeLine = true;
++ lineend = linestart + nread;
++ status = Eof;
+ return;
+ }
+- if (backslashr && *linestart == '\n') {
+- // we have to skip a \n because of a \r\n lineend across the read
+- // boundary
+- linestart++;
+- if (linestart == bufend) {
+- rewindToLineStart();
+- fillBuffer();
+- if (bufstart == 0) {
+- // the input has been exhausted
+- return;
++ input->reset(nextLineStartPosition);
++ if (input->getStatus() == Error) {
++ status = Error;
++ error = input->getError();
++ return;
++ } else if (linepos >= maxlinesize) {
++ // error line is too long
++ status = Error;
++ ostringstream str;
++ str << linenum;
++ error = "line "+str.str()+" is too long";
++ return;
++ } else {
++ while (linepos < nread) {
++ c = linestart[linepos];
++ if (state == 0) {
++ if (c == '\r') {
++ state = 1;
++ } else if (c == '\n') {
++ state = 2;
++ }
++ } else if (state == 1) { // '\r'
++ if (c == '\n') {
++ state = 3;
++ } else if (c == '\r' || !isspace(c)) { // end
++ completeLine = true;
++ lineend = linestart + linepos - 1;
++ break;
++ } else {
++ state = 0;
++ }
++ } else if (state == 2) { // '\n'
++ if (c == '\n' || !isspace(c)) { // end
++ completeLine = true;
++ lineend = linestart + linepos - 1;
++ break;
++ } else {
++ state = 0;
++ }
++ } else { // state == 3 '\r\n'
++ if (c == '\r' || !isspace(c)) { // end
++ completeLine = true;
++ lineend = linestart + linepos - 2;
++ break;
++ } else {
++ state = 0;
++ }
+ }
++ linepos++;
+ }
+ }
+- lineend = linestart;
+- while (lineend != bufend && *lineend != '\n' && *lineend != '\r') {
+- lineend++;
+- }
+- if (lineend == bufend) {
+- string str(linestart, 10);
+- fprintf(stderr, "line %i is too long '%s' %i %i\n", linenum,
+- str.c_str(), lineend-linestart, maxlinesize);
+- eol = false;
+- }
+- }
+-// printf("%.*s\n", lineend-linestart, linestart);
++ } while (!completeLine);
++ nextLineStartPosition += linepos;
+ }
+ string
+ MailInputStream::getValue(const char* n, const string& headerline) const {
+- string name = n;
+- name += '=';
++ size_t nl = strlen(n);
+ string value;
+ // get the value
+ const char* hl = headerline.c_str();
+- const char* v = strcasestr(hl, name.c_str());
++ const char* v = strcasestr(hl, n);
+ if (v == 0) {
+ // so far we just scan for a value attribute
+ return value;
+ }
+- v += name.length();
++ v += nl;
++ v += strspn(v, "= \n\r");
+ const char* vend = strchr(v, ';');
+ if (vend == 0) {
+ vend = hl + headerline.length();
+@@ -195,148 +295,44 @@
+ }
+ return value;
+ }
+-/**
+- * Position the stream to the start of the active line. So in the next
+- * call to this function, this line is read again.
+- **/
+-void
+-MailInputStream::rewindToLineStart() {
+-/* int d = bufend-linestart;
+- printf("bsp: %lli position: %lli diff: %i newpos: %lli\n", bufstartpos, bufendpos, d,
+- bufendpos-d);
+- printf("'%.*s'\n", (d>10)?10:d, linestart);*/
+-
+- input->reset(bufendpos-(bufend-linestart));
+- //int64_t rp = bufstartpos + (linestart-bufstart);
+- //int64_t np = input->reset(bufstartpos + (linestart-bufstart));
+- //printf("rewind %lli %lli\n", rp, np);
+-}
+-void
+-MailInputStream::fillBuffer() {
+- bufstartpos = input->getPosition();
+- int32_t nread = input->read(bufstart, maxlinesize, 0);
+- if (nread > 0) {
+-// printf("buf: '%.*s'\n", 10, bufstart);
+- bufend = bufstart + nread;
+- bufendpos = input->getPosition();
+- linestart = bufstart;
+- } else {
+- bufstart = 0;
+- }
+-}
+ void
+-MailInputStream::skipHeader() {
+- maxlinesize = 100;
++MailInputStream::readHeader() {
++ maxlinesize = 1000;
+
+- fillBuffer();
+- lineend = bufstart;
+-
+- if (bufstart == 0) {
+- // error: file too short
+- return;
+- }
+- lastHeader = 0;
+- eol = false;
+- readLine();
+- while (bufstart) {
+- readLine();
+- //printf("%i: %.*s\n", lineend-linestart, lineend-linestart, linestart);
+- if (linestart == lineend) {
+- //printf("ok %lli\n", input->getPosition());
+- break;
+- }
++ readHeaderLine();
++ while (status == Ok && linestart != lineend) {
+ handleHeaderLine();
++ readHeaderLine();
+ }
+- readLine();
+- rewindToLineStart();
+-}
+-void
+-MailInputStream::scanBody() {
+- while (bufstart) {
+- readLine();
+- if (boundary.length()+2 == size_t(lineend-linestart)
+- && strncmp(boundary.c_str(), linestart+2, boundary.length())
+- == 0) {
+- handleBodyLine();
+- break;
+- }
+- }
+-}
+-char
+-decodeHex(char h) {
+- if (h >= 'A' && h <= 'F') return 10+h-'A';
+- if (h >= 'a' && h <= 'f') return 10+h-'a';
+- return h - '0';
+-}
+-string
+-decodeQuotedPrintable(const char* v, int32_t len) {
+- string decoded;
+- decoded.reserve(len);
+- const char* pos = v;
+- const char* end = v + len;
+- char c;
+- while (v < end) {
+- if (*v == '=' && end - v > 2 && isxdigit(v[1]) && isxdigit(v[2])) {
+- decoded.append(pos, v - pos);
+- c = decodeHex(v[1])*16 + decodeHex(v[2]);
+- decoded.append(&c, 1);
+- pos = v = v + 3;
+- } else if (*v == '_') {
+- decoded.append(pos, v - pos);
+- decoded.append(" ");
+- v++;
+- } else {
+- v++;
+- }
+- }
+- if (pos < end) {
+- decoded.append(pos, end-pos);
+- }
+- return decoded;
+ }
+ /**
+- * This function can decode a mail header if it contains utf8 encoded in base64.
++ * Read lines from the email until a line contains the boundary.
++ * If a boundary is encountered, the block header is parsed.
+ **/
+-string
+-getDecodedHeaderValue(const char* v, int32_t len) {
+- string decoded;
+- decoded.reserve(len*2);
+- const char* s = v;
+- const char* p = v;
+- const char* e = s + len;
+- while (s < e) {
+- if (*s == '=' && e-s >= 12 && strncasecmp("?utf-8?", s+1, 7) == 0) {
+- if (strncasecmp("b?", s+8, 2) == 0) {
+- const char* ec = s + 10;
+- while (ec < e && *ec != '?') ec += 4;
+- if (ec < e - 1) {
+- decoded.append(p, s-p);
+- decoded.append(Base64InputStream::decode(s+10, ec-10-s));
+- s = p = ec + 2;
+- } else {
+- s++;
++void
++MailInputStream::scanBody() {
++ while (status == Ok) {
++ readHeaderLine();
++ string::size_type len = lineend - linestart;
++ if (len > 2 && strncmp("--", linestart, 2) == 0) {
++ string::size_type blen = boundary.top().length();
++ if (len == blen + 4 && strncmp(linestart + 2 + blen, "--", 2) == 0
++ && strncmp(linestart + 2, boundary.top().c_str(), blen)
++ == 0) {
++ // check if this is the end of a multipart
++ boundary.pop();
++ if (boundary.size() == 0) {
++ status = Eof;
+ }
+- } else if (strncasecmp("q?", s+8, 2) == 0) {
+- const char* ec = s + 10;
+- while (ec < e && *ec != '?') ++ec;
+- if (ec < e -1) {
+- decoded.append(p, s-p);
+- decoded.append(decodeQuotedPrintable(s+10, ec-10-s));
+- s = p = ec + 2;
+- } else {
+- s++;
++ } else if (len == blen + 2
++ && strncmp(linestart + 2, boundary.top().c_str(), blen)
++ == 0) {
++ if (handleBodyLine()) {
++ break;
+ }
+- } else {
+- s++;
+ }
+- } else {
+- s++;
+ }
+ }
+- if (p < e) {
+- decoded.append(p, e-p);
+- }
+- return decoded;
+ }
+ void
+ MailInputStream::handleHeaderLine() {
+@@ -346,34 +342,30 @@
+ static const char* contentdisposition = "Content-Disposition:";
+ int32_t len = lineend - linestart;
+ if (len < 2) return;
+- if (lastHeader && isspace(*linestart)) {
+- *lastHeader += string(linestart, len);
+- } else if (len < 8) {
+- lastHeader = 0;
++ if (len < 8) {
+ return;
+ } else if (strncasecmp(linestart, subject, 8) == 0) {
+ int32_t offset = 8;
+ while (offset < len && isspace(linestart[offset])) offset++;
+ this->subject = getDecodedHeaderValue(linestart+offset, len-offset);
+- lastHeader = &this->subject;
+ } else if (strncasecmp(linestart, contenttype, 13) == 0) {
+ int32_t offset = 13;
+ while (offset < len && isspace(linestart[offset])) offset++;
+ this->contenttype = std::string(linestart+offset, len-offset);
+- lastHeader = &this->contenttype;
++ // get the boundary
++ string b = getValue("boundary", this->contenttype);
++ if (b.size()) {
++ boundary.push(b);
++ }
+ } else if (strncasecmp(linestart, contenttransferencoding, 26) == 0) {
+ this->contenttransferencoding = std::string(linestart, len);
+- lastHeader = &this->contenttransferencoding;
+ } else if (strncasecmp(linestart, contentdisposition, 20) == 0) {
+ this->contentdisposition = std::string(linestart, len);
+- lastHeader = &this->contentdisposition;
+- } else {
+- lastHeader = 0;
+ }
+ }
+ bool
+ MailInputStream::checkHeaderLine() const {
+- bool validheader = bufstart && linestart != lineend;
++ bool validheader = linestart != lineend;
+ if (validheader) {
+ const char* colpos = linestart;
+ while (*colpos != ':' && ++colpos != lineend) {}
+@@ -381,26 +373,31 @@
+ }
+ return validheader;
+ }
+-// return true if we are at the start of a base64 encoded block
+-void
++/**
++ * Handle the body part header.
++ **/
++bool
+ MailInputStream::handleBodyLine() {
+ clearHeaders();
+- //printf("handleBodyLine %p %s\n", linestart, boundary.c_str());
++
+ // start of new block
+- // skip header
++ // read part header
+ bool validheader;
++ size_t n = boundary.size();
+ do {
+- readLine();
++ readHeaderLine();
+ validheader = checkHeaderLine();
+ if (validheader) {
+ handleHeaderLine();
+ }
+- } while (validheader);
+- // set the stream to the start of the content
+- readLine();
+- if (bufstart == 0) return;
+- rewindToLineStart();
+- //printf("b %p %p %.*s\n", bufstart, linestart, lineend-linestart, linestart);
++ } while (status == Ok && validheader);
++ if (boundary.size() > n) {
++ return false;
++ }
++ readHeaderLine();
++ if (status != Ok) {
++ return false;
++ }
+
+ // get the filename
+ entryinfo.filename = getValue("filename", contentdisposition);
+@@ -409,16 +406,20 @@
+ }
+
+ // create a stream that's limited to the content
+- substream = new StringTerminatedSubStream(input, "--"+boundary);
++ substream = new StringTerminatedSubStream(input, "--"+boundary.top());
+ // set a reasonable buffer size
+- //substream->mark(10*boundary.length());
+- //printf("%s\n", contenttransferencoding.c_str());
+ if (strcasestr(contenttransferencoding.c_str(), "base64")) {
+ entrystream = new Base64InputStream(substream);
+ } else {
+ entrystream = substream;
+ }
++ return true;
+ }
++/**
++ * Not all parts of multipart emails have a name. This function keeps a running
++ * number to make sure all parts have a name so that they can be referenced
++ * later.
++ **/
+ void
+ MailInputStream::ensureFileName() {
+ entrynumber++;
+@@ -434,11 +435,11 @@
+ if (status != Ok) return 0;
+ // if the mail does not consist of multiple parts, we give a pointer to
+ // the input stream
+- if (boundary.length() == 0) {
++ if (boundary.size() == 0) {
+ // signal eof because we only return eof once
+ status = Eof;
+ entrystream = new SubInputStream(input);
+- ensureFileName();
++ entryinfo.filename = "body";
+ return entrystream;
+ }
+ // read anything that's left over in the previous stream
+@@ -450,35 +451,8 @@
+ if (substream->getStatus() == Error) {
+ status = Error;
+ } else {
+- if (substream->getSize()<0) {
+- fprintf(stderr, "%s %i\n", boundary.c_str(),
+- substream->getStatus());
+- fprintf(stderr, "NONDEJU size should be determined %lli\n",
+- substream->getSize());
+- status = Eof;
+- // make sure valgrind is called
+-/* substream = 0;
+- substream->getSize();
+- exit(0);*/
+- }
+- int64_t end = substream->getOffset()+substream->getSize()
+- + boundary.length()+2;
+- //printf("weird: %lli %lli\n",substream->getOffset(),substream->getSize());
+- // skip to pass the boundary
+- int64_t np = input->reset(end);
+- if (np != end) {
+- status = Error;
+- fprintf(stderr, "error: could not reset position\n");
+- } else {
+- int32_t nr = input->read(dummy, 1, 0);
+- //printf("ohoh: %lli %lli '%.*s'\n",end,np, (nr>10)?10:nr,dummy);
+- if (nr < 1 || *dummy == '-') {
+- // the end of the mail
+- status = Eof;
+- }
+- input->reset(end);
+- input->read(dummy, 2, 2);
+- }
++ nextLineStartPosition = substream->getOffset()
++ + substream->getSize();
+ }
+ if (substream && substream != entrystream) {
+ delete substream;
+@@ -490,13 +464,9 @@
+ if (status != Ok) {
+ return 0;
+ }
+- // force the stream to refresh the buffer
+- fillBuffer();
+- lineend = bufstart;
+- handleBodyLine();
+- } else {
+- scanBody();
+ }
++ scanBody();
++
+ if (entrystream == 0) {
+ status = Eof;
+ }
+diff -Nur strigi-0.3.11/src/streams/mailinputstream.h strigi-0.3.11.new/src/streams/mailinputstream.h
+--- strigi-0.3.11/src/streams/mailinputstream.h 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/mailinputstream.h 2006-12-16 18:04:36.000000000 +0100
+@@ -21,9 +21,9 @@
+ #define MAILINPUTSTREAM_H
+
+ #include "substreamprovider.h"
+-
++#include <stack>
+ /**
+- * This is a proof of concept implementation for handling email streams as
++ * This is an implementation for handling email streams as
+ * archives. It allows one to read the email body and email attachements as
+ * streams.
+ **/
+@@ -33,35 +33,28 @@
+ class StringTerminatedSubStream;
+ class MailInputStream : public SubStreamProvider {
+ private:
++ int64_t nextLineStartPosition;
+ // variables that record the current read state
+- bool eol; // true if the buffer contains a line end
+ int32_t entrynumber;
+- int64_t bufstartpos;
+- int64_t bufendpos;
+ int linenum;
+ int maxlinesize;
+ const char* linestart;
+ const char* lineend;
+- const char* bufstart;
+- const char* bufend;
+
+ StringTerminatedSubStream* substream;
+ std::string subject;
+ std::string contenttype;
+ std::string contenttransferencoding;
+ std::string contentdisposition;
+- std::string* lastHeader;
+
+- std::string boundary;
++ std::stack<std::string> boundary;
+
+- void readLine();
+- void fillBuffer();
+- void skipHeader();
++ void readHeaderLine();
++ void readHeader();
+ void scanBody();
+ void handleHeaderLine();
+- void handleBodyLine();
++ bool handleBodyLine();
+ bool lineIsEndOfBlock();
+- void rewindToLineStart();
+ bool checkHeaderLine() const;
+ void clearHeaders();
+ void ensureFileName();
+diff -Nur strigi-0.3.11/src/streams/pdf/CMakeLists.txt strigi-0.3.11.new/src/streams/pdf/CMakeLists.txt
+--- strigi-0.3.11/src/streams/pdf/CMakeLists.txt 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/pdf/CMakeLists.txt 2006-12-13 21:08:33.000000000 +0100
+@@ -1,4 +1,5 @@
+
++if (Magic_FOUND)
+ include_directories(.. ${MAGIC_INCLUDE_DIR})
+
+ add_library(pdfstream pdfparser.cpp pdfinputstream.cpp)
+@@ -9,4 +10,4 @@
+ add_executable(pdftest pdftest.cpp)
+
+ target_link_libraries(pdftest streams ${MAGIC_LIBRARIES})
+-
++endif (Magic_FOUND)
+diff -Nur strigi-0.3.11/src/streams/pdf/pdf.cpp strigi-0.3.11.new/src/streams/pdf/pdf.cpp
+--- strigi-0.3.11/src/streams/pdf/pdf.cpp 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/pdf/pdf.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "jstreamsconfig.h"
+ #include "pdfparser.h"
+ #include "fileinputstream.h"
+diff -Nur strigi-0.3.11/src/streams/pdf/pdfparser.cpp strigi-0.3.11.new/src/streams/pdf/pdfparser.cpp
+--- strigi-0.3.11/src/streams/pdf/pdfparser.cpp 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/pdf/pdfparser.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "jstreamsconfig.h"
+ #include "pdfparser.h"
+ #include "stringterminatedsubstream.h"
+diff -Nur strigi-0.3.11/src/streams/pdf/pdfparser.h strigi-0.3.11.new/src/streams/pdf/pdfparser.h
+--- strigi-0.3.11/src/streams/pdf/pdfparser.h 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/pdf/pdfparser.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #ifndef PDFPARSER_H
+ #define PDFPARSER_H
+
+diff -Nur strigi-0.3.11/src/streams/pdf/pdftest.cpp strigi-0.3.11.new/src/streams/pdf/pdftest.cpp
+--- strigi-0.3.11/src/streams/pdf/pdftest.cpp 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/pdf/pdftest.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "jstreamsconfig.h"
+ #include "fileinputstream.h"
+ #include "stringreader.h"
+diff -Nur strigi-0.3.11/src/streams/processinputstream.cpp strigi-0.3.11.new/src/streams/processinputstream.cpp
+--- strigi-0.3.11/src/streams/processinputstream.cpp 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/processinputstream.cpp 2007-01-10 00:56:16.000000000 +0100
+@@ -20,6 +20,7 @@
+ #include "jstreamsconfig.h"
+ #include "processinputstream.h"
+ #include <errno.h>
++#include <sys/wait.h>
+ #include <unistd.h>
+ using namespace jstreams;
+ using namespace std;
+@@ -115,8 +116,21 @@
+ ProcessInputStream::runCmd() {
+ int p[2];
+ pipe(p);
+- pid = fork();
+- if (pid == 0) {
++
++ if( (pid=fork()) == -1) {
++ /* something went wrong */
++ fprintf(stderr,"ProcessInputStream::runCmd: fork error\n");
++ close (p[0]);
++ close (p[1]);
++ return;
++ }
++
++ if (pid) {
++ int rv;
++ wait (&rv);
++ //fprintf(stderr,"%s process exited with a %i value\n", args[0], rv);
++ }
++ else {
+ // define the output to be written into p[1]
+ dup2(p[1], 1);
+ // close p[0], because this process will not read from it
+@@ -137,8 +151,23 @@
+ int pout[2];
+ pipe(pin);
+ pipe(pout);
+- pid = fork();
+- if (pid == 0) {
++
++ if( (pid=fork()) == -1) {
++ /* something went wrong */
++ fprintf(stderr,"ProcessInputStream::runCmdWithInput: fork error\n");
++ close (pin[0]);
++ close (pin[1]);
++ close (pout[0]);
++ close (pout[1]);
++ return;
++ }
++
++ if (pid) {
++ int rv;
++ wait (&rv);
++ //fprintf(stderr,"%s process exited with a %i value\n", args[0], rv);
++ }
++ else {
+ // define the output to be written into p[1]
+ dup2(pin[0], 0);
+ dup2(pout[1], 1);
+diff -Nur strigi-0.3.11/src/streams/stringreader.h strigi-0.3.11.new/src/streams/stringreader.h
+--- strigi-0.3.11/src/streams/stringreader.h 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/stringreader.h 2006-12-13 20:02:10.000000000 +0100
+@@ -94,6 +94,7 @@
+ template <class T>
+ int64_t
+ StringReader<T>::skip(int64_t ntoskip) {
++ if (ntoskip == 0) return 0;
+ const T* start;
+ return read(start, ntoskip, ntoskip);
+ }
+diff -Nur strigi-0.3.11/src/streams/subinputstream.cpp strigi-0.3.11.new/src/streams/subinputstream.cpp
+--- strigi-0.3.11/src/streams/subinputstream.cpp 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/subinputstream.cpp 2006-12-13 20:01:05.000000000 +0100
+@@ -78,7 +78,7 @@
+ // newpos, offset);
+ position = input->reset(newpos + offset);
+ if (position < offset) {
+- fprintf(stderr, "########### position %lli newpos %lli\n", position, newpos);
++ fprintf(stderr, "########### position %li newpos %li\n", position, newpos);
+ status = Error;
+ error = input->getError();
+ } else {
+@@ -94,6 +94,7 @@
+ status = Eof;
+ return -1;
+ }
++ if (ntoskip == 0) return 0;
+ if (size != -1) {
+ const int64_t left = size - position;
+ // restrict the amount of data that can be skipped
+diff -Nur strigi-0.3.11/src/streams/tarinputstream.cpp strigi-0.3.11.new/src/streams/tarinputstream.cpp
+--- strigi-0.3.11/src/streams/tarinputstream.cpp 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/tarinputstream.cpp 2006-12-15 00:36:12.000000000 +0100
+@@ -59,6 +59,16 @@
+ // header is too small to check
+ return false;
+ }
++ // the file starts with a filename of at most 100 characters. The filename
++ // is ended by a \0, after this \0 only \0 is allowed
++ int p = 0;
++ while (p < 100 && h[p] != '\0') ++p;
++ while (p < 100) {
++ if (h[p++] != '\0') {
++ return false;
++ }
++ }
++
+ // check for field values that should be '\0' for the header to be a
+ // tar header. Two positions are also accepted if they are ' ' because they
+ return !(h[107] || h[115] || h[123] || (h[135]&&h[135]!=' ')
+diff -Nur strigi-0.3.11/src/streams/testpt.cpp strigi-0.3.11.new/src/streams/testpt.cpp
+--- strigi-0.3.11/src/streams/testpt.cpp 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/testpt.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "processinputstream.h"
+ #include "stringreader.h"
+ using namespace jstreams;
+diff -Nur strigi-0.3.11/src/streams/tests/ArchiveReaderTest.cpp strigi-0.3.11.new/src/streams/tests/ArchiveReaderTest.cpp
+--- strigi-0.3.11/src/streams/tests/ArchiveReaderTest.cpp 1970-01-01 01:00:00.000000000 +0100
++++ strigi-0.3.11.new/src/streams/tests/ArchiveReaderTest.cpp 2006-12-17 18:15:14.000000000 +0100
+@@ -0,0 +1,103 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
++
++#include "../archivereader.h"
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <dirent.h>
++#include <unistd.h>
++
++using namespace jstreams;
++using namespace std;
++
++int errors;
++
++void
++test1(const char* path) {
++ FileStreamOpener opener;
++ ArchiveReader r;
++ r.addStreamOpener(&opener);
++ StreamBase<char>* s = r.openStream(path);
++ if (s == 0) {
++ fprintf(stderr, "cannot open stream to %s\n", path);
++ errors++;
++ }
++ r.closeStream(s);
++}
++void
++test2(const char* path) {
++ FileStreamOpener opener;
++ ArchiveReader r;
++ r.addStreamOpener(&opener);
++ DirLister dl = r.getDirEntries(path);
++ EntryInfo e;
++ while (dl.nextEntry(e)) {
++ string filepath(path);
++ filepath += "/";
++ filepath += e.filename;
++ if (e.type == EntryInfo::File) {
++ test1(filepath.c_str());
++ }
++ test2(filepath.c_str());
++ }
++}
++
++void
++walkdirectories(const char* path, void (*callback)(const char*)) {
++ DIR* dir = opendir(path);
++ if (dir == 0) return;
++ string p(path);
++ struct dirent* subdir = readdir(dir);
++ struct stat dirstat;
++ while (subdir) {
++ if (subdir->d_name[0] == '.') {
++ subdir = readdir(dir);
++ continue;
++ }
++ string name = subdir->d_name;
++ string filepath = p + name;
++ if (lstat(filepath.c_str(), &dirstat) == 0) {
++ if (S_ISREG(dirstat.st_mode)) {
++ callback(filepath.c_str());
++ } else if (S_ISDIR(dirstat.st_mode)) {
++ filepath += "/";
++ walkdirectories(filepath.c_str(), callback);
++ }
++ }
++ subdir = readdir(dir);
++ }
++ closedir(dir);
++}
++
++/**
++ * Test the class ArchiveReader by analyzing all files in the given
++ * directory.
++ **/
++int
++ArchiveReaderTest(int argc, char** argv) {
++ if (argc < 2) return 1;
++ errors = 0;
++ walkdirectories(argv[1], test1);
++ walkdirectories(argv[1], test2);
++ if (errors) {
++ fprintf(stderr, "%i errors\n", errors);
++ }
++ return errors;
++}
+diff -Nur strigi-0.3.11/src/streams/tests/CMakeLists.txt strigi-0.3.11.new/src/streams/tests/CMakeLists.txt
+--- strigi-0.3.11/src/streams/tests/CMakeLists.txt 2006-12-12 23:50:29.000000000 +0100
++++ strigi-0.3.11.new/src/streams/tests/CMakeLists.txt 2006-12-17 14:00:23.000000000 +0100
+@@ -14,6 +14,7 @@
+ StringTerminatedSubStreamTest.cpp
+ DigestInputStreamTest.cpp
+ ProcessInputStreamTest.cpp
++ ArchiveReaderTest.cpp
+ )
+
+ ADD_EXECUTABLE(testrunner ${Tests} inputstreamtests.cpp)
+diff -Nur strigi-0.3.11/src/streams/tests/inputstreamtests.cpp strigi-0.3.11.new/src/streams/tests/inputstreamtests.cpp
+--- strigi-0.3.11/src/streams/tests/inputstreamtests.cpp 2006-12-12 23:50:29.000000000 +0100
++++ strigi-0.3.11.new/src/streams/tests/inputstreamtests.cpp 2006-12-13 20:01:05.000000000 +0100
+@@ -28,6 +28,7 @@
+ void
+ inputStreamTest1(StreamBase<T>* s) {
+ int64_t size = s->getSize();
++ VERIFY(s->skip(0) == 0);
+ VERIFY(size >= -1);
+ const T* ptr = 0;
+ int32_t n;
+diff -Nur strigi-0.3.11/src/streams/textutils.cpp strigi-0.3.11.new/src/streams/textutils.cpp
+--- strigi-0.3.11/src/streams/textutils.cpp 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/textutils.cpp 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #include "jstreamsconfig.h"
+ #include "textutils.h"
+
+diff -Nur strigi-0.3.11/src/streams/textutils.h strigi-0.3.11.new/src/streams/textutils.h
+--- strigi-0.3.11/src/streams/textutils.h 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/textutils.h 2007-01-05 10:53:01.000000000 +0100
+@@ -1,3 +1,22 @@
++/* This file is part of Strigi Desktop Search
++ *
++ * Copyright (C) 2006 Jos van den Oever <jos at vandenoever.info>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
+ #ifndef TEXTUTILS_H
+ #define TEXTUTILS_H
+
+diff -Nur strigi-0.3.11/src/streams/zipinputstream.cpp strigi-0.3.11.new/src/streams/zipinputstream.cpp
+--- strigi-0.3.11/src/streams/zipinputstream.cpp 2006-12-12 23:50:31.000000000 +0100
++++ strigi-0.3.11.new/src/streams/zipinputstream.cpp 2006-12-13 20:01:05.000000000 +0100
+@@ -197,6 +197,7 @@
+ int64_t skipped = input->skip(extralen);
+ if (skipped != extralen) {
+ status = Error;
++// printf("skipped %li extralen %li position: %li size: %li\n", skipped, extralen, input->getPosition(), input->getSize());
+ error = "Error skipping extra field: ";
+ error += input->getError();
+ return;
+diff -Nur strigi-0.3.11/src/xmlindexer/indexer.cpp strigi-0.3.11.new/src/xmlindexer/indexer.cpp
+--- strigi-0.3.11/src/xmlindexer/indexer.cpp 2006-12-12 23:50:16.000000000 +0100
++++ strigi-0.3.11.new/src/xmlindexer/indexer.cpp 2007-01-14 14:47:27.000000000 +0100
+@@ -30,7 +30,7 @@
+ Indexer *Indexer::workingIndexer;
+
+ Indexer::Indexer(ostream& o, IndexerConfiguration& ic)
+- :out(o), writer(out), m_indexer(writer, ic) {
++ :out(o), writer(out), m_indexer(ic) {
+ m_lister = new FileLister(ic);
+ }
+
+@@ -72,5 +72,5 @@
+ }
+ void
+ Indexer::doFile(const char* filepath) {
+- m_indexer.indexFile(filepath);
++ m_indexer.indexFile(filepath, writer);
+ }
+diff -Nur strigi-0.3.11/src/xmlindexer/xmlindexwriter.h strigi-0.3.11.new/src/xmlindexer/xmlindexwriter.h
+--- strigi-0.3.11/src/xmlindexer/xmlindexwriter.h 2006-12-12 23:50:16.000000000 +0100
++++ strigi-0.3.11.new/src/xmlindexer/xmlindexwriter.h 2007-01-14 19:15:14.000000000 +0100
+@@ -184,7 +184,8 @@
+ out << " <value name='" << i->first << "'>" << i->second
+ << "</value>\n";
+ }
+- if (d->text.size()) {
++ out << " <value name='depth'>" << (int)idx->getDepth() << "</value>\n";
++ if (d->text.size() > 0) {
+ out << " <text>";
+ printText(d->text);
+ out << "</text>\n";
+@@ -197,14 +198,16 @@
+ Data* d = static_cast<Data*>(idx->getWriterData());
+ d->text.append(text, length);
+ }
+- void setField(const jstreams::Indexable* idx, const std::string &fieldname,
++ void addField(const jstreams::Indexable* idx, const std::string &fieldname,
+ const std::string& value) {
+ Data* d = static_cast<Data*>(idx->getWriterData());
+ d->values.insert(
+ std::make_pair<std::string,std::string>(fieldname, value));
+ }
++ void addField(const jstreams::Indexable* idx, const std::string &fieldname,
++ const unsigned char* data, int32_t size) {}
+ public:
+- XmlIndexWriter(std::ostream& o) :out(o) {
++ explicit XmlIndexWriter(std::ostream& o) :out(o) {
+ }
+ ~XmlIndexWriter() {}
+ void commit() {}
+diff -Nur strigi-0.3.11/testdata/data/COL_0_02_Printer.desktop strigi-0.3.11.new/testdata/data/COL_0_02_Printer.desktop
+--- strigi-0.3.11/testdata/data/COL_0_02_Printer.desktop 2006-12-12 23:50:34.000000000 +0100
++++ strigi-0.3.11.new/testdata/data/COL_0_02_Printer.desktop 2007-01-17 11:57:35.000000000 +0100
+@@ -2,6 +2,8 @@
+ X-SuSE-translate=true
+ OnlyShowIn=KDE;
+ Name=Printer
++Name[bg]=Принтер
++Name[br]=Moullerez
+ Name[de]=Drucker
+ Name[el]=Εκτυπωτής
+ Name[es]=Impresora
+@@ -20,10 +22,12 @@
+ [Desktop Action List]
+ Exec=kjobviewer --show
+ Name=State for all printers
++Name[bg]=Състояние на всички принтери
+ Name[da]=Tilstand for alle printere
+ Name[de]=Status aller Drucker
+ Name[el]=Κατάσταση για όλους τους εκτυπωες
+ Name[es]=Estado de todas las impresoras
++Name[et]=Kõigi printerite olek
+ Name[ja]=すべてのプリンタの状態
+ Name[nl]=Status voor alle printers
+ Name[pt]=Estado de todas as impressoras
+@@ -32,10 +36,12 @@
+ [Desktop Action Print]
+ Exec=kprinter %u
+ Name=Print files
++Name[bg]=Файлове за печат
+ Name[da]=Udskriv filer
+ Name[de]=Dateien drucken
+ Name[el]=Εκτύπωση αρχείων
+ Name[es]=Imprimir archivos
++Name[et]=Failide trükkimine
+ Name[ga]=Priontáil comhaid
+ Name[ja]=ファイルを印刷
+ Name[nl]=Bestanden afdrukken
+diff -Nur strigi-0.3.11/TODO strigi-0.3.11.new/TODO
+--- strigi-0.3.11/TODO 2006-12-12 23:50:34.000000000 +0100
++++ strigi-0.3.11.new/TODO 2007-01-12 22:56:09.000000000 +0100
+@@ -18,3 +18,5 @@
+ [17:57] <dfaure> this will get the list of services (parts and app) out of ksycoca quite fast
+ [17:57] <dfaure> much faster than parsing .desktop files.
+
++- port KFilePlugin implementations to strigi analyzers:
++ http://lxr.kde.org/ident?i=KFilePlugin
Deleted: kde-extras/strigi/trunk/debian/patches/10_ftbfs_amd64.diff
Modified: kde-extras/strigi/trunk/debian/rules
===================================================================
--- kde-extras/strigi/trunk/debian/rules 2007-01-19 16:13:58 UTC (rev 5376)
+++ kde-extras/strigi/trunk/debian/rules 2007-01-19 18:34:59 UTC (rev 5377)
@@ -7,8 +7,3 @@
DEB_CMAKE_EXTRA_FLAGS = -DENABLE_DBUS:BOOL=ON -DENABLE_INOTIFY:BOOL=OFF -DENABLE_LOG4CXX:BOOL=ON
DEB_DH_INSTALL_ARGS = --sourcedir=debian/tmp
-
-install/strigi-daemon::
- install -D -p -m0644 debian/strigi-daemon.lintian-overrides \
- debian/strigi-daemon/usr/share/lintian/overrides/strigi-daemon
-
Modified: kde-extras/strigi/trunk/debian/strigi-daemon.install
===================================================================
--- kde-extras/strigi/trunk/debian/strigi-daemon.install 2007-01-19 16:13:58 UTC (rev 5376)
+++ kde-extras/strigi/trunk/debian/strigi-daemon.install 2007-01-19 18:34:59 UTC (rev 5377)
@@ -1,9 +1,2 @@
-usr/bin/deepfind
-usr/bin/deepgrep
usr/bin/luceneindexer
usr/bin/strigidaemon
-usr/bin/xmlindexer
-usr/lib/libsearchclient.*
-usr/lib/libstreamindexer.*
-usr/lib/libstreams.*
-usr/lib/strigi/strigita_*
Deleted: kde-extras/strigi/trunk/debian/strigi-daemon.lintian-overrides
Added: kde-extras/strigi/trunk/debian/strigi-utils.install
===================================================================
--- kde-extras/strigi/trunk/debian/strigi-utils.install 2007-01-19 16:13:58 UTC (rev 5376)
+++ kde-extras/strigi/trunk/debian/strigi-utils.install 2007-01-19 18:34:59 UTC (rev 5377)
@@ -0,0 +1,3 @@
+usr/bin/deepfind
+usr/bin/deepgrep
+usr/bin/xmlindexer
More information about the pkg-kde-commits
mailing list