summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-11-16 19:14:18 (UTC)
committer mickeyl <mickeyl>2004-11-16 19:14:18 (UTC)
commitea3945a9bd8f9830f70b1efa133f9df13b19362f (patch) (side-by-side diff)
treef2ea22cc50e9aa8aa73ee7dea148f41c563c9666
parent1c6f490e8541626f68422e0a3a7c7281d7f5b7d3 (diff)
downloadopie-ea3945a9bd8f9830f70b1efa133f9df13b19362f.zip
opie-ea3945a9bd8f9830f70b1efa133f9df13b19362f.tar.gz
opie-ea3945a9bd8f9830f70b1efa133f9df13b19362f.tar.bz2
libopie1 goes into unsupported
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie/TODO16
-rw-r--r--libopie/ofileselector/.cvsignore1
-rw-r--r--libopie/pim/ABSTRACT18
-rw-r--r--libopie/pim/DESIGN56
-rw-r--r--libopie/pim/TODO34
-rw-r--r--libopie/pim/test/converter.cpp107
-rwxr-xr-xlibopie/pim/test/converter.h18
-rw-r--r--libopie/pim/test/converter.pro12
-rw-r--r--libopie/pim/test/converter_base.ui238
-rw-r--r--libopie/pim/test/oevent_test.cpp35
-rw-r--r--libopie/pim/test/oevent_test.pro11
-rw-r--r--libopie/pim/test/test_todo.cpp36
-rw-r--r--libopie/pim/test/todo_test.pro11
-rw-r--r--noncore/unsupported/libopie/.cvsignore (renamed from libopie/.cvsignore)0
-rw-r--r--noncore/unsupported/libopie/colordialog.cpp (renamed from libopie/colordialog.cpp)0
-rw-r--r--noncore/unsupported/libopie/colordialog.h (renamed from libopie/colordialog.h)0
-rw-r--r--noncore/unsupported/libopie/colorpopupmenu.cpp (renamed from libopie/colorpopupmenu.cpp)0
-rw-r--r--noncore/unsupported/libopie/colorpopupmenu.h (renamed from libopie/colorpopupmenu.h)0
-rw-r--r--noncore/unsupported/libopie/config.in (renamed from libopie/config.in)0
-rw-r--r--noncore/unsupported/libopie/libopie.pro (renamed from libopie/libopie.pro)0
-rw-r--r--noncore/unsupported/libopie/libopie1.control (renamed from libopie/libopie1.control)0
-rwxr-xr-xnoncore/unsupported/libopie/libopie1.postinst (renamed from libopie/libopie1.postinst)0
-rw-r--r--noncore/unsupported/libopie/oapplicationfactory.h (renamed from libopie/oapplicationfactory.h)0
-rw-r--r--noncore/unsupported/libopie/ocheckitem.cpp (renamed from libopie/ocheckitem.cpp)0
-rw-r--r--noncore/unsupported/libopie/ocheckitem.h (renamed from libopie/ocheckitem.h)0
-rw-r--r--noncore/unsupported/libopie/oclickablelabel.cpp (renamed from libopie/oclickablelabel.cpp)0
-rw-r--r--noncore/unsupported/libopie/oclickablelabel.h (renamed from libopie/oclickablelabel.h)0
-rw-r--r--noncore/unsupported/libopie/ocolorbutton.cpp (renamed from libopie/ocolorbutton.cpp)0
-rw-r--r--noncore/unsupported/libopie/ocolorbutton.h (renamed from libopie/ocolorbutton.h)0
-rw-r--r--noncore/unsupported/libopie/odevice.cpp (renamed from libopie/odevice.cpp)0
-rw-r--r--noncore/unsupported/libopie/odevice.h (renamed from libopie/odevice.h)0
-rw-r--r--noncore/unsupported/libopie/odevicebutton.cpp (renamed from libopie/odevicebutton.cpp)0
-rw-r--r--noncore/unsupported/libopie/odevicebutton.h (renamed from libopie/odevicebutton.h)0
-rw-r--r--noncore/unsupported/libopie/ofiledialog.cc (renamed from libopie/ofiledialog.cc)0
-rw-r--r--noncore/unsupported/libopie/ofiledialog.h (renamed from libopie/ofiledialog.h)0
-rw-r--r--noncore/unsupported/libopie/ofileselector.cpp (renamed from libopie/ofileselector.cpp)0
-rw-r--r--noncore/unsupported/libopie/ofileselector.h (renamed from libopie/ofileselector.h)0
-rw-r--r--noncore/unsupported/libopie/ofileselector_p.h (renamed from libopie/ofileselector_p.h)0
-rw-r--r--noncore/unsupported/libopie/ofileview.h (renamed from libopie/ofileview.h)0
-rw-r--r--noncore/unsupported/libopie/ofontmenu.cc (renamed from libopie/ofontmenu.cc)0
-rw-r--r--noncore/unsupported/libopie/ofontmenu.h (renamed from libopie/ofontmenu.h)0
-rw-r--r--noncore/unsupported/libopie/ofontselector.cpp (renamed from libopie/ofontselector.cpp)0
-rw-r--r--noncore/unsupported/libopie/ofontselector.h (renamed from libopie/ofontselector.h)0
-rw-r--r--noncore/unsupported/libopie/oprocctrl.cpp (renamed from libopie/oprocctrl.cpp)0
-rw-r--r--noncore/unsupported/libopie/oprocctrl.h (renamed from libopie/oprocctrl.h)0
-rw-r--r--noncore/unsupported/libopie/oprocess.cpp (renamed from libopie/oprocess.cpp)0
-rw-r--r--noncore/unsupported/libopie/oprocess.h (renamed from libopie/oprocess.h)0
-rw-r--r--noncore/unsupported/libopie/orecurrancebase.ui (renamed from libopie/orecurrancebase.ui)0
-rw-r--r--noncore/unsupported/libopie/orecurrancewidget.cpp (renamed from libopie/orecurrancewidget.cpp)0
-rw-r--r--noncore/unsupported/libopie/orecurrancewidget.h (renamed from libopie/orecurrancewidget.h)0
-rw-r--r--noncore/unsupported/libopie/otabbar.cpp (renamed from libopie/otabbar.cpp)0
-rw-r--r--noncore/unsupported/libopie/otabbar.h (renamed from libopie/otabbar.h)0
-rw-r--r--noncore/unsupported/libopie/otabinfo.h (renamed from libopie/otabinfo.h)0
-rw-r--r--noncore/unsupported/libopie/otabwidget.cpp (renamed from libopie/otabwidget.cpp)0
-rw-r--r--noncore/unsupported/libopie/otabwidget.h (renamed from libopie/otabwidget.h)0
-rw-r--r--noncore/unsupported/libopie/oticker.cpp (renamed from libopie/oticker.cpp)0
-rw-r--r--noncore/unsupported/libopie/oticker.h (renamed from libopie/oticker.h)0
-rw-r--r--noncore/unsupported/libopie/otimepicker.cpp (renamed from libopie/otimepicker.cpp)0
-rw-r--r--noncore/unsupported/libopie/otimepicker.h (renamed from libopie/otimepicker.h)0
-rw-r--r--noncore/unsupported/libopie/otimepickerbase.ui (renamed from libopie/otimepickerbase.ui)0
-rw-r--r--noncore/unsupported/libopie/owait.cpp (renamed from libopie/owait.cpp)0
-rw-r--r--noncore/unsupported/libopie/owait.h (renamed from libopie/owait.h)0
-rw-r--r--noncore/unsupported/libopie/pim/.cvsignore (renamed from libopie/pim/.cvsignore)0
-rw-r--r--noncore/unsupported/libopie/pim/config.in2
-rw-r--r--noncore/unsupported/libopie/pim/libopie.pro (renamed from libopie/pim/libopie.pro)0
-rw-r--r--noncore/unsupported/libopie/pim/obackendfactory.h (renamed from libopie/pim/obackendfactory.h)3
-rw-r--r--noncore/unsupported/libopie/pim/ocontact.cpp (renamed from libopie/pim/ocontact.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/ocontact.h (renamed from libopie/pim/ocontact.h)0
-rw-r--r--noncore/unsupported/libopie/pim/ocontactaccess.cpp (renamed from libopie/pim/ocontactaccess.cpp)3
-rw-r--r--noncore/unsupported/libopie/pim/ocontactaccess.h (renamed from libopie/pim/ocontactaccess.h)3
-rw-r--r--noncore/unsupported/libopie/pim/ocontactaccessbackend.h (renamed from libopie/pim/ocontactaccessbackend.h)3
-rw-r--r--noncore/unsupported/libopie/pim/ocontactaccessbackend_sql.cpp (renamed from libopie/pim/ocontactaccessbackend_sql.cpp)3
-rw-r--r--noncore/unsupported/libopie/pim/ocontactaccessbackend_sql.h (renamed from libopie/pim/ocontactaccessbackend_sql.h)3
-rw-r--r--noncore/unsupported/libopie/pim/ocontactaccessbackend_vcard.cpp (renamed from libopie/pim/ocontactaccessbackend_vcard.cpp)3
-rw-r--r--noncore/unsupported/libopie/pim/ocontactaccessbackend_vcard.h (renamed from libopie/pim/ocontactaccessbackend_vcard.h)3
-rw-r--r--noncore/unsupported/libopie/pim/ocontactaccessbackend_xml.cpp (renamed from libopie/pim/ocontactaccessbackend_xml.cpp)3
-rw-r--r--noncore/unsupported/libopie/pim/ocontactaccessbackend_xml.h (renamed from libopie/pim/ocontactaccessbackend_xml.h)3
-rw-r--r--noncore/unsupported/libopie/pim/ocontactfields.cpp (renamed from libopie/pim/ocontactfields.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/ocontactfields.h (renamed from libopie/pim/ocontactfields.h)0
-rw-r--r--noncore/unsupported/libopie/pim/oconversion.cpp (renamed from libopie/pim/oconversion.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/oconversion.h (renamed from libopie/pim/oconversion.h)0
-rw-r--r--noncore/unsupported/libopie/pim/odatebookaccess.cpp (renamed from libopie/pim/odatebookaccess.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/odatebookaccess.h (renamed from libopie/pim/odatebookaccess.h)0
-rw-r--r--noncore/unsupported/libopie/pim/odatebookaccessbackend.cpp (renamed from libopie/pim/odatebookaccessbackend.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/odatebookaccessbackend.h (renamed from libopie/pim/odatebookaccessbackend.h)0
-rw-r--r--noncore/unsupported/libopie/pim/odatebookaccessbackend_sql.cpp (renamed from libopie/pim/odatebookaccessbackend_sql.cpp)3
-rw-r--r--noncore/unsupported/libopie/pim/odatebookaccessbackend_sql.h (renamed from libopie/pim/odatebookaccessbackend_sql.h)0
-rw-r--r--noncore/unsupported/libopie/pim/odatebookaccessbackend_xml.cpp (renamed from libopie/pim/odatebookaccessbackend_xml.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/odatebookaccessbackend_xml.h (renamed from libopie/pim/odatebookaccessbackend_xml.h)0
-rw-r--r--noncore/unsupported/libopie/pim/oevent.cpp (renamed from libopie/pim/oevent.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/oevent.h (renamed from libopie/pim/oevent.h)0
-rw-r--r--noncore/unsupported/libopie/pim/opimaccessbackend.h (renamed from libopie/pim/opimaccessbackend.h)0
-rw-r--r--noncore/unsupported/libopie/pim/opimaccesstemplate.h (renamed from libopie/pim/opimaccesstemplate.h)0
-rw-r--r--noncore/unsupported/libopie/pim/opimcache.h (renamed from libopie/pim/opimcache.h)0
-rw-r--r--noncore/unsupported/libopie/pim/opimmaintainer.cpp (renamed from libopie/pim/opimmaintainer.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/opimmaintainer.h (renamed from libopie/pim/opimmaintainer.h)0
-rw-r--r--noncore/unsupported/libopie/pim/opimmainwindow.cpp (renamed from libopie/pim/opimmainwindow.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/opimmainwindow.h (renamed from libopie/pim/opimmainwindow.h)0
-rw-r--r--noncore/unsupported/libopie/pim/opimnotify.cpp (renamed from libopie/pim/opimnotify.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/opimnotify.h (renamed from libopie/pim/opimnotify.h)0
-rw-r--r--noncore/unsupported/libopie/pim/opimnotifymanager.cpp (renamed from libopie/pim/opimnotifymanager.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/opimnotifymanager.h (renamed from libopie/pim/opimnotifymanager.h)0
-rw-r--r--noncore/unsupported/libopie/pim/opimrecord.cpp (renamed from libopie/pim/opimrecord.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/opimrecord.h (renamed from libopie/pim/opimrecord.h)0
-rw-r--r--noncore/unsupported/libopie/pim/opimresolver.cpp (renamed from libopie/pim/opimresolver.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/opimresolver.h (renamed from libopie/pim/opimresolver.h)0
-rw-r--r--noncore/unsupported/libopie/pim/opimstate.cpp (renamed from libopie/pim/opimstate.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/opimstate.h (renamed from libopie/pim/opimstate.h)0
-rw-r--r--noncore/unsupported/libopie/pim/opimxref.cpp (renamed from libopie/pim/opimxref.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/opimxref.h (renamed from libopie/pim/opimxref.h)0
-rw-r--r--noncore/unsupported/libopie/pim/opimxrefmanager.cpp (renamed from libopie/pim/opimxrefmanager.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/opimxrefmanager.h (renamed from libopie/pim/opimxrefmanager.h)0
-rw-r--r--noncore/unsupported/libopie/pim/opimxrefpartner.cpp (renamed from libopie/pim/opimxrefpartner.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/opimxrefpartner.h (renamed from libopie/pim/opimxrefpartner.h)0
-rw-r--r--noncore/unsupported/libopie/pim/orecordlist.h (renamed from libopie/pim/orecordlist.h)0
-rw-r--r--noncore/unsupported/libopie/pim/orecur.cpp (renamed from libopie/pim/orecur.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/orecur.h (renamed from libopie/pim/orecur.h)0
-rw-r--r--noncore/unsupported/libopie/pim/otemplatebase.h (renamed from libopie/pim/otemplatebase.h)0
-rw-r--r--noncore/unsupported/libopie/pim/otimezone.cpp (renamed from libopie/pim/otimezone.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/otimezone.h (renamed from libopie/pim/otimezone.h)0
-rw-r--r--noncore/unsupported/libopie/pim/otodo.cpp (renamed from libopie/pim/otodo.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/otodo.h (renamed from libopie/pim/otodo.h)0
-rw-r--r--noncore/unsupported/libopie/pim/otodoaccess.cpp (renamed from libopie/pim/otodoaccess.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/otodoaccess.h (renamed from libopie/pim/otodoaccess.h)0
-rw-r--r--noncore/unsupported/libopie/pim/otodoaccessbackend.cpp (renamed from libopie/pim/otodoaccessbackend.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/otodoaccessbackend.h (renamed from libopie/pim/otodoaccessbackend.h)0
-rw-r--r--noncore/unsupported/libopie/pim/otodoaccesssql.cpp (renamed from libopie/pim/otodoaccesssql.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/otodoaccesssql.h (renamed from libopie/pim/otodoaccesssql.h)0
-rw-r--r--noncore/unsupported/libopie/pim/otodoaccessvcal.cpp (renamed from libopie/pim/otodoaccessvcal.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/otodoaccessvcal.h (renamed from libopie/pim/otodoaccessvcal.h)0
-rw-r--r--noncore/unsupported/libopie/pim/otodoaccessxml.cpp (renamed from libopie/pim/otodoaccessxml.cpp)0
-rw-r--r--noncore/unsupported/libopie/pim/otodoaccessxml.h (renamed from libopie/pim/otodoaccessxml.h)0
-rw-r--r--noncore/unsupported/libopie/sharp_compat.cpp (renamed from libopie/sharp_compat.cpp)0
-rw-r--r--noncore/unsupported/libopie/todayconfigwidget.h (renamed from libopie/todayconfigwidget.h)0
-rw-r--r--noncore/unsupported/libopie/todayplugininterface.h (renamed from libopie/todayplugininterface.h)0
-rw-r--r--noncore/unsupported/libopie/xmltree.cc (renamed from libopie/xmltree.cc)0
-rw-r--r--noncore/unsupported/libopie/xmltree.h (renamed from libopie/xmltree.h)0
137 files changed, 35 insertions, 593 deletions
diff --git a/libopie/TODO b/libopie/TODO
deleted file mode 100644
index 9607fde..0000000
--- a/libopie/TODO
+++ b/dev/null
@@ -1,16 +0,0 @@
-- xmltree done
-
-- tododb
- - set Alarms
-
-- OFileSelector
- - m_mimeCheck always shows the first icon
- - mimetype selection broken
- - when changing dirs the mimetype selections get messed up
- - DocLnk when not in Document Mode ( and vice versa )
- - MultipleDocuments
- - Move OFileSelectorItem to it's own files
- - new Dirs created inside the listview
-
-- Clickable labels?
- committed \ No newline at end of file
diff --git a/libopie/ofileselector/.cvsignore b/libopie/ofileselector/.cvsignore
deleted file mode 100644
index 6d678c6..0000000
--- a/libopie/ofileselector/.cvsignore
+++ b/dev/null
@@ -1 +0,0 @@
-config.in
diff --git a/libopie/pim/ABSTRACT b/libopie/pim/ABSTRACT
deleted file mode 100644
index 5538d19..0000000
--- a/libopie/pim/ABSTRACT
+++ b/dev/null
@@ -1,18 +0,0 @@
-What is Opie PIM? Why is it special?
-Why do we need Opie PIM?
-
-The goal of OpiePIM is to be first of all
-extendable, light weight, scalable and fast.
-For the programmer we try to add a nice but
-powerful API to all classes.
-
-Memory is a costy resource on small and embedded
-devices. So we try to keep the memory usage as
-low as possible. Never the less we won't use structs
-and Pointers in the public API.
-The whole pim framework is value based. Internally we try
-to use implicit sharing as found in other Qt classes as well.
-This makes it possible to give 3rd party devels a nice
-API while keeping the memory usage as low as possible.
-
-We use C++ Templates
diff --git a/libopie/pim/DESIGN b/libopie/pim/DESIGN
deleted file mode 100644
index bd92b1b..0000000
--- a/libopie/pim/DESIGN
+++ b/dev/null
@@ -1,56 +0,0 @@
-Hija to the DESIGN of our OPIE PIM stuff
-
-This design was firstly discussed in the train
-from Frankfurt to Hannover between me (zecke ) and eilers.
-
-We had a look at our pim implementation and the one from
-trolltech and we looked what was missing.
-
-GOALS:
- - clean implementation
- - share code
- - ObjectOriented Design
- - Scalable
- - Integration into common solutions like STL and Qt
- - Addition
- - Ease of Use
-
-GENERAL:
- - use templates
- - have a common base class for all Records OPimRecord
- - use references instead of pointers
- - make use of QShared internally memory consumption
-
-We've a 'public' and 'private' part in our lib
-OPimAccessTemplate is the public part. This will be used
-by 3rd party developers to access the PIMs.
-OPimAccessBackend is the backend. You could also call it
-resource.
-
-Both things need to be implemented for different kind of records.
-By using templates we can make sure we share code and the reason
-not to use simple inheretance is that we can specialise quite easy.
-
-For example we have OTodoAccess : public OPimAccessTemplate<OTodo>;
-the we would do
-OTodoAccess::List list = otodoAccess.all();
-OTodoAccess::List::Iterator it;
-for( it = list.begin(); it != list.end(); ++it );
-
-
-as you can see from here it just behaves like you expect from Qt or STL.
-
-The kewlest thing is that List and List::Iterator is free to use if you
-want to implement your own OPimAccessTemplate.
-You just have to sub class it and voila you're done
-
-
-Hope you enjoy using OPIE PIM
-
-regards Holger 'zecke' Freyther
-
-
-
-
-
-
diff --git a/libopie/pim/TODO b/libopie/pim/TODO
deleted file mode 100644
index 9bd2789..0000000
--- a/libopie/pim/TODO
+++ b/dev/null
@@ -1,34 +0,0 @@
--Add XML Index ( dropped )
--Add ReadOnly Resources ( to be discussed )
--Add Sorted/Random Access mode for faster access to the base ( to be discussed )
-
-Yeah Stefan you're right I need to stop the fragmentation but these are just ideas
-we not to talk about.
-
-New Ideas Widgets:
- OCategoryPopup:
- Like the function Menu in Xemacs. If there are too many
- Categories sort them into sub popups. A-B,B-G,H-K....
- Integrate SUbcategories
-
-
-New Ideas on Infrastructure:
- -finally switch to sqlite
- -rework Category Sub Categories
- -X-Ref!!!!!
- -signalling ( Peer to Peer/ Backend to Backend communication of changes on a file basis )
- -Signal the User about updates. Use QSignal and make it generic push from backend
- to the access.
- -flocking, mmapping
- -Generic Tablewidget, getting QString for a record and attribute ( generic ) like QProperty
- -chooser widgets
- -hierachies
- -multiple backends
- -public private sort public and private on backends. default backend for each if multiple
- backends loaded. Move from backend to backend.. ( backend mover app? )
- -importer/exporter
- -check if cache also drops
- -port to BigSize Api
-
- ORedoManager ORedoItem both are templates to allow undoing and redoing to a level...
- \ No newline at end of file
diff --git a/libopie/pim/test/converter.cpp b/libopie/pim/test/converter.cpp
deleted file mode 100644
index bfdb605..0000000
--- a/libopie/pim/test/converter.cpp
+++ b/dev/null
@@ -1,107 +0,0 @@
-#include "converter.h"
-
-#include <qdatetime.h>
-#include <qprogressbar.h>
-
-#include <qpe/qpeapplication.h>
-
-#include <opie/ocontactaccess.h>
-#include <opie/ocontactaccessbackend_xml.h>
-#include <opie/ocontactaccessbackend_sql.h>
-
-#include <opie/odatebookaccess.h>
-#include <opie/odatebookaccessbackend_xml.h>
-#include <opie/odatebookaccessbackend_sql.h>
-
-// #define _ADDRESSBOOK_ACCESS
-
-Converter::Converter(){
-}
-
-void Converter::start_conversion(){
- qWarning("Converting Contacts from XML to SQL..");
-
- // Creating backends to the requested databases..
-
-#ifdef _ADDRESSBOOK_ACCESS
- OContactAccessBackend* xmlBackend = new OContactAccessBackend_XML( "Converter",
- QString::null );
-
- OContactAccessBackend* sqlBackend = new OContactAccessBackend_SQL( QString::null,
- QString::null );
- // Put the created backends into frontends to access them
- OContactAccess* xmlAccess = new OContactAccess ( "addressbook_xml",
- QString::null , xmlBackend, true );
-
- OContactAccess* sqlAccess = new OContactAccess ( "addressbook_sql",
- QString::null );
-
-#else
- ODateBookAccessBackend* xmlBackend = new ODateBookAccessBackend_XML( "Converter",
- QString::null );
-
- ODateBookAccessBackend* sqlBackend = new ODateBookAccessBackend_SQL( QString::null,
- QString::null );
- // Put the created backends into frontends to access them
- ODateBookAccess* xmlAccess = new ODateBookAccess ( xmlBackend );
-
- ODateBookAccess* sqlAccess = new ODateBookAccess ( sqlBackend );
-
- xmlAccess->load();
-
-#endif
-
- QTime t;
- t.start();
-
-// Clean the sql-database..
- sqlAccess->clear();
-
-#ifdef _ADDRESSBOOK_ACCESS
- // Now trasmit every contact from the xml database to the sql-database
- OContactAccess::List contactList = xmlAccess->allRecords();
- m_progressBar->setTotalSteps( contactList.count() );
- int count = 0;
- if ( sqlAccess && xmlAccess ){
- OContactAccess::List::Iterator it;
- for ( it = contactList.begin(); it != contactList.end(); ++it ){
- sqlAccess->add( *it );
- m_progressBar->setProgress( ++count );
- }
- }
-#else
- // Now transmit every contact from the xml database to the sql-database
- ODateBookAccess::List dateList = xmlAccess->allRecords();
- m_progressBar->setTotalSteps( dateList.count() );
- qWarning( "Number of elements to copy: %d", dateList.count() );
-
- int count = 0;
- if ( sqlAccess && xmlAccess ){
- ODateBookAccess::List::Iterator it;
- for ( it = dateList.begin(); it != dateList.end(); ++it ){
- sqlAccess->add( *it );
- m_progressBar->setProgress( ++count );
- }
- }
-
-#endif
- // Delete the frontends. Backends will be deleted automatically, too !
- delete sqlAccess;
-
- qWarning("Conversion is finished and needed %d ms !", t.elapsed());
-
- delete xmlAccess;
-}
-
-int main( int argc, char** argv ) {
-
- QPEApplication a( argc, argv );
-
- Converter dlg;
-
- a.showMainWidget( &dlg );
- // dlg. showMaximized ( );
-
- return a.exec();
-
-}
diff --git a/libopie/pim/test/converter.h b/libopie/pim/test/converter.h
deleted file mode 100755
index 1cc2a7c..0000000
--- a/libopie/pim/test/converter.h
+++ b/dev/null
@@ -1,18 +0,0 @@
-#ifndef _CONVERTER_H_
-#define _CONVERTER_H_
-
-
-#include "converter_base.h"
-
-
-class Converter: public converter_base {
-public:
- Converter();
-
- void start_conversion();
-private:
-
-};
-
-
-#endif
diff --git a/libopie/pim/test/converter.pro b/libopie/pim/test/converter.pro
deleted file mode 100644
index bd9c7a3..0000000
--- a/libopie/pim/test/converter.pro
+++ b/dev/null
@@ -1,12 +0,0 @@
-# TEMPLATE = app
-CONFIG = qt warn_on debug
-# CONFIG = qt warn_on release
-#HEADERS =
-SOURCES = converter.cpp
-INTERFACES = converter_base.ui
-INCLUDEPATH += $(OPIEDIR)/include
-DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe -lopie
-TARGET = converter
-
-include ( $(OPIEDIR)/include.pro )
diff --git a/libopie/pim/test/converter_base.ui b/libopie/pim/test/converter_base.ui
deleted file mode 100644
index e9bf636..0000000
--- a/libopie/pim/test/converter_base.ui
+++ b/dev/null
@@ -1,238 +0,0 @@
-<!DOCTYPE UI><UI>
-<class>converter_base</class>
-<widget>
- <class>QDialog</class>
- <property stdset="1">
- <name>name</name>
- <cstring>converter_base</cstring>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>0</x>
- <y>0</y>
- <width>273</width>
- <height>324</height>
- </rect>
- </property>
- <property stdset="1">
- <name>caption</name>
- <string>PIM-Database Converter</string>
- </property>
- <property>
- <name>layoutMargin</name>
- </property>
- <grid>
- <property stdset="1">
- <name>margin</name>
- <number>4</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>6</number>
- </property>
- <widget row="0" column="0" >
- <class>QGroupBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>GroupBox6</cstring>
- </property>
- <property stdset="1">
- <name>title</name>
- <string>Converter</string>
- </property>
- <property>
- <name>layoutMargin</name>
- </property>
- <property>
- <name>layoutSpacing</name>
- </property>
- <vbox>
- <property stdset="1">
- <name>margin</name>
- <number>4</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>4</number>
- </property>
- <widget>
- <class>QGroupBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>GroupBox1</cstring>
- </property>
- <property stdset="1">
- <name>title</name>
- <string>Select Database:</string>
- </property>
- <grid>
- <property stdset="1">
- <name>margin</name>
- <number>11</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>6</number>
- </property>
- <widget row="0" column="1" >
- <class>QComboBox</class>
- <item>
- <property>
- <name>text</name>
- <string>Addressbook</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>TodoList</string>
- </property>
- </item>
- <property stdset="1">
- <name>name</name>
- <cstring>ComboBox1</cstring>
- </property>
- </widget>
- </grid>
- </widget>
- <widget>
- <class>QGroupBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>GroupBox2</cstring>
- </property>
- <property stdset="1">
- <name>title</name>
- <string>Source/Destination:</string>
- </property>
- <grid>
- <property stdset="1">
- <name>margin</name>
- <number>11</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>6</number>
- </property>
- <widget row="1" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>TextLabel3_2</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>to</string>
- </property>
- </widget>
- <widget row="1" column="1" >
- <class>QComboBox</class>
- <item>
- <property>
- <name>text</name>
- <string>Select</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>XML</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>SQL (SQLite)</string>
- </property>
- </item>
- <property stdset="1">
- <name>name</name>
- <cstring>ComboBox2_3</cstring>
- </property>
- </widget>
- <widget row="0" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>TextLabel2_2</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Convert from</string>
- </property>
- </widget>
- <widget row="0" column="1" >
- <class>QComboBox</class>
- <item>
- <property>
- <name>text</name>
- <string>XML</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>SQL (SQLite)</string>
- </property>
- </item>
- <property stdset="1">
- <name>name</name>
- <cstring>ComboBox2_2_2</cstring>
- </property>
- </widget>
- </grid>
- </widget>
- <widget>
- <class>QGroupBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>GroupBox4</cstring>
- </property>
- <property stdset="1">
- <name>title</name>
- <string>Progress:</string>
- </property>
- <grid>
- <property stdset="1">
- <name>margin</name>
- <number>11</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>6</number>
- </property>
- <widget row="0" column="0" >
- <class>QProgressBar</class>
- <property stdset="1">
- <name>name</name>
- <cstring>m_progressBar</cstring>
- </property>
- </widget>
- </grid>
- </widget>
- <widget>
- <class>QPushButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>PushButton1</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Go!</string>
- </property>
- </widget>
- </vbox>
- </widget>
- </grid>
-</widget>
-<connections>
- <connection>
- <sender>PushButton1</sender>
- <signal>clicked()</signal>
- <receiver>converter_base</receiver>
- <slot>start_conversion()</slot>
- </connection>
- <slot access="public">start_conversion()</slot>
-</connections>
-</UI>
diff --git a/libopie/pim/test/oevent_test.cpp b/libopie/pim/test/oevent_test.cpp
deleted file mode 100644
index 9f16911..0000000
--- a/libopie/pim/test/oevent_test.cpp
+++ b/dev/null
@@ -1,35 +0,0 @@
-#include <qdatetime.h>
-
-#include "../oevent.h"
-#include "../odatebookaccess.h"
-
-int main(int argc, char* argv ) {
- ODateBookAccess acc;
- if(!acc.load() ) qWarning("could not load");
-
- ODateBookAccess::List::Iterator it;
- ODateBookAccess::List list = acc.allRecords();
-
- for( it = list.begin(); it != list.end(); ++it ){
- OEvent ev = (*it);
- qWarning("Summary: %s",ev.description().latin1() );
- qWarning("Start: %s End: %s",ev.startDateTime().toString().latin1(), ev.endDateTime().toString().latin1() );
- qWarning("All Day: %d Recurrence: %d",ev.isAllDay(), ev.hasRecurrence() );
- qWarning("UID %d", ev.uid() );
-
- }
- QDate date1(2003,02,01 );
- QDate date2(2003,03,01 );
-
- OEffectiveEvent::ValueList effList = acc.effectiveEvents( date1,date2 );
- OEffectiveEvent::ValueList::Iterator effIt;
-
- for( effIt = effList.begin(); effIt != effList.end(); ++effIt ){
- OEffectiveEvent ef = (*effIt);
- qWarning("Summary: %s", ef.description().latin1() );
- qWarning("Date: %s", ef.date().toString().latin1() );
- }
- acc.save();
-
- return 0;
-}
diff --git a/libopie/pim/test/oevent_test.pro b/libopie/pim/test/oevent_test.pro
deleted file mode 100644
index 3365def..0000000
--- a/libopie/pim/test/oevent_test.pro
+++ b/dev/null
@@ -1,11 +0,0 @@
-TEMPLATE = app
-#CONFIG = qt warn_on debug
-CONFIG = qt warn_on release
-#HEADERS =
-SOURCES = oevent_test.cpp
-INCLUDEPATH += $(OPIEDIR)/include
-DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe -lopie
-TARGET = oevent_test
-
-include ( $(OPIEDIR)/include.pro ) \ No newline at end of file
diff --git a/libopie/pim/test/test_todo.cpp b/libopie/pim/test/test_todo.cpp
deleted file mode 100644
index 7440503..0000000
--- a/libopie/pim/test/test_todo.cpp
+++ b/dev/null
@@ -1,36 +0,0 @@
-#include <qdatetime.h>
-#include <qmap.h>
-
-#include <opie/otodo.h>
-#include <opie/otodoaccess.h>
-#include <opie/otodoaccessxml.h>
-
-int main(int argc, char* argv[] ) {
-
- OTodoAccessXML* xml = new OTodoAccessXML("demo");
- OTodoAccess ac(xml);
- int elc;
- QTime timer;
- qWarning("start loading");
- timer.start();
- ac.load();
- elc = timer.elapsed();
- qWarning("Elapsed loading %d %d", elc, elc/1000);
-
- timer.start();
- OTodoAccess::List lis = ac.allRecords();
- elc = timer.elapsed();
- qWarning("Elapsed allRecords %d %d", elc, elc/1000 );
- OTodoAccess::List::Iterator it;
- timer.start();
-ac.save();
-/*
- for( it = lis.begin(); it != lis.end(); ++it ) {
- qWarning("Desc: " + (*it).summary() );
- qWarning("UID %d", (*it).uid() );
- }
- */
-elc = timer.elapsed();
-
- qWarning("elapsed iterating %d %d", elc, elc/1000 );
-};
diff --git a/libopie/pim/test/todo_test.pro b/libopie/pim/test/todo_test.pro
deleted file mode 100644
index 3d14dda..0000000
--- a/libopie/pim/test/todo_test.pro
+++ b/dev/null
@@ -1,11 +0,0 @@
-TEMPLATE = app
-#CONFIG = qt warn_on debug
-CONFIG = qt warn_on release
-#HEADERS =
-SOURCES = test_todo.cpp
-INCLUDEPATH += $(OPIEDIR)/include
-DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe -lopie -lopiesql
-TARGET = todo_test
-
-include ( $(OPIEDIR)/ ) \ No newline at end of file
diff --git a/libopie/.cvsignore b/noncore/unsupported/libopie/.cvsignore
index f76e42e..f76e42e 100644
--- a/libopie/.cvsignore
+++ b/noncore/unsupported/libopie/.cvsignore
diff --git a/libopie/colordialog.cpp b/noncore/unsupported/libopie/colordialog.cpp
index b2854a6..b2854a6 100644
--- a/libopie/colordialog.cpp
+++ b/noncore/unsupported/libopie/colordialog.cpp
diff --git a/libopie/colordialog.h b/noncore/unsupported/libopie/colordialog.h
index c825a83..c825a83 100644
--- a/libopie/colordialog.h
+++ b/noncore/unsupported/libopie/colordialog.h
diff --git a/libopie/colorpopupmenu.cpp b/noncore/unsupported/libopie/colorpopupmenu.cpp
index 03ad233..03ad233 100644
--- a/libopie/colorpopupmenu.cpp
+++ b/noncore/unsupported/libopie/colorpopupmenu.cpp
diff --git a/libopie/colorpopupmenu.h b/noncore/unsupported/libopie/colorpopupmenu.h
index 98d67cc..98d67cc 100644
--- a/libopie/colorpopupmenu.h
+++ b/noncore/unsupported/libopie/colorpopupmenu.h
diff --git a/libopie/config.in b/noncore/unsupported/libopie/config.in
index e8bc2e2..e8bc2e2 100644
--- a/libopie/config.in
+++ b/noncore/unsupported/libopie/config.in
diff --git a/libopie/libopie.pro b/noncore/unsupported/libopie/libopie.pro
index 783c11d..783c11d 100644
--- a/libopie/libopie.pro
+++ b/noncore/unsupported/libopie/libopie.pro
diff --git a/libopie/libopie1.control b/noncore/unsupported/libopie/libopie1.control
index 5b6825e..5b6825e 100644
--- a/libopie/libopie1.control
+++ b/noncore/unsupported/libopie/libopie1.control
diff --git a/libopie/libopie1.postinst b/noncore/unsupported/libopie/libopie1.postinst
index 0c37b3d..0c37b3d 100755
--- a/libopie/libopie1.postinst
+++ b/noncore/unsupported/libopie/libopie1.postinst
diff --git a/libopie/oapplicationfactory.h b/noncore/unsupported/libopie/oapplicationfactory.h
index ab88d80..ab88d80 100644
--- a/libopie/oapplicationfactory.h
+++ b/noncore/unsupported/libopie/oapplicationfactory.h
diff --git a/libopie/ocheckitem.cpp b/noncore/unsupported/libopie/ocheckitem.cpp
index cd763c1..cd763c1 100644
--- a/libopie/ocheckitem.cpp
+++ b/noncore/unsupported/libopie/ocheckitem.cpp
diff --git a/libopie/ocheckitem.h b/noncore/unsupported/libopie/ocheckitem.h
index 82ee3d0..82ee3d0 100644
--- a/libopie/ocheckitem.h
+++ b/noncore/unsupported/libopie/ocheckitem.h
diff --git a/libopie/oclickablelabel.cpp b/noncore/unsupported/libopie/oclickablelabel.cpp
index bc7037b..bc7037b 100644
--- a/libopie/oclickablelabel.cpp
+++ b/noncore/unsupported/libopie/oclickablelabel.cpp
diff --git a/libopie/oclickablelabel.h b/noncore/unsupported/libopie/oclickablelabel.h
index f93ade0..f93ade0 100644
--- a/libopie/oclickablelabel.h
+++ b/noncore/unsupported/libopie/oclickablelabel.h
diff --git a/libopie/ocolorbutton.cpp b/noncore/unsupported/libopie/ocolorbutton.cpp
index 298dba2..298dba2 100644
--- a/libopie/ocolorbutton.cpp
+++ b/noncore/unsupported/libopie/ocolorbutton.cpp
diff --git a/libopie/ocolorbutton.h b/noncore/unsupported/libopie/ocolorbutton.h
index 6196c83..6196c83 100644
--- a/libopie/ocolorbutton.h
+++ b/noncore/unsupported/libopie/ocolorbutton.h
diff --git a/libopie/odevice.cpp b/noncore/unsupported/libopie/odevice.cpp
index 9d0bbbf..9d0bbbf 100644
--- a/libopie/odevice.cpp
+++ b/noncore/unsupported/libopie/odevice.cpp
diff --git a/libopie/odevice.h b/noncore/unsupported/libopie/odevice.h
index fc41079..fc41079 100644
--- a/libopie/odevice.h
+++ b/noncore/unsupported/libopie/odevice.h
diff --git a/libopie/odevicebutton.cpp b/noncore/unsupported/libopie/odevicebutton.cpp
index 647ac4b..647ac4b 100644
--- a/libopie/odevicebutton.cpp
+++ b/noncore/unsupported/libopie/odevicebutton.cpp
diff --git a/libopie/odevicebutton.h b/noncore/unsupported/libopie/odevicebutton.h
index 1621526..1621526 100644
--- a/libopie/odevicebutton.h
+++ b/noncore/unsupported/libopie/odevicebutton.h
diff --git a/libopie/ofiledialog.cc b/noncore/unsupported/libopie/ofiledialog.cc
index 47306b6..47306b6 100644
--- a/libopie/ofiledialog.cc
+++ b/noncore/unsupported/libopie/ofiledialog.cc
diff --git a/libopie/ofiledialog.h b/noncore/unsupported/libopie/ofiledialog.h
index 3b905c0..3b905c0 100644
--- a/libopie/ofiledialog.h
+++ b/noncore/unsupported/libopie/ofiledialog.h
diff --git a/libopie/ofileselector.cpp b/noncore/unsupported/libopie/ofileselector.cpp
index 2a6aed0..2a6aed0 100644
--- a/libopie/ofileselector.cpp
+++ b/noncore/unsupported/libopie/ofileselector.cpp
diff --git a/libopie/ofileselector.h b/noncore/unsupported/libopie/ofileselector.h
index 767455c..767455c 100644
--- a/libopie/ofileselector.h
+++ b/noncore/unsupported/libopie/ofileselector.h
diff --git a/libopie/ofileselector_p.h b/noncore/unsupported/libopie/ofileselector_p.h
index 7fd0c50..7fd0c50 100644
--- a/libopie/ofileselector_p.h
+++ b/noncore/unsupported/libopie/ofileselector_p.h
diff --git a/libopie/ofileview.h b/noncore/unsupported/libopie/ofileview.h
index e072477..e072477 100644
--- a/libopie/ofileview.h
+++ b/noncore/unsupported/libopie/ofileview.h
diff --git a/libopie/ofontmenu.cc b/noncore/unsupported/libopie/ofontmenu.cc
index d16c5e5..d16c5e5 100644
--- a/libopie/ofontmenu.cc
+++ b/noncore/unsupported/libopie/ofontmenu.cc
diff --git a/libopie/ofontmenu.h b/noncore/unsupported/libopie/ofontmenu.h
index 6e143ca..6e143ca 100644
--- a/libopie/ofontmenu.h
+++ b/noncore/unsupported/libopie/ofontmenu.h
diff --git a/libopie/ofontselector.cpp b/noncore/unsupported/libopie/ofontselector.cpp
index 87b7869..87b7869 100644
--- a/libopie/ofontselector.cpp
+++ b/noncore/unsupported/libopie/ofontselector.cpp
diff --git a/libopie/ofontselector.h b/noncore/unsupported/libopie/ofontselector.h
index b819c45..b819c45 100644
--- a/libopie/ofontselector.h
+++ b/noncore/unsupported/libopie/ofontselector.h
diff --git a/libopie/oprocctrl.cpp b/noncore/unsupported/libopie/oprocctrl.cpp
index df8da1e..df8da1e 100644
--- a/libopie/oprocctrl.cpp
+++ b/noncore/unsupported/libopie/oprocctrl.cpp
diff --git a/libopie/oprocctrl.h b/noncore/unsupported/libopie/oprocctrl.h
index 5b39490..5b39490 100644
--- a/libopie/oprocctrl.h
+++ b/noncore/unsupported/libopie/oprocctrl.h
diff --git a/libopie/oprocess.cpp b/noncore/unsupported/libopie/oprocess.cpp
index c19881a..c19881a 100644
--- a/libopie/oprocess.cpp
+++ b/noncore/unsupported/libopie/oprocess.cpp
diff --git a/libopie/oprocess.h b/noncore/unsupported/libopie/oprocess.h
index af7cddb..af7cddb 100644
--- a/libopie/oprocess.h
+++ b/noncore/unsupported/libopie/oprocess.h
diff --git a/libopie/orecurrancebase.ui b/noncore/unsupported/libopie/orecurrancebase.ui
index baf79d3..baf79d3 100644
--- a/libopie/orecurrancebase.ui
+++ b/noncore/unsupported/libopie/orecurrancebase.ui
diff --git a/libopie/orecurrancewidget.cpp b/noncore/unsupported/libopie/orecurrancewidget.cpp
index 33be269..33be269 100644
--- a/libopie/orecurrancewidget.cpp
+++ b/noncore/unsupported/libopie/orecurrancewidget.cpp
diff --git a/libopie/orecurrancewidget.h b/noncore/unsupported/libopie/orecurrancewidget.h
index 37a57f0..37a57f0 100644
--- a/libopie/orecurrancewidget.h
+++ b/noncore/unsupported/libopie/orecurrancewidget.h
diff --git a/libopie/otabbar.cpp b/noncore/unsupported/libopie/otabbar.cpp
index 52621ca..52621ca 100644
--- a/libopie/otabbar.cpp
+++ b/noncore/unsupported/libopie/otabbar.cpp
diff --git a/libopie/otabbar.h b/noncore/unsupported/libopie/otabbar.h
index 668187b..668187b 100644
--- a/libopie/otabbar.h
+++ b/noncore/unsupported/libopie/otabbar.h
diff --git a/libopie/otabinfo.h b/noncore/unsupported/libopie/otabinfo.h
index 00bb06d..00bb06d 100644
--- a/libopie/otabinfo.h
+++ b/noncore/unsupported/libopie/otabinfo.h
diff --git a/libopie/otabwidget.cpp b/noncore/unsupported/libopie/otabwidget.cpp
index 52190b2..52190b2 100644
--- a/libopie/otabwidget.cpp
+++ b/noncore/unsupported/libopie/otabwidget.cpp
diff --git a/libopie/otabwidget.h b/noncore/unsupported/libopie/otabwidget.h
index 047eaa1..047eaa1 100644
--- a/libopie/otabwidget.h
+++ b/noncore/unsupported/libopie/otabwidget.h
diff --git a/libopie/oticker.cpp b/noncore/unsupported/libopie/oticker.cpp
index b41cab6..b41cab6 100644
--- a/libopie/oticker.cpp
+++ b/noncore/unsupported/libopie/oticker.cpp
diff --git a/libopie/oticker.h b/noncore/unsupported/libopie/oticker.h
index 45bf7ce..45bf7ce 100644
--- a/libopie/oticker.h
+++ b/noncore/unsupported/libopie/oticker.h
diff --git a/libopie/otimepicker.cpp b/noncore/unsupported/libopie/otimepicker.cpp
index 11b80ed..11b80ed 100644
--- a/libopie/otimepicker.cpp
+++ b/noncore/unsupported/libopie/otimepicker.cpp
diff --git a/libopie/otimepicker.h b/noncore/unsupported/libopie/otimepicker.h
index 8df7d10..8df7d10 100644
--- a/libopie/otimepicker.h
+++ b/noncore/unsupported/libopie/otimepicker.h
diff --git a/libopie/otimepickerbase.ui b/noncore/unsupported/libopie/otimepickerbase.ui
index 3e7f2fb..3e7f2fb 100644
--- a/libopie/otimepickerbase.ui
+++ b/noncore/unsupported/libopie/otimepickerbase.ui
diff --git a/libopie/owait.cpp b/noncore/unsupported/libopie/owait.cpp
index a0f3834..a0f3834 100644
--- a/libopie/owait.cpp
+++ b/noncore/unsupported/libopie/owait.cpp
diff --git a/libopie/owait.h b/noncore/unsupported/libopie/owait.h
index cbfc8d6..cbfc8d6 100644
--- a/libopie/owait.h
+++ b/noncore/unsupported/libopie/owait.h
diff --git a/libopie/pim/.cvsignore b/noncore/unsupported/libopie/pim/.cvsignore
index aef62c4..aef62c4 100644
--- a/libopie/pim/.cvsignore
+++ b/noncore/unsupported/libopie/pim/.cvsignore
diff --git a/noncore/unsupported/libopie/pim/config.in b/noncore/unsupported/libopie/pim/config.in
new file mode 100644
index 0000000..95d3737
--- a/dev/null
+++ b/noncore/unsupported/libopie/pim/config.in
@@ -0,0 +1,2 @@
+menu "Pim"
+endmenu
diff --git a/libopie/pim/libopie.pro b/noncore/unsupported/libopie/pim/libopie.pro
index 62f235d..62f235d 100644
--- a/libopie/pim/libopie.pro
+++ b/noncore/unsupported/libopie/pim/libopie.pro
diff --git a/libopie/pim/obackendfactory.h b/noncore/unsupported/libopie/pim/obackendfactory.h
index 761ab9a..4cdef8b 100644
--- a/libopie/pim/obackendfactory.h
+++ b/noncore/unsupported/libopie/pim/obackendfactory.h
@@ -1,194 +1,197 @@
/*
* Class to manage Backends.
*
* Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
*
* =====================================================================
* This program 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.
* =====================================================================
* ToDo: Use plugins
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.1 2004/11/16 21:46:07 mickeyl
+ * libopie1 goes into unsupported
+ *
* Revision 1.9 2003/12/22 10:19:26 eilers
* Finishing implementation of sql-backend for datebook. But I have to
* port the PIM datebook application to use it, before I could debug the
* whole stuff.
* Thus, PIM-Database backend is finished, but highly experimental. And some
* parts are still generic. For instance, the "queryByExample()" methods are
* not (or not fully) implemented. Todo: custom-entries not stored.
* The big show stopper: matchRegExp() (needed by OpieSearch) needs regular
* expression search in the database, which is not supported by sqlite !
* Therefore we need either an extended sqlite or a workaround which would
* be very slow and memory consuming..
*
* Revision 1.8 2003/09/22 14:31:16 eilers
* Added first experimental incarnation of sql-backend for addressbook.
* Some modifications to be able to compile the todo sql-backend.
* A lot of changes fill follow...
*
* Revision 1.7 2003/08/01 12:30:16 eilers
* Merging changes from BRANCH_1_0 to HEAD
*
* Revision 1.6.4.1 2003/06/30 14:34:19 eilers
* Patches from Zecke:
* Fixing and cleaning up extraMap handling
* Adding d_ptr for binary compatibility in the future
*
* Revision 1.6 2003/04/13 18:07:10 zecke
* More API doc
* QString -> const QString&
* QString = 0l -> QString::null
*
* Revision 1.5 2003/02/21 23:31:52 zecke
* Add XML datebookresource
* -clean up todoaccessxml header
* -implement some more stuff in the oeven tester
* -extend DefaultFactory to not crash and to use datebook
*
* -reading of OEvents is working nicely.. saving will be added
* tomorrow
* -fix spelling in ODateBookAcces
*
* Revision 1.4 2002/10/14 15:55:18 eilers
* Redeactivate SQL.. ;)
*
* Revision 1.3 2002/10/10 17:08:58 zecke
* The Cache is finally in place
* I tested it with my todolist and it 'works' for 10.000 todos the hits are awesome ;)
* The read ahead functionality does not make sense for XMLs backends because most of the stuff is already in memory. While using readahead on SQL makes things a lot faster....
* I still have to fully implement read ahead
* This change is bic but sc
*
* Revision 1.2 2002/10/08 09:27:36 eilers
* Fixed libopie.pro to include the new pim-API.
* The SQL-Stuff is currently deactivated. Otherwise everyone who wants to
* compile itself would need to install libsqlite, libopiesql...
* Therefore, the backend currently uses XML only..
*
* Revision 1.1 2002/10/07 17:35:01 eilers
* added OBackendFactory for advanced backend access
*
*
* =====================================================================
*/
#ifndef OPIE_BACKENDFACTORY_H_
#define OPIE_BACKENDFACTORY_H_
#include <qstring.h>
#include <qasciidict.h>
#include <qpe/config.h>
#include "otodoaccessxml.h"
#include "ocontactaccessbackend_xml.h"
#include "odatebookaccessbackend_xml.h"
#ifdef __USE_SQL
#include "otodoaccesssql.h"
#include "ocontactaccessbackend_sql.h"
#include "odatebookaccessbackend_sql.h"
#endif
class OBackendPrivate;
/**
* This class is our factory. It will give us the default implementations
* of at least Todolist, Contacts and Datebook. In the future this class will
* allow users to switch the backend with ( XML->SQLite ) without the need
* to recompile.#
* This class as the whole PIM Api is making use of templates
*
* <pre>
* OTodoAccessBackend* backend = OBackEndFactory<OTodoAccessBackend>::Default("todo", QString::null );
* backend->load();
* </pre>
*
* @author Stefan Eilers
* @version 0.1
*/
template<class T>
class OBackendFactory
{
public:
OBackendFactory() {};
enum BACKENDS {
TODO,
CONTACT,
DATE
};
/**
* Returns a backend implementation for backendName
* @param backendName the type of the backend
* @param appName will be passed on to the backend
*/
static T* Default( const QString backendName, const QString& appName ){
// __asm__("int3");
Config config( "pimaccess" );
config.setGroup ( backendName );
QString backend = config.readEntry( "usebackend" );
qWarning("Selected backend for %s is: %s", backendName.latin1(), backend.latin1() );
QAsciiDict<int> dict ( 3 );
dict.setAutoDelete ( TRUE );
dict.insert( "todo", new int (TODO) );
dict.insert( "contact", new int (CONTACT) );
dict.insert( "datebook", new int(DATE) );
int *find = dict[ backendName ];
if (!find ) return 0;
switch ( *find ){
case TODO:
#ifdef __USE_SQL
if ( backend == "sql" )
return (T*) new OTodoAccessBackendSQL("");
#else
if ( backend == "sql" )
qWarning ("OBackendFactory:: sql Backend for TODO not implemented! Using XML instead!");
#endif
return (T*) new OTodoAccessXML( appName );
case CONTACT:
#ifdef __USE_SQL
if ( backend == "sql" )
return (T*) new OContactAccessBackend_SQL("");
#else
if ( backend == "sql" )
qWarning ("OBackendFactory:: sql Backend for CONTACT not implemented! Using XML instead!");
#endif
return (T*) new OContactAccessBackend_XML( appName );
case DATE:
#ifdef __USE_SQL
if ( backend == "sql" )
return (T*) new ODateBookAccessBackend_SQL("");
#else
if ( backend == "sql" )
qWarning("OBackendFactory:: sql Backend for DATEBOOK not implemented! Using XML instead!");
#endif
return (T*) new ODateBookAccessBackend_XML( appName );
default:
return NULL;
}
}
private:
OBackendPrivate* d;
};
#endif
diff --git a/libopie/pim/ocontact.cpp b/noncore/unsupported/libopie/pim/ocontact.cpp
index fcf3b26..fcf3b26 100644
--- a/libopie/pim/ocontact.cpp
+++ b/noncore/unsupported/libopie/pim/ocontact.cpp
diff --git a/libopie/pim/ocontact.h b/noncore/unsupported/libopie/pim/ocontact.h
index 1d46b81..1d46b81 100644
--- a/libopie/pim/ocontact.h
+++ b/noncore/unsupported/libopie/pim/ocontact.h
diff --git a/libopie/pim/ocontactaccess.cpp b/noncore/unsupported/libopie/pim/ocontactaccess.cpp
index bc359f7..63b93ee 100644
--- a/libopie/pim/ocontactaccess.cpp
+++ b/noncore/unsupported/libopie/pim/ocontactaccess.cpp
@@ -1,173 +1,176 @@
/*
* Class to manage the Contacts.
*
* Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
*
* =====================================================================
* This program 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.
* =====================================================================
* Info: This class could just work with a change in the header-file
* of the Contact class ! Therefore our libopie only compiles
* with our version of libqpe
* =====================================================================
* ToDo: XML-Backend: Automatic reload if something was changed...
*
*
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.1 2004/11/16 21:46:07 mickeyl
+ * libopie1 goes into unsupported
+ *
* Revision 1.9 2004/03/02 12:14:22 alwin
* run the optimize_connect script
* the whole cvs is tagged with "before_optimize_connect" if there are problems you
* can check the diff (but it had compiled and run here)
*
* Revision 1.8 2003/05/08 13:55:09 tille
* search stuff
* and match, toRichText & toShortText in oevent
*
* Revision 1.7 2002/11/13 14:14:51 eilers
* Added sorted for Contacts..
*
* Revision 1.6 2002/11/01 15:10:42 eilers
* Added regExp-search in database for all fields in a contact.
*
* Revision 1.5 2002/10/16 10:52:40 eilers
* Added some docu to the interface and now using the cache infrastucture by zecke.. :)
*
* Revision 1.4 2002/10/14 16:21:54 eilers
* Some minor interface updates
*
* Revision 1.3 2002/10/07 17:34:24 eilers
* added OBackendFactory for advanced backend access
*
* Revision 1.2 2002/10/02 16:18:11 eilers
* debugged and seems to work almost perfectly ..
*
* Revision 1.1 2002/09/27 17:11:44 eilers
* Added API for accessing the Contact-Database ! It is compiling, but
* please do not expect that anything is working !
* I will debug that stuff in the next time ..
* Please read README_COMPILE for compiling !
*
*
*/
#include "ocontactaccess.h"
#include "obackendfactory.h"
#include <qasciidict.h>
#include <qdatetime.h>
#include <qfile.h>
#include <qregexp.h>
#include <qlist.h>
#include <qcopchannel_qws.h>
//#include <qpe/qcopenvelope_qws.h>
#include <qpe/global.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include "ocontactaccessbackend_xml.h"
OContactAccess::OContactAccess ( const QString appname, const QString ,
OContactAccessBackend* end, bool autosync ):
OPimAccessTemplate<OContact>( end )
{
/* take care of the backend. If there is no one defined, we
* will use the XML-Backend as default (until we have a cute SQL-Backend..).
*/
if( end == 0 ) {
qWarning ("Using BackendFactory !");
end = OBackendFactory<OContactAccessBackend>::Default( "contact", appname );
}
// Set backend locally and in template
m_backEnd = end;
OPimAccessTemplate<OContact>::setBackEnd (end);
/* Connect signal of external db change to function */
QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this );
connect( dbchannel, SIGNAL(received(const QCString&,const QByteArray&)),
this, SLOT(copMessage(const QCString&,const QByteArray&)) );
if ( autosync ){
QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this );
connect( syncchannel, SIGNAL(received(const QCString&,const QByteArray&)),
this, SLOT(copMessage(const QCString&,const QByteArray&)) );
}
}
OContactAccess::~OContactAccess ()
{
/* The user may forget to save the changed database, therefore try to
* do it for him..
*/
save();
// delete m_backEnd; is done by template..
}
bool OContactAccess::save ()
{
/* If the database was changed externally, we could not save the
* Data. This will remove added items which is unacceptable !
* Therefore: Reload database and merge the data...
*/
if ( OPimAccessTemplate<OContact>::wasChangedExternally() )
reload();
bool status = OPimAccessTemplate<OContact>::save();
if ( !status ) return false;
/* Now tell everyone that new data is available.
*/
QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" );
return true;
}
const uint OContactAccess::querySettings()
{
return ( m_backEnd->querySettings() );
}
bool OContactAccess::hasQuerySettings ( int querySettings ) const
{
return ( m_backEnd->hasQuerySettings ( querySettings ) );
}
ORecordList<OContact> OContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const
{
QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat );
return ( ORecordList<OContact>(matchingContacts, this) );
}
bool OContactAccess::wasChangedExternally()const
{
return ( m_backEnd->wasChangedExternally() );
}
void OContactAccess::copMessage( const QCString &msg, const QByteArray & )
{
if ( msg == "addressbookUpdated()" ){
qWarning ("OContactAccess: Received addressbokUpdated()");
emit signalChanged ( this );
} else if ( msg == "flush()" ) {
qWarning ("OContactAccess: Received flush()");
save ();
} else if ( msg == "reload()" ) {
qWarning ("OContactAccess: Received reload()");
reload ();
emit signalChanged ( this );
}
}
diff --git a/libopie/pim/ocontactaccess.h b/noncore/unsupported/libopie/pim/ocontactaccess.h
index bd6da40..a7a099f 100644
--- a/libopie/pim/ocontactaccess.h
+++ b/noncore/unsupported/libopie/pim/ocontactaccess.h
@@ -1,193 +1,196 @@
/*
* Class to manage the Contacts.
*
* Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
* Copyright (c) 2002 by Holger Freyther (zecke@handhelds.org)
*
* =====================================================================
* This program 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.
* =====================================================================
* ToDo: Define enum for query settings
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.1 2004/11/16 21:46:07 mickeyl
+ * libopie1 goes into unsupported
+ *
* Revision 1.10 2003/12/22 10:19:26 eilers
* Finishing implementation of sql-backend for datebook. But I have to
* port the PIM datebook application to use it, before I could debug the
* whole stuff.
* Thus, PIM-Database backend is finished, but highly experimental. And some
* parts are still generic. For instance, the "queryByExample()" methods are
* not (or not fully) implemented. Todo: custom-entries not stored.
* The big show stopper: matchRegExp() (needed by OpieSearch) needs regular
* expression search in the database, which is not supported by sqlite !
* Therefore we need either an extended sqlite or a workaround which would
* be very slow and memory consuming..
*
* Revision 1.9 2003/08/01 12:30:16 eilers
* Merging changes from BRANCH_1_0 to HEAD
*
* Revision 1.8.2.1 2003/06/30 14:34:19 eilers
* Patches from Zecke:
* Fixing and cleaning up extraMap handling
* Adding d_ptr for binary compatibility in the future
*
* Revision 1.8 2003/05/08 13:55:09 tille
* search stuff
* and match, toRichText & toShortText in oevent
*
* Revision 1.7 2003/04/13 18:07:10 zecke
* More API doc
* QString -> const QString&
* QString = 0l -> QString::null
*
* Revision 1.6 2003/01/02 14:27:12 eilers
* Improved query by example: Search by date is possible.. First step
* for a today plugin for birthdays..
*
* Revision 1.5 2002/11/13 14:14:51 eilers
* Added sorted for Contacts..
*
* Revision 1.4 2002/11/01 15:10:42 eilers
* Added regExp-search in database for all fields in a contact.
*
* Revision 1.3 2002/10/16 10:52:40 eilers
* Added some docu to the interface and now using the cache infrastucture by zecke.. :)
*
* Revision 1.2 2002/10/14 16:21:54 eilers
* Some minor interface updates
*
* Revision 1.1 2002/09/27 17:11:44 eilers
* Added API for accessing the Contact-Database ! It is compiling, but
* please do not expect that anything is working !
* I will debug that stuff in the next time ..
* Please read README_COMPILE for compiling !
*
* =====================================================================
*/
#ifndef _OCONTACTACCESS_H
#define _OCONTACTACCESS_H
#include <qobject.h>
#include <qpe/qcopenvelope_qws.h>
#include <qvaluelist.h>
#include <qfileinfo.h>
#include "ocontact.h"
#include "ocontactaccessbackend.h"
#include "opimaccesstemplate.h"
/**
* Class to access the contacts database.
* This is just a frontend for the real database handling which is
* done by the backend.
* This class is used to access the Contacts on a system. This class as any OPIE PIM
* class is backend independent.
* @author Stefan Eilers, Holger Freyther
* @see OPimAccessTemplate
*/
class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
{
Q_OBJECT
public:
/**
* Create Database with contacts (addressbook).
* @param appname Name of application which wants access to the database
* (i.e. "todolist")
* @param filename The name of the database file. If not set, the default one
* is used.
* @param backend Pointer to an alternative Backend. If not set, we will use
* the default backend.
* @param handlesync If <b>true</b> the database stores the current state
* automatically if it receives the signals <i>flush()</i> and <i>reload()</i>
* which are used before and after synchronisation. If the application wants
* to react itself, it should be disabled by setting it to <b>false</b>
* @see OContactAccessBackend
*/
OContactAccess (const QString appname, const QString filename = 0l,
OContactAccessBackend* backend = 0l, bool handlesync = true);
~OContactAccess ();
/** Constants for query.
* Use this constants to set the query parameters.
* Note: <i>query_IgnoreCase</i> just make sense with one of the other attributes !
* @see queryByExample()
*/
enum QuerySettings {
WildCards = 0x0001,
IgnoreCase = 0x0002,
RegExp = 0x0004,
ExactMatch = 0x0008,
MatchOne = 0x0010, // Only one Entry must match
DateDiff = 0x0020, // Find all entries from today until given date
DateYear = 0x0040, // The year matches
DateMonth = 0x0080, // The month matches
DateDay = 0x0100, // The day matches
};
/** Return all Contacts in a sorted manner.
* @param ascending true: Sorted in acending order.
* @param sortOrder Currently not implemented. Just defined to stay compatible to otodoaccess
* @param sortFilter Currently not implemented. Just defined to stay compatible to otodoaccess
* @param cat Currently not implemented. Just defined to stay compatible to otodoaccess
*/
List sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const;
/** Return all possible settings.
* @return All settings provided by the current backend
* (i.e.: query_WildCards & query_IgnoreCase)
*/
const uint querySettings();
/** Check whether settings are correct.
* @return <i>true</i> if the given settings are correct and possible.
*/
bool hasQuerySettings ( int querySettings ) const;
/**
* if the resource was changed externally.
* You should use the signal instead of polling possible changes !
*/
bool wasChangedExternally()const;
/** Save contacts database.
* Save is more a "commit". After calling this function, all changes are public available.
* @return true if successful
*/
bool save();
signals:
/* Signal is emitted if the database was changed. Therefore
* we may need to reload to stay consistent.
* @param which Pointer to the database who created this event. This pointer
* is useful if an application has to handle multiple databases at the same time.
* @see reload()
*/
void signalChanged ( const OContactAccess *which );
private:
// class OContactAccessPrivate;
// OContactAccessPrivate* d;
OContactAccessBackend *m_backEnd;
bool m_loading:1;
private slots:
void copMessage( const QCString &msg, const QByteArray &data );
private:
class Private;
Private *d;
};
#endif
diff --git a/libopie/pim/ocontactaccessbackend.h b/noncore/unsupported/libopie/pim/ocontactaccessbackend.h
index 0eac6dc..cfeeff2 100644
--- a/libopie/pim/ocontactaccessbackend.h
+++ b/noncore/unsupported/libopie/pim/ocontactaccessbackend.h
@@ -1,128 +1,131 @@
/**
* The class responsible for managing a backend.
* The implementation of this abstract class contains
* the complete database handling.
*
* Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
* Copyright (c) 2002 by Holger Freyther (zecke@handhelds.org)
*
* =====================================================================
* This program 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.
* =====================================================================
* ToDo: Define enum for query settings
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.1 2004/11/16 21:46:07 mickeyl
+ * libopie1 goes into unsupported
+ *
* Revision 1.7 2004/02/19 02:05:37 zecke
* Add notes for API fixes and BC stuff
*
* Revision 1.6 2003/08/01 12:30:16 eilers
* Merging changes from BRANCH_1_0 to HEAD
*
* Revision 1.5.4.1 2003/06/30 14:34:19 eilers
* Patches from Zecke:
* Fixing and cleaning up extraMap handling
* Adding d_ptr for binary compatibility in the future
*
* Revision 1.5 2003/04/13 18:07:10 zecke
* More API doc
* QString -> const QString&
* QString = 0l -> QString::null
*
* Revision 1.4 2002/11/13 14:14:51 eilers
* Added sorted for Contacts..
*
* Revision 1.3 2002/11/01 15:10:42 eilers
* Added regExp-search in database for all fields in a contact.
*
* Revision 1.2 2002/10/07 17:34:24 eilers
* added OBackendFactory for advanced backend access
*
* Revision 1.1 2002/09/27 17:11:44 eilers
* Added API for accessing the Contact-Database ! It is compiling, but
* please do not expect that anything is working !
* I will debug that stuff in the next time ..
* Please read README_COMPILE for compiling !
*
* =====================================================================
*
*/
#ifndef _OCONTACTACCESSBACKEND_H_
#define _OCONTACTACCESSBACKEND_H_
#include "ocontact.h"
#include "opimaccessbackend.h"
#include <qregexp.h>
/**
* This class represents the interface of all Contact Backends.
* Derivates of this class will be used to access the contacts.
* As implementation currently XML and vCard exist. This class needs to be implemented
* if you want to provide your own storage.
* In all queries a list of uids is passed on instead of loading the actual record!
*
* @see OContactAccessBackend_VCard
* @see OContactAccessBackend_XML
*/
class OContactAccessBackend: public OPimAccessBackend<OContact> {
public:
/**
* @todo make non line in regard to BC guide of KDE
*/
OContactAccessBackend() {}
/**
* @todo make non inline in regard to the BC guide of KDE
*/
virtual ~OContactAccessBackend() {}
/**
* Return if database was changed externally.
* This may just make sense on file based databases like a XML-File.
* It is used to prevent to overwrite the current database content
* if the file was already changed by something else !
* If this happens, we have to reload before save our data.
* If we use real databases, this should be handled by the database
* management system themselve, therefore this function should always return false in
* this case. It is not our problem to handle this conflict ...
* @return <i>true</i> if the database was changed and if save without reload will
* be dangerous. <i>false</i> if the database was not changed or it is save to write
* in this situation.
*/
virtual bool wasChangedExternally() = 0;
virtual QArray<int> matchRegexp( const QRegExp &r ) const = 0;
/**
* Return all possible settings.
* @return All settings provided by the current backend
* (i.e.: query_WildCards & query_IgnoreCase)
*/
virtual const uint querySettings() = 0;
/**
* Check whether settings are correct.
* @return <i>true</i> if the given settings are correct and possible.
*/
virtual bool hasQuerySettings (uint querySettings) const = 0;
/**
* FIXME!!!
* Returns a sorted list of records either ascendinf or descending for a giving criteria and category
*/
virtual QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat ) = 0;
private:
class Private;
Private *d;
};
#endif
diff --git a/libopie/pim/ocontactaccessbackend_sql.cpp b/noncore/unsupported/libopie/pim/ocontactaccessbackend_sql.cpp
index d20df56..669483d 100644
--- a/libopie/pim/ocontactaccessbackend_sql.cpp
+++ b/noncore/unsupported/libopie/pim/ocontactaccessbackend_sql.cpp
@@ -1,945 +1,948 @@
/*
* SQL Backend for the OPIE-Contact Database.
*
* Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
*
* =====================================================================
* This program 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.
* =====================================================================
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.1 2004/11/16 21:46:07 mickeyl
+ * libopie1 goes into unsupported
+ *
* Revision 1.5 2004/03/14 13:50:35 alwin
* namespace correction
*
* Revision 1.4 2003/12/22 10:19:26 eilers
* Finishing implementation of sql-backend for datebook. But I have to
* port the PIM datebook application to use it, before I could debug the
* whole stuff.
* Thus, PIM-Database backend is finished, but highly experimental. And some
* parts are still generic. For instance, the "queryByExample()" methods are
* not (or not fully) implemented. Todo: custom-entries not stored.
* The big show stopper: matchRegExp() (needed by OpieSearch) needs regular
* expression search in the database, which is not supported by sqlite !
* Therefore we need either an extended sqlite or a workaround which would
* be very slow and memory consuming..
*
* Revision 1.3 2003/12/08 15:18:10 eilers
* Committing unfinished sql implementation before merging to libopie2 starts..
*
* Revision 1.2 2003/09/29 07:44:26 eilers
* Improvement of PIM-SQL Databases, but search queries are still limited.
* Addressbook: Changed table layout. Now, we just need 1/3 of disk-space.
* Todo: Started to add new attributes. Some type conversions missing.
*
* Revision 1.1 2003/09/22 14:31:16 eilers
* Added first experimental incarnation of sql-backend for addressbook.
* Some modifications to be able to compile the todo sql-backend.
* A lot of changes fill follow...
*
*/
#include "ocontactaccessbackend_sql.h"
#include <qarray.h>
#include <qdatetime.h>
#include <qstringlist.h>
#include <qpe/global.h>
#include <qpe/recordfields.h>
#include <opie/ocontactfields.h>
#include <opie/oconversion.h>
#include <opie2/osqldriver.h>
#include <opie2/osqlresult.h>
#include <opie2/osqlmanager.h>
#include <opie2/osqlquery.h>
using namespace Opie::DB;
// If defined, we use a horizontal table ( uid, attr1, attr2, attr3, ..., attrn ) instead
// vertical like "uid, type, value".
// DON'T DEACTIVATE THIS DEFINE IN PRODUCTIVE ENVIRONMENTS !!
#define __STORE_HORIZONTAL_
// Distinct loading is not very fast. If I expect that every person has just
// one (and always one) 'Last Name', I can request all uid's for existing lastnames,
// which is faster..
// But this may not be true for all entries, like company contacts..
// The current AddressBook application handles this problem, but other may not.. (eilers)
#define __USE_SUPERFAST_LOADQUERY
/*
* Implementation of used query types
* CREATE query
* LOAD query
* INSERT
* REMOVE
* CLEAR
*/
namespace {
/**
* CreateQuery for the Todolist Table
*/
class CreateQuery : public OSQLQuery {
public:
CreateQuery();
~CreateQuery();
QString query()const;
};
/**
* Clears (delete) a Table
*/
class ClearQuery : public OSQLQuery {
public:
ClearQuery();
~ClearQuery();
QString query()const;
};
/**
* LoadQuery
* this one queries for all uids
*/
class LoadQuery : public OSQLQuery {
public:
LoadQuery();
~LoadQuery();
QString query()const;
};
/**
* inserts/adds a OContact to the table
*/
class InsertQuery : public OSQLQuery {
public:
InsertQuery(const OContact& );
~InsertQuery();
QString query()const;
private:
OContact m_contact;
};
/**
* removes one from the table
*/
class RemoveQuery : public OSQLQuery {
public:
RemoveQuery(int uid );
~RemoveQuery();
QString query()const;
private:
int m_uid;
};
/**
* a find query for noncustom elements
*/
class FindQuery : public OSQLQuery {
public:
FindQuery(int uid);
FindQuery(const QArray<int>& );
~FindQuery();
QString query()const;
private:
QString single()const;
QString multi()const;
QArray<int> m_uids;
int m_uid;
};
/**
* a find query for custom elements
*/
class FindCustomQuery : public OSQLQuery {
public:
FindCustomQuery(int uid);
FindCustomQuery(const QArray<int>& );
~FindCustomQuery();
QString query()const;
private:
QString single()const;
QString multi()const;
QArray<int> m_uids;
int m_uid;
};
// We using three tables to store the information:
// 1. addressbook : It contains General information about the contact (non custom)
// 2. custom_data : Not official supported entries
// All tables are connected by the uid of the contact.
// Maybe I should add a table for meta-information ?
CreateQuery::CreateQuery() : OSQLQuery() {}
CreateQuery::~CreateQuery() {}
QString CreateQuery::query()const {
QString qu;
#ifdef __STORE_HORIZONTAL_
qu += "create table addressbook( uid PRIMARY KEY ";
QStringList fieldList = OContactFields::untrfields( false );
for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){
qu += QString( ",\"%1\" VARCHAR(10)" ).arg( *it );
}
qu += " );";
qu += "create table custom_data( uid INTEGER, id INTEGER, type VARCHAR, priority INTEGER, value VARCHAR, PRIMARY KEY /* identifier */ (uid, id) );";
#else
qu += "create table addressbook( uid INTEGER, id INTEGER, type VARCHAR, priority INTEGER, value VARCHAR, PRIMARY KEY /* identifier */ (uid, id));";
qu += "create table custom_data( uid INTEGER, id INTEGER, type VARCHAR, priority INTEGER, value VARCHAR, PRIMARY KEY /* identifier */ (uid, id) );";
// qu += "create table dates( uid PRIMARY KEY, type, day, month, year, hour, minute, second );";
#endif // __STORE_HORIZONTAL_
return qu;
}
ClearQuery::ClearQuery()
: OSQLQuery() {}
ClearQuery::~ClearQuery() {}
QString ClearQuery::query()const {
QString qu = "drop table addressbook;";
qu += "drop table custom_data;";
// qu += "drop table dates;";
return qu;
}
LoadQuery::LoadQuery() : OSQLQuery() {}
LoadQuery::~LoadQuery() {}
QString LoadQuery::query()const {
QString qu;
#ifdef __STORE_HORIZONTAL_
qu += "select uid from addressbook";
#else
# ifndef __USE_SUPERFAST_LOADQUERY
qu += "select distinct uid from addressbook";
# else
qu += "select uid from addressbook where type = 'Last Name'";
# endif // __USE_SUPERFAST_LOADQUERY
#endif // __STORE_HORIZONTAL_
return qu;
}
InsertQuery::InsertQuery( const OContact& contact )
: OSQLQuery(), m_contact( contact ) {
}
InsertQuery::~InsertQuery() {
}
/*
* converts from a OContact to a query
*/
QString InsertQuery::query()const{
#ifdef __STORE_HORIZONTAL_
QString qu;
qu += "insert into addressbook VALUES( " +
QString::number( m_contact.uid() );
// Get all information out of the contact-class
// Remember: The category is stored in contactMap, too !
QMap<int, QString> contactMap = m_contact.toMap();
QStringList fieldList = OContactFields::untrfields( false );
QMap<QString, int> translate = OContactFields::untrFieldsToId();
for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){
// Convert Column-String to Id and get value for this id..
// Hmmm.. Maybe not very cute solution..
int id = translate[*it];
switch ( id ){
case Qtopia::Birthday:{
// These entries should stored in a special format
// year-month-day
QDate day = m_contact.birthday();
if ( day.isValid() ){
qu += QString(",\"%1-%2-%3\"")
.arg( day.year() )
.arg( day.month() )
.arg( day.day() );
} else {
qu += ",\"\"";
}
}
break;
case Qtopia::Anniversary:{
// These entries should stored in a special format
// year-month-day
QDate day = m_contact.anniversary();
if ( day.isValid() ){
qu += QString(",\"%1-%2-%3\"")
.arg( day.year() )
.arg( day.month() )
.arg( day.day() );
} else {
qu += ",\"\"";
}
}
break;
default:
qu += QString( ",\"%1\"" ).arg( contactMap[id] );
}
}
qu += " );";
#else
// Get all information out of the contact-class
// Remember: The category is stored in contactMap, too !
QMap<int, QString> contactMap = m_contact.toMap();
QMap<QString, QString> addressbook_db;
// Get the translation from the ID to the String
QMap<int, QString> transMap = OContactFields::idToUntrFields();
for( QMap<int, QString>::Iterator it = contactMap.begin();
it != contactMap.end(); ++it ){
switch ( it.key() ){
case Qtopia::Birthday:{
// These entries should stored in a special format
// year-month-day
QDate day = m_contact.birthday();
addressbook_db.insert( transMap[it.key()],
QString("%1-%2-%3")
.arg( day.year() )
.arg( day.month() )
.arg( day.day() ) );
}
break;
case Qtopia::Anniversary:{
// These entries should stored in a special format
// year-month-day
QDate day = m_contact.anniversary();
addressbook_db.insert( transMap[it.key()],
QString("%1-%2-%3")
.arg( day.year() )
.arg( day.month() )
.arg( day.day() ) );
}
break;
case Qtopia::AddressUid: // Ignore UID
break;
default: // Translate id to String
addressbook_db.insert( transMap[it.key()], it.data() );
break;
}
}
// Now convert this whole stuff into a SQL String, beginning with
// the addressbook table..
QString qu;
// qu += "begin transaction;";
int id = 0;
for( QMap<QString, QString>::Iterator it = addressbook_db.begin();
it != addressbook_db.end(); ++it ){
qu += "insert into addressbook VALUES("
+ QString::number( m_contact.uid() )
+ ","
+ QString::number( id++ )
+ ",'"
+ it.key() //.latin1()
+ "',"
+ "0" // Priority for future enhancements
+ ",'"
+ it.data() //.latin1()
+ "');";
}
#endif //__STORE_HORIZONTAL_
// Now add custom data..
#ifdef __STORE_HORIZONTAL_
int id = 0;
#endif
id = 0;
QMap<QString, QString> customMap = m_contact.toExtraMap();
for( QMap<QString, QString>::Iterator it = customMap.begin();
it != customMap.end(); ++it ){
qu += "insert into custom_data VALUES("
+ QString::number( m_contact.uid() )
+ ","
+ QString::number( id++ )
+ ",'"
+ it.key() //.latin1()
+ "',"
+ "0" // Priority for future enhancements
+ ",'"
+ it.data() //.latin1()
+ "');";
}
// qu += "commit;";
qWarning("add %s", qu.latin1() );
return qu;
}
RemoveQuery::RemoveQuery(int uid )
: OSQLQuery(), m_uid( uid ) {}
RemoveQuery::~RemoveQuery() {}
QString RemoveQuery::query()const {
QString qu = "DELETE from addressbook where uid = "
+ QString::number(m_uid) + ";";
qu += "DELETE from custom_data where uid = "
+ QString::number(m_uid) + ";";
return qu;
}
FindQuery::FindQuery(int uid)
: OSQLQuery(), m_uid( uid ) {
}
FindQuery::FindQuery(const QArray<int>& ints)
: OSQLQuery(), m_uids( ints ){
}
FindQuery::~FindQuery() {
}
QString FindQuery::query()const{
// if ( m_uids.count() == 0 )
return single();
}
/*
else
return multi();
}
QString FindQuery::multi()const {
QString qu = "select uid, type, value from addressbook where";
for (uint i = 0; i < m_uids.count(); i++ ) {
qu += " UID = " + QString::number( m_uids[i] ) + " OR";
}
qu.remove( qu.length()-2, 2 ); // Hmmmm..
return qu;
}
*/
#ifdef __STORE_HORIZONTAL_
QString FindQuery::single()const{
QString qu = "select *";
qu += " from addressbook where uid = " + QString::number(m_uid);
// qWarning("find query: %s", qu.latin1() );
return qu;
}
#else
QString FindQuery::single()const{
QString qu = "select uid, type, value from addressbook where uid = ";
qu += QString::number(m_uid);
return qu;
}
#endif
FindCustomQuery::FindCustomQuery(int uid)
: OSQLQuery(), m_uid( uid ) {
}
FindCustomQuery::FindCustomQuery(const QArray<int>& ints)
: OSQLQuery(), m_uids( ints ){
}
FindCustomQuery::~FindCustomQuery() {
}
QString FindCustomQuery::query()const{
// if ( m_uids.count() == 0 )
return single();
}
QString FindCustomQuery::single()const{
QString qu = "select uid, type, value from custom_data where uid = ";
qu += QString::number(m_uid);
return qu;
}
};
/* --------------------------------------------------------------------------- */
OContactAccessBackend_SQL::OContactAccessBackend_SQL ( const QString& /* appname */,
const QString& filename ):
OContactAccessBackend(), m_changed(false), m_driver( NULL )
{
qWarning("C'tor OContactAccessBackend_SQL starts");
QTime t;
t.start();
/* Expecting to access the default filename if nothing else is set */
if ( filename.isEmpty() ){
m_fileName = Global::applicationFileName( "addressbook","addressbook.db" );
} else
m_fileName = filename;
// Get the standart sql-driver from the OSQLManager..
OSQLManager man;
m_driver = man.standard();
m_driver->setUrl( m_fileName );
load();
qWarning("C'tor OContactAccessBackend_SQL ends: %d ms", t.elapsed() );
}
OContactAccessBackend_SQL::~OContactAccessBackend_SQL ()
{
if( m_driver )
delete m_driver;
}
bool OContactAccessBackend_SQL::load ()
{
if (!m_driver->open() )
return false;
// Don't expect that the database exists.
// It is save here to create the table, even if it
// do exist. ( Is that correct for all databases ?? )
CreateQuery creat;
OSQLResult res = m_driver->query( &creat );
update();
return true;
}
bool OContactAccessBackend_SQL::reload()
{
return load();
}
bool OContactAccessBackend_SQL::save()
{
return m_driver->close(); // Shouldn't m_driver->sync be better than close ? (eilers)
}
void OContactAccessBackend_SQL::clear ()
{
ClearQuery cle;
OSQLResult res = m_driver->query( &cle );
reload();
}
bool OContactAccessBackend_SQL::wasChangedExternally()
{
return false;
}
QArray<int> OContactAccessBackend_SQL::allRecords() const
{
// FIXME: Think about cute handling of changed tables..
// Thus, we don't have to call update here...
if ( m_changed )
((OContactAccessBackend_SQL*)this)->update();
return m_uids;
}
bool OContactAccessBackend_SQL::add ( const OContact &newcontact )
{
InsertQuery ins( newcontact );
OSQLResult res = m_driver->query( &ins );
if ( res.state() == OSQLResult::Failure )
return false;
int c = m_uids.count();
m_uids.resize( c+1 );
m_uids[c] = newcontact.uid();
return true;
}
bool OContactAccessBackend_SQL::remove ( int uid )
{
RemoveQuery rem( uid );
OSQLResult res = m_driver->query(&rem );
if ( res.state() == OSQLResult::Failure )
return false;
m_changed = true;
return true;
}
bool OContactAccessBackend_SQL::replace ( const OContact &contact )
{
if ( !remove( contact.uid() ) )
return false;
return add( contact );
}
OContact OContactAccessBackend_SQL::find ( int uid ) const
{
qWarning("OContactAccessBackend_SQL::find()");
QTime t;
t.start();
OContact retContact( requestNonCustom( uid ) );
retContact.setExtraMap( requestCustom( uid ) );
qWarning("OContactAccessBackend_SQL::find() needed: %d ms", t.elapsed() );
return retContact;
}
QArray<int> OContactAccessBackend_SQL::queryByExample ( const OContact &query, int settings, const QDateTime& d = QDateTime() )
{
QString qu = "SELECT uid FROM addressbook WHERE";
QMap<int, QString> queryFields = query.toMap();
QStringList fieldList = OContactFields::untrfields( false );
QMap<QString, int> translate = OContactFields::untrFieldsToId();
// Convert every filled field to a SQL-Query
bool isAnyFieldSelected = false;
for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){
int id = translate[*it];
QString queryStr = queryFields[id];
if ( !queryStr.isEmpty() ){
isAnyFieldSelected = true;
switch( id ){
default:
// Switching between case sensitive and insensitive...
// LIKE is not case sensitive, GLOB is case sensitive
// Do exist a better solution to switch this ?
if ( settings & OContactAccess::IgnoreCase )
qu += "(\"" + *it + "\"" + " LIKE " + "'"
+ queryStr.replace(QRegExp("\\*"),"%") + "'" + ") AND ";
else
qu += "(\"" + *it + "\"" + " GLOB " + "'"
+ queryStr + "'" + ") AND ";
}
}
}
// Skip trailing "AND"
if ( isAnyFieldSelected )
qu = qu.left( qu.length() - 4 );
qWarning( "queryByExample query: %s", qu.latin1() );
// Execute query and return the received uid's
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
if ( res.state() != OSQLResult::Success ){
QArray<int> empty;
return empty;
}
QArray<int> list = extractUids( res );
return list;
}
QArray<int> OContactAccessBackend_SQL::matchRegexp( const QRegExp &r ) const
{
QArray<int> nix(0);
return nix;
}
const uint OContactAccessBackend_SQL::querySettings()
{
return OContactAccess::IgnoreCase
|| OContactAccess::WildCards;
}
bool OContactAccessBackend_SQL::hasQuerySettings (uint querySettings) const
{
/* OContactAccess::IgnoreCase, DateDiff, DateYear, DateMonth, DateDay
* may be added with any of the other settings. IgnoreCase should never used alone.
* Wildcards, RegExp, ExactMatch should never used at the same time...
*/
// Step 1: Check whether the given settings are supported by this backend
if ( ( querySettings & (
OContactAccess::IgnoreCase
| OContactAccess::WildCards
// | OContactAccess::DateDiff
// | OContactAccess::DateYear
// | OContactAccess::DateMonth
// | OContactAccess::DateDay
// | OContactAccess::RegExp
// | OContactAccess::ExactMatch
) ) != querySettings )
return false;
// Step 2: Check whether the given combinations are ok..
// IngoreCase alone is invalid
if ( querySettings == OContactAccess::IgnoreCase )
return false;
// WildCards, RegExp and ExactMatch should never used at the same time
switch ( querySettings & ~( OContactAccess::IgnoreCase
| OContactAccess::DateDiff
| OContactAccess::DateYear
| OContactAccess::DateMonth
| OContactAccess::DateDay
)
){
case OContactAccess::RegExp:
return ( true );
case OContactAccess::WildCards:
return ( true );
case OContactAccess::ExactMatch:
return ( true );
case 0: // one of the upper removed bits were set..
return ( true );
default:
return ( false );
}
}
QArray<int> OContactAccessBackend_SQL::sorted( bool asc, int , int , int )
{
QTime t;
t.start();
#ifdef __STORE_HORIZONTAL_
QString query = "SELECT uid FROM addressbook ";
query += "ORDER BY \"Last Name\" ";
#else
QString query = "SELECT uid FROM addressbook WHERE type = 'Last Name' ";
query += "ORDER BY upper( value )";
#endif
if ( !asc )
query += "DESC";
// qWarning("sorted query is: %s", query.latin1() );
OSQLRawQuery raw( query );
OSQLResult res = m_driver->query( &raw );
if ( res.state() != OSQLResult::Success ){
QArray<int> empty;
return empty;
}
QArray<int> list = extractUids( res );
qWarning("sorted needed %d ms!", t.elapsed() );
return list;
}
void OContactAccessBackend_SQL::update()
{
qWarning("Update starts");
QTime t;
t.start();
// Now load the database set and extract the uid's
// which will be held locally
LoadQuery lo;
OSQLResult res = m_driver->query(&lo);
if ( res.state() != OSQLResult::Success )
return;
m_uids = extractUids( res );
m_changed = false;
qWarning("Update ends %d ms", t.elapsed() );
}
QArray<int> OContactAccessBackend_SQL::extractUids( OSQLResult& res ) const
{
qWarning("extractUids");
QTime t;
t.start();
OSQLResultItem::ValueList list = res.results();
OSQLResultItem::ValueList::Iterator it;
QArray<int> ints(list.count() );
qWarning(" count = %d", list.count() );
int i = 0;
for (it = list.begin(); it != list.end(); ++it ) {
ints[i] = (*it).data("uid").toInt();
i++;
}
qWarning("extractUids ready: count2 = %d needs %d ms", i, t.elapsed() );
return ints;
}
#ifdef __STORE_HORIZONTAL_
QMap<int, QString> OContactAccessBackend_SQL::requestNonCustom( int uid ) const
{
QTime t;
t.start();
QMap<int, QString> nonCustomMap;
int t2needed = 0;
int t3needed = 0;
QTime t2;
t2.start();
FindQuery query( uid );
OSQLResult res_noncustom = m_driver->query( &query );
t2needed = t2.elapsed();
OSQLResultItem resItem = res_noncustom.first();
QTime t3;
t3.start();
// Now loop through all columns
QStringList fieldList = OContactFields::untrfields( false );
QMap<QString, int> translate = OContactFields::untrFieldsToId();
for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){
// Get data for the selected column and store it with the
// corresponding id into the map..
int id = translate[*it];
QString value = resItem.data( (*it) );
// qWarning("Reading %s... found: %s", (*it).latin1(), value.latin1() );
switch( id ){
case Qtopia::Birthday:
case Qtopia::Anniversary:{
// Birthday and Anniversary are encoded special ( yyyy-mm-dd )
QStringList list = QStringList::split( '-', value );
QStringList::Iterator lit = list.begin();
int year = (*lit).toInt();
int month = (*(++lit)).toInt();
int day = (*(++lit)).toInt();
if ( ( day != 0 ) && ( month != 0 ) && ( year != 0 ) ){
QDate date( year, month, day );
nonCustomMap.insert( id, OConversion::dateToString( date ) );
}
}
break;
case Qtopia::AddressCategory:
qWarning("Category is: %s", value.latin1() );
default:
nonCustomMap.insert( id, value );
}
}
// First insert uid
nonCustomMap.insert( Qtopia::AddressUid, resItem.data( "uid" ) );
t3needed = t3.elapsed();
// qWarning("Adding UID: %s", resItem.data( "uid" ).latin1() );
qWarning("RequestNonCustom needed: insg.:%d ms, query: %d ms, mapping: %d ms",
t.elapsed(), t2needed, t3needed );
return nonCustomMap;
}
#else
QMap<int, QString> OContactAccessBackend_SQL::requestNonCustom( int uid ) const
{
QTime t;
t.start();
QMap<int, QString> nonCustomMap;
int t2needed = 0;
QTime t2;
t2.start();
FindQuery query( uid );
OSQLResult res_noncustom = m_driver->query( &query );
t2needed = t2.elapsed();
if ( res_noncustom.state() == OSQLResult::Failure ) {
qWarning("OSQLResult::Failure in find query !!");
QMap<int, QString> empty;
return empty;
}
int t3needed = 0;
QTime t3;
t3.start();
QMap<QString, int> translateMap = OContactFields::untrFieldsToId();
OSQLResultItem::ValueList list = res_noncustom.results();
OSQLResultItem::ValueList::Iterator it = list.begin();
for ( ; it != list.end(); ++it ) {
if ( (*it).data("type") != "" ){
int typeId = translateMap[(*it).data( "type" )];
switch( typeId ){
case Qtopia::Birthday:
case Qtopia::Anniversary:{
// Birthday and Anniversary are encoded special ( yyyy-mm-dd )
QStringList list = QStringList::split( '-', (*it).data( "value" ) );
QStringList::Iterator lit = list.begin();
int year = (*lit).toInt();
qWarning("1. %s", (*lit).latin1());
int month = (*(++lit)).toInt();
qWarning("2. %s", (*lit).latin1());
int day = (*(++lit)).toInt();
qWarning("3. %s", (*lit).latin1());
qWarning( "RequestNonCustom->Converting:%s to Year: %d, Month: %d, Day: %d ", (*it).data( "value" ).latin1(), year, month, day );
QDate date( year, month, day );
nonCustomMap.insert( typeId, OConversion::dateToString( date ) );
}
break;
default:
nonCustomMap.insert( typeId,
(*it).data( "value" ) );
}
}
}
// Add UID to Map..
nonCustomMap.insert( Qtopia::AddressUid, QString::number( uid ) );
t3needed = t3.elapsed();
qWarning("RequestNonCustom needed: insg.:%d ms, query: %d ms, mapping: %d ms", t.elapsed(), t2needed, t3needed );
return nonCustomMap;
}
#endif // __STORE_HORIZONTAL_
QMap<QString, QString> OContactAccessBackend_SQL::requestCustom( int uid ) const
{
QTime t;
t.start();
QMap<QString, QString> customMap;
FindCustomQuery query( uid );
OSQLResult res_custom = m_driver->query( &query );
if ( res_custom.state() == OSQLResult::Failure ) {
qWarning("OSQLResult::Failure in find query !!");
QMap<QString, QString> empty;
return empty;
}
OSQLResultItem::ValueList list = res_custom.results();
OSQLResultItem::ValueList::Iterator it = list.begin();
for ( ; it != list.end(); ++it ) {
customMap.insert( (*it).data( "type" ), (*it).data( "value" ) );
}
qWarning("RequestCustom needed: %d ms", t.elapsed() );
return customMap;
}
diff --git a/libopie/pim/ocontactaccessbackend_sql.h b/noncore/unsupported/libopie/pim/ocontactaccessbackend_sql.h
index f553760..8cd92e8 100644
--- a/libopie/pim/ocontactaccessbackend_sql.h
+++ b/noncore/unsupported/libopie/pim/ocontactaccessbackend_sql.h
@@ -1,107 +1,110 @@
/*
* SQL Backend for the OPIE-Contact Database.
*
* Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
*
* =====================================================================
* This program 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.
* =====================================================================
*
*
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.1 2004/11/16 21:46:07 mickeyl
+ * libopie1 goes into unsupported
+ *
* Revision 1.3 2004/03/14 13:50:35 alwin
* namespace correction
*
* Revision 1.2 2003/12/08 15:18:11 eilers
* Committing unfinished sql implementation before merging to libopie2 starts..
*
* Revision 1.1 2003/09/22 14:31:16 eilers
* Added first experimental incarnation of sql-backend for addressbook.
* Some modifications to be able to compile the todo sql-backend.
* A lot of changes fill follow...
*
*
*/
#ifndef _OContactAccessBackend_SQL_
#define _OContactAccessBackend_SQL_
#include "ocontactaccessbackend.h"
#include "ocontactaccess.h"
#include <qlist.h>
#include <qdict.h>
namespace Opie { namespace DB {
class OSQLDriver;
class OSQLResult;
class OSQLResultItem;
}}
/* the default xml implementation */
/**
* This class is the SQL implementation of a Contact backend
* it does implement everything available for OContact.
* @see OPimAccessBackend for more information of available methods
*/
class OContactAccessBackend_SQL : public OContactAccessBackend {
public:
OContactAccessBackend_SQL ( const QString& appname, const QString& filename = QString::null );
~OContactAccessBackend_SQL ();
bool save();
bool load ();
void clear ();
bool wasChangedExternally();
QArray<int> allRecords() const;
OContact find ( int uid ) const;
// FIXME: Add lookahead-cache support !
//OContact find(int uid, const QArray<int>&, uint cur, Frontend::CacheDirection )const;
QArray<int> queryByExample ( const OContact &query, int settings,
const QDateTime& d );
QArray<int> matchRegexp( const QRegExp &r ) const;
const uint querySettings();
bool hasQuerySettings (uint querySettings) const;
// Currently only asc implemented..
QArray<int> sorted( bool asc, int , int , int );
bool add ( const OContact &newcontact );
bool replace ( const OContact &contact );
bool remove ( int uid );
bool reload();
private:
QArray<int> extractUids( Opie::DB::OSQLResult& res ) const;
QMap<int, QString> requestNonCustom( int uid ) const;
QMap<QString, QString> requestCustom( int uid ) const;
void update();
protected:
bool m_changed;
QString m_fileName;
QArray<int> m_uids;
Opie::DB::OSQLDriver* m_driver;
};
#endif
diff --git a/libopie/pim/ocontactaccessbackend_vcard.cpp b/noncore/unsupported/libopie/pim/ocontactaccessbackend_vcard.cpp
index b60c5be..a795b56 100644
--- a/libopie/pim/ocontactaccessbackend_vcard.cpp
+++ b/noncore/unsupported/libopie/pim/ocontactaccessbackend_vcard.cpp
@@ -1,646 +1,649 @@
/*
* VCard Backend for the OPIE-Contact Database.
*
* Copyright (C) 2000 Trolltech AS. All rights reserved.
* Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
*
* =====================================================================
* This program 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.
* =====================================================================
* ToDo:
*
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.1 2004/11/16 21:46:07 mickeyl
+ * libopie1 goes into unsupported
+ *
* Revision 1.11 2003/08/01 12:30:16 eilers
* Merging changes from BRANCH_1_0 to HEAD
*
* Revision 1.10.4.3 2003/07/23 08:54:37 eilers
* Default email was added to the list of all emails, which already contains
* the default email..
* This closes bug #1045
*
* Revision 1.10.4.2 2003/07/23 08:44:45 eilers
* Importing of Notes in vcard files wasn't implemented.
* Closes bug #1044
*
* Revision 1.10.4.1 2003/06/02 13:37:49 eilers
* Fixing memory leak
*
* Revision 1.10 2003/04/13 18:07:10 zecke
* More API doc
* QString -> const QString&
* QString = 0l -> QString::null
*
* Revision 1.9 2003/03/21 10:33:09 eilers
* Merged speed optimized xml backend for contacts to main.
* Added QDateTime to querybyexample. For instance, it is now possible to get
* all Birthdays/Anniversaries between two dates. This should be used
* to show all birthdays in the datebook..
* This change is sourcecode backward compatible but you have to upgrade
* the binaries for today-addressbook.
*
* Revision 1.8 2003/02/21 16:52:49 zecke
* -Remove old Todo classes they're deprecated and today I already using the
* new API
* -Guard against self assignment in OTodo
* -Add test apps for OPIM
* -Opiefied Event classes
* -Added TimeZone handling and pinning of TimeZones to OEvent
* -Adjust ORecur and the widget to better timezone behaviour
*
* Revision 1.7 2003/02/16 22:25:46 zecke
* 0000276 Fix for that bug.. or better temp workaround
* A Preferred Number is HOME|VOICE
* A CellPhone is HOME|VOICE|CELL the type & HOME|VOICE test
* triggers both
* and the cell phone number overrides the other entries..
*
* as a temp I check that it's not equal to HOME|VOICE|CELL before setting the
* number
*
* The right and final fix would be to reorder the if statement to make it
* if else based and the less common thing put to the bottom
*
* OTodoAccessVcal fix the date for beaming
*
* Revision 1.6 2003/01/13 15:49:31 eilers
* Fixing crash when businesscard.vcf is missing..
*
* Revision 1.5 2002/12/07 13:26:22 eilers
* Fixing bug in storing anniversary..
*
* Revision 1.4 2002/11/13 14:14:51 eilers
* Added sorted for Contacts..
*
* Revision 1.3 2002/11/11 16:41:09 kergoth
* no default arguments in implementation
*
* Revision 1.2 2002/11/10 15:41:53 eilers
* Bugfixes..
*
* Revision 1.1 2002/11/09 14:34:52 eilers
* Added VCard Backend.
*
*/
#include "ocontactaccessbackend_vcard.h"
#include "../../library/backend/vobject_p.h"
#include "../../library/backend/qfiledirect_p.h"
#include <qpe/timeconversion.h>
#include <qfile.h>
OContactAccessBackend_VCard::OContactAccessBackend_VCard ( const QString& , const QString& filename ):
m_dirty( false ),
m_file( filename )
{
load();
}
bool OContactAccessBackend_VCard::load ()
{
m_map.clear();
m_dirty = false;
VObject* obj = 0l;
if ( QFile::exists(m_file) ){
obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() );
if ( !obj )
return false;
}else{
qWarning("File \"%s\" not found !", m_file.latin1() );
return false;
}
while ( obj ) {
OContact con = parseVObject( obj );
/*
* if uid is 0 assign a new one
* this at least happens on
* Nokia6210
*/
if ( con.uid() == 0 ){
con.setUid( 1 );
qWarning("assigned new uid %d",con.uid() );
}
m_map.insert( con.uid(), con );
VObject *t = obj;
obj = nextVObjectInList(obj);
cleanVObject( t );
}
return true;
}
bool OContactAccessBackend_VCard::reload()
{
return load();
}
bool OContactAccessBackend_VCard::save()
{
if (!m_dirty )
return true;
QFileDirect file( m_file );
if (!file.open(IO_WriteOnly ) )
return false;
VObject *obj;
obj = newVObject( VCCalProp );
addPropValue( obj, VCVersionProp, "1.0" );
VObject *vo;
for(QMap<int, OContact>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){
vo = createVObject( *it );
writeVObject( file.directHandle() , vo );
cleanVObject( vo );
}
cleanStrTbl();
deleteVObject( obj );
m_dirty = false;
return true;
}
void OContactAccessBackend_VCard::clear ()
{
m_map.clear();
m_dirty = true; // ??? sure ? (se)
}
bool OContactAccessBackend_VCard::add ( const OContact& newcontact )
{
m_map.insert( newcontact.uid(), newcontact );
m_dirty = true;
return true;
}
bool OContactAccessBackend_VCard::remove ( int uid )
{
m_map.remove( uid );
m_dirty = true;
return true;
}
bool OContactAccessBackend_VCard::replace ( const OContact &contact )
{
m_map.replace( contact.uid(), contact );
m_dirty = true;
return true;
}
OContact OContactAccessBackend_VCard::find ( int uid ) const
{
return m_map[uid];
}
QArray<int> OContactAccessBackend_VCard::allRecords() const
{
QArray<int> ar( m_map.count() );
QMap<int, OContact>::ConstIterator it;
int i = 0;
for ( it = m_map.begin(); it != m_map.end(); ++it ) {
ar[i] = it.key();
i++;
}
return ar;
}
// Not implemented
QArray<int> OContactAccessBackend_VCard::queryByExample ( const OContact&, int, const QDateTime& )
{
QArray<int> ar(0);
return ar;
}
// Not implemented
QArray<int> OContactAccessBackend_VCard::matchRegexp( const QRegExp& ) const
{
QArray<int> ar(0);
return ar;
}
const uint OContactAccessBackend_VCard::querySettings()
{
return 0; // No search possible
}
bool OContactAccessBackend_VCard::hasQuerySettings (uint ) const
{
return false; // No search possible, therefore all settings invalid ;)
}
bool OContactAccessBackend_VCard::wasChangedExternally()
{
return false; // Don't expect concurrent access
}
// Not implemented
QArray<int> OContactAccessBackend_VCard::sorted( bool , int, int, int )
{
QArray<int> ar(0);
return ar;
}
// *** Private stuff ***
OContact OContactAccessBackend_VCard::parseVObject( VObject *obj )
{
OContact c;
VObjectIterator it;
initPropIterator( &it, obj );
while( moreIteration( &it ) ) {
VObject *o = nextVObject( &it );
QCString name = vObjectName( o );
QCString value = vObjectStringZValue( o );
if ( name == VCNameProp ) {
VObjectIterator nit;
initPropIterator( &nit, o );
while( moreIteration( &nit ) ) {
VObject *o = nextVObject( &nit );
QCString name = vObjectTypeInfo( o );
QString value = vObjectStringZValue( o );
if ( name == VCNamePrefixesProp )
c.setTitle( value );
else if ( name == VCNameSuffixesProp )
c.setSuffix( value );
else if ( name == VCFamilyNameProp )
c.setLastName( value );
else if ( name == VCGivenNameProp )
c.setFirstName( value );
else if ( name == VCAdditionalNamesProp )
c.setMiddleName( value );
}
}
else if ( name == VCAdrProp ) {
bool work = TRUE; // default address is work address
QString street;
QString city;
QString region;
QString postal;
QString country;
VObjectIterator nit;
initPropIterator( &nit, o );
while( moreIteration( &nit ) ) {
VObject *o = nextVObject( &nit );
QCString name = vObjectName( o );
QString value = vObjectStringZValue( o );
if ( name == VCHomeProp )
work = FALSE;
else if ( name == VCWorkProp )
work = TRUE;
else if ( name == VCStreetAddressProp )
street = value;
else if ( name == VCCityProp )
city = value;
else if ( name == VCRegionProp )
region = value;
else if ( name == VCPostalCodeProp )
postal = value;
else if ( name == VCCountryNameProp )
country = value;
}
if ( work ) {
c.setBusinessStreet( street );
c.setBusinessCity( city );
c.setBusinessCountry( country );
c.setBusinessZip( postal );
c.setBusinessState( region );
} else {
c.setHomeStreet( street );
c.setHomeCity( city );
c.setHomeCountry( country );
c.setHomeZip( postal );
c.setHomeState( region );
}
}
else if ( name == VCTelephoneProp ) {
enum {
HOME = 0x01,
WORK = 0x02,
VOICE = 0x04,
CELL = 0x08,
FAX = 0x10,
PAGER = 0x20,
UNKNOWN = 0x80
};
int type = 0;
VObjectIterator nit;
initPropIterator( &nit, o );
while( moreIteration( &nit ) ) {
VObject *o = nextVObject( &nit );
QCString name = vObjectTypeInfo( o );
if ( name == VCHomeProp )
type |= HOME;
else if ( name == VCWorkProp )
type |= WORK;
else if ( name == VCVoiceProp )
type |= VOICE;
else if ( name == VCCellularProp )
type |= CELL;
else if ( name == VCFaxProp )
type |= FAX;
else if ( name == VCPagerProp )
type |= PAGER;
else if ( name == VCPreferredProp )
;
else
type |= UNKNOWN;
}
if ( (type & UNKNOWN) != UNKNOWN ) {
if ( ( type & (HOME|WORK) ) == 0 ) // default
type |= HOME;
if ( ( type & (VOICE|CELL|FAX|PAGER) ) == 0 ) // default
type |= VOICE;
qWarning("value %s %d", value.data(), type );
if ( (type & (VOICE|HOME) ) == (VOICE|HOME) && (type & (CELL|HOME) ) != (CELL|HOME) )
c.setHomePhone( value );
if ( ( type & (FAX|HOME) ) == (FAX|HOME) )
c.setHomeFax( value );
if ( ( type & (CELL|HOME) ) == (CELL|HOME) )
c.setHomeMobile( value );
if ( ( type & (VOICE|WORK) ) == (VOICE|WORK) && (type & (CELL|WORK) ) != (CELL|WORK) )
c.setBusinessPhone( value );
if ( ( type & (FAX|WORK) ) == (FAX|WORK) )
c.setBusinessFax( value );
if ( ( type & (CELL|WORK) ) == (CELL|WORK) )
c.setBusinessMobile( value );
if ( ( type & (PAGER|WORK) ) == (PAGER|WORK) )
c.setBusinessPager( value );
}
}
else if ( name == VCEmailAddressProp ) {
QString email = vObjectStringZValue( o );
bool valid = TRUE;
VObjectIterator nit;
initPropIterator( &nit, o );
while( moreIteration( &nit ) ) {
VObject *o = nextVObject( &nit );
QCString name = vObjectTypeInfo( o );
if ( name != VCInternetProp && name != VCHomeProp &&
name != VCWorkProp &&
name != VCPreferredProp )
// ### preffered should map to default email
valid = FALSE;
}
if ( valid ) {
c.insertEmail( email );
}
}
else if ( name == VCURLProp ) {
VObjectIterator nit;
initPropIterator( &nit, o );
while( moreIteration( &nit ) ) {
VObject *o = nextVObject( &nit );
QCString name = vObjectTypeInfo( o );
if ( name == VCHomeProp )
c.setHomeWebpage( value );
else if ( name == VCWorkProp )
c.setBusinessWebpage( value );
}
}
else if ( name == VCOrgProp ) {
VObjectIterator nit;
initPropIterator( &nit, o );
while( moreIteration( &nit ) ) {
VObject *o = nextVObject( &nit );
QCString name = vObjectName( o );
QString value = vObjectStringZValue( o );
if ( name == VCOrgNameProp )
c.setCompany( value );
else if ( name == VCOrgUnitProp )
c.setDepartment( value );
else if ( name == VCOrgUnit2Prop )
c.setOffice( value );
}
}
else if ( name == VCTitleProp ) {
c.setJobTitle( value );
}
else if ( name == "X-Qtopia-Profession" ) {
c.setProfession( value );
}
else if ( name == "X-Qtopia-Manager" ) {
c.setManager( value );
}
else if ( name == "X-Qtopia-Assistant" ) {
c.setAssistant( value );
}
else if ( name == "X-Qtopia-Spouse" ) {
c.setSpouse( value );
}
else if ( name == "X-Qtopia-Gender" ) {
c.setGender( value );
}
else if ( name == "X-Qtopia-Anniversary" ) {
c.setAnniversary( convVCardDateToDate( value ) );
}
else if ( name == "X-Qtopia-Nickname" ) {
c.setNickname( value );
}
else if ( name == "X-Qtopia-Children" ) {
c.setChildren( value );
}
else if ( name == VCBirthDateProp ) {
// Reading Birthdate regarding RFC 2425 (5.8.4)
c.setBirthday( convVCardDateToDate( value ) );
}
else if ( name == VCCommentProp ) {
c.setNotes( value );
}
#if 0
else {
printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) );
VObjectIterator nit;
initPropIterator( &nit, o );
while( moreIteration( &nit ) ) {
VObject *o = nextVObject( &nit );
QCString name = vObjectName( o );
QString value = vObjectStringZValue( o );
printf(" subprop: %s = %s\n", name.data(), value.latin1() );
}
}
#endif
}
c.setFileAs();
return c;
}
VObject* OContactAccessBackend_VCard::createVObject( const OContact &c )
{
VObject *vcard = newVObject( VCCardProp );
safeAddPropValue( vcard, VCVersionProp, "2.1" );
safeAddPropValue( vcard, VCLastRevisedProp, TimeConversion::toISO8601( QDateTime::currentDateTime() ) );
safeAddPropValue( vcard, VCUniqueStringProp, QString::number(c.uid()) );
// full name
safeAddPropValue( vcard, VCFullNameProp, c.fullName() );
// name properties
VObject *name = safeAddProp( vcard, VCNameProp );
safeAddPropValue( name, VCFamilyNameProp, c.lastName() );
safeAddPropValue( name, VCGivenNameProp, c.firstName() );
safeAddPropValue( name, VCAdditionalNamesProp, c.middleName() );
safeAddPropValue( name, VCNamePrefixesProp, c.title() );
safeAddPropValue( name, VCNameSuffixesProp, c.suffix() );
// home properties
VObject *home_adr= safeAddProp( vcard, VCAdrProp );
safeAddProp( home_adr, VCHomeProp );
safeAddPropValue( home_adr, VCStreetAddressProp, c.homeStreet() );
safeAddPropValue( home_adr, VCCityProp, c.homeCity() );
safeAddPropValue( home_adr, VCRegionProp, c.homeState() );
safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() );
safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() );
VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() );
safeAddProp( home_phone, VCHomeProp );
home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeMobile() );
safeAddProp( home_phone, VCHomeProp );
safeAddProp( home_phone, VCCellularProp );
home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeFax() );
safeAddProp( home_phone, VCHomeProp );
safeAddProp( home_phone, VCFaxProp );
VObject *url = safeAddPropValue( vcard, VCURLProp, c.homeWebpage() );
safeAddProp( url, VCHomeProp );
// work properties
VObject *work_adr= safeAddProp( vcard, VCAdrProp );
safeAddProp( work_adr, VCWorkProp );
safeAddPropValue( work_adr, VCStreetAddressProp, c.businessStreet() );
safeAddPropValue( work_adr, VCCityProp, c.businessCity() );
safeAddPropValue( work_adr, VCRegionProp, c.businessState() );
safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() );
safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() );
VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() );
safeAddProp( work_phone, VCWorkProp );
work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessMobile() );
safeAddProp( work_phone, VCWorkProp );
safeAddProp( work_phone, VCCellularProp );
work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessFax() );
safeAddProp( work_phone, VCWorkProp );
safeAddProp( work_phone, VCFaxProp );
work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() );
safeAddProp( work_phone, VCWorkProp );
safeAddProp( work_phone, VCPagerProp );
url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() );
safeAddProp( url, VCWorkProp );
VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() );
safeAddProp( title, VCWorkProp );
QStringList emails = c.emailList();
// emails.prepend( c.defaultEmail() ); Fix for bugreport #1045
for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) {
VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it );
safeAddProp( email, VCInternetProp );
}
safeAddPropValue( vcard, VCNoteProp, c.notes() );
// Exporting Birthday regarding RFC 2425 (5.8.4)
if ( c.birthday().isValid() ){
qWarning("Exporting birthday as: %s", convDateToVCardDate( c.birthday() ).latin1() );
safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) );
}
if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) {
VObject *org = safeAddProp( vcard, VCOrgProp );
safeAddPropValue( org, VCOrgNameProp, c.company() );
safeAddPropValue( org, VCOrgUnitProp, c.department() );
safeAddPropValue( org, VCOrgUnit2Prop, c.office() );
}
// some values we have to export as custom fields
safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() );
safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() );
safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() );
safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() );
safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() );
if ( c.anniversary().isValid() ){
qWarning("Exporting anniversary as: %s", convDateToVCardDate( c.anniversary() ).latin1() );
safeAddPropValue( vcard, "X-Qtopia-Anniversary", convDateToVCardDate( c.anniversary() ) );
}
safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() );
safeAddPropValue( vcard, "X-Qtopia-Children", c.children() );
return vcard;
}
QString OContactAccessBackend_VCard::convDateToVCardDate( const QDate& d ) const
{
QString str_rfc2425 = QString("%1-%2-%3")
.arg( d.year() )
.arg( d.month(), 2 )
.arg( d.day(), 2 );
// Now replace spaces with "0"...
int pos = 0;
while ( ( pos = str_rfc2425.find (' ') ) > 0 )
str_rfc2425.replace( pos, 1, "0" );
return str_rfc2425;
}
QDate OContactAccessBackend_VCard::convVCardDateToDate( const QString& datestr )
{
int monthPos = datestr.find('-');
int dayPos = datestr.find('-', monthPos+1 );
int sep_ignore = 1;
if ( monthPos == -1 || dayPos == -1 ) {
qDebug("fromString didn't find - in str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos );
// Ok.. No "-" found, therefore we will try to read other format ( YYYYMMDD )
if ( datestr.length() == 8 ){
monthPos = 4;
dayPos = 6;
sep_ignore = 0;
qDebug("Try with follwing positions str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos );
} else {
return QDate();
}
}
int y = datestr.left( monthPos ).toInt();
int m = datestr.mid( monthPos + sep_ignore, dayPos - monthPos - sep_ignore ).toInt();
int d = datestr.mid( dayPos + sep_ignore ).toInt();
qDebug("TimeConversion::fromString ymd = %s => %d %d %d; mpos = %d ypos = %d", datestr.latin1(), y, m, d, monthPos, dayPos);
QDate date ( y,m,d );
return date;
}
VObject* OContactAccessBackend_VCard::safeAddPropValue( VObject *o, const char *prop, const QString &value )
{
VObject *ret = 0;
if ( o && !value.isEmpty() )
ret = addPropValue( o, prop, value.latin1() );
return ret;
}
VObject* OContactAccessBackend_VCard::safeAddProp( VObject *o, const char *prop)
{
VObject *ret = 0;
if ( o )
ret = addProp( o, prop );
return ret;
}
diff --git a/libopie/pim/ocontactaccessbackend_vcard.h b/noncore/unsupported/libopie/pim/ocontactaccessbackend_vcard.h
index 712d769..6dbc718 100644
--- a/libopie/pim/ocontactaccessbackend_vcard.h
+++ b/noncore/unsupported/libopie/pim/ocontactaccessbackend_vcard.h
@@ -1,96 +1,99 @@
/*
* VCard Backend for the OPIE-Contact Database.
*
* Copyright (C) 2000 Trolltech AS. All rights reserved.
* Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
*
* =====================================================================
* This program 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.
* =====================================================================
* ToDo:
*
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.1 2004/11/16 21:46:07 mickeyl
+ * libopie1 goes into unsupported
+ *
* Revision 1.6 2003/04/13 18:07:10 zecke
* More API doc
* QString -> const QString&
* QString = 0l -> QString::null
*
* Revision 1.5 2003/03/21 10:33:09 eilers
* Merged speed optimized xml backend for contacts to main.
* Added QDateTime to querybyexample. For instance, it is now possible to get
* all Birthdays/Anniversaries between two dates. This should be used
* to show all birthdays in the datebook..
* This change is sourcecode backward compatible but you have to upgrade
* the binaries for today-addressbook.
*
* Revision 1.4 2002/12/07 13:26:22 eilers
* Fixing bug in storing anniversary..
*
* Revision 1.3 2002/11/13 14:14:51 eilers
* Added sorted for Contacts..
*
* Revision 1.2 2002/11/10 15:41:53 eilers
* Bugfixes..
*
* Revision 1.1 2002/11/09 14:34:52 eilers
* Added VCard Backend.
*
*/
#ifndef __OCONTACTACCESSBACKEND_VCARD_H_
#define __OCONTACTACCESSBACKEND_VCARD_H_
#include <opie/ocontact.h>
#include "ocontactaccessbackend.h"
class VObject;
/**
* This is the vCard 2.1 implementation of the Contact Storage
* @see OContactAccessBackend_XML
* @see OPimAccessBackend
*/
class OContactAccessBackend_VCard : public OContactAccessBackend {
public:
OContactAccessBackend_VCard ( const QString& appname, const QString& filename = QString::null );
bool load ();
bool reload();
bool save();
void clear ();
bool add ( const OContact& newcontact );
bool remove ( int uid );
bool replace ( const OContact& contact );
OContact find ( int uid ) const;
QArray<int> allRecords() const;
QArray<int> queryByExample ( const OContact &query, int settings, const QDateTime& d = QDateTime() );
QArray<int> matchRegexp( const QRegExp &r ) const;
const uint querySettings();
bool hasQuerySettings (uint querySettings) const;
QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat );
bool wasChangedExternally();
private:
OContact parseVObject( VObject* obj );
VObject* createVObject( const OContact& c );
QString convDateToVCardDate( const QDate& c ) const;
QDate convVCardDateToDate( const QString& datestr );
VObject *safeAddPropValue( VObject *o, const char* prop, const QString& value );
VObject *safeAddProp( VObject* o, const char* prop);
bool m_dirty : 1;
QString m_file;
QMap<int, OContact> m_map;
};
#endif
diff --git a/libopie/pim/ocontactaccessbackend_xml.cpp b/noncore/unsupported/libopie/pim/ocontactaccessbackend_xml.cpp
index 2373ad6..7ceaf5b 100644
--- a/libopie/pim/ocontactaccessbackend_xml.cpp
+++ b/noncore/unsupported/libopie/pim/ocontactaccessbackend_xml.cpp
@@ -1,821 +1,824 @@
/*
* XML Backend for the OPIE-Contact Database.
*
* Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
*
* =====================================================================
* This program 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.
* =====================================================================
*
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.1 2004/11/16 21:46:07 mickeyl
+ * libopie1 goes into unsupported
+ *
* Revision 1.10 2004/03/01 15:44:36 chicken
* fix includes
*
* Revision 1.9 2003/09/22 14:31:16 eilers
* Added first experimental incarnation of sql-backend for addressbook.
* Some modifications to be able to compile the todo sql-backend.
* A lot of changes fill follow...
*
* Revision 1.8 2003/08/30 15:28:26 eilers
* Removed some unimportant debug output which causes slow down..
*
* Revision 1.7 2003/08/01 12:30:16 eilers
* Merging changes from BRANCH_1_0 to HEAD
*
* Revision 1.6 2003/07/07 16:19:47 eilers
* Fixing serious bug in hasQuerySettings()
*
* Revision 1.5 2003/04/13 18:07:10 zecke
* More API doc
* QString -> const QString&
* QString = 0l -> QString::null
*
* Revision 1.4 2003/03/21 14:32:54 mickeyl
* g++ compliance fix: default arguments belong into the declaration, but not the definition
*
* Revision 1.3 2003/03/21 12:26:28 eilers
* Fixing small bug: If we search a birthday from today to today, it returned
* every contact ..
*
* Revision 1.2 2003/03/21 10:33:09 eilers
* Merged speed optimized xml backend for contacts to main.
* Added QDateTime to querybyexample. For instance, it is now possible to get
* all Birthdays/Anniversaries between two dates. This should be used
* to show all birthdays in the datebook..
* This change is sourcecode backward compatible but you have to upgrade
* the binaries for today-addressbook.
*
* Revision 1.1.2.2 2003/02/11 12:17:28 eilers
* Speed optimization. Removed the sequential search loops.
*
* Revision 1.1.2.1 2003/02/10 15:31:38 eilers
* Writing offsets to debug output..
*
* Revision 1.1 2003/02/09 15:05:01 eilers
* Nothing happened.. Just some cleanup before I will start..
*
* Revision 1.12 2003/01/03 16:58:03 eilers
* Reenable debug output
*
* Revision 1.11 2003/01/03 12:31:28 eilers
* Bugfix for calculating data diffs..
*
* Revision 1.10 2003/01/02 14:27:12 eilers
* Improved query by example: Search by date is possible.. First step
* for a today plugin for birthdays..
*
* Revision 1.9 2002/12/08 12:48:57 eilers
* Moved journal-enum from ocontact into i the xml-backend..
*
* Revision 1.8 2002/11/14 17:04:24 eilers
* Sorting will now work if fullname is identical on some entries
*
* Revision 1.7 2002/11/13 15:02:46 eilers
* Small Bug in sorted fixed
*
* Revision 1.6 2002/11/13 14:14:51 eilers
* Added sorted for Contacts..
*
* Revision 1.5 2002/11/01 15:10:42 eilers
* Added regExp-search in database for all fields in a contact.
*
* Revision 1.4 2002/10/16 10:52:40 eilers
* Added some docu to the interface and now using the cache infrastucture by zecke.. :)
*
* Revision 1.3 2002/10/14 16:21:54 eilers
* Some minor interface updates
*
* Revision 1.2 2002/10/07 17:34:24 eilers
* added OBackendFactory for advanced backend access
*
* Revision 1.1 2002/09/27 17:11:44 eilers
* Added API for accessing the Contact-Database ! It is compiling, but
* please do not expect that anything is working !
* I will debug that stuff in the next time ..
* Please read README_COMPILE for compiling !
*
*
*/
#include "ocontactaccessbackend_xml.h"
#include <qasciidict.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qregexp.h>
#include <qarray.h>
#include <qmap.h>
#include <qpe/global.h>
#include <opie/xmltree.h>
#include "ocontactaccessbackend.h"
#include "ocontactaccess.h"
#include <stdlib.h>
#include <errno.h>
using namespace Opie;
OContactAccessBackend_XML::OContactAccessBackend_XML ( const QString& appname, const QString& filename ):
m_changed( false )
{
// Just m_contactlist should call delete if an entry
// is removed.
m_contactList.setAutoDelete( true );
m_uidToContact.setAutoDelete( false );
m_appName = appname;
/* Set journalfile name ... */
m_journalName = getenv("HOME");
m_journalName +="/.abjournal" + appname;
/* Expecting to access the default filename if nothing else is set */
if ( filename.isEmpty() ){
m_fileName = Global::applicationFileName( "addressbook","addressbook.xml" );
} else
m_fileName = filename;
/* Load Database now */
load ();
}
bool OContactAccessBackend_XML::save()
{
if ( !m_changed )
return true;
QString strNewFile = m_fileName + ".new";
QFile f( strNewFile );
if ( !f.open( IO_WriteOnly|IO_Raw ) )
return false;
int total_written;
int idx_offset = 0;
QString out;
// Write Header
out = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE Addressbook ><AddressBook>\n"
" <Groups>\n"
" </Groups>\n"
" <Contacts>\n";
QCString cstr = out.utf8();
f.writeBlock( cstr.data(), cstr.length() );
idx_offset += cstr.length();
out = "";
// Write all contacts
QListIterator<OContact> it( m_contactList );
for ( ; it.current(); ++it ) {
// qWarning(" Uid %d at Offset: %x", (*it)->uid(), idx_offset );
out += "<Contact ";
(*it)->save( out );
out += "/>\n";
cstr = out.utf8();
total_written = f.writeBlock( cstr.data(), cstr.length() );
idx_offset += cstr.length();
if ( total_written != int(cstr.length()) ) {
f.close();
QFile::remove( strNewFile );
return false;
}
out = "";
}
out += " </Contacts>\n</AddressBook>\n";
// Write Footer
cstr = out.utf8();
total_written = f.writeBlock( cstr.data(), cstr.length() );
if ( total_written != int( cstr.length() ) ) {
f.close();
QFile::remove( strNewFile );
return false;
}
f.close();
// move the file over, I'm just going to use the system call
// because, I don't feel like using QDir.
if ( ::rename( strNewFile.latin1(), m_fileName.latin1() ) < 0 ) {
qWarning( "problem renaming file %s to %s, errno: %d",
strNewFile.latin1(), m_journalName.latin1(), errno );
// remove the tmp file...
QFile::remove( strNewFile );
}
/* The journalfile should be removed now... */
removeJournal();
m_changed = false;
return true;
}
bool OContactAccessBackend_XML::load ()
{
m_contactList.clear();
m_uidToContact.clear();
/* Load XML-File and journal if it exists */
if ( !load ( m_fileName, false ) )
return false;
/* The returncode of the journalfile is ignored due to the
* fact that it does not exist when this class is instantiated !
* But there may such a file exist, if the application crashed.
* Therefore we try to load it to get the changes before the #
* crash happened...
*/
load (m_journalName, true);
return true;
}
void OContactAccessBackend_XML::clear ()
{
m_contactList.clear();
m_uidToContact.clear();
m_changed = false;
}
bool OContactAccessBackend_XML::wasChangedExternally()
{
QFileInfo fi( m_fileName );
QDateTime lastmod = fi.lastModified ();
return (lastmod != m_readtime);
}
QArray<int> OContactAccessBackend_XML::allRecords() const
{
QArray<int> uid_list( m_contactList.count() );
uint counter = 0;
QListIterator<OContact> it( m_contactList );
for( ; it.current(); ++it ){
uid_list[counter++] = (*it)->uid();
}
return ( uid_list );
}
OContact OContactAccessBackend_XML::find ( int uid ) const
{
OContact foundContact; //Create empty contact
OContact* found = m_uidToContact.find( QString().setNum( uid ) );
if ( found ){
foundContact = *found;
}
return ( foundContact );
}
QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, int settings,
const QDateTime& d )
{
QArray<int> m_currentQuery( m_contactList.count() );
QListIterator<OContact> it( m_contactList );
uint arraycounter = 0;
for( ; it.current(); ++it ){
/* Search all fields and compare them with query object. Store them into list
* if all fields matches.
*/
QDate* queryDate = 0l;
QDate* checkDate = 0l;
bool allcorrect = true;
for ( int i = 0; i < Qtopia::Groups; i++ ) {
// Birthday and anniversary are special nonstring fields and should
// be handled specially
switch ( i ){
case Qtopia::Birthday:
queryDate = new QDate( query.birthday() );
checkDate = new QDate( (*it)->birthday() );
case Qtopia::Anniversary:
if ( queryDate == 0l ){
queryDate = new QDate( query.anniversary() );
checkDate = new QDate( (*it)->anniversary() );
}
if ( queryDate->isValid() ){
if( checkDate->isValid() ){
if ( settings & OContactAccess::DateYear ){
if ( queryDate->year() != checkDate->year() )
allcorrect = false;
}
if ( settings & OContactAccess::DateMonth ){
if ( queryDate->month() != checkDate->month() )
allcorrect = false;
}
if ( settings & OContactAccess::DateDay ){
if ( queryDate->day() != checkDate->day() )
allcorrect = false;
}
if ( settings & OContactAccess::DateDiff ) {
QDate current;
// If we get an additional date, we
// will take this date instead of
// the current one..
if ( !d.date().isValid() )
current = QDate::currentDate();
else
current = d.date();
// We have to equalize the year, otherwise
// the search will fail..
checkDate->setYMD( current.year(),
checkDate->month(),
checkDate->day() );
if ( *checkDate < current )
checkDate->setYMD( current.year()+1,
checkDate->month(),
checkDate->day() );
// Check whether the birthday/anniversary date is between
// the current/given date and the maximum date
// ( maximum time range ) !
qWarning("Checking if %s is between %s and %s ! ",
checkDate->toString().latin1(),
current.toString().latin1(),
queryDate->toString().latin1() );
if ( current.daysTo( *queryDate ) >= 0 ){
if ( !( ( *checkDate >= current ) &&
( *checkDate <= *queryDate ) ) ){
allcorrect = false;
qWarning (" Nope!..");
}
}
}
} else{
// checkDate is invalid. Therefore this entry is always rejected
allcorrect = false;
}
}
delete queryDate;
queryDate = 0l;
delete checkDate;
checkDate = 0l;
break;
default:
/* Just compare fields which are not empty in the query object */
if ( !query.field(i).isEmpty() ){
switch ( settings & ~( OContactAccess::IgnoreCase
| OContactAccess::DateDiff
| OContactAccess::DateYear
| OContactAccess::DateMonth
| OContactAccess::DateDay
| OContactAccess::MatchOne
) ){
case OContactAccess::RegExp:{
QRegExp expr ( query.field(i),
!(settings & OContactAccess::IgnoreCase),
false );
if ( expr.find ( (*it)->field(i), 0 ) == -1 )
allcorrect = false;
}
break;
case OContactAccess::WildCards:{
QRegExp expr ( query.field(i),
!(settings & OContactAccess::IgnoreCase),
true );
if ( expr.find ( (*it)->field(i), 0 ) == -1 )
allcorrect = false;
}
break;
case OContactAccess::ExactMatch:{
if (settings & OContactAccess::IgnoreCase){
if ( query.field(i).upper() !=
(*it)->field(i).upper() )
allcorrect = false;
}else{
if ( query.field(i) != (*it)->field(i) )
allcorrect = false;
}
}
break;
}
}
}
}
if ( allcorrect ){
m_currentQuery[arraycounter++] = (*it)->uid();
}
}
// Shrink to fit..
m_currentQuery.resize(arraycounter);
return m_currentQuery;
}
QArray<int> OContactAccessBackend_XML::matchRegexp( const QRegExp &r ) const
{
QArray<int> m_currentQuery( m_contactList.count() );
QListIterator<OContact> it( m_contactList );
uint arraycounter = 0;
for( ; it.current(); ++it ){
if ( (*it)->match( r ) ){
m_currentQuery[arraycounter++] = (*it)->uid();
}
}
// Shrink to fit..
m_currentQuery.resize(arraycounter);
return m_currentQuery;
}
const uint OContactAccessBackend_XML::querySettings()
{
return ( OContactAccess::WildCards
| OContactAccess::IgnoreCase
| OContactAccess::RegExp
| OContactAccess::ExactMatch
| OContactAccess::DateDiff
| OContactAccess::DateYear
| OContactAccess::DateMonth
| OContactAccess::DateDay
);
}
bool OContactAccessBackend_XML::hasQuerySettings (uint querySettings) const
{
/* OContactAccess::IgnoreCase, DateDiff, DateYear, DateMonth, DateDay
* may be added with any of the other settings. IgnoreCase should never used alone.
* Wildcards, RegExp, ExactMatch should never used at the same time...
*/
// Step 1: Check whether the given settings are supported by this backend
if ( ( querySettings & (
OContactAccess::IgnoreCase
| OContactAccess::WildCards
| OContactAccess::DateDiff
| OContactAccess::DateYear
| OContactAccess::DateMonth
| OContactAccess::DateDay
| OContactAccess::RegExp
| OContactAccess::ExactMatch
) ) != querySettings )
return false;
// Step 2: Check whether the given combinations are ok..
// IngoreCase alone is invalid
if ( querySettings == OContactAccess::IgnoreCase )
return false;
// WildCards, RegExp and ExactMatch should never used at the same time
switch ( querySettings & ~( OContactAccess::IgnoreCase
| OContactAccess::DateDiff
| OContactAccess::DateYear
| OContactAccess::DateMonth
| OContactAccess::DateDay
)
){
case OContactAccess::RegExp:
return ( true );
case OContactAccess::WildCards:
return ( true );
case OContactAccess::ExactMatch:
return ( true );
case 0: // one of the upper removed bits were set..
return ( true );
default:
return ( false );
}
}
// Currently only asc implemented..
QArray<int> OContactAccessBackend_XML::sorted( bool asc, int , int , int )
{
QMap<QString, int> nameToUid;
QStringList names;
QArray<int> m_currentQuery( m_contactList.count() );
// First fill map and StringList with all Names
// Afterwards sort namelist and use map to fill array to return..
QListIterator<OContact> it( m_contactList );
for( ; it.current(); ++it ){
names.append( (*it)->fileAs() + QString::number( (*it)->uid() ) );
nameToUid.insert( (*it)->fileAs() + QString::number( (*it)->uid() ), (*it)->uid() );
}
names.sort();
int i = 0;
if ( asc ){
for ( QStringList::Iterator it = names.begin(); it != names.end(); ++it )
m_currentQuery[i++] = nameToUid[ (*it) ];
}else{
for ( QStringList::Iterator it = names.end(); it != names.begin(); --it )
m_currentQuery[i++] = nameToUid[ (*it) ];
}
return m_currentQuery;
}
bool OContactAccessBackend_XML::add ( const OContact &newcontact )
{
//qWarning("odefaultbackend: ACTION::ADD");
updateJournal (newcontact, ACTION_ADD);
addContact_p( newcontact );
m_changed = true;
return true;
}
bool OContactAccessBackend_XML::replace ( const OContact &contact )
{
m_changed = true;
OContact* found = m_uidToContact.find ( QString().setNum( contact.uid() ) );
if ( found ) {
OContact* newCont = new OContact( contact );
updateJournal ( *newCont, ACTION_REPLACE);
m_contactList.removeRef ( found );
m_contactList.append ( newCont );
m_uidToContact.remove( QString().setNum( contact.uid() ) );
m_uidToContact.insert( QString().setNum( newCont->uid() ), newCont );
qWarning("Nur zur Sicherheit: %d == %d ?",contact.uid(), newCont->uid());
return true;
} else
return false;
}
bool OContactAccessBackend_XML::remove ( int uid )
{
m_changed = true;
OContact* found = m_uidToContact.find ( QString().setNum( uid ) );
if ( found ) {
updateJournal ( *found, ACTION_REMOVE);
m_contactList.removeRef ( found );
m_uidToContact.remove( QString().setNum( uid ) );
return true;
} else
return false;
}
bool OContactAccessBackend_XML::reload(){
/* Reload is the same as load in this implementation */
return ( load() );
}
void OContactAccessBackend_XML::addContact_p( const OContact &newcontact )
{
OContact* contRef = new OContact( newcontact );
m_contactList.append ( contRef );
m_uidToContact.insert( QString().setNum( newcontact.uid() ), contRef );
}
/* This function loads the xml-database and the journalfile */
bool OContactAccessBackend_XML::load( const QString filename, bool isJournal )
{
/* We use the time of the last read to check if the file was
* changed externally.
*/
if ( !isJournal ){
QFileInfo fi( filename );
m_readtime = fi.lastModified ();
}
const int JOURNALACTION = Qtopia::Notes + 1;
const int JOURNALROW = JOURNALACTION + 1;
bool foundAction = false;
journal_action action = ACTION_ADD;
int journalKey = 0;
QMap<int, QString> contactMap;
QMap<QString, QString> customMap;
QMap<QString, QString>::Iterator customIt;
QAsciiDict<int> dict( 47 );
dict.setAutoDelete( TRUE );
dict.insert( "Uid", new int(Qtopia::AddressUid) );
dict.insert( "Title", new int(Qtopia::Title) );
dict.insert( "FirstName", new int(Qtopia::FirstName) );
dict.insert( "MiddleName", new int(Qtopia::MiddleName) );
dict.insert( "LastName", new int(Qtopia::LastName) );
dict.insert( "Suffix", new int(Qtopia::Suffix) );
dict.insert( "FileAs", new int(Qtopia::FileAs) );
dict.insert( "Categories", new int(Qtopia::AddressCategory) );
dict.insert( "DefaultEmail", new int(Qtopia::DefaultEmail) );
dict.insert( "Emails", new int(Qtopia::Emails) );
dict.insert( "HomeStreet", new int(Qtopia::HomeStreet) );
dict.insert( "HomeCity", new int(Qtopia::HomeCity) );
dict.insert( "HomeState", new int(Qtopia::HomeState) );
dict.insert( "HomeZip", new int(Qtopia::HomeZip) );
dict.insert( "HomeCountry", new int(Qtopia::HomeCountry) );
dict.insert( "HomePhone", new int(Qtopia::HomePhone) );
dict.insert( "HomeFax", new int(Qtopia::HomeFax) );
dict.insert( "HomeMobile", new int(Qtopia::HomeMobile) );
dict.insert( "HomeWebPage", new int(Qtopia::HomeWebPage) );
dict.insert( "Company", new int(Qtopia::Company) );
dict.insert( "BusinessStreet", new int(Qtopia::BusinessStreet) );
dict.insert( "BusinessCity", new int(Qtopia::BusinessCity) );
dict.insert( "BusinessState", new int(Qtopia::BusinessState) );
dict.insert( "BusinessZip", new int(Qtopia::BusinessZip) );
dict.insert( "BusinessCountry", new int(Qtopia::BusinessCountry) );
dict.insert( "BusinessWebPage", new int(Qtopia::BusinessWebPage) );
dict.insert( "JobTitle", new int(Qtopia::JobTitle) );
dict.insert( "Department", new int(Qtopia::Department) );
dict.insert( "Office", new int(Qtopia::Office) );
dict.insert( "BusinessPhone", new int(Qtopia::BusinessPhone) );
dict.insert( "BusinessFax", new int(Qtopia::BusinessFax) );
dict.insert( "BusinessMobile", new int(Qtopia::BusinessMobile) );
dict.insert( "BusinessPager", new int(Qtopia::BusinessPager) );
dict.insert( "Profession", new int(Qtopia::Profession) );
dict.insert( "Assistant", new int(Qtopia::Assistant) );
dict.insert( "Manager", new int(Qtopia::Manager) );
dict.insert( "Spouse", new int(Qtopia::Spouse) );
dict.insert( "Children", new int(Qtopia::Children) );
dict.insert( "Gender", new int(Qtopia::Gender) );
dict.insert( "Birthday", new int(Qtopia::Birthday) );
dict.insert( "Anniversary", new int(Qtopia::Anniversary) );
dict.insert( "Nickname", new int(Qtopia::Nickname) );
dict.insert( "Notes", new int(Qtopia::Notes) );
dict.insert( "action", new int(JOURNALACTION) );
dict.insert( "actionrow", new int(JOURNALROW) );
//qWarning( "OContactDefaultBackEnd::loading %s", filename.latin1() );
XMLElement *root = XMLElement::load( filename );
if(root != 0l ){ // start parsing
/* Parse all XML-Elements and put the data into the
* Contact-Class
*/
XMLElement *element = root->firstChild();
//qWarning("OContactAccess::load tagName(): %s", root->tagName().latin1() );
element = element->firstChild();
/* Search Tag "Contacts" which is the parent of all Contacts */
while( element && !isJournal ){
if( element->tagName() != QString::fromLatin1("Contacts") ){
//qWarning ("OContactDefBack::Searching for Tag \"Contacts\"! Found: %s",
// element->tagName().latin1());
element = element->nextChild();
} else {
element = element->firstChild();
break;
}
}
/* Parse all Contacts and ignore unknown tags */
while( element ){
if( element->tagName() != QString::fromLatin1("Contact") ){
//qWarning ("OContactDefBack::Searching for Tag \"Contact\"! Found: %s",
// element->tagName().latin1());
element = element->nextChild();
continue;
}
/* Found alement with tagname "contact", now parse and store all
* attributes contained
*/
//qWarning("OContactDefBack::load element tagName() : %s",
// element->tagName().latin1() );
QString dummy;
foundAction = false;
XMLElement::AttributeMap aMap = element->attributes();
XMLElement::AttributeMap::Iterator it;
contactMap.clear();
customMap.clear();
for( it = aMap.begin(); it != aMap.end(); ++it ){
// qWarning ("Read Attribute: %s=%s", it.key().latin1(),it.data().latin1());
int *find = dict[ it.key() ];
/* Unknown attributes will be stored as "Custom" elements */
if ( !find ) {
// qWarning("Attribute %s not known.", it.key().latin1());
//contact.setCustomField(it.key(), it.data());
customMap.insert( it.key(), it.data() );
continue;
}
/* Check if special conversion is needed and add attribute
* into Contact class
*/
switch( *find ) {
/*
case Qtopia::AddressUid:
contact.setUid( it.data().toInt() );
break;
case Qtopia::AddressCategory:
contact.setCategories( Qtopia::Record::idsFromString( it.data( )));
break;
*/
case JOURNALACTION:
action = journal_action(it.data().toInt());
foundAction = true;
qWarning ("ODefBack(journal)::ACTION found: %d", action);
break;
case JOURNALROW:
journalKey = it.data().toInt();
break;
default: // no conversion needed add them to the map
contactMap.insert( *find, it.data() );
break;
}
}
/* now generate the Contact contact */
OContact contact( contactMap );
for (customIt = customMap.begin(); customIt != customMap.end(); ++customIt ) {
contact.setCustomField( customIt.key(), customIt.data() );
}
if (foundAction){
foundAction = false;
switch ( action ) {
case ACTION_ADD:
addContact_p (contact);
break;
case ACTION_REMOVE:
if ( !remove (contact.uid()) )
qWarning ("ODefBack(journal)::Unable to remove uid: %d",
contact.uid() );
break;
case ACTION_REPLACE:
if ( !replace ( contact ) )
qWarning ("ODefBack(journal)::Unable to replace uid: %d",
contact.uid() );
break;
default:
qWarning ("Unknown action: ignored !");
break;
}
}else{
/* Add contact to list */
addContact_p (contact);
}
/* Move to next element */
element = element->nextChild();
}
}else {
qWarning("ODefBack::could not load");
}
delete root;
qWarning("returning from loading" );
return true;
}
void OContactAccessBackend_XML::updateJournal( const OContact& cnt,
journal_action action )
{
QFile f( m_journalName );
bool created = !f.exists();
if ( !f.open(IO_WriteOnly|IO_Append) )
return;
QString buf;
QCString str;
// if the file was created, we have to set the Tag "<CONTACTS>" to
// get a XML-File which is readable by our parser.
// This is just a cheat, but better than rewrite the parser.
if ( created ){
buf = "<Contacts>";
QCString cstr = buf.utf8();
f.writeBlock( cstr.data(), cstr.length() );
}
buf = "<Contact ";
cnt.save( buf );
buf += " action=\"" + QString::number( (int)action ) + "\" ";
buf += "/>\n";
QCString cstr = buf.utf8();
f.writeBlock( cstr.data(), cstr.length() );
}
void OContactAccessBackend_XML::removeJournal()
{
QFile f ( m_journalName );
if ( f.exists() )
f.remove();
}
diff --git a/libopie/pim/ocontactaccessbackend_xml.h b/noncore/unsupported/libopie/pim/ocontactaccessbackend_xml.h
index a0cae4d..6857844 100644
--- a/libopie/pim/ocontactaccessbackend_xml.h
+++ b/noncore/unsupported/libopie/pim/ocontactaccessbackend_xml.h
@@ -1,160 +1,163 @@
/*
* XML Backend for the OPIE-Contact Database.
*
* Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
*
* =====================================================================
* This program 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.
* =====================================================================
* ToDo: XML-Backend: Automatic reload if something was changed...
* File Locking to protect against concurrent access
*
*
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.1 2004/11/16 21:46:07 mickeyl
+ * libopie1 goes into unsupported
+ *
* Revision 1.15 2003/09/22 14:31:16 eilers
* Added first experimental incarnation of sql-backend for addressbook.
* Some modifications to be able to compile the todo sql-backend.
* A lot of changes fill follow...
*
* Revision 1.14 2003/04/13 18:07:10 zecke
* More API doc
* QString -> const QString&
* QString = 0l -> QString::null
*
* Revision 1.13 2003/03/21 10:33:09 eilers
* Merged speed optimized xml backend for contacts to main.
* Added QDateTime to querybyexample. For instance, it is now possible to get
* all Birthdays/Anniversaries between two dates. This should be used
* to show all birthdays in the datebook..
* This change is sourcecode backward compatible but you have to upgrade
* the binaries for today-addressbook.
*
* Revision 1.12.2.2 2003/02/11 12:17:28 eilers
* Speed optimization. Removed the sequential search loops.
*
* Revision 1.12.2.1 2003/02/09 15:05:01 eilers
* Nothing happened.. Just some cleanup before I will start..
*
* Revision 1.12 2003/01/03 16:58:03 eilers
* Reenable debug output
*
* Revision 1.11 2003/01/03 12:31:28 eilers
* Bugfix for calculating data diffs..
*
* Revision 1.10 2003/01/02 14:27:12 eilers
* Improved query by example: Search by date is possible.. First step
* for a today plugin for birthdays..
*
* Revision 1.9 2002/12/08 12:48:57 eilers
* Moved journal-enum from ocontact into i the xml-backend..
*
* Revision 1.8 2002/11/14 17:04:24 eilers
* Sorting will now work if fullname is identical on some entries
*
* Revision 1.7 2002/11/13 15:02:46 eilers
* Small Bug in sorted fixed
*
* Revision 1.6 2002/11/13 14:14:51 eilers
* Added sorted for Contacts..
*
* Revision 1.5 2002/11/01 15:10:42 eilers
* Added regExp-search in database for all fields in a contact.
*
* Revision 1.4 2002/10/16 10:52:40 eilers
* Added some docu to the interface and now using the cache infrastucture by zecke.. :)
*
* Revision 1.3 2002/10/14 16:21:54 eilers
* Some minor interface updates
*
* Revision 1.2 2002/10/07 17:34:24 eilers
* added OBackendFactory for advanced backend access
*
* Revision 1.1 2002/09/27 17:11:44 eilers
* Added API for accessing the Contact-Database ! It is compiling, but
* please do not expect that anything is working !
* I will debug that stuff in the next time ..
* Please read README_COMPILE for compiling !
*
*
*/
#ifndef _OContactAccessBackend_XML_
#define _OContactAccessBackend_XML_
#include "ocontactaccessbackend.h"
#include "ocontactaccess.h"
#include <qlist.h>
#include <qdict.h>
/* the default xml implementation */
/**
* This class is the XML implementation of a Contact backend
* it does implement everything available for OContact.
* @see OPimAccessBackend for more information of available methods
*/
class OContactAccessBackend_XML : public OContactAccessBackend {
public:
OContactAccessBackend_XML ( const QString& appname, const QString& filename = QString::null );
bool save();
bool load ();
void clear ();
bool wasChangedExternally();
QArray<int> allRecords() const;
OContact find ( int uid ) const;
QArray<int> queryByExample ( const OContact &query, int settings, const QDateTime& d = QDateTime() );
QArray<int> matchRegexp( const QRegExp &r ) const;
const uint querySettings();
bool hasQuerySettings (uint querySettings) const;
// Currently only asc implemented..
QArray<int> sorted( bool asc, int , int , int );
bool add ( const OContact &newcontact );
bool replace ( const OContact &contact );
bool remove ( int uid );
bool reload();
private:
enum journal_action { ACTION_ADD, ACTION_REMOVE, ACTION_REPLACE };
void addContact_p( const OContact &newcontact );
/* This function loads the xml-database and the journalfile */
bool load( const QString filename, bool isJournal );
void updateJournal( const OContact& cnt, journal_action action );
void removeJournal();
protected:
bool m_changed;
QString m_journalName;
QString m_fileName;
QString m_appName;
QList<OContact> m_contactList;
QDateTime m_readtime;
QDict<OContact> m_uidToContact;
};
#endif
diff --git a/libopie/pim/ocontactfields.cpp b/noncore/unsupported/libopie/pim/ocontactfields.cpp
index 0f08a5a..0f08a5a 100644
--- a/libopie/pim/ocontactfields.cpp
+++ b/noncore/unsupported/libopie/pim/ocontactfields.cpp
diff --git a/libopie/pim/ocontactfields.h b/noncore/unsupported/libopie/pim/ocontactfields.h
index f105de7..f105de7 100644
--- a/libopie/pim/ocontactfields.h
+++ b/noncore/unsupported/libopie/pim/ocontactfields.h
diff --git a/libopie/pim/oconversion.cpp b/noncore/unsupported/libopie/pim/oconversion.cpp
index 0d15414..0d15414 100644
--- a/libopie/pim/oconversion.cpp
+++ b/noncore/unsupported/libopie/pim/oconversion.cpp
diff --git a/libopie/pim/oconversion.h b/noncore/unsupported/libopie/pim/oconversion.h
index 4c0a497..4c0a497 100644
--- a/libopie/pim/oconversion.h
+++ b/noncore/unsupported/libopie/pim/oconversion.h
diff --git a/libopie/pim/odatebookaccess.cpp b/noncore/unsupported/libopie/pim/odatebookaccess.cpp
index d95fed6..d95fed6 100644
--- a/libopie/pim/odatebookaccess.cpp
+++ b/noncore/unsupported/libopie/pim/odatebookaccess.cpp
diff --git a/libopie/pim/odatebookaccess.h b/noncore/unsupported/libopie/pim/odatebookaccess.h
index 62196da..62196da 100644
--- a/libopie/pim/odatebookaccess.h
+++ b/noncore/unsupported/libopie/pim/odatebookaccess.h
diff --git a/libopie/pim/odatebookaccessbackend.cpp b/noncore/unsupported/libopie/pim/odatebookaccessbackend.cpp
index f0c5d65..f0c5d65 100644
--- a/libopie/pim/odatebookaccessbackend.cpp
+++ b/noncore/unsupported/libopie/pim/odatebookaccessbackend.cpp
diff --git a/libopie/pim/odatebookaccessbackend.h b/noncore/unsupported/libopie/pim/odatebookaccessbackend.h
index 3472ab3..3472ab3 100644
--- a/libopie/pim/odatebookaccessbackend.h
+++ b/noncore/unsupported/libopie/pim/odatebookaccessbackend.h
diff --git a/libopie/pim/odatebookaccessbackend_sql.cpp b/noncore/unsupported/libopie/pim/odatebookaccessbackend_sql.cpp
index 44dd2bc..5f87afe 100644
--- a/libopie/pim/odatebookaccessbackend_sql.cpp
+++ b/noncore/unsupported/libopie/pim/odatebookaccessbackend_sql.cpp
@@ -1,371 +1,374 @@
/*
* SQL Backend for the OPIE-Calender Database.
*
* Copyright (c) 2003 by Stefan Eilers (Eilers.Stefan@epost.de)
*
* =====================================================================
* This program 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.
* =====================================================================
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.1 2004/11/16 21:46:08 mickeyl
+ * libopie1 goes into unsupported
+ *
* Revision 1.4 2004/03/14 13:50:35 alwin
* namespace correction
*
* Revision 1.3 2003/12/22 11:41:39 eilers
* Fixing stupid bug, found by sourcode review..
*
* Revision 1.2 2003/12/22 10:19:26 eilers
* Finishing implementation of sql-backend for datebook. But I have to
* port the PIM datebook application to use it, before I could debug the
* whole stuff.
* Thus, PIM-Database backend is finished, but highly experimental. And some
* parts are still generic. For instance, the "queryByExample()" methods are
* not (or not fully) implemented. Todo: custom-entries not stored.
* The big show stopper: matchRegExp() (needed by OpieSearch) needs regular
* expression search in the database, which is not supported by sqlite !
* Therefore we need either an extended sqlite or a workaround which would
* be very slow and memory consuming..
*
* Revision 1.1 2003/12/08 15:18:12 eilers
* Committing unfinished sql implementation before merging to libopie2 starts..
*
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <qarray.h>
#include <qstringlist.h>
#include <qpe/global.h>
#include <opie2/osqldriver.h>
#include <opie2/osqlmanager.h>
#include <opie2/osqlquery.h>
#include "orecur.h"
#include "odatebookaccessbackend_sql.h"
using namespace Opie::DB;
ODateBookAccessBackend_SQL::ODateBookAccessBackend_SQL( const QString& ,
const QString& fileName )
: ODateBookAccessBackend(), m_driver( NULL )
{
m_fileName = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.db" ) : fileName;
// Get the standart sql-driver from the OSQLManager..
OSQLManager man;
m_driver = man.standard();
m_driver->setUrl( m_fileName );
initFields();
load();
}
ODateBookAccessBackend_SQL::~ODateBookAccessBackend_SQL() {
if( m_driver )
delete m_driver;
}
void ODateBookAccessBackend_SQL::initFields()
{
// This map contains the translation of the fieldtype id's to
// the names of the table columns
m_fieldMap.insert( OEvent::FUid, "uid" );
m_fieldMap.insert( OEvent::FCategories, "Categories" );
m_fieldMap.insert( OEvent::FDescription, "Description" );
m_fieldMap.insert( OEvent::FLocation, "Location" );
m_fieldMap.insert( OEvent::FType, "Type" );
m_fieldMap.insert( OEvent::FAlarm, "Alarm" );
m_fieldMap.insert( OEvent::FSound, "Sound" );
m_fieldMap.insert( OEvent::FRType, "RType" );
m_fieldMap.insert( OEvent::FRWeekdays, "RWeekdays" );
m_fieldMap.insert( OEvent::FRPosition, "RPosition" );
m_fieldMap.insert( OEvent::FRFreq, "RFreq" );
m_fieldMap.insert( OEvent::FRHasEndDate, "RHasEndDate" );
m_fieldMap.insert( OEvent::FREndDate, "REndDate" );
m_fieldMap.insert( OEvent::FRCreated, "RCreated" );
m_fieldMap.insert( OEvent::FRExceptions, "RExceptions" );
m_fieldMap.insert( OEvent::FStart, "Start" );
m_fieldMap.insert( OEvent::FEnd, "End" );
m_fieldMap.insert( OEvent::FNote, "Note" );
m_fieldMap.insert( OEvent::FTimeZone, "TimeZone" );
m_fieldMap.insert( OEvent::FRecParent, "RecParent" );
m_fieldMap.insert( OEvent::FRecChildren, "Recchildren" );
// Create a map that maps the column name to the id
QMapConstIterator<int, QString> it;
for ( it = ++m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){
m_reverseFieldMap.insert( it.data(), it.key() );
}
}
bool ODateBookAccessBackend_SQL::load()
{
if (!m_driver->open() )
return false;
// Don't expect that the database exists.
// It is save here to create the table, even if it
// do exist. ( Is that correct for all databases ?? )
QString qu = "create table datebook( uid INTEGER PRIMARY KEY ";
QMap<int, QString>::Iterator it;
for ( it = ++m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){
qu += QString( ",%1 VARCHAR(10)" ).arg( it.data() );
}
qu += " );";
qu += "create table custom_data( uid INTEGER, id INTEGER, type VARCHAR, priority INTEGER, value VARCHAR, PRIMARY KEY /* identifier */ (uid, id) );";
qWarning( "command: %s", qu.latin1() );
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
if ( res.state() != OSQLResult::Success )
return false;
update();
return true;
}
void ODateBookAccessBackend_SQL::update()
{
QString qu = "select uid from datebook";
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
if ( res.state() != OSQLResult::Success ){
// m_uids.clear();
return;
}
m_uids = extractUids( res );
}
bool ODateBookAccessBackend_SQL::reload()
{
return load();
}
bool ODateBookAccessBackend_SQL::save()
{
return m_driver->close(); // Shouldn't m_driver->sync be better than close ? (eilers)
}
QArray<int> ODateBookAccessBackend_SQL::allRecords()const
{
return m_uids;
}
QArray<int> ODateBookAccessBackend_SQL::queryByExample(const OEvent&, int, const QDateTime& ) {
return QArray<int>();
}
void ODateBookAccessBackend_SQL::clear()
{
QString qu = "drop table datebook;";
qu += "drop table custom_data;";
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
reload();
}
OEvent ODateBookAccessBackend_SQL::find( int uid ) const{
QString qu = "select *";
qu += "from datebook where uid = " + QString::number(uid);
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
OSQLResultItem resItem = res.first();
// Create Map for date event and insert UID
QMap<int,QString> dateEventMap;
dateEventMap.insert( OEvent::FUid, QString::number( uid ) );
// Now insert the data out of the columns into the map.
QMapConstIterator<int, QString> it;
for ( it = ++m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){
dateEventMap.insert( m_reverseFieldMap[*it], resItem.data( *it ) );
}
// Last step: Put map into date event and return it
OEvent retDate( dateEventMap );
return retDate;
}
// FIXME: Speed up update of uid's..
bool ODateBookAccessBackend_SQL::add( const OEvent& ev )
{
QMap<int,QString> eventMap = ev.toMap();
QString qu = "insert into datebook VALUES( " + QString::number( ev.uid() );
QMap<int, QString>::Iterator it;
for ( it = ++m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){
if ( !eventMap[it.key()].isEmpty() )
qu += QString( ",\"%1\"" ).arg( eventMap[it.key()] );
else
qu += QString( ",\"\"" );
}
qu += " );";
// Add custom entries
int id = 0;
QMap<QString, QString> customMap = ev.toExtraMap();
for( QMap<QString, QString>::Iterator it = customMap.begin();
it != customMap.end(); ++it ){
qu += "insert into custom_data VALUES("
+ QString::number( ev.uid() )
+ ","
+ QString::number( id++ )
+ ",'"
+ it.key() //.latin1()
+ "',"
+ "0" // Priority for future enhancements
+ ",'"
+ it.data() //.latin1()
+ "');";
}
qWarning("add %s", qu.latin1() );
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
if ( res.state() != OSQLResult::Success ){
return false;
}
// Update list of uid's
update();
return true;
}
// FIXME: Speed up update of uid's..
bool ODateBookAccessBackend_SQL::remove( int uid )
{
QString qu = "DELETE from datebook where uid = "
+ QString::number( uid ) + ";";
qu += "DELETE from custom_data where uid = "
+ QString::number( uid ) + ";";
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
if ( res.state() != OSQLResult::Success ){
return false;
}
// Update list of uid's
update();
return true;
}
bool ODateBookAccessBackend_SQL::replace( const OEvent& ev )
{
remove( ev.uid() );
return add( ev );
}
QArray<int> ODateBookAccessBackend_SQL::rawEvents()const
{
return allRecords();
}
QArray<int> ODateBookAccessBackend_SQL::rawRepeats()const
{
QString qu = "select uid from datebook where RType!=\"\" AND RType!=\"NoRepeat\"";
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
if ( res.state() != OSQLResult::Success ){
QArray<int> nix;
return nix;
}
return extractUids( res );
}
QArray<int> ODateBookAccessBackend_SQL::nonRepeats()const
{
QString qu = "select uid from datebook where RType=\"\" or RType=\"NoRepeat\"";
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
if ( res.state() != OSQLResult::Success ){
QArray<int> nix;
return nix;
}
return extractUids( res );
}
OEvent::ValueList ODateBookAccessBackend_SQL::directNonRepeats()
{
QArray<int> nonRepUids = nonRepeats();
OEvent::ValueList list;
for (uint i = 0; i < nonRepUids.count(); ++i ){
list.append( find( nonRepUids[i] ) );
}
return list;
}
OEvent::ValueList ODateBookAccessBackend_SQL::directRawRepeats()
{
QArray<int> rawRepUids = rawRepeats();
OEvent::ValueList list;
for (uint i = 0; i < rawRepUids.count(); ++i ){
list.append( find( rawRepUids[i] ) );
}
return list;
}
QArray<int> ODateBookAccessBackend_SQL::matchRegexp( const QRegExp &r ) const
{
QArray<int> null;
return null;
}
/* ===== Private Functions ========================================== */
QArray<int> ODateBookAccessBackend_SQL::extractUids( OSQLResult& res ) const
{
qWarning("extractUids");
QTime t;
t.start();
OSQLResultItem::ValueList list = res.results();
OSQLResultItem::ValueList::Iterator it;
QArray<int> ints(list.count() );
qWarning(" count = %d", list.count() );
int i = 0;
for (it = list.begin(); it != list.end(); ++it ) {
ints[i] = (*it).data("uid").toInt();
i++;
}
qWarning("extractUids ready: count2 = %d needs %d ms", i, t.elapsed() );
return ints;
}
diff --git a/libopie/pim/odatebookaccessbackend_sql.h b/noncore/unsupported/libopie/pim/odatebookaccessbackend_sql.h
index ba514bc..ba514bc 100644
--- a/libopie/pim/odatebookaccessbackend_sql.h
+++ b/noncore/unsupported/libopie/pim/odatebookaccessbackend_sql.h
diff --git a/libopie/pim/odatebookaccessbackend_xml.cpp b/noncore/unsupported/libopie/pim/odatebookaccessbackend_xml.cpp
index 929d004..929d004 100644
--- a/libopie/pim/odatebookaccessbackend_xml.cpp
+++ b/noncore/unsupported/libopie/pim/odatebookaccessbackend_xml.cpp
diff --git a/libopie/pim/odatebookaccessbackend_xml.h b/noncore/unsupported/libopie/pim/odatebookaccessbackend_xml.h
index a5cc0fc..a5cc0fc 100644
--- a/libopie/pim/odatebookaccessbackend_xml.h
+++ b/noncore/unsupported/libopie/pim/odatebookaccessbackend_xml.h
diff --git a/libopie/pim/oevent.cpp b/noncore/unsupported/libopie/pim/oevent.cpp
index 9b31957..9b31957 100644
--- a/libopie/pim/oevent.cpp
+++ b/noncore/unsupported/libopie/pim/oevent.cpp
diff --git a/libopie/pim/oevent.h b/noncore/unsupported/libopie/pim/oevent.h
index 9eb948f..9eb948f 100644
--- a/libopie/pim/oevent.h
+++ b/noncore/unsupported/libopie/pim/oevent.h
diff --git a/libopie/pim/opimaccessbackend.h b/noncore/unsupported/libopie/pim/opimaccessbackend.h
index fd264fc..fd264fc 100644
--- a/libopie/pim/opimaccessbackend.h
+++ b/noncore/unsupported/libopie/pim/opimaccessbackend.h
diff --git a/libopie/pim/opimaccesstemplate.h b/noncore/unsupported/libopie/pim/opimaccesstemplate.h
index ecbeb68..ecbeb68 100644
--- a/libopie/pim/opimaccesstemplate.h
+++ b/noncore/unsupported/libopie/pim/opimaccesstemplate.h
diff --git a/libopie/pim/opimcache.h b/noncore/unsupported/libopie/pim/opimcache.h
index 7f7cff5..7f7cff5 100644
--- a/libopie/pim/opimcache.h
+++ b/noncore/unsupported/libopie/pim/opimcache.h
diff --git a/libopie/pim/opimmaintainer.cpp b/noncore/unsupported/libopie/pim/opimmaintainer.cpp
index 92cb25a..92cb25a 100644
--- a/libopie/pim/opimmaintainer.cpp
+++ b/noncore/unsupported/libopie/pim/opimmaintainer.cpp
diff --git a/libopie/pim/opimmaintainer.h b/noncore/unsupported/libopie/pim/opimmaintainer.h
index 793d066..793d066 100644
--- a/libopie/pim/opimmaintainer.h
+++ b/noncore/unsupported/libopie/pim/opimmaintainer.h
diff --git a/libopie/pim/opimmainwindow.cpp b/noncore/unsupported/libopie/pim/opimmainwindow.cpp
index 99a0333..99a0333 100644
--- a/libopie/pim/opimmainwindow.cpp
+++ b/noncore/unsupported/libopie/pim/opimmainwindow.cpp
diff --git a/libopie/pim/opimmainwindow.h b/noncore/unsupported/libopie/pim/opimmainwindow.h
index 855d364..855d364 100644
--- a/libopie/pim/opimmainwindow.h
+++ b/noncore/unsupported/libopie/pim/opimmainwindow.h
diff --git a/libopie/pim/opimnotify.cpp b/noncore/unsupported/libopie/pim/opimnotify.cpp
index af5514b..af5514b 100644
--- a/libopie/pim/opimnotify.cpp
+++ b/noncore/unsupported/libopie/pim/opimnotify.cpp
diff --git a/libopie/pim/opimnotify.h b/noncore/unsupported/libopie/pim/opimnotify.h
index 58417db..58417db 100644
--- a/libopie/pim/opimnotify.h
+++ b/noncore/unsupported/libopie/pim/opimnotify.h
diff --git a/libopie/pim/opimnotifymanager.cpp b/noncore/unsupported/libopie/pim/opimnotifymanager.cpp
index d6f0ead..d6f0ead 100644
--- a/libopie/pim/opimnotifymanager.cpp
+++ b/noncore/unsupported/libopie/pim/opimnotifymanager.cpp
diff --git a/libopie/pim/opimnotifymanager.h b/noncore/unsupported/libopie/pim/opimnotifymanager.h
index f3c22f9..f3c22f9 100644
--- a/libopie/pim/opimnotifymanager.h
+++ b/noncore/unsupported/libopie/pim/opimnotifymanager.h
diff --git a/libopie/pim/opimrecord.cpp b/noncore/unsupported/libopie/pim/opimrecord.cpp
index 2365748..2365748 100644
--- a/libopie/pim/opimrecord.cpp
+++ b/noncore/unsupported/libopie/pim/opimrecord.cpp
diff --git a/libopie/pim/opimrecord.h b/noncore/unsupported/libopie/pim/opimrecord.h
index 3d774e2..3d774e2 100644
--- a/libopie/pim/opimrecord.h
+++ b/noncore/unsupported/libopie/pim/opimrecord.h
diff --git a/libopie/pim/opimresolver.cpp b/noncore/unsupported/libopie/pim/opimresolver.cpp
index 4ebbd6e..4ebbd6e 100644
--- a/libopie/pim/opimresolver.cpp
+++ b/noncore/unsupported/libopie/pim/opimresolver.cpp
diff --git a/libopie/pim/opimresolver.h b/noncore/unsupported/libopie/pim/opimresolver.h
index 1ce1619..1ce1619 100644
--- a/libopie/pim/opimresolver.h
+++ b/noncore/unsupported/libopie/pim/opimresolver.h
diff --git a/libopie/pim/opimstate.cpp b/noncore/unsupported/libopie/pim/opimstate.cpp
index 6fb2feb..6fb2feb 100644
--- a/libopie/pim/opimstate.cpp
+++ b/noncore/unsupported/libopie/pim/opimstate.cpp
diff --git a/libopie/pim/opimstate.h b/noncore/unsupported/libopie/pim/opimstate.h
index cf6af46..cf6af46 100644
--- a/libopie/pim/opimstate.h
+++ b/noncore/unsupported/libopie/pim/opimstate.h
diff --git a/libopie/pim/opimxref.cpp b/noncore/unsupported/libopie/pim/opimxref.cpp
index 8eefbd8..8eefbd8 100644
--- a/libopie/pim/opimxref.cpp
+++ b/noncore/unsupported/libopie/pim/opimxref.cpp
diff --git a/libopie/pim/opimxref.h b/noncore/unsupported/libopie/pim/opimxref.h
index 6852651..6852651 100644
--- a/libopie/pim/opimxref.h
+++ b/noncore/unsupported/libopie/pim/opimxref.h
diff --git a/libopie/pim/opimxrefmanager.cpp b/noncore/unsupported/libopie/pim/opimxrefmanager.cpp
index 58bfd24..58bfd24 100644
--- a/libopie/pim/opimxrefmanager.cpp
+++ b/noncore/unsupported/libopie/pim/opimxrefmanager.cpp
diff --git a/libopie/pim/opimxrefmanager.h b/noncore/unsupported/libopie/pim/opimxrefmanager.h
index c485e98..c485e98 100644
--- a/libopie/pim/opimxrefmanager.h
+++ b/noncore/unsupported/libopie/pim/opimxrefmanager.h
diff --git a/libopie/pim/opimxrefpartner.cpp b/noncore/unsupported/libopie/pim/opimxrefpartner.cpp
index 6ef3efb..6ef3efb 100644
--- a/libopie/pim/opimxrefpartner.cpp
+++ b/noncore/unsupported/libopie/pim/opimxrefpartner.cpp
diff --git a/libopie/pim/opimxrefpartner.h b/noncore/unsupported/libopie/pim/opimxrefpartner.h
index d76e384..d76e384 100644
--- a/libopie/pim/opimxrefpartner.h
+++ b/noncore/unsupported/libopie/pim/opimxrefpartner.h
diff --git a/libopie/pim/orecordlist.h b/noncore/unsupported/libopie/pim/orecordlist.h
index 5211f57..5211f57 100644
--- a/libopie/pim/orecordlist.h
+++ b/noncore/unsupported/libopie/pim/orecordlist.h
diff --git a/libopie/pim/orecur.cpp b/noncore/unsupported/libopie/pim/orecur.cpp
index f46f22e..f46f22e 100644
--- a/libopie/pim/orecur.cpp
+++ b/noncore/unsupported/libopie/pim/orecur.cpp
diff --git a/libopie/pim/orecur.h b/noncore/unsupported/libopie/pim/orecur.h
index d7ecd90..d7ecd90 100644
--- a/libopie/pim/orecur.h
+++ b/noncore/unsupported/libopie/pim/orecur.h
diff --git a/libopie/pim/otemplatebase.h b/noncore/unsupported/libopie/pim/otemplatebase.h
index cadac74..cadac74 100644
--- a/libopie/pim/otemplatebase.h
+++ b/noncore/unsupported/libopie/pim/otemplatebase.h
diff --git a/libopie/pim/otimezone.cpp b/noncore/unsupported/libopie/pim/otimezone.cpp
index 34659c3..34659c3 100644
--- a/libopie/pim/otimezone.cpp
+++ b/noncore/unsupported/libopie/pim/otimezone.cpp
diff --git a/libopie/pim/otimezone.h b/noncore/unsupported/libopie/pim/otimezone.h
index bb08349..bb08349 100644
--- a/libopie/pim/otimezone.h
+++ b/noncore/unsupported/libopie/pim/otimezone.h
diff --git a/libopie/pim/otodo.cpp b/noncore/unsupported/libopie/pim/otodo.cpp
index b2c76f8..b2c76f8 100644
--- a/libopie/pim/otodo.cpp
+++ b/noncore/unsupported/libopie/pim/otodo.cpp
diff --git a/libopie/pim/otodo.h b/noncore/unsupported/libopie/pim/otodo.h
index 6df98b9..6df98b9 100644
--- a/libopie/pim/otodo.h
+++ b/noncore/unsupported/libopie/pim/otodo.h
diff --git a/libopie/pim/otodoaccess.cpp b/noncore/unsupported/libopie/pim/otodoaccess.cpp
index 37f6fbc..37f6fbc 100644
--- a/libopie/pim/otodoaccess.cpp
+++ b/noncore/unsupported/libopie/pim/otodoaccess.cpp
diff --git a/libopie/pim/otodoaccess.h b/noncore/unsupported/libopie/pim/otodoaccess.h
index 916923f..916923f 100644
--- a/libopie/pim/otodoaccess.h
+++ b/noncore/unsupported/libopie/pim/otodoaccess.h
diff --git a/libopie/pim/otodoaccessbackend.cpp b/noncore/unsupported/libopie/pim/otodoaccessbackend.cpp
index baaeecc..baaeecc 100644
--- a/libopie/pim/otodoaccessbackend.cpp
+++ b/noncore/unsupported/libopie/pim/otodoaccessbackend.cpp
diff --git a/libopie/pim/otodoaccessbackend.h b/noncore/unsupported/libopie/pim/otodoaccessbackend.h
index 6be95bc..6be95bc 100644
--- a/libopie/pim/otodoaccessbackend.h
+++ b/noncore/unsupported/libopie/pim/otodoaccessbackend.h
diff --git a/libopie/pim/otodoaccesssql.cpp b/noncore/unsupported/libopie/pim/otodoaccesssql.cpp
index fd01a42..fd01a42 100644
--- a/libopie/pim/otodoaccesssql.cpp
+++ b/noncore/unsupported/libopie/pim/otodoaccesssql.cpp
diff --git a/libopie/pim/otodoaccesssql.h b/noncore/unsupported/libopie/pim/otodoaccesssql.h
index 72214de..72214de 100644
--- a/libopie/pim/otodoaccesssql.h
+++ b/noncore/unsupported/libopie/pim/otodoaccesssql.h
diff --git a/libopie/pim/otodoaccessvcal.cpp b/noncore/unsupported/libopie/pim/otodoaccessvcal.cpp
index 6415952..6415952 100644
--- a/libopie/pim/otodoaccessvcal.cpp
+++ b/noncore/unsupported/libopie/pim/otodoaccessvcal.cpp
diff --git a/libopie/pim/otodoaccessvcal.h b/noncore/unsupported/libopie/pim/otodoaccessvcal.h
index 2b17147..2b17147 100644
--- a/libopie/pim/otodoaccessvcal.h
+++ b/noncore/unsupported/libopie/pim/otodoaccessvcal.h
diff --git a/libopie/pim/otodoaccessxml.cpp b/noncore/unsupported/libopie/pim/otodoaccessxml.cpp
index 4a5cb33..4a5cb33 100644
--- a/libopie/pim/otodoaccessxml.cpp
+++ b/noncore/unsupported/libopie/pim/otodoaccessxml.cpp
diff --git a/libopie/pim/otodoaccessxml.h b/noncore/unsupported/libopie/pim/otodoaccessxml.h
index e4850a1..e4850a1 100644
--- a/libopie/pim/otodoaccessxml.h
+++ b/noncore/unsupported/libopie/pim/otodoaccessxml.h
diff --git a/libopie/sharp_compat.cpp b/noncore/unsupported/libopie/sharp_compat.cpp
index 1d16a09..1d16a09 100644
--- a/libopie/sharp_compat.cpp
+++ b/noncore/unsupported/libopie/sharp_compat.cpp
diff --git a/libopie/todayconfigwidget.h b/noncore/unsupported/libopie/todayconfigwidget.h
index f3501a1..f3501a1 100644
--- a/libopie/todayconfigwidget.h
+++ b/noncore/unsupported/libopie/todayconfigwidget.h
diff --git a/libopie/todayplugininterface.h b/noncore/unsupported/libopie/todayplugininterface.h
index 5dfeaa8..5dfeaa8 100644
--- a/libopie/todayplugininterface.h
+++ b/noncore/unsupported/libopie/todayplugininterface.h
diff --git a/libopie/xmltree.cc b/noncore/unsupported/libopie/xmltree.cc
index 27db5b3..27db5b3 100644
--- a/libopie/xmltree.cc
+++ b/noncore/unsupported/libopie/xmltree.cc
diff --git a/libopie/xmltree.h b/noncore/unsupported/libopie/xmltree.h
index 4b6bdfa..4b6bdfa 100644
--- a/libopie/xmltree.h
+++ b/noncore/unsupported/libopie/xmltree.h