summaryrefslogtreecommitdiff
path: root/libopie2/opiepim
authoralwin <alwin>2004-02-20 02:06:52 (UTC)
committer alwin <alwin>2004-02-20 02:06:52 (UTC)
commit55f4d502486e01927356908223622e435c975f7e (patch) (unidiff)
tree824b5c1e8992564677c4f39473bc108a32a2cf2a /libopie2/opiepim
parent060b4fc7a3fd5c1b5f745167fe084f7486719b7e (diff)
downloadopie-55f4d502486e01927356908223622e435c975f7e.zip
opie-55f4d502486e01927356908223622e435c975f7e.tar.gz
opie-55f4d502486e01927356908223622e435c975f7e.tar.bz2
moved the opie pim stuff to libopie2 - pim. Tried to resort them, may be someone should take a look for a better file order. but now all applications can start using libopiepim2 instead of libopie1-pim-stuff.
Diffstat (limited to 'libopie2/opiepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/backends.pro31
-rw-r--r--libopie2/opiepim/backend/obackendfactory.h118
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend.h82
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp77
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_sql.h62
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp125
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_vcard.h77
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp135
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.h118
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend.cpp38
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend.h35
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp67
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_sql.h33
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp41
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_xml.h33
-rw-r--r--libopie2/opiepim/backend/opimaccessbackend.h36
-rw-r--r--libopie2/opiepim/backend/otodoaccessbackend.cpp33
-rw-r--r--libopie2/opiepim/backend/otodoaccessbackend.h35
-rw-r--r--libopie2/opiepim/backend/otodoaccesssql.cpp41
-rw-r--r--libopie2/opiepim/backend/otodoaccesssql.h34
-rw-r--r--libopie2/opiepim/backend/otodoaccessvcal.cpp35
-rw-r--r--libopie2/opiepim/backend/otodoaccessvcal.h34
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp45
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.h33
-rw-r--r--libopie2/opiepim/core/core.pro21
-rw-r--r--libopie2/opiepim/core/ocontactaccess.cpp80
-rw-r--r--libopie2/opiepim/core/ocontactaccess.h105
-rw-r--r--libopie2/opiepim/core/oconversion.cpp47
-rw-r--r--libopie2/opiepim/core/oconversion.h50
-rw-r--r--libopie2/opiepim/core/odatebookaccess.cpp35
-rw-r--r--libopie2/opiepim/core/odatebookaccess.h33
-rw-r--r--libopie2/opiepim/core/opimaccesstemplate.h43
-rw-r--r--libopie2/opiepim/core/opimcache.h33
-rw-r--r--libopie2/opiepim/core/opimmaintainer.cpp34
-rw-r--r--libopie2/opiepim/core/opimmaintainer.h31
-rw-r--r--libopie2/opiepim/core/opimnotify.cpp33
-rw-r--r--libopie2/opiepim/core/opimnotify.h32
-rw-r--r--libopie2/opiepim/core/opimnotifymanager.cpp37
-rw-r--r--libopie2/opiepim/core/opimnotifymanager.h33
-rw-r--r--libopie2/opiepim/core/opimrecord.cpp33
-rw-r--r--libopie2/opiepim/core/opimrecord.h33
-rw-r--r--libopie2/opiepim/core/opimresolver.cpp38
-rw-r--r--libopie2/opiepim/core/opimresolver.h33
-rw-r--r--libopie2/opiepim/core/opimstate.cpp31
-rw-r--r--libopie2/opiepim/core/opimstate.h31
-rw-r--r--libopie2/opiepim/core/opimxref.cpp34
-rw-r--r--libopie2/opiepim/core/opimxref.h34
-rw-r--r--libopie2/opiepim/core/opimxrefmanager.cpp33
-rw-r--r--libopie2/opiepim/core/opimxrefmanager.h33
-rw-r--r--libopie2/opiepim/core/opimxrefpartner.cpp34
-rw-r--r--libopie2/opiepim/core/opimxrefpartner.h30
-rw-r--r--libopie2/opiepim/core/orecur.cpp36
-rw-r--r--libopie2/opiepim/core/orecur.h31
-rw-r--r--libopie2/opiepim/core/otemplatebase.h33
-rw-r--r--libopie2/opiepim/core/otimezone.cpp37
-rw-r--r--libopie2/opiepim/core/otimezone.h33
-rw-r--r--libopie2/opiepim/core/otodoaccess.cpp37
-rw-r--r--libopie2/opiepim/core/otodoaccess.h37
-rw-r--r--libopie2/opiepim/ocontact.cpp37
-rw-r--r--libopie2/opiepim/ocontact.h51
-rw-r--r--libopie2/opiepim/ocontactfields.cpp35
-rw-r--r--libopie2/opiepim/ocontactfields.h33
-rw-r--r--libopie2/opiepim/oevent.cpp40
-rw-r--r--libopie2/opiepim/oevent.h36
-rw-r--r--libopie2/opiepim/opiepim.pro10
-rw-r--r--libopie2/opiepim/orecordlist.h36
-rw-r--r--libopie2/opiepim/otodo.cpp44
-rw-r--r--libopie2/opiepim/otodo.h34
-rw-r--r--libopie2/opiepim/ui/opimmainwindow.cpp33
-rw-r--r--libopie2/opiepim/ui/opimmainwindow.h36
-rw-r--r--libopie2/opiepim/ui/ui.pro3
71 files changed, 2288 insertions, 826 deletions
diff --git a/libopie2/opiepim/backend/backends.pro b/libopie2/opiepim/backend/backends.pro
new file mode 100644
index 0000000..4231a00
--- a/dev/null
+++ b/libopie2/opiepim/backend/backends.pro
@@ -0,0 +1,31 @@
1SOURCES += core/backends/ocontactaccessbackend_sql.cpp \
2 core/backends/ocontactaccessbackend_vcard.cpp \
3 core/backends/ocontactaccessbackend_xml.cpp \
4 core/backends/ocontactaccess.cpp \
5 core/backends/odatebookaccessbackend.cpp \
6 core/backends/odatebookaccessbackend_xml.cpp \
7 core/backends/otodoaccessbackend.cpp \
8 core/backends/otodoaccess.cpp \
9 core/backends/otodoaccesssql.cpp \
10 core/backends/otodoaccessvcal.cpp \
11 core/backends/otodoaccessxml.cpp \
12 core/backends/odatebookaccess.cpp \
13 core/backends/odatebookaccessbackend_sql.cpp
14
15HEADERS += core/backends/obackendfactory.h \
16 core/backends/ocontactaccessbackend.h \
17 core/backends/ocontactaccessbackend_sql.h \
18 core/backends/ocontactaccessbackend_vcard.h \
19 core/backends/ocontactaccessbackend_xml.h \
20 core/backends/ocontactaccess.h \
21 core/backends/odatebookaccessbackend.h \
22 core/backends/odatebookaccessbackend_sql.h \
23 core/backends/odatebookaccessbackend_xml.h \
24 core/backends/opimaccessbackend.h \
25 core/backends/opimaccesstemplate.h \
26 core/backends/otodoaccessbackend.h \
27 core/backends/otodoaccess.h \
28 core/backends/otodoaccesssql.h \
29 core/backends/otodoaccessvcal.h \
30 core/backends/otodoaccessxml.h \
31 core/backends/odatebookaccess.h
diff --git a/libopie2/opiepim/backend/obackendfactory.h b/libopie2/opiepim/backend/obackendfactory.h
index 761ab9a..346e2f5 100644
--- a/libopie2/opiepim/backend/obackendfactory.h
+++ b/libopie2/opiepim/backend/obackendfactory.h
@@ -1,113 +1,68 @@
1/* 1/*
2 * Class to manage Backends. 2 This file is part of the Opie Project
3 * 3 Copyright (C) The Main Author <main-author@whereever.org>
4 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 * 5 .=l.
6 * ===================================================================== 6 .>+-=
7 *This program is free software; you can redistribute it and/or 7 _;:, .> :=|. This program is free software; you can
8 *modify it under the terms of the GNU Library General Public 8.> <`_, > . <= redistribute it and/or modify it under
9 * License as published by the Free Software Foundation; 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10 * either version 2 of the License, or (at your option) any later 10.="- .-=="i, .._ License as published by the Free Software
11 * version. 11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29/*
12 * ===================================================================== 30 * =====================================================================
13 * ToDo: Use plugins 31 * ToDo: Use plugins
14 * ===================================================================== 32 * =====================================================================
15 * Version: $Id$
16 * =====================================================================
17 * History:
18 * $Log$
19 * Revision 1.9 2003/12/22 10:19:26 eilers
20 * Finishing implementation of sql-backend for datebook. But I have to
21 * port the PIM datebook application to use it, before I could debug the
22 * whole stuff.
23 * Thus, PIM-Database backend is finished, but highly experimental. And some
24 * parts are still generic. For instance, the "queryByExample()" methods are
25 * not (or not fully) implemented. Todo: custom-entries not stored.
26 * The big show stopper: matchRegExp() (needed by OpieSearch) needs regular
27 * expression search in the database, which is not supported by sqlite !
28 * Therefore we need either an extended sqlite or a workaround which would
29 * be very slow and memory consuming..
30 *
31 * Revision 1.8 2003/09/22 14:31:16 eilers
32 * Added first experimental incarnation of sql-backend for addressbook.
33 * Some modifications to be able to compile the todo sql-backend.
34 * A lot of changes fill follow...
35 *
36 * Revision 1.7 2003/08/01 12:30:16 eilers
37 * Merging changes from BRANCH_1_0 to HEAD
38 *
39 * Revision 1.6.4.1 2003/06/30 14:34:19 eilers
40 * Patches from Zecke:
41 * Fixing and cleaning up extraMap handling
42 * Adding d_ptr for binary compatibility in the future
43 *
44 * Revision 1.6 2003/04/13 18:07:10 zecke
45 * More API doc
46 * QString -> const QString&
47 * QString = 0l -> QString::null
48 *
49 * Revision 1.5 2003/02/21 23:31:52 zecke
50 * Add XML datebookresource
51 * -clean up todoaccessxml header
52 * -implement some more stuff in the oeven tester
53 * -extend DefaultFactory to not crash and to use datebook
54 *
55 * -reading of OEvents is working nicely.. saving will be added
56 * tomorrow
57 * -fix spelling in ODateBookAcces
58 *
59 * Revision 1.4 2002/10/14 15:55:18 eilers
60 * Redeactivate SQL.. ;)
61 *
62 * Revision 1.3 2002/10/10 17:08:58 zecke
63 * The Cache is finally in place
64 * I tested it with my todolist and it 'works' for 10.000 todos the hits are awesome ;)
65 * 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....
66 * I still have to fully implement read ahead
67 * This change is bic but sc
68 *
69 * Revision 1.2 2002/10/08 09:27:36 eilers
70 * Fixed libopie.pro to include the new pim-API.
71 * The SQL-Stuff is currently deactivated. Otherwise everyone who wants to
72 * compile itself would need to install libsqlite, libopiesql...
73 * Therefore, the backend currently uses XML only..
74 *
75 * Revision 1.1 2002/10/07 17:35:01 eilers
76 * added OBackendFactory for advanced backend access
77 *
78 *
79 * =====================================================================
80 */ 33 */
81#ifndef OPIE_BACKENDFACTORY_H_ 34#ifndef OPIE_BACKENDFACTORY_H_
82#define OPIE_BACKENDFACTORY_H_ 35#define OPIE_BACKENDFACTORY_H_
83 36
84#include <qstring.h> 37#include <qstring.h>
85#include <qasciidict.h> 38#include <qasciidict.h>
86#include <qpe/config.h> 39#include <qpe/config.h>
87 40
88#include "otodoaccessxml.h" 41#include <opie2/otodoaccessxml.h>
89#include "ocontactaccessbackend_xml.h" 42#include <opie2/ocontactaccessbackend_xml.h>
90#include "odatebookaccessbackend_xml.h" 43#include <opie2/odatebookaccessbackend_xml.h>
91 44
92#ifdef __USE_SQL 45#ifdef __USE_SQL
93#include "otodoaccesssql.h" 46#include <opie2/otodoaccesssql.h>
94#include "ocontactaccessbackend_sql.h" 47#include <opie2/ocontactaccessbackend_sql.h>
95#include "odatebookaccessbackend_sql.h" 48#include <opie2/odatebookaccessbackend_sql.h>
96#endif 49#endif
97 50
51namespace Opie {
52
98class OBackendPrivate; 53class OBackendPrivate;
99 54
100/** 55/**
101 * This class is our factory. It will give us the default implementations 56 * This class is our factory. It will give us the default implementations
102 * of at least Todolist, Contacts and Datebook. In the future this class will 57 * of at least Todolist, Contacts and Datebook. In the future this class will
103 * allow users to switch the backend with ( XML->SQLite ) without the need 58 * allow users to switch the backend with ( XML->SQLite ) without the need
104 * to recompile.# 59 * to recompile.#
105 * This class as the whole PIM Api is making use of templates 60 * This class as the whole PIM Api is making use of templates
106 * 61 *
107 * <pre> 62 * <pre>
108 * OTodoAccessBackend* backend = OBackEndFactory<OTodoAccessBackend>::Default("todo", QString::null ); 63 * OTodoAccessBackend* backend = OBackEndFactory<OTodoAccessBackend>::Default("todo", QString::null );
109 * backend->load(); 64 * backend->load();
110 * </pre> 65 * </pre>
111 * 66 *
112 * @author Stefan Eilers 67 * @author Stefan Eilers
113 * @version 0.1 68 * @version 0.1
@@ -177,18 +132,19 @@ class OBackendFactory
177#else 132#else
178 if ( backend == "sql" ) 133 if ( backend == "sql" )
179 qWarning("OBackendFactory:: sql Backend for DATEBOOK not implemented! Using XML instead!"); 134 qWarning("OBackendFactory:: sql Backend for DATEBOOK not implemented! Using XML instead!");
180#endif 135#endif
181 136
182 return (T*) new ODateBookAccessBackend_XML( appName ); 137 return (T*) new ODateBookAccessBackend_XML( appName );
183 default: 138 default:
184 return NULL; 139 return NULL;
185 } 140 }
186 141
187 142
188 } 143 }
189 private: 144 private:
190 OBackendPrivate* d; 145 OBackendPrivate* d;
191}; 146};
192 147
148}
193 149
194#endif 150#endif
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend.h b/libopie2/opiepim/backend/ocontactaccessbackend.h
index 0eac6dc..6113cea 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend.h
+++ b/libopie2/opiepim/backend/ocontactaccessbackend.h
@@ -1,80 +1,63 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1/** 29/**
2 * The class responsible for managing a backend. 30 * The class responsible for managing a backend.
3 * The implementation of this abstract class contains 31 * The implementation of this abstract class contains
4 * the complete database handling. 32 * the complete database handling.
5 * 33 *
6 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) 34 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
7 * Copyright (c) 2002 by Holger Freyther (zecke@handhelds.org) 35 * Copyright (c) 2002 by Holger Freyther (zecke@handhelds.org)
8 * 36 *
9 * =====================================================================
10 *This program is free software; you can redistribute it and/or
11 *modify it under the terms of the GNU Library General Public
12 * License as published by the Free Software Foundation;
13 * either version 2 of the License, or (at your option) any later
14 * version.
15 * =====================================================================
16 * ToDo: Define enum for query settings
17 * =====================================================================
18 * Version: $Id$
19 * =====================================================================
20 * History:
21 * $Log$
22 * Revision 1.7 2004/02/19 02:05:37 zecke
23 * Add notes for API fixes and BC stuff
24 *
25 * Revision 1.6 2003/08/01 12:30:16 eilers
26 * Merging changes from BRANCH_1_0 to HEAD
27 *
28 * Revision 1.5.4.1 2003/06/30 14:34:19 eilers
29 * Patches from Zecke:
30 * Fixing and cleaning up extraMap handling
31 * Adding d_ptr for binary compatibility in the future
32 *
33 * Revision 1.5 2003/04/13 18:07:10 zecke
34 * More API doc
35 * QString -> const QString&
36 * QString = 0l -> QString::null
37 *
38 * Revision 1.4 2002/11/13 14:14:51 eilers
39 * Added sorted for Contacts..
40 *
41 * Revision 1.3 2002/11/01 15:10:42 eilers
42 * Added regExp-search in database for all fields in a contact.
43 *
44 * Revision 1.2 2002/10/07 17:34:24 eilers
45 * added OBackendFactory for advanced backend access
46 *
47 * Revision 1.1 2002/09/27 17:11:44 eilers
48 * Added API for accessing the Contact-Database ! It is compiling, but
49 * please do not expect that anything is working !
50 * I will debug that stuff in the next time ..
51 * Please read README_COMPILE for compiling !
52 *
53 * =====================================================================
54 *
55 */ 37 */
56 38
57#ifndef _OCONTACTACCESSBACKEND_H_ 39#ifndef _OCONTACTACCESSBACKEND_H_
58#define _OCONTACTACCESSBACKEND_H_ 40#define _OCONTACTACCESSBACKEND_H_
59 41
60#include "ocontact.h" 42#include <opie2/ocontact.h>
61#include "opimaccessbackend.h" 43#include <opie2/opimaccessbackend.h>
62 44
63#include <qregexp.h> 45#include <qregexp.h>
64 46
47namespace Opie {
65/** 48/**
66 * This class represents the interface of all Contact Backends. 49 * This class represents the interface of all Contact Backends.
67 * Derivates of this class will be used to access the contacts. 50 * Derivates of this class will be used to access the contacts.
68 * As implementation currently XML and vCard exist. This class needs to be implemented 51 * As implementation currently XML and vCard exist. This class needs to be implemented
69 * if you want to provide your own storage. 52 * if you want to provide your own storage.
70 * In all queries a list of uids is passed on instead of loading the actual record! 53 * In all queries a list of uids is passed on instead of loading the actual record!
71 * 54 *
72 * @see OContactAccessBackend_VCard 55 * @see OContactAccessBackend_VCard
73 * @see OContactAccessBackend_XML 56 * @see OContactAccessBackend_XML
74 */ 57 */
75class OContactAccessBackend: public OPimAccessBackend<OContact> { 58class OContactAccessBackend: public OPimAccessBackend<OContact> {
76 public: 59 public:
77 /** 60 /**
78 * @todo make non line in regard to BC guide of KDE 61 * @todo make non line in regard to BC guide of KDE
79 */ 62 */
80 OContactAccessBackend() {} 63 OContactAccessBackend() {}
@@ -112,17 +95,20 @@ class OContactAccessBackend: public OPimAccessBackend<OContact> {
112 * Check whether settings are correct. 95 * Check whether settings are correct.
113 * @return <i>true</i> if the given settings are correct and possible. 96 * @return <i>true</i> if the given settings are correct and possible.
114 */ 97 */
115 virtual bool hasQuerySettings (uint querySettings) const = 0; 98 virtual bool hasQuerySettings (uint querySettings) const = 0;
116 99
117 /** 100 /**
118 * FIXME!!! 101 * FIXME!!!
119 * Returns a sorted list of records either ascendinf or descending for a giving criteria and category 102 * Returns a sorted list of records either ascendinf or descending for a giving criteria and category
120 */ 103 */
121 virtual QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat ) = 0; 104 virtual QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat ) = 0;
122 105
123 106
124private: 107private:
125 class Private; 108 class Private;
126 Private *d; 109 Private *d;
127}; 110};
111
112}
113
128#endif 114#endif
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp
index a5be4c8..d0c8052 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp
@@ -1,100 +1,89 @@
1/* 1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29/*
2 * SQL Backend for the OPIE-Contact Database. 30 * SQL Backend for the OPIE-Contact Database.
3 *
4 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
5 *
6 * =====================================================================
7 *This program is free software; you can redistribute it and/or
8 *modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 * =====================================================================
12 * =====================================================================
13 * Version: $Id$
14 * =====================================================================
15 * History:
16 * $Log$
17 * Revision 1.4 2003/12/22 10:19:26 eilers
18 * Finishing implementation of sql-backend for datebook. But I have to
19 * port the PIM datebook application to use it, before I could debug the
20 * whole stuff.
21 * Thus, PIM-Database backend is finished, but highly experimental. And some
22 * parts are still generic. For instance, the "queryByExample()" methods are
23 * not (or not fully) implemented. Todo: custom-entries not stored.
24 * The big show stopper: matchRegExp() (needed by OpieSearch) needs regular
25 * expression search in the database, which is not supported by sqlite !
26 * Therefore we need either an extended sqlite or a workaround which would
27 * be very slow and memory consuming..
28 *
29 * Revision 1.3 2003/12/08 15:18:10 eilers
30 * Committing unfinished sql implementation before merging to libopie2 starts..
31 *
32 * Revision 1.2 2003/09/29 07:44:26 eilers
33 * Improvement of PIM-SQL Databases, but search queries are still limited.
34 * Addressbook: Changed table layout. Now, we just need 1/3 of disk-space.
35 * Todo: Started to add new attributes. Some type conversions missing.
36 *
37 * Revision 1.1 2003/09/22 14:31:16 eilers
38 * Added first experimental incarnation of sql-backend for addressbook.
39 * Some modifications to be able to compile the todo sql-backend.
40 * A lot of changes fill follow...
41 *
42 */ 31 */
43 32
44#include "ocontactaccessbackend_sql.h" 33#include "ocontactaccessbackend_sql.h"
45 34
46#include <qarray.h> 35#include <qarray.h>
47#include <qdatetime.h> 36#include <qdatetime.h>
48#include <qstringlist.h> 37#include <qstringlist.h>
49 38
50#include <qpe/global.h> 39#include <qpe/global.h>
51#include <qpe/recordfields.h> 40#include <qpe/recordfields.h>
52 41
53#include <opie/ocontactfields.h> 42#include <opie2/ocontactfields.h>
54#include <opie/oconversion.h> 43#include <opie2/oconversion.h>
55#include <opie2/osqldriver.h> 44#include <opie2/osqldriver.h>
56#include <opie2/osqlresult.h> 45#include <opie2/osqlresult.h>
57#include <opie2/osqlmanager.h> 46#include <opie2/osqlmanager.h>
58#include <opie2/osqlquery.h> 47#include <opie2/osqlquery.h>
59 48
60 49
61 50
62 51
63// If defined, we use a horizontal table ( uid, attr1, attr2, attr3, ..., attrn ) instead 52// If defined, we use a horizontal table ( uid, attr1, attr2, attr3, ..., attrn ) instead
64// vertical like "uid, type, value". 53// vertical like "uid, type, value".
65// DON'T DEACTIVATE THIS DEFINE IN PRODUCTIVE ENVIRONMENTS !! 54// DON'T DEACTIVATE THIS DEFINE IN PRODUCTIVE ENVIRONMENTS !!
66#define __STORE_HORIZONTAL_ 55#define __STORE_HORIZONTAL_
67 56
68// Distinct loading is not very fast. If I expect that every person has just 57// Distinct loading is not very fast. If I expect that every person has just
69// one (and always one) 'Last Name', I can request all uid's for existing lastnames, 58// one (and always one) 'Last Name', I can request all uid's for existing lastnames,
70// which is faster.. 59// which is faster..
71// But this may not be true for all entries, like company contacts.. 60// But this may not be true for all entries, like company contacts..
72// The current AddressBook application handles this problem, but other may not.. (eilers) 61// The current AddressBook application handles this problem, but other may not.. (eilers)
73#define __USE_SUPERFAST_LOADQUERY 62#define __USE_SUPERFAST_LOADQUERY
74 63
75 64
76/* 65/*
77 * Implementation of used query types 66 * Implementation of used query types
78 * CREATE query 67 * CREATE query
79 * LOAD query 68 * LOAD query
80 * INSERT 69 * INSERT
81 * REMOVE 70 * REMOVE
82 * CLEAR 71 * CLEAR
83 */ 72 */
84namespace { 73namespace Opie {
85 /** 74 /**
86 * CreateQuery for the Todolist Table 75 * CreateQuery for the Todolist Table
87 */ 76 */
88 class CreateQuery : public OSQLQuery { 77 class CreateQuery : public OSQLQuery {
89 public: 78 public:
90 CreateQuery(); 79 CreateQuery();
91 ~CreateQuery(); 80 ~CreateQuery();
92 QString query()const; 81 QString query()const;
93 }; 82 };
94 83
95 /** 84 /**
96 * Clears (delete) a Table 85 * Clears (delete) a Table
97 */ 86 */
98 class ClearQuery : public OSQLQuery { 87 class ClearQuery : public OSQLQuery {
99 public: 88 public:
100 ClearQuery(); 89 ClearQuery();
@@ -455,32 +444,34 @@ namespace {
455 } 444 }
456 QString FindCustomQuery::query()const{ 445 QString FindCustomQuery::query()const{
457 // if ( m_uids.count() == 0 ) 446 // if ( m_uids.count() == 0 )
458 return single(); 447 return single();
459 } 448 }
460 QString FindCustomQuery::single()const{ 449 QString FindCustomQuery::single()const{
461 QString qu = "select uid, type, value from custom_data where uid = "; 450 QString qu = "select uid, type, value from custom_data where uid = ";
462 qu += QString::number(m_uid); 451 qu += QString::number(m_uid);
463 return qu; 452 return qu;
464 } 453 }
465 454
466}; 455};
467 456
468 457
469/* --------------------------------------------------------------------------- */ 458/* --------------------------------------------------------------------------- */
470 459
460namespace Opie {
461
471OContactAccessBackend_SQL::OContactAccessBackend_SQL ( const QString& /* appname */, 462OContactAccessBackend_SQL::OContactAccessBackend_SQL ( const QString& /* appname */,
472 const QString& filename ): 463 const QString& filename ):
473 OContactAccessBackend(), m_changed(false), m_driver( NULL ) 464 OContactAccessBackend(), m_changed(false), m_driver( NULL )
474{ 465{
475 qWarning("C'tor OContactAccessBackend_SQL starts"); 466 qWarning("C'tor OContactAccessBackend_SQL starts");
476 QTime t; 467 QTime t;
477 t.start(); 468 t.start();
478 469
479 /* Expecting to access the default filename if nothing else is set */ 470 /* Expecting to access the default filename if nothing else is set */
480 if ( filename.isEmpty() ){ 471 if ( filename.isEmpty() ){
481 m_fileName = Global::applicationFileName( "addressbook","addressbook.db" ); 472 m_fileName = Global::applicationFileName( "addressbook","addressbook.db" );
482 } else 473 } else
483 m_fileName = filename; 474 m_fileName = filename;
484 475
485 // Get the standart sql-driver from the OSQLManager.. 476 // Get the standart sql-driver from the OSQLManager..
486 OSQLManager man; 477 OSQLManager man;
@@ -927,16 +918,18 @@ QMap<QString, QString> OContactAccessBackend_SQL::requestCustom( int uid ) cons
927 918
928 if ( res_custom.state() == OSQLResult::Failure ) { 919 if ( res_custom.state() == OSQLResult::Failure ) {
929 qWarning("OSQLResult::Failure in find query !!"); 920 qWarning("OSQLResult::Failure in find query !!");
930 QMap<QString, QString> empty; 921 QMap<QString, QString> empty;
931 return empty; 922 return empty;
932 } 923 }
933 924
934 OSQLResultItem::ValueList list = res_custom.results(); 925 OSQLResultItem::ValueList list = res_custom.results();
935 OSQLResultItem::ValueList::Iterator it = list.begin(); 926 OSQLResultItem::ValueList::Iterator it = list.begin();
936 for ( ; it != list.end(); ++it ) { 927 for ( ; it != list.end(); ++it ) {
937 customMap.insert( (*it).data( "type" ), (*it).data( "value" ) ); 928 customMap.insert( (*it).data( "type" ), (*it).data( "value" ) );
938 } 929 }
939 930
940 qWarning("RequestCustom needed: %d ms", t.elapsed() ); 931 qWarning("RequestCustom needed: %d ms", t.elapsed() );
941 return customMap; 932 return customMap;
942} 933}
934
935}
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_sql.h b/libopie2/opiepim/backend/ocontactaccessbackend_sql.h
index b8f1d8d..55b95fd 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_sql.h
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_sql.h
@@ -1,58 +1,64 @@
1/* 1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29/*
2 * SQL Backend for the OPIE-Contact Database. 30 * SQL Backend for the OPIE-Contact Database.
3 *
4 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
5 *
6 * =====================================================================
7 *This program is free software; you can redistribute it and/or
8 *modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 * =====================================================================
12 *
13 *
14 * =====================================================================
15 * Version: $Id$
16 * =====================================================================
17 * History:
18 * $Log$
19 * Revision 1.2 2003/12/08 15:18:11 eilers
20 * Committing unfinished sql implementation before merging to libopie2 starts..
21 *
22 * Revision 1.1 2003/09/22 14:31:16 eilers
23 * Added first experimental incarnation of sql-backend for addressbook.
24 * Some modifications to be able to compile the todo sql-backend.
25 * A lot of changes fill follow...
26 *
27 *
28 */ 31 */
29 32
30#ifndef _OContactAccessBackend_SQL_ 33#ifndef _OContactAccessBackend_SQL_
31#define _OContactAccessBackend_SQL_ 34#define _OContactAccessBackend_SQL_
32 35
33#include "ocontactaccessbackend.h" 36#include <opie2/ocontactaccessbackend.h>
34#include "ocontactaccess.h" 37#include <opie2/ocontactaccess.h>
35 38
36#include <qlist.h> 39#include <qlist.h>
37#include <qdict.h> 40#include <qdict.h>
38 41
42/* aren't in namespace Opie yet - alwin */
39class OSQLDriver; 43class OSQLDriver;
40class OSQLResult; 44class OSQLResult;
41class OSQLResultItem; 45class OSQLResultItem;
42 46
47namespace Opie {
48
43/* the default xml implementation */ 49/* the default xml implementation */
44/** 50/**
45 * This class is the SQL implementation of a Contact backend 51 * This class is the SQL implementation of a Contact backend
46 * it does implement everything available for OContact. 52 * it does implement everything available for OContact.
47 * @see OPimAccessBackend for more information of available methods 53 * @see OPimAccessBackend for more information of available methods
48 */ 54 */
49class OContactAccessBackend_SQL : public OContactAccessBackend { 55class OContactAccessBackend_SQL : public OContactAccessBackend {
50 public: 56 public:
51 OContactAccessBackend_SQL ( const QString& appname, const QString& filename = QString::null ); 57 OContactAccessBackend_SQL ( const QString& appname, const QString& filename = QString::null );
52 58
53 ~OContactAccessBackend_SQL (); 59 ~OContactAccessBackend_SQL ();
54 60
55 bool save(); 61 bool save();
56 62
57 bool load (); 63 bool load ();
58 64
@@ -85,17 +91,19 @@ class OContactAccessBackend_SQL : public OContactAccessBackend {
85 bool reload(); 91 bool reload();
86 92
87 private: 93 private:
88 QArray<int> extractUids( OSQLResult& res ) const; 94 QArray<int> extractUids( OSQLResult& res ) const;
89 QMap<int, QString> requestNonCustom( int uid ) const; 95 QMap<int, QString> requestNonCustom( int uid ) const;
90 QMap<QString, QString> requestCustom( int uid ) const; 96 QMap<QString, QString> requestCustom( int uid ) const;
91 void update(); 97 void update();
92 98
93 protected: 99 protected:
94 bool m_changed; 100 bool m_changed;
95 QString m_fileName; 101 QString m_fileName;
96 QArray<int> m_uids; 102 QArray<int> m_uids;
97 103
98 OSQLDriver* m_driver; 104 OSQLDriver* m_driver;
99}; 105};
100 106
107}
108
101#endif 109#endif
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
index b60c5be..f85cf38 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
@@ -1,114 +1,57 @@
1/* 1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29/*
2 * VCard Backend for the OPIE-Contact Database. 30 * VCard Backend for the OPIE-Contact Database.
3 *
4 * Copyright (C) 2000 Trolltech AS. All rights reserved.
5 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
6 *
7 * =====================================================================
8 *This program is free software; you can redistribute it and/or
9 *modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 * =====================================================================
13 * ToDo:
14 *
15 * =====================================================================
16 * Version: $Id$
17 * =====================================================================
18 * History:
19 * $Log$
20 * Revision 1.11 2003/08/01 12:30:16 eilers
21 * Merging changes from BRANCH_1_0 to HEAD
22 *
23 * Revision 1.10.4.3 2003/07/23 08:54:37 eilers
24 * Default email was added to the list of all emails, which already contains
25 * the default email..
26 * This closes bug #1045
27 *
28 * Revision 1.10.4.2 2003/07/23 08:44:45 eilers
29 * Importing of Notes in vcard files wasn't implemented.
30 * Closes bug #1044
31 *
32 * Revision 1.10.4.1 2003/06/02 13:37:49 eilers
33 * Fixing memory leak
34 *
35 * Revision 1.10 2003/04/13 18:07:10 zecke
36 * More API doc
37 * QString -> const QString&
38 * QString = 0l -> QString::null
39 *
40 * Revision 1.9 2003/03/21 10:33:09 eilers
41 * Merged speed optimized xml backend for contacts to main.
42 * Added QDateTime to querybyexample. For instance, it is now possible to get
43 * all Birthdays/Anniversaries between two dates. This should be used
44 * to show all birthdays in the datebook..
45 * This change is sourcecode backward compatible but you have to upgrade
46 * the binaries for today-addressbook.
47 *
48 * Revision 1.8 2003/02/21 16:52:49 zecke
49 * -Remove old Todo classes they're deprecated and today I already using the
50 * new API
51 * -Guard against self assignment in OTodo
52 * -Add test apps for OPIM
53 * -Opiefied Event classes
54 * -Added TimeZone handling and pinning of TimeZones to OEvent
55 * -Adjust ORecur and the widget to better timezone behaviour
56 *
57 * Revision 1.7 2003/02/16 22:25:46 zecke
58 * 0000276 Fix for that bug.. or better temp workaround
59 * A Preferred Number is HOME|VOICE
60 * A CellPhone is HOME|VOICE|CELL the type & HOME|VOICE test
61 * triggers both
62 * and the cell phone number overrides the other entries..
63 *
64 * as a temp I check that it's not equal to HOME|VOICE|CELL before setting the
65 * number
66 *
67 * The right and final fix would be to reorder the if statement to make it
68 * if else based and the less common thing put to the bottom
69 *
70 * OTodoAccessVcal fix the date for beaming
71 *
72 * Revision 1.6 2003/01/13 15:49:31 eilers
73 * Fixing crash when businesscard.vcf is missing..
74 *
75 * Revision 1.5 2002/12/07 13:26:22 eilers
76 * Fixing bug in storing anniversary..
77 *
78 * Revision 1.4 2002/11/13 14:14:51 eilers
79 * Added sorted for Contacts..
80 *
81 * Revision 1.3 2002/11/11 16:41:09 kergoth
82 * no default arguments in implementation
83 *
84 * Revision 1.2 2002/11/10 15:41:53 eilers
85 * Bugfixes..
86 *
87 * Revision 1.1 2002/11/09 14:34:52 eilers
88 * Added VCard Backend.
89 *
90 */ 31 */
91#include "ocontactaccessbackend_vcard.h" 32#include <opie2/ocontactaccessbackend_vcard.h>
92#include "../../library/backend/vobject_p.h" 33#include "../../../../library/backend/vobject_p.h"
93#include "../../library/backend/qfiledirect_p.h" 34#include "../../../../library/backend/qfiledirect_p.h"
94 35
95#include <qpe/timeconversion.h> 36#include <qpe/timeconversion.h>
96 37
97#include <qfile.h> 38#include <qfile.h>
98 39
40namespace Opie {
41
99OContactAccessBackend_VCard::OContactAccessBackend_VCard ( const QString& , const QString& filename ): 42OContactAccessBackend_VCard::OContactAccessBackend_VCard ( const QString& , const QString& filename ):
100 m_dirty( false ), 43 m_dirty( false ),
101 m_file( filename ) 44 m_file( filename )
102{ 45{
103 load(); 46 load();
104} 47}
105 48
106 49
107bool OContactAccessBackend_VCard::load () 50bool OContactAccessBackend_VCard::load ()
108{ 51{
109 m_map.clear(); 52 m_map.clear();
110 m_dirty = false; 53 m_dirty = false;
111 54
112 VObject* obj = 0l; 55 VObject* obj = 0l;
113 56
114 if ( QFile::exists(m_file) ){ 57 if ( QFile::exists(m_file) ){
@@ -631,16 +574,18 @@ QDate OContactAccessBackend_VCard::convVCardDateToDate( const QString& datestr )
631 574
632VObject* OContactAccessBackend_VCard::safeAddPropValue( VObject *o, const char *prop, const QString &value ) 575VObject* OContactAccessBackend_VCard::safeAddPropValue( VObject *o, const char *prop, const QString &value )
633{ 576{
634 VObject *ret = 0; 577 VObject *ret = 0;
635 if ( o && !value.isEmpty() ) 578 if ( o && !value.isEmpty() )
636 ret = addPropValue( o, prop, value.latin1() ); 579 ret = addPropValue( o, prop, value.latin1() );
637 return ret; 580 return ret;
638} 581}
639 582
640VObject* OContactAccessBackend_VCard::safeAddProp( VObject *o, const char *prop) 583VObject* OContactAccessBackend_VCard::safeAddProp( VObject *o, const char *prop)
641{ 584{
642 VObject *ret = 0; 585 VObject *ret = 0;
643 if ( o ) 586 if ( o )
644 ret = addProp( o, prop ); 587 ret = addProp( o, prop );
645 return ret; 588 return ret;
646} 589}
590
591}
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.h b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.h
index 712d769..11be027 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.h
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.h
@@ -1,70 +1,57 @@
1/* 1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29/*
2 * VCard Backend for the OPIE-Contact Database. 30 * VCard Backend for the OPIE-Contact Database.
3 *
4 * Copyright (C) 2000 Trolltech AS. All rights reserved.
5 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
6 *
7 * =====================================================================
8 *This program is free software; you can redistribute it and/or
9 *modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 * =====================================================================
13 * ToDo:
14 *
15 * =====================================================================
16 * Version: $Id$
17 * =====================================================================
18 * History:
19 * $Log$
20 * Revision 1.6 2003/04/13 18:07:10 zecke
21 * More API doc
22 * QString -> const QString&
23 * QString = 0l -> QString::null
24 *
25 * Revision 1.5 2003/03/21 10:33:09 eilers
26 * Merged speed optimized xml backend for contacts to main.
27 * Added QDateTime to querybyexample. For instance, it is now possible to get
28 * all Birthdays/Anniversaries between two dates. This should be used
29 * to show all birthdays in the datebook..
30 * This change is sourcecode backward compatible but you have to upgrade
31 * the binaries for today-addressbook.
32 *
33 * Revision 1.4 2002/12/07 13:26:22 eilers
34 * Fixing bug in storing anniversary..
35 *
36 * Revision 1.3 2002/11/13 14:14:51 eilers
37 * Added sorted for Contacts..
38 *
39 * Revision 1.2 2002/11/10 15:41:53 eilers
40 * Bugfixes..
41 *
42 * Revision 1.1 2002/11/09 14:34:52 eilers
43 * Added VCard Backend.
44 *
45 */ 31 */
46#ifndef __OCONTACTACCESSBACKEND_VCARD_H_ 32#ifndef __OCONTACTACCESSBACKEND_VCARD_H_
47#define __OCONTACTACCESSBACKEND_VCARD_H_ 33#define __OCONTACTACCESSBACKEND_VCARD_H_
48 34
49#include <opie/ocontact.h> 35#include <opie2/ocontact.h>
50 36
51#include "ocontactaccessbackend.h" 37#include <opie2/ocontactaccessbackend.h>
52 38
53class VObject; 39class VObject;
54 40
41namespace Opie {
55/** 42/**
56 * This is the vCard 2.1 implementation of the Contact Storage 43 * This is the vCard 2.1 implementation of the Contact Storage
57 * @see OContactAccessBackend_XML 44 * @see OContactAccessBackend_XML
58 * @see OPimAccessBackend 45 * @see OPimAccessBackend
59 */ 46 */
60class OContactAccessBackend_VCard : public OContactAccessBackend { 47class OContactAccessBackend_VCard : public OContactAccessBackend {
61 public: 48 public:
62 OContactAccessBackend_VCard ( const QString& appname, const QString& filename = QString::null ); 49 OContactAccessBackend_VCard ( const QString& appname, const QString& filename = QString::null );
63 50
64 bool load (); 51 bool load ();
65 bool reload(); 52 bool reload();
66 bool save(); 53 bool save();
67 void clear (); 54 void clear ();
68 55
69 bool add ( const OContact& newcontact ); 56 bool add ( const OContact& newcontact );
70 bool remove ( int uid ); 57 bool remove ( int uid );
@@ -80,17 +67,19 @@ class OContactAccessBackend_VCard : public OContactAccessBackend {
80 QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat ); 67 QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat );
81 bool wasChangedExternally(); 68 bool wasChangedExternally();
82 69
83private: 70private:
84 OContact parseVObject( VObject* obj ); 71 OContact parseVObject( VObject* obj );
85 VObject* createVObject( const OContact& c ); 72 VObject* createVObject( const OContact& c );
86 QString convDateToVCardDate( const QDate& c ) const; 73 QString convDateToVCardDate( const QDate& c ) const;
87 QDate convVCardDateToDate( const QString& datestr ); 74 QDate convVCardDateToDate( const QString& datestr );
88 VObject *safeAddPropValue( VObject *o, const char* prop, const QString& value ); 75 VObject *safeAddPropValue( VObject *o, const char* prop, const QString& value );
89 VObject *safeAddProp( VObject* o, const char* prop); 76 VObject *safeAddProp( VObject* o, const char* prop);
90 77
91 bool m_dirty : 1; 78 bool m_dirty : 1;
92 QString m_file; 79 QString m_file;
93 QMap<int, OContact> m_map; 80 QMap<int, OContact> m_map;
94}; 81};
95 82
83}
84
96#endif 85#endif
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
index aae7fca..4c3da0c 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
@@ -1,142 +1,72 @@
1/* 1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29/*
2 * XML Backend for the OPIE-Contact Database. 30 * XML Backend for the OPIE-Contact Database.
3 *
4 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
5 *
6 * =====================================================================
7 *This program is free software; you can redistribute it and/or
8 *modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 * =====================================================================
12 *
13 * =====================================================================
14 * Version: $Id$
15 * =====================================================================
16 * History:
17 * $Log$
18 * Revision 1.9 2003/09/22 14:31:16 eilers
19 * Added first experimental incarnation of sql-backend for addressbook.
20 * Some modifications to be able to compile the todo sql-backend.
21 * A lot of changes fill follow...
22 *
23 * Revision 1.8 2003/08/30 15:28:26 eilers
24 * Removed some unimportant debug output which causes slow down..
25 *
26 * Revision 1.7 2003/08/01 12:30:16 eilers
27 * Merging changes from BRANCH_1_0 to HEAD
28 *
29 * Revision 1.6 2003/07/07 16:19:47 eilers
30 * Fixing serious bug in hasQuerySettings()
31 *
32 * Revision 1.5 2003/04/13 18:07:10 zecke
33 * More API doc
34 * QString -> const QString&
35 * QString = 0l -> QString::null
36 *
37 * Revision 1.4 2003/03/21 14:32:54 mickeyl
38 * g++ compliance fix: default arguments belong into the declaration, but not the definition
39 *
40 * Revision 1.3 2003/03/21 12:26:28 eilers
41 * Fixing small bug: If we search a birthday from today to today, it returned
42 * every contact ..
43 *
44 * Revision 1.2 2003/03/21 10:33:09 eilers
45 * Merged speed optimized xml backend for contacts to main.
46 * Added QDateTime to querybyexample. For instance, it is now possible to get
47 * all Birthdays/Anniversaries between two dates. This should be used
48 * to show all birthdays in the datebook..
49 * This change is sourcecode backward compatible but you have to upgrade
50 * the binaries for today-addressbook.
51 *
52 * Revision 1.1.2.2 2003/02/11 12:17:28 eilers
53 * Speed optimization. Removed the sequential search loops.
54 *
55 * Revision 1.1.2.1 2003/02/10 15:31:38 eilers
56 * Writing offsets to debug output..
57 *
58 * Revision 1.1 2003/02/09 15:05:01 eilers
59 * Nothing happened.. Just some cleanup before I will start..
60 *
61 * Revision 1.12 2003/01/03 16:58:03 eilers
62 * Reenable debug output
63 *
64 * Revision 1.11 2003/01/03 12:31:28 eilers
65 * Bugfix for calculating data diffs..
66 *
67 * Revision 1.10 2003/01/02 14:27:12 eilers
68 * Improved query by example: Search by date is possible.. First step
69 * for a today plugin for birthdays..
70 *
71 * Revision 1.9 2002/12/08 12:48:57 eilers
72 * Moved journal-enum from ocontact into i the xml-backend..
73 *
74 * Revision 1.8 2002/11/14 17:04:24 eilers
75 * Sorting will now work if fullname is identical on some entries
76 *
77 * Revision 1.7 2002/11/13 15:02:46 eilers
78 * Small Bug in sorted fixed
79 *
80 * Revision 1.6 2002/11/13 14:14:51 eilers
81 * Added sorted for Contacts..
82 *
83 * Revision 1.5 2002/11/01 15:10:42 eilers
84 * Added regExp-search in database for all fields in a contact.
85 *
86 * Revision 1.4 2002/10/16 10:52:40 eilers
87 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
88 *
89 * Revision 1.3 2002/10/14 16:21:54 eilers
90 * Some minor interface updates
91 *
92 * Revision 1.2 2002/10/07 17:34:24 eilers
93 * added OBackendFactory for advanced backend access
94 *
95 * Revision 1.1 2002/09/27 17:11:44 eilers
96 * Added API for accessing the Contact-Database ! It is compiling, but
97 * please do not expect that anything is working !
98 * I will debug that stuff in the next time ..
99 * Please read README_COMPILE for compiling !
100 *
101 *
102 */ 31 */
103 32
104#include "ocontactaccessbackend_xml.h" 33#include <opie2/ocontactaccessbackend_xml.h>
105 34
106#include <qasciidict.h> 35#include <qasciidict.h>
107#include <qdatetime.h> 36#include <qdatetime.h>
108#include <qfile.h> 37#include <qfile.h>
109#include <qfileinfo.h> 38#include <qfileinfo.h>
110#include <qregexp.h> 39#include <qregexp.h>
111#include <qarray.h> 40#include <qarray.h>
112#include <qmap.h> 41#include <qmap.h>
113#include <qdatetime.h> 42#include <qdatetime.h>
114 43
115#include <qpe/global.h> 44#include <qpe/global.h>
116 45
117#include <opie/xmltree.h> 46#include <opie/xmltree.h>
118#include "ocontactaccessbackend.h" 47#include <opie2/ocontactaccessbackend.h>
119#include "ocontactaccess.h" 48#include <opie2/ocontactaccess.h>
120 49
121#include <stdlib.h> 50#include <stdlib.h>
122#include <errno.h> 51#include <errno.h>
123 52
124using namespace Opie; 53using namespace Opie;
125 54
126 55
56namespace Opie {
127OContactAccessBackend_XML::OContactAccessBackend_XML ( const QString& appname, const QString& filename ): 57OContactAccessBackend_XML::OContactAccessBackend_XML ( const QString& appname, const QString& filename ):
128 m_changed( false ) 58 m_changed( false )
129{ 59{
130 // Just m_contactlist should call delete if an entry 60 // Just m_contactlist should call delete if an entry
131 // is removed. 61 // is removed.
132 m_contactList.setAutoDelete( true ); 62 m_contactList.setAutoDelete( true );
133 m_uidToContact.setAutoDelete( false ); 63 m_uidToContact.setAutoDelete( false );
134 64
135 m_appName = appname; 65 m_appName = appname;
136 66
137 /* Set journalfile name ... */ 67 /* Set journalfile name ... */
138 m_journalName = getenv("HOME"); 68 m_journalName = getenv("HOME");
139 m_journalName +="/.abjournal" + appname; 69 m_journalName +="/.abjournal" + appname;
140 70
141 /* Expecting to access the default filename if nothing else is set */ 71 /* Expecting to access the default filename if nothing else is set */
142 if ( filename.isEmpty() ){ 72 if ( filename.isEmpty() ){
@@ -805,16 +735,17 @@ void OContactAccessBackend_XML::updateJournal( const OContact& cnt,
805 735
806 buf = "<Contact "; 736 buf = "<Contact ";
807 cnt.save( buf ); 737 cnt.save( buf );
808 buf += " action=\"" + QString::number( (int)action ) + "\" "; 738 buf += " action=\"" + QString::number( (int)action ) + "\" ";
809 buf += "/>\n"; 739 buf += "/>\n";
810 QCString cstr = buf.utf8(); 740 QCString cstr = buf.utf8();
811 f.writeBlock( cstr.data(), cstr.length() ); 741 f.writeBlock( cstr.data(), cstr.length() );
812} 742}
813 743
814void OContactAccessBackend_XML::removeJournal() 744void OContactAccessBackend_XML::removeJournal()
815{ 745{
816 QFile f ( m_journalName ); 746 QFile f ( m_journalName );
817 if ( f.exists() ) 747 if ( f.exists() )
818 f.remove(); 748 f.remove();
819} 749}
820 750
751}
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.h b/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
index a0cae4d..f439c4c 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
@@ -1,112 +1,58 @@
1/* 1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29/*
2 * XML Backend for the OPIE-Contact Database. 30 * XML Backend for the OPIE-Contact Database.
3 *
4 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
5 *
6 * =====================================================================
7 *This program is free software; you can redistribute it and/or
8 *modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 * =====================================================================
12 * ToDo: XML-Backend: Automatic reload if something was changed...
13 * File Locking to protect against concurrent access
14 *
15 *
16 * =====================================================================
17 * Version: $Id$
18 * =====================================================================
19 * History:
20 * $Log$
21 * Revision 1.15 2003/09/22 14:31:16 eilers
22 * Added first experimental incarnation of sql-backend for addressbook.
23 * Some modifications to be able to compile the todo sql-backend.
24 * A lot of changes fill follow...
25 *
26 * Revision 1.14 2003/04/13 18:07:10 zecke
27 * More API doc
28 * QString -> const QString&
29 * QString = 0l -> QString::null
30 *
31 * Revision 1.13 2003/03/21 10:33:09 eilers
32 * Merged speed optimized xml backend for contacts to main.
33 * Added QDateTime to querybyexample. For instance, it is now possible to get
34 * all Birthdays/Anniversaries between two dates. This should be used
35 * to show all birthdays in the datebook..
36 * This change is sourcecode backward compatible but you have to upgrade
37 * the binaries for today-addressbook.
38 *
39 * Revision 1.12.2.2 2003/02/11 12:17:28 eilers
40 * Speed optimization. Removed the sequential search loops.
41 *
42 * Revision 1.12.2.1 2003/02/09 15:05:01 eilers
43 * Nothing happened.. Just some cleanup before I will start..
44 *
45 * Revision 1.12 2003/01/03 16:58:03 eilers
46 * Reenable debug output
47 *
48 * Revision 1.11 2003/01/03 12:31:28 eilers
49 * Bugfix for calculating data diffs..
50 *
51 * Revision 1.10 2003/01/02 14:27:12 eilers
52 * Improved query by example: Search by date is possible.. First step
53 * for a today plugin for birthdays..
54 *
55 * Revision 1.9 2002/12/08 12:48:57 eilers
56 * Moved journal-enum from ocontact into i the xml-backend..
57 *
58 * Revision 1.8 2002/11/14 17:04:24 eilers
59 * Sorting will now work if fullname is identical on some entries
60 *
61 * Revision 1.7 2002/11/13 15:02:46 eilers
62 * Small Bug in sorted fixed
63 *
64 * Revision 1.6 2002/11/13 14:14:51 eilers
65 * Added sorted for Contacts..
66 *
67 * Revision 1.5 2002/11/01 15:10:42 eilers
68 * Added regExp-search in database for all fields in a contact.
69 *
70 * Revision 1.4 2002/10/16 10:52:40 eilers
71 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
72 *
73 * Revision 1.3 2002/10/14 16:21:54 eilers
74 * Some minor interface updates
75 *
76 * Revision 1.2 2002/10/07 17:34:24 eilers
77 * added OBackendFactory for advanced backend access
78 *
79 * Revision 1.1 2002/09/27 17:11:44 eilers
80 * Added API for accessing the Contact-Database ! It is compiling, but
81 * please do not expect that anything is working !
82 * I will debug that stuff in the next time ..
83 * Please read README_COMPILE for compiling !
84 *
85 *
86 */ 31 */
87 32
88#ifndef _OContactAccessBackend_XML_ 33#ifndef _OContactAccessBackend_XML_
89#define _OContactAccessBackend_XML_ 34#define _OContactAccessBackend_XML_
90 35
91#include "ocontactaccessbackend.h" 36#include <opie2/ocontactaccessbackend.h>
92#include "ocontactaccess.h" 37#include <opie2/ocontactaccess.h>
93 38
94#include <qlist.h> 39#include <qlist.h>
95#include <qdict.h> 40#include <qdict.h>
96 41
42namespace Opie {
97/* the default xml implementation */ 43/* the default xml implementation */
98/** 44/**
99 * This class is the XML implementation of a Contact backend 45 * This class is the XML implementation of a Contact backend
100 * it does implement everything available for OContact. 46 * it does implement everything available for OContact.
101 * @see OPimAccessBackend for more information of available methods 47 * @see OPimAccessBackend for more information of available methods
102 */ 48 */
103class OContactAccessBackend_XML : public OContactAccessBackend { 49class OContactAccessBackend_XML : public OContactAccessBackend {
104 public: 50 public:
105 OContactAccessBackend_XML ( const QString& appname, const QString& filename = QString::null ); 51 OContactAccessBackend_XML ( const QString& appname, const QString& filename = QString::null );
106 52
107 bool save(); 53 bool save();
108 54
109 bool load (); 55 bool load ();
110 56
111 void clear (); 57 void clear ();
112 58
@@ -144,17 +90,19 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
144 90
145 91
146 void updateJournal( const OContact& cnt, journal_action action ); 92 void updateJournal( const OContact& cnt, journal_action action );
147 void removeJournal(); 93 void removeJournal();
148 94
149 protected: 95 protected:
150 bool m_changed; 96 bool m_changed;
151 QString m_journalName; 97 QString m_journalName;
152 QString m_fileName; 98 QString m_fileName;
153 QString m_appName; 99 QString m_appName;
154 QList<OContact> m_contactList; 100 QList<OContact> m_contactList;
155 QDateTime m_readtime; 101 QDateTime m_readtime;
156 102
157 QDict<OContact> m_uidToContact; 103 QDict<OContact> m_uidToContact;
158}; 104};
159 105
106}
107
160#endif 108#endif
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend.cpp b/libopie2/opiepim/backend/odatebookaccessbackend.cpp
index f0c5d65..9bf4bf0 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend.cpp
+++ b/libopie2/opiepim/backend/odatebookaccessbackend.cpp
@@ -1,21 +1,51 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#include <qtl.h> 29#include <qtl.h>
2 30
3#include "orecur.h" 31#include <opie2/orecur.h>
4 32
5#include "odatebookaccessbackend.h" 33#include <opie2/odatebookaccessbackend.h>
34
35using namespace Opie;
6 36
7namespace { 37namespace {
8/* a small helper to get all NonRepeating events for a range of time */ 38/* a small helper to get all NonRepeating events for a range of time */
9 void events( OEffectiveEvent::ValueList& tmpList, const OEvent::ValueList& events, 39 void events( OEffectiveEvent::ValueList& tmpList, const OEvent::ValueList& events,
10 const QDate& from, const QDate& to ) { 40 const QDate& from, const QDate& to ) {
11 QDateTime dtStart, dtEnd; 41 QDateTime dtStart, dtEnd;
12 42
13 for ( OEvent::ValueList::ConstIterator it = events.begin(); it != events.end(); ++it ) { 43 for ( OEvent::ValueList::ConstIterator it = events.begin(); it != events.end(); ++it ) {
14 dtStart = (*it).startDateTime(); 44 dtStart = (*it).startDateTime();
15 dtEnd = (*it).endDateTime(); 45 dtEnd = (*it).endDateTime();
16 46
17 /* 47 /*
18 * If in range 48 * If in range
19 */ 49 */
20 if (dtStart.date() >= from && dtEnd.date() <= to ) { 50 if (dtStart.date() >= from && dtEnd.date() <= to ) {
21 OEffectiveEvent eff; 51 OEffectiveEvent eff;
@@ -106,32 +136,34 @@ namespace {
106 tmpEff.setEffectiveDates( startDate, endDate ); 136 tmpEff.setEffectiveDates( startDate, endDate );
107 tmpList.append( tmpEff ); 137 tmpList.append( tmpEff );
108 138
109 sub_it = sub_it.addDays( 1 ); 139 sub_it = sub_it.addDays( 1 );
110 } 140 }
111 itDate = endDate; 141 itDate = endDate;
112 }else { 142 }else {
113 eff.setEvent( (*it) ); 143 eff.setEvent( (*it) );
114 tmpList.append( eff ); 144 tmpList.append( eff );
115 itDate = repeat.addDays( 1 ); 145 itDate = repeat.addDays( 1 );
116 } 146 }
117 } 147 }
118 } 148 }
119 } 149 }
120} 150}
121 151
152namespace Opie {
153
122ODateBookAccessBackend::ODateBookAccessBackend() 154ODateBookAccessBackend::ODateBookAccessBackend()
123 : OPimAccessBackend<OEvent>() 155 : OPimAccessBackend<OEvent>()
124{ 156{
125 157
126} 158}
127ODateBookAccessBackend::~ODateBookAccessBackend() { 159ODateBookAccessBackend::~ODateBookAccessBackend() {
128 160
129} 161}
130OEffectiveEvent::ValueList ODateBookAccessBackend::effectiveEvents( const QDate& from, 162OEffectiveEvent::ValueList ODateBookAccessBackend::effectiveEvents( const QDate& from,
131 const QDate& to ) { 163 const QDate& to ) {
132 OEffectiveEvent::ValueList tmpList; 164 OEffectiveEvent::ValueList tmpList;
133 OEvent::ValueList list = directNonRepeats(); 165 OEvent::ValueList list = directNonRepeats();
134 166
135 events( tmpList, list, from, to ); 167 events( tmpList, list, from, to );
136 repeat( tmpList, directRawRepeats(),from,to ); 168 repeat( tmpList, directRawRepeats(),from,to );
137 169
@@ -167,16 +199,18 @@ OEffectiveEvent::ValueList ODateBookAccessBackend::effectiveNonRepeatingEvents(
167} 199}
168 200
169OEffectiveEvent::ValueList ODateBookAccessBackend::effectiveNonRepeatingEvents( const QDateTime& dt ) { 201OEffectiveEvent::ValueList ODateBookAccessBackend::effectiveNonRepeatingEvents( const QDateTime& dt ) {
170 OEffectiveEvent::ValueList day = effectiveNonRepeatingEvents( dt.date(), dt.date() ); 202 OEffectiveEvent::ValueList day = effectiveNonRepeatingEvents( dt.date(), dt.date() );
171 OEffectiveEvent::ValueList::Iterator it; 203 OEffectiveEvent::ValueList::Iterator it;
172 204
173 OEffectiveEvent::ValueList tmpList; 205 OEffectiveEvent::ValueList tmpList;
174 QDateTime dtTmp; 206 QDateTime dtTmp;
175 for ( it = day.begin(); it != day.end(); ++it ) { 207 for ( it = day.begin(); it != day.end(); ++it ) {
176 dtTmp = QDateTime( (*it).date(), (*it).startTime() ); 208 dtTmp = QDateTime( (*it).date(), (*it).startTime() );
177 if ( QABS(dt.secsTo(dtTmp) ) < 60 ) 209 if ( QABS(dt.secsTo(dtTmp) ) < 60 )
178 tmpList.append( (*it) ); 210 tmpList.append( (*it) );
179 } 211 }
180 212
181 return tmpList; 213 return tmpList;
182} 214}
215
216}
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend.h b/libopie2/opiepim/backend/odatebookaccessbackend.h
index 3472ab3..6853670 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend.h
+++ b/libopie2/opiepim/backend/odatebookaccessbackend.h
@@ -1,24 +1,53 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_H 29#ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_H
2#define OPIE_DATE_BOOK_ACCESS_BACKEND_H 30#define OPIE_DATE_BOOK_ACCESS_BACKEND_H
3 31
4#include <qarray.h> 32#include <qarray.h>
5 33
6#include "opimaccessbackend.h" 34#include <opie2/opimaccessbackend.h>
7#include "oevent.h" 35#include <opie2/oevent.h>
8 36
37namespace Opie {
9/** 38/**
10 * This class is the interface to the storage of Events. 39 * This class is the interface to the storage of Events.
11 * @see OPimAccessBackend 40 * @see OPimAccessBackend
12 * 41 *
13 */ 42 */
14class ODateBookAccessBackend : public OPimAccessBackend<OEvent> { 43class ODateBookAccessBackend : public OPimAccessBackend<OEvent> {
15public: 44public:
16 typedef int UID; 45 typedef int UID;
17 46
18 /** 47 /**
19 * c'tor without parameter 48 * c'tor without parameter
20 */ 49 */
21 ODateBookAccessBackend(); 50 ODateBookAccessBackend();
22 ~ODateBookAccessBackend(); 51 ~ODateBookAccessBackend();
23 52
24 /** 53 /**
@@ -74,17 +103,19 @@ public:
74 * yourself 103 * yourself
75 */ 104 */
76 virtual OEffectiveEvent::ValueList effectiveNonRepeatingEvents( const QDate& from, const QDate& to ); 105 virtual OEffectiveEvent::ValueList effectiveNonRepeatingEvents( const QDate& from, const QDate& to );
77 106
78 /** 107 /**
79 * this is an overloaded member function 108 * this is an overloaded member function
80 * @see effectiveNonRepeatingEvents( const QDate& from, const QDate& to ) 109 * @see effectiveNonRepeatingEvents( const QDate& from, const QDate& to )
81 */ 110 */
82 virtual OEffectiveEvent::ValueList effectiveNonRepeatingEvents( const QDateTime& start ); 111 virtual OEffectiveEvent::ValueList effectiveNonRepeatingEvents( const QDateTime& start );
83 112
84private: 113private:
85 class Private; 114 class Private;
86 Private *d; 115 Private *d;
87 116
88}; 117};
89 118
119}
120
90#endif 121#endif
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
index 756f405..e79696c 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
@@ -1,68 +1,65 @@
1/* 1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29/*
2 * SQL Backend for the OPIE-Calender Database. 30 * SQL Backend for the OPIE-Calender Database.
3 * 31 *
4 * Copyright (c) 2003 by Stefan Eilers (Eilers.Stefan@epost.de)
5 *
6 * =====================================================================
7 *This program is free software; you can redistribute it and/or
8 *modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 * =====================================================================
12 * =====================================================================
13 * Version: $Id$
14 * =====================================================================
15 * History:
16 * $Log$
17 * Revision 1.3 2003/12/22 11:41:39 eilers
18 * Fixing stupid bug, found by sourcode review..
19 *
20 * Revision 1.2 2003/12/22 10:19:26 eilers
21 * Finishing implementation of sql-backend for datebook. But I have to
22 * port the PIM datebook application to use it, before I could debug the
23 * whole stuff.
24 * Thus, PIM-Database backend is finished, but highly experimental. And some
25 * parts are still generic. For instance, the "queryByExample()" methods are
26 * not (or not fully) implemented. Todo: custom-entries not stored.
27 * The big show stopper: matchRegExp() (needed by OpieSearch) needs regular
28 * expression search in the database, which is not supported by sqlite !
29 * Therefore we need either an extended sqlite or a workaround which would
30 * be very slow and memory consuming..
31 *
32 * Revision 1.1 2003/12/08 15:18:12 eilers
33 * Committing unfinished sql implementation before merging to libopie2 starts..
34 *
35 *
36 */ 32 */
37 33
38#include <stdio.h> 34#include <stdio.h>
39#include <stdlib.h> 35#include <stdlib.h>
40 36
41#include <qarray.h> 37#include <qarray.h>
42#include <qstringlist.h> 38#include <qstringlist.h>
43 39
44#include <qpe/global.h> 40#include <qpe/global.h>
45 41
46#include <opie2/osqldriver.h> 42#include <opie2/osqldriver.h>
47#include <opie2/osqlmanager.h> 43#include <opie2/osqlmanager.h>
48#include <opie2/osqlquery.h> 44#include <opie2/osqlquery.h>
49 45
50#include "orecur.h" 46#include <opie2/orecur.h>
51#include "odatebookaccessbackend_sql.h" 47#include <opie2/odatebookaccessbackend_sql.h>
52 48
49namespace Opie {
53 50
54 51
55ODateBookAccessBackend_SQL::ODateBookAccessBackend_SQL( const QString& , 52ODateBookAccessBackend_SQL::ODateBookAccessBackend_SQL( const QString& ,
56 const QString& fileName ) 53 const QString& fileName )
57 : ODateBookAccessBackend(), m_driver( NULL ) 54 : ODateBookAccessBackend(), m_driver( NULL )
58{ 55{
59 m_fileName = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.db" ) : fileName; 56 m_fileName = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.db" ) : fileName;
60 57
61 // Get the standart sql-driver from the OSQLManager.. 58 // Get the standart sql-driver from the OSQLManager..
62 OSQLManager man; 59 OSQLManager man;
63 m_driver = man.standard(); 60 m_driver = man.standard();
64 m_driver->setUrl( m_fileName ); 61 m_driver->setUrl( m_fileName );
65 62
66 initFields(); 63 initFields();
67 64
68 load(); 65 load();
@@ -352,16 +349,18 @@ QArray<int> ODateBookAccessBackend_SQL::extractUids( OSQLResult& res ) const
352 t.start(); 349 t.start();
353 OSQLResultItem::ValueList list = res.results(); 350 OSQLResultItem::ValueList list = res.results();
354 OSQLResultItem::ValueList::Iterator it; 351 OSQLResultItem::ValueList::Iterator it;
355 QArray<int> ints(list.count() ); 352 QArray<int> ints(list.count() );
356 qWarning(" count = %d", list.count() ); 353 qWarning(" count = %d", list.count() );
357 354
358 int i = 0; 355 int i = 0;
359 for (it = list.begin(); it != list.end(); ++it ) { 356 for (it = list.begin(); it != list.end(); ++it ) {
360 ints[i] = (*it).data("uid").toInt(); 357 ints[i] = (*it).data("uid").toInt();
361 i++; 358 i++;
362 } 359 }
363 qWarning("extractUids ready: count2 = %d needs %d ms", i, t.elapsed() ); 360 qWarning("extractUids ready: count2 = %d needs %d ms", i, t.elapsed() );
364 361
365 return ints; 362 return ints;
366 363
367} 364}
365
366}
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.h b/libopie2/opiepim/backend/odatebookaccessbackend_sql.h
index f39e154..89939ef 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.h
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.h
@@ -1,26 +1,55 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H 29#ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H
2#define OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H 30#define OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H
3 31
4#include <qmap.h> 32#include <qmap.h>
5#include <opie2/osqlresult.h> 33#include <opie2/osqlresult.h>
6 34
7#include "odatebookaccessbackend.h" 35#include <opie2/odatebookaccessbackend.h>
8 36
9class OSQLDriver; 37class OSQLDriver;
10 38
39namespace Opie {
11/** 40/**
12 * This is the default SQL implementation for DateBoook SQL storage 41 * This is the default SQL implementation for DateBoook SQL storage
13 * It fully implements the interface 42 * It fully implements the interface
14 * @see ODateBookAccessBackend 43 * @see ODateBookAccessBackend
15 * @see OPimAccessBackend 44 * @see OPimAccessBackend
16 */ 45 */
17class ODateBookAccessBackend_SQL : public ODateBookAccessBackend { 46class ODateBookAccessBackend_SQL : public ODateBookAccessBackend {
18public: 47public:
19 ODateBookAccessBackend_SQL( const QString& appName, 48 ODateBookAccessBackend_SQL( const QString& appName,
20 const QString& fileName = QString::null); 49 const QString& fileName = QString::null);
21 ~ODateBookAccessBackend_SQL(); 50 ~ODateBookAccessBackend_SQL();
22 51
23 bool load(); 52 bool load();
24 bool reload(); 53 bool reload();
25 bool save(); 54 bool save();
26 55
@@ -46,17 +75,19 @@ private:
46 QArray<int> m_uids; 75 QArray<int> m_uids;
47 76
48 QMap<int, QString> m_fieldMap; 77 QMap<int, QString> m_fieldMap;
49 QMap<QString, int> m_reverseFieldMap; 78 QMap<QString, int> m_reverseFieldMap;
50 79
51 OSQLDriver* m_driver; 80 OSQLDriver* m_driver;
52 81
53 class Private; 82 class Private;
54 Private *d; 83 Private *d;
55 84
56 void initFields(); 85 void initFields();
57 void update(); 86 void update();
58 QArray<int> extractUids( OSQLResult& res ) const; 87 QArray<int> extractUids( OSQLResult& res ) const;
59 88
60}; 89};
61 90
91}
92
62#endif 93#endif
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp
index 929d004..0ebda98 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp
@@ -1,39 +1,69 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#include <errno.h> 29#include <errno.h>
2#include <fcntl.h> 30#include <fcntl.h>
3 31
4#include <stdio.h> 32#include <stdio.h>
5#include <stdlib.h> 33#include <stdlib.h>
6 34
7#include <sys/types.h> 35#include <sys/types.h>
8#include <sys/mman.h> 36#include <sys/mman.h>
9#include <sys/stat.h> 37#include <sys/stat.h>
10 38
11#include <unistd.h> 39#include <unistd.h>
12 40
13#include <qasciidict.h> 41#include <qasciidict.h>
14#include <qfile.h> 42#include <qfile.h>
15 43
16#include <qtopia/global.h> 44#include <qtopia/global.h>
17#include <qtopia/stringutil.h> 45#include <qtopia/stringutil.h>
18#include <qtopia/timeconversion.h> 46#include <qtopia/timeconversion.h>
19 47
20#include "opimnotifymanager.h" 48#include <opie2/opimnotifymanager.h>
21#include "orecur.h" 49#include <opie2/orecur.h>
22#include "otimezone.h" 50#include <opie2/otimezone.h>
23#include "odatebookaccessbackend_xml.h" 51#include <opie2/odatebookaccessbackend_xml.h>
52
53using namespace Opie;
24 54
25namespace { 55namespace {
26 // FROM TT again 56 // FROM TT again
27char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen) 57char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen)
28{ 58{
29 char needleChar; 59 char needleChar;
30 char haystackChar; 60 char haystackChar;
31 if (!needle || !haystack || !hLen || !nLen) 61 if (!needle || !haystack || !hLen || !nLen)
32 return 0; 62 return 0;
33 63
34 const char* hsearch = haystack; 64 const char* hsearch = haystack;
35 65
36 if ((needleChar = *needle++) != 0) { 66 if ((needleChar = *needle++) != 0) {
37 nLen--; //(to make up for needle++) 67 nLen--; //(to make up for needle++)
38 do { 68 do {
39 do { 69 do {
@@ -153,32 +183,33 @@ namespace {
153 QCString str; 183 QCString str;
154 int total_written; 184 int total_written;
155 for ( it = list.begin(); it != list.end(); ++it ) { 185 for ( it = list.begin(); it != list.end(); ++it ) {
156 buf = "<event"; 186 buf = "<event";
157 save( it.data(), buf ); 187 save( it.data(), buf );
158 buf += " />\n"; 188 buf += " />\n";
159 str = buf.utf8(); 189 str = buf.utf8();
160 190
161 total_written = file.writeBlock(str.data(), str.length() ); 191 total_written = file.writeBlock(str.data(), str.length() );
162 if ( total_written != int(str.length() ) ) 192 if ( total_written != int(str.length() ) )
163 return false; 193 return false;
164 } 194 }
165 return true; 195 return true;
166 } 196 }
167} 197}
168 198
199namespace Opie {
169ODateBookAccessBackend_XML::ODateBookAccessBackend_XML( const QString& , 200ODateBookAccessBackend_XML::ODateBookAccessBackend_XML( const QString& ,
170 const QString& fileName ) 201 const QString& fileName )
171 : ODateBookAccessBackend() { 202 : ODateBookAccessBackend() {
172 m_name = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.xml" ) : fileName; 203 m_name = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.xml" ) : fileName;
173 m_changed = false; 204 m_changed = false;
174} 205}
175ODateBookAccessBackend_XML::~ODateBookAccessBackend_XML() { 206ODateBookAccessBackend_XML::~ODateBookAccessBackend_XML() {
176} 207}
177bool ODateBookAccessBackend_XML::load() { 208bool ODateBookAccessBackend_XML::load() {
178 return loadFile(); 209 return loadFile();
179} 210}
180bool ODateBookAccessBackend_XML::reload() { 211bool ODateBookAccessBackend_XML::reload() {
181 clear(); 212 clear();
182 return load(); 213 return load();
183} 214}
184bool ODateBookAccessBackend_XML::save() { 215bool ODateBookAccessBackend_XML::save() {
@@ -597,16 +628,18 @@ QArray<int> ODateBookAccessBackend_XML::matchRegexp( const QRegExp &r ) const
597 QArray<int> m_currentQuery( m_raw.count()+ m_rep.count() ); 628 QArray<int> m_currentQuery( m_raw.count()+ m_rep.count() );
598 uint arraycounter = 0; 629 uint arraycounter = 0;
599 QMap<int, OEvent>::ConstIterator it; 630 QMap<int, OEvent>::ConstIterator it;
600 631
601 for ( it = m_raw.begin(); it != m_raw.end(); ++it ) 632 for ( it = m_raw.begin(); it != m_raw.end(); ++it )
602 if ( it.data().match( r ) ) 633 if ( it.data().match( r ) )
603 m_currentQuery[arraycounter++] = it.data().uid(); 634 m_currentQuery[arraycounter++] = it.data().uid();
604 for ( it = m_rep.begin(); it != m_rep.end(); ++it ) 635 for ( it = m_rep.begin(); it != m_rep.end(); ++it )
605 if ( it.data().match( r ) ) 636 if ( it.data().match( r ) )
606 m_currentQuery[arraycounter++] = it.data().uid(); 637 m_currentQuery[arraycounter++] = it.data().uid();
607 638
608 // Shrink to fit.. 639 // Shrink to fit..
609 m_currentQuery.resize(arraycounter); 640 m_currentQuery.resize(arraycounter);
610 641
611 return m_currentQuery; 642 return m_currentQuery;
612} 643}
644
645}
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_xml.h b/libopie2/opiepim/backend/odatebookaccessbackend_xml.h
index a5cc0fc..29f5f4f 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_xml.h
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_xml.h
@@ -1,23 +1,52 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_XML__H 29#ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_XML__H
2#define OPIE_DATE_BOOK_ACCESS_BACKEND_XML__H 30#define OPIE_DATE_BOOK_ACCESS_BACKEND_XML__H
3 31
4#include <qmap.h> 32#include <qmap.h>
5 33
6#include "odatebookaccessbackend.h" 34#include <opie2/odatebookaccessbackend.h>
7 35
36namespace Opie {
8/** 37/**
9 * This is the default XML implementation for DateBoook XML storage 38 * This is the default XML implementation for DateBoook XML storage
10 * It fully implements the interface 39 * It fully implements the interface
11 * @see ODateBookAccessBackend 40 * @see ODateBookAccessBackend
12 * @see OPimAccessBackend 41 * @see OPimAccessBackend
13 */ 42 */
14class ODateBookAccessBackend_XML : public ODateBookAccessBackend { 43class ODateBookAccessBackend_XML : public ODateBookAccessBackend {
15public: 44public:
16 ODateBookAccessBackend_XML( const QString& appName, 45 ODateBookAccessBackend_XML( const QString& appName,
17 const QString& fileName = QString::null); 46 const QString& fileName = QString::null);
18 ~ODateBookAccessBackend_XML(); 47 ~ODateBookAccessBackend_XML();
19 48
20 bool load(); 49 bool load();
21 bool reload(); 50 bool reload();
22 bool save(); 51 bool save();
23 52
@@ -39,17 +68,19 @@ public:
39 68
40private: 69private:
41 bool m_changed :1 ; 70 bool m_changed :1 ;
42 bool loadFile(); 71 bool loadFile();
43 inline void finalizeRecord( OEvent& ev ); 72 inline void finalizeRecord( OEvent& ev );
44 inline void setField( OEvent&, int field, const QString& val ); 73 inline void setField( OEvent&, int field, const QString& val );
45 QString m_name; 74 QString m_name;
46 QMap<int, OEvent> m_raw; 75 QMap<int, OEvent> m_raw;
47 QMap<int, OEvent> m_rep; 76 QMap<int, OEvent> m_rep;
48 77
49 struct Data; 78 struct Data;
50 Data* data; 79 Data* data;
51 class Private; 80 class Private;
52 Private *d; 81 Private *d;
53}; 82};
54 83
84}
85
55#endif 86#endif
diff --git a/libopie2/opiepim/backend/opimaccessbackend.h b/libopie2/opiepim/backend/opimaccessbackend.h
index fd264fc..505358e 100644
--- a/libopie2/opiepim/backend/opimaccessbackend.h
+++ b/libopie2/opiepim/backend/opimaccessbackend.h
@@ -1,26 +1,55 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_PIM_ACCESS_BACKEND 29#ifndef OPIE_PIM_ACCESS_BACKEND
2#define OPIE_PIM_ACCESS_BACKEND 30#define OPIE_PIM_ACCESS_BACKEND
3 31
4#include <qarray.h> 32#include <qarray.h>
5#include <qdatetime.h> 33#include <qdatetime.h>
6 34
7#include <opie/otemplatebase.h> 35#include <opie2/otemplatebase.h>
8#include <opie/opimrecord.h> 36#include <opie2/opimrecord.h>
9 37
10 38
39namespace Opie {
11class OPimAccessBackendPrivate; 40class OPimAccessBackendPrivate;
12/** 41/**
13 * OPimAccessBackend is the base class 42 * OPimAccessBackend is the base class
14 * for all private backends 43 * for all private backends
15 * it operates on OPimRecord as the base class 44 * it operates on OPimRecord as the base class
16 * and it's responsible for fast manipulating 45 * and it's responsible for fast manipulating
17 * the resource the implementation takes care 46 * the resource the implementation takes care
18 * of 47 * of
19 */ 48 */
20template <class T = OPimRecord> 49template <class T = OPimRecord>
21class OPimAccessBackend { 50class OPimAccessBackend {
22public: 51public:
23 typedef OTemplateBase<T> Frontend; 52 typedef OTemplateBase<T> Frontend;
24 53
25 /** The access hint from the frontend */ 54 /** The access hint from the frontend */
26 OPimAccessBackend(int access = 0); 55 OPimAccessBackend(int access = 0);
@@ -144,17 +173,20 @@ template <class T>
144T OPimAccessBackend<T>::find( int uid, const QArray<int>&, 173T OPimAccessBackend<T>::find( int uid, const QArray<int>&,
145 uint, typename Frontend::CacheDirection )const { 174 uint, typename Frontend::CacheDirection )const {
146 return find( uid ); 175 return find( uid );
147} 176}
148template <class T> 177template <class T>
149void OPimAccessBackend<T>::setReadAhead( uint count ) { 178void OPimAccessBackend<T>::setReadAhead( uint count ) {
150 m_read = count; 179 m_read = count;
151} 180}
152template <class T> 181template <class T>
153uint OPimAccessBackend<T>::readAhead()const { 182uint OPimAccessBackend<T>::readAhead()const {
154 return m_read; 183 return m_read;
155} 184}
156template <class T> 185template <class T>
157int OPimAccessBackend<T>::access()const { 186int OPimAccessBackend<T>::access()const {
158 return m_acc; 187 return m_acc;
159} 188}
189
190}
191
160#endif 192#endif
diff --git a/libopie2/opiepim/backend/otodoaccessbackend.cpp b/libopie2/opiepim/backend/otodoaccessbackend.cpp
index baaeecc..d27f5ef 100644
--- a/libopie2/opiepim/backend/otodoaccessbackend.cpp
+++ b/libopie2/opiepim/backend/otodoaccessbackend.cpp
@@ -1,10 +1,41 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1 29
2#include "otodoaccessbackend.h" 30#include <opie2/otodoaccessbackend.h>
3 31
32namespace Opie {
4OTodoAccessBackend::OTodoAccessBackend() 33OTodoAccessBackend::OTodoAccessBackend()
5 : OPimAccessBackend<OTodo>() 34 : OPimAccessBackend<OTodo>()
6{ 35{
7} 36}
8OTodoAccessBackend::~OTodoAccessBackend() { 37OTodoAccessBackend::~OTodoAccessBackend() {
9 38
10} 39}
40
41}
diff --git a/libopie2/opiepim/backend/otodoaccessbackend.h b/libopie2/opiepim/backend/otodoaccessbackend.h
index 6be95bc..54b52cc 100644
--- a/libopie2/opiepim/backend/otodoaccessbackend.h
+++ b/libopie2/opiepim/backend/otodoaccessbackend.h
@@ -1,28 +1,59 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_TODO_ACCESS_BACKEND_H 29#ifndef OPIE_TODO_ACCESS_BACKEND_H
2#define OPIE_TODO_ACCESS_BACKEND_H 30#define OPIE_TODO_ACCESS_BACKEND_H
3 31
4#include <qbitarray.h> 32#include <qbitarray.h>
5 33
6#include "otodo.h" 34#include <opie2/otodo.h>
7#include "opimaccessbackend.h" 35#include <opie2/opimaccessbackend.h>
8 36
37namespace Opie {
9class OTodoAccessBackend : public OPimAccessBackend<OTodo> { 38class OTodoAccessBackend : public OPimAccessBackend<OTodo> {
10public: 39public:
11 OTodoAccessBackend(); 40 OTodoAccessBackend();
12 ~OTodoAccessBackend(); 41 ~OTodoAccessBackend();
13 virtual QArray<int> effectiveToDos( const QDate& start, 42 virtual QArray<int> effectiveToDos( const QDate& start,
14 const QDate& end, 43 const QDate& end,
15 bool includeNoDates ) = 0; 44 bool includeNoDates ) = 0;
16 virtual QArray<int> overDue() = 0; 45 virtual QArray<int> overDue() = 0;
17 virtual QArray<int> sorted( bool asc, int sortOrder, int sortFilter, 46 virtual QArray<int> sorted( bool asc, int sortOrder, int sortFilter,
18 int cat ) = 0; 47 int cat ) = 0;
19 virtual void removeAllCompleted() = 0; 48 virtual void removeAllCompleted() = 0;
20 virtual QBitArray supports()const = 0; 49 virtual QBitArray supports()const = 0;
21 50
22private: 51private:
23 class Private; 52 class Private;
24 Private *d; 53 Private *d;
25 54
26}; 55};
27 56
57}
58
28#endif 59#endif
diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp
index 3764c7e..944f82a 100644
--- a/libopie2/opiepim/backend/otodoaccesssql.cpp
+++ b/libopie2/opiepim/backend/otodoaccesssql.cpp
@@ -1,31 +1,60 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1 29
2#include <qdatetime.h> 30#include <qdatetime.h>
3 31
4#include <qpe/global.h> 32#include <qpe/global.h>
5 33
6#include <opie2/osqldriver.h> 34#include <opie2/osqldriver.h>
7#include <opie2/osqlresult.h> 35#include <opie2/osqlresult.h>
8#include <opie2/osqlmanager.h> 36#include <opie2/osqlmanager.h>
9#include <opie2/osqlquery.h> 37#include <opie2/osqlquery.h>
10 38
11#include "otodoaccesssql.h" 39#include <opie2/otodoaccesssql.h>
12#include "opimstate.h" 40#include <opie2/opimstate.h>
13#include "opimnotifymanager.h" 41#include <opie2/opimnotifymanager.h>
14#include "orecur.h" 42#include <opie2/orecur.h>
15 43
44using namespace Opie;
16/* 45/*
17 * first some query 46 * first some query
18 * CREATE query 47 * CREATE query
19 * LOAD query 48 * LOAD query
20 * INSERT 49 * INSERT
21 * REMOVE 50 * REMOVE
22 * CLEAR 51 * CLEAR
23 */ 52 */
24namespace { 53namespace {
25 /** 54 /**
26 * CreateQuery for the Todolist Table 55 * CreateQuery for the Todolist Table
27 */ 56 */
28 class CreateQuery : public OSQLQuery { 57 class CreateQuery : public OSQLQuery {
29 public: 58 public:
30 CreateQuery(); 59 CreateQuery();
31 ~CreateQuery(); 60 ~CreateQuery();
@@ -285,32 +314,34 @@ namespace {
285 QString str; 314 QString str;
286 str = QString("select uid from todolist where ( DueDate >= '%1-%2-%3' AND DueDate <= '%4-%5-%6' ) OR DueDate = '0-0-0' ") 315 str = QString("select uid from todolist where ( DueDate >= '%1-%2-%3' AND DueDate <= '%4-%5-%6' ) OR DueDate = '0-0-0' ")
287 .arg( m_start.year() ).arg( m_start.month() ).arg( m_start.day() ) 316 .arg( m_start.year() ).arg( m_start.month() ).arg( m_start.day() )
288 .arg( m_end .year() ).arg( m_end .month() ).arg( m_end .day() ); 317 .arg( m_end .year() ).arg( m_end .month() ).arg( m_end .day() );
289 return str; 318 return str;
290 } 319 }
291 QString EffQuery::out()const { 320 QString EffQuery::out()const {
292 QString str; 321 QString str;
293 str = QString("select uid from todolist where DueDate >= '%1-%2-%3' AND DueDate <= '%4-%5-%6'") 322 str = QString("select uid from todolist where DueDate >= '%1-%2-%3' AND DueDate <= '%4-%5-%6'")
294 .arg(m_start.year() ).arg(m_start.month() ).arg( m_start.day() ) 323 .arg(m_start.year() ).arg(m_start.month() ).arg( m_start.day() )
295 .arg(m_end. year() ).arg(m_end. month() ).arg(m_end.day() ); 324 .arg(m_end. year() ).arg(m_end. month() ).arg(m_end.day() );
296 325
297 return str; 326 return str;
298 } 327 }
299}; 328};
300 329
330
331namespace Opie {
301OTodoAccessBackendSQL::OTodoAccessBackendSQL( const QString& file ) 332OTodoAccessBackendSQL::OTodoAccessBackendSQL( const QString& file )
302 : OTodoAccessBackend(), m_dict(15), m_driver(NULL), m_dirty(true) 333 : OTodoAccessBackend(), m_dict(15), m_driver(NULL), m_dirty(true)
303{ 334{
304 QString fi = file; 335 QString fi = file;
305 if ( fi.isEmpty() ) 336 if ( fi.isEmpty() )
306 fi = Global::applicationFileName( "todolist", "todolist.db" ); 337 fi = Global::applicationFileName( "todolist", "todolist.db" );
307 OSQLManager man; 338 OSQLManager man;
308 m_driver = man.standard(); 339 m_driver = man.standard();
309 m_driver->setUrl(fi); 340 m_driver->setUrl(fi);
310 // fillDict(); 341 // fillDict();
311} 342}
312 343
313OTodoAccessBackendSQL::~OTodoAccessBackendSQL(){ 344OTodoAccessBackendSQL::~OTodoAccessBackendSQL(){
314 if( m_driver ) 345 if( m_driver )
315 delete m_driver; 346 delete m_driver;
316} 347}
@@ -678,16 +709,18 @@ QBitArray OTodoAccessBackendSQL::sup() const{
678 709
679 QBitArray ar( OTodo::CompletedDate + 1 ); 710 QBitArray ar( OTodo::CompletedDate + 1 );
680 ar.fill( true ); 711 ar.fill( true );
681 ar[OTodo::CrossReference] = false; 712 ar[OTodo::CrossReference] = false;
682 ar[OTodo::State ] = false; 713 ar[OTodo::State ] = false;
683 ar[OTodo::Reminders] = false; 714 ar[OTodo::Reminders] = false;
684 ar[OTodo::Notifiers] = false; 715 ar[OTodo::Notifiers] = false;
685 ar[OTodo::Maintainer] = false; 716 ar[OTodo::Maintainer] = false;
686 717
687 return ar; 718 return ar;
688} 719}
689 720
690void OTodoAccessBackendSQL::removeAllCompleted(){ 721void OTodoAccessBackendSQL::removeAllCompleted(){
691#warning OTodoAccessBackendSQL::removeAllCompleted() not implemented !! 722#warning OTodoAccessBackendSQL::removeAllCompleted() not implemented !!
692 723
693} 724}
725
726}
diff --git a/libopie2/opiepim/backend/otodoaccesssql.h b/libopie2/opiepim/backend/otodoaccesssql.h
index 1c55567..1a6f614 100644
--- a/libopie2/opiepim/backend/otodoaccesssql.h
+++ b/libopie2/opiepim/backend/otodoaccesssql.h
@@ -1,26 +1,57 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_PIM_ACCESS_SQL_H 29#ifndef OPIE_PIM_ACCESS_SQL_H
2#define OPIE_PIM_ACCESS_SQL_H 30#define OPIE_PIM_ACCESS_SQL_H
3 31
4#include <qasciidict.h> 32#include <qasciidict.h>
5 33
6#include "otodoaccessbackend.h" 34#include <opie2/otodoaccessbackend.h>
7 35
8class OSQLDriver; 36class OSQLDriver;
9class OSQLResult; 37class OSQLResult;
10class OSQLResultItem; 38class OSQLResultItem;
39
40namespace Opie {
41
11class OTodoAccessBackendSQL : public OTodoAccessBackend { 42class OTodoAccessBackendSQL : public OTodoAccessBackend {
12public: 43public:
13 OTodoAccessBackendSQL( const QString& file ); 44 OTodoAccessBackendSQL( const QString& file );
14 ~OTodoAccessBackendSQL(); 45 ~OTodoAccessBackendSQL();
15 46
16 bool load(); 47 bool load();
17 bool reload(); 48 bool reload();
18 bool save(); 49 bool save();
19 QArray<int> allRecords()const; 50 QArray<int> allRecords()const;
20 51
21 QArray<int> queryByExample( const OTodo& t, int settings, const QDateTime& d = QDateTime() ); 52 QArray<int> queryByExample( const OTodo& t, int settings, const QDateTime& d = QDateTime() );
22 OTodo find(int uid)const; 53 OTodo find(int uid)const;
23 OTodo find(int uid, const QArray<int>&, uint cur, Frontend::CacheDirection )const; 54 OTodo find(int uid, const QArray<int>&, uint cur, Frontend::CacheDirection )const;
24 void clear(); 55 void clear();
25 bool add( const OTodo& t ); 56 bool add( const OTodo& t );
26 bool remove( int uid ); 57 bool remove( int uid );
@@ -39,18 +70,19 @@ public:
39private: 70private:
40 void update()const; 71 void update()const;
41 void fillDict(); 72 void fillDict();
42 inline bool date( QDate& date, const QString& )const; 73 inline bool date( QDate& date, const QString& )const;
43 inline OTodo todo( const OSQLResult& )const; 74 inline OTodo todo( const OSQLResult& )const;
44 inline OTodo todo( OSQLResultItem& )const; 75 inline OTodo todo( OSQLResultItem& )const;
45 inline QArray<int> uids( const OSQLResult& )const; 76 inline QArray<int> uids( const OSQLResult& )const;
46 OTodo todo( int uid )const; 77 OTodo todo( int uid )const;
47 QBitArray sup() const; 78 QBitArray sup() const;
48 79
49 QAsciiDict<int> m_dict; 80 QAsciiDict<int> m_dict;
50 OSQLDriver* m_driver; 81 OSQLDriver* m_driver;
51 QArray<int> m_uids; 82 QArray<int> m_uids;
52 bool m_dirty : 1; 83 bool m_dirty : 1;
53}; 84};
54 85
86}
55 87
56#endif 88#endif
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.cpp b/libopie2/opiepim/backend/otodoaccessvcal.cpp
index 6415952..e364ee2 100644
--- a/libopie2/opiepim/backend/otodoaccessvcal.cpp
+++ b/libopie2/opiepim/backend/otodoaccessvcal.cpp
@@ -1,23 +1,53 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#include <qfile.h> 29#include <qfile.h>
2 30
3#include <qtopia/private/vobject_p.h> 31#include <qtopia/private/vobject_p.h>
4#include <qtopia/timeconversion.h> 32#include <qtopia/timeconversion.h>
5#include <qtopia/private/qfiledirect_p.h> 33#include <qtopia/private/qfiledirect_p.h>
6 34
7#include "otodoaccessvcal.h" 35#include <opie2/otodoaccessvcal.h>
36
37using namespace Opie;
8 38
9namespace { 39namespace {
10 static OTodo eventByVObj( VObject *obj ){ 40 static OTodo eventByVObj( VObject *obj ){
11 OTodo event; 41 OTodo event;
12 VObject *ob; 42 VObject *ob;
13 QCString name; 43 QCString name;
14 // no uid, attendees, ... and no fun 44 // no uid, attendees, ... and no fun
15 // description 45 // description
16 if( ( ob = isAPropertyOf( obj, VCDescriptionProp )) != 0 ){ 46 if( ( ob = isAPropertyOf( obj, VCDescriptionProp )) != 0 ){
17 name = vObjectStringZValue( ob ); 47 name = vObjectStringZValue( ob );
18#if 0 48#if 0
19 event.setDescription( name ); 49 event.setDescription( name );
20#else 50#else
21 event.setSummary( name ); 51 event.setSummary( name );
22#endif 52#endif
23 } 53 }
@@ -94,32 +124,33 @@ namespace {
94 event.description().local8Bit() ); 124 event.description().local8Bit() );
95 125
96 addPropValue( task, VCSummaryProp, 126 addPropValue( task, VCSummaryProp,
97 event.summary().local8Bit() ); 127 event.summary().local8Bit() );
98 128
99#else 129#else
100 addPropValue( task, VCDescriptionProp, 130 addPropValue( task, VCDescriptionProp,
101 event.summary().local8Bit() ); 131 event.summary().local8Bit() );
102 132
103 addPropValue( task, VCSummaryProp, 133 addPropValue( task, VCSummaryProp,
104 event.description().local8Bit() ); 134 event.description().local8Bit() );
105#endif 135#endif
106 return task; 136 return task;
107}; 137};
108} 138}
109 139
140namespace Opie {
110OTodoAccessVCal::OTodoAccessVCal( const QString& path ) 141OTodoAccessVCal::OTodoAccessVCal( const QString& path )
111 : m_dirty(false), m_file( path ) 142 : m_dirty(false), m_file( path )
112{ 143{
113} 144}
114OTodoAccessVCal::~OTodoAccessVCal() { 145OTodoAccessVCal::~OTodoAccessVCal() {
115} 146}
116bool OTodoAccessVCal::load() { 147bool OTodoAccessVCal::load() {
117 m_map.clear(); 148 m_map.clear();
118 m_dirty = false; 149 m_dirty = false;
119 150
120 VObject* vcal = 0l; 151 VObject* vcal = 0l;
121 vcal = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); 152 vcal = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() );
122 if (!vcal ) 153 if (!vcal )
123 return false; 154 return false;
124 155
125 // Iterate over the list 156 // Iterate over the list
@@ -234,16 +265,18 @@ QBitArray OTodoAccessVCal::supports()const {
234} 265}
235QBitArray OTodoAccessVCal::sup() { 266QBitArray OTodoAccessVCal::sup() {
236 QBitArray ar ( OTodo::CompletedDate +1 ); 267 QBitArray ar ( OTodo::CompletedDate +1 );
237 ar.fill( true ); 268 ar.fill( true );
238 269
239 ar[OTodo::CrossReference] = false; 270 ar[OTodo::CrossReference] = false;
240 ar[OTodo::State ] = false; 271 ar[OTodo::State ] = false;
241 ar[OTodo::Reminders] = false; 272 ar[OTodo::Reminders] = false;
242 ar[OTodo::Notifiers] = false; 273 ar[OTodo::Notifiers] = false;
243 ar[OTodo::Maintainer] = false; 274 ar[OTodo::Maintainer] = false;
244 ar[OTodo::Progress] = false; 275 ar[OTodo::Progress] = false;
245 ar[OTodo::Alarms ] = false; 276 ar[OTodo::Alarms ] = false;
246 ar[OTodo::Recurrence] = false; 277 ar[OTodo::Recurrence] = false;
247 278
248 return ar; 279 return ar;
249} 280}
281
282}
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.h b/libopie2/opiepim/backend/otodoaccessvcal.h
index 2b17147..f9323fb 100644
--- a/libopie2/opiepim/backend/otodoaccessvcal.h
+++ b/libopie2/opiepim/backend/otodoaccessvcal.h
@@ -1,20 +1,50 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_OTODO_ACCESS_VCAL_H 29#ifndef OPIE_OTODO_ACCESS_VCAL_H
2#define OPIE_OTODO_ACCESS_VCAL_H 30#define OPIE_OTODO_ACCESS_VCAL_H
3 31
4#include "otodoaccessbackend.h" 32#include <opie2/otodoaccessbackend.h>
33
34namespace Opie {
5 35
6class OTodoAccessVCal : public OTodoAccessBackend { 36class OTodoAccessVCal : public OTodoAccessBackend {
7public: 37public:
8 OTodoAccessVCal(const QString& ); 38 OTodoAccessVCal(const QString& );
9 ~OTodoAccessVCal(); 39 ~OTodoAccessVCal();
10 40
11 bool load(); 41 bool load();
12 bool reload(); 42 bool reload();
13 bool save(); 43 bool save();
14 44
15 QArray<int> allRecords()const; 45 QArray<int> allRecords()const;
16 QArray<int> matchRegexp(const QRegExp &r) const; 46 QArray<int> matchRegexp(const QRegExp &r) const;
17 QArray<int> queryByExample( const OTodo& t, int sort, const QDateTime& d = QDateTime() ); 47 QArray<int> queryByExample( const OTodo& t, int sort, const QDateTime& d = QDateTime() );
18 QArray<int> effectiveToDos( const QDate& start, 48 QArray<int> effectiveToDos( const QDate& start,
19 const QDate& end, 49 const QDate& end,
20 bool includeNoDates ); 50 bool includeNoDates );
@@ -24,17 +54,19 @@ public:
24 OTodo find(int uid)const; 54 OTodo find(int uid)const;
25 void clear(); 55 void clear();
26 bool add( const OTodo& ); 56 bool add( const OTodo& );
27 bool remove( int uid ); 57 bool remove( int uid );
28 bool replace( const OTodo& ); 58 bool replace( const OTodo& );
29 59
30 void removeAllCompleted(); 60 void removeAllCompleted();
31 virtual QBitArray supports()const; 61 virtual QBitArray supports()const;
32 62
33private: 63private:
34 static QBitArray sup(); 64 static QBitArray sup();
35 bool m_dirty : 1; 65 bool m_dirty : 1;
36 QString m_file; 66 QString m_file;
37 QMap<int, OTodo> m_map; 67 QMap<int, OTodo> m_map;
38}; 68};
39 69
70}
71
40#endif 72#endif
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp
index 4a5cb33..2d50ecd 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.cpp
+++ b/libopie2/opiepim/backend/otodoaccessxml.cpp
@@ -1,39 +1,69 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#include <errno.h> 29#include <errno.h>
2#include <fcntl.h> 30#include <fcntl.h>
3 31
4#include <sys/mman.h> 32#include <sys/mman.h>
5#include <sys/stat.h> 33#include <sys/stat.h>
6#include <sys/types.h> 34#include <sys/types.h>
7 35
8#include <unistd.h> 36#include <unistd.h>
9 37
10 38
11#include <qfile.h> 39#include <qfile.h>
12#include <qvector.h> 40#include <qvector.h>
13 41
14#include <qpe/global.h> 42#include <qpe/global.h>
15#include <qpe/stringutil.h> 43#include <qpe/stringutil.h>
16#include <qpe/timeconversion.h> 44#include <qpe/timeconversion.h>
17 45
18#include "oconversion.h" 46#include <opie2/oconversion.h>
19#include "opimstate.h" 47#include <opie2/opimstate.h>
20#include "otimezone.h" 48#include <opie2/otimezone.h>
21#include "opimnotifymanager.h" 49#include <opie2/opimnotifymanager.h>
22#include "orecur.h" 50#include <opie2/orecur.h>
23#include "otodoaccessxml.h" 51#include <opie2/otodoaccessxml.h>
52
53using namespace Opie;
24 54
25namespace { 55namespace {
26 time_t rp_end; 56 time_t rp_end;
27 ORecur* rec; 57 ORecur* rec;
28 ORecur *recur() { 58 ORecur *recur() {
29 if (!rec ) rec = new ORecur; 59 if (!rec ) rec = new ORecur;
30 return rec; 60 return rec;
31 } 61 }
32 int snd; 62 int snd;
33 enum MoreAttributes { 63 enum MoreAttributes {
34 FRType = OTodo::CompletedDate + 2, 64 FRType = OTodo::CompletedDate + 2,
35 FRWeekdays, 65 FRWeekdays,
36 FRPosition, 66 FRPosition,
37 FRFreq, 67 FRFreq,
38 FRHasEndDate, 68 FRHasEndDate,
39 FREndDate, 69 FREndDate,
@@ -53,32 +83,33 @@ char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen)
53 if ((needleChar = *needle++) != 0) { 83 if ((needleChar = *needle++) != 0) {
54 nLen--; //(to make up for needle++) 84 nLen--; //(to make up for needle++)
55 do { 85 do {
56 do { 86 do {
57 if ((haystackChar = *hsearch++) == 0) 87 if ((haystackChar = *hsearch++) == 0)
58 return (0); 88 return (0);
59 if (hsearch >= haystack + hLen) 89 if (hsearch >= haystack + hLen)
60 return (0); 90 return (0);
61 } while (haystackChar != needleChar); 91 } while (haystackChar != needleChar);
62 } while (strncmp(hsearch, needle, QMIN(hLen - (hsearch - haystack), nLen)) != 0); 92 } while (strncmp(hsearch, needle, QMIN(hLen - (hsearch - haystack), nLen)) != 0);
63 hsearch--; 93 hsearch--;
64 } 94 }
65 return ((char *)hsearch); 95 return ((char *)hsearch);
66} 96}
67} 97}
68 98
99namespace Opie {
69 100
70OTodoAccessXML::OTodoAccessXML( const QString& appName, 101OTodoAccessXML::OTodoAccessXML( const QString& appName,
71 const QString& fileName ) 102 const QString& fileName )
72 : OTodoAccessBackend(), m_app( appName ), m_opened( false ), m_changed( false ) 103 : OTodoAccessBackend(), m_app( appName ), m_opened( false ), m_changed( false )
73{ 104{
74 if (!fileName.isEmpty() ) 105 if (!fileName.isEmpty() )
75 m_file = fileName; 106 m_file = fileName;
76 else 107 else
77 m_file = Global::applicationFileName( "todolist", "todolist.xml" ); 108 m_file = Global::applicationFileName( "todolist", "todolist.xml" );
78} 109}
79OTodoAccessXML::~OTodoAccessXML() { 110OTodoAccessXML::~OTodoAccessXML() {
80 111
81} 112}
82bool OTodoAccessXML::load() { 113bool OTodoAccessXML::load() {
83 rec = 0; 114 rec = 0;
84 m_opened = true; 115 m_opened = true;
@@ -861,16 +892,18 @@ QBitArray OTodoAccessXML::sup() {
861QArray<int> OTodoAccessXML::matchRegexp( const QRegExp &r ) const 892QArray<int> OTodoAccessXML::matchRegexp( const QRegExp &r ) const
862{ 893{
863 QArray<int> m_currentQuery( m_events.count() ); 894 QArray<int> m_currentQuery( m_events.count() );
864 uint arraycounter = 0; 895 uint arraycounter = 0;
865 896
866 QMap<int, OTodo>::ConstIterator it; 897 QMap<int, OTodo>::ConstIterator it;
867 for (it = m_events.begin(); it != m_events.end(); ++it ) { 898 for (it = m_events.begin(); it != m_events.end(); ++it ) {
868 if ( it.data().match( r ) ) 899 if ( it.data().match( r ) )
869 m_currentQuery[arraycounter++] = it.data().uid(); 900 m_currentQuery[arraycounter++] = it.data().uid();
870 901
871 } 902 }
872 // Shrink to fit.. 903 // Shrink to fit..
873 m_currentQuery.resize(arraycounter); 904 m_currentQuery.resize(arraycounter);
874 905
875 return m_currentQuery; 906 return m_currentQuery;
876} 907}
908
909}
diff --git a/libopie2/opiepim/backend/otodoaccessxml.h b/libopie2/opiepim/backend/otodoaccessxml.h
index e4850a1..d634398 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.h
+++ b/libopie2/opiepim/backend/otodoaccessxml.h
@@ -1,27 +1,54 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_TODO_ACCESS_XML_H 29#ifndef OPIE_TODO_ACCESS_XML_H
2#define OPIE_TODO_ACCESS_XML_H 30#define OPIE_TODO_ACCESS_XML_H
3 31
4#include <qasciidict.h> 32#include <qasciidict.h>
5#include <qmap.h> 33#include <qmap.h>
6 34
7#include "otodoaccessbackend.h" 35#include <opie2/otodoaccessbackend.h>
8 36
9namespace Opie { 37namespace Opie {
10 class XMLElement; 38 class XMLElement;
11};
12 39
13class OTodoAccessXML : public OTodoAccessBackend { 40class OTodoAccessXML : public OTodoAccessBackend {
14public: 41public:
15 /** 42 /**
16 * fileName if Empty we will use the default path 43 * fileName if Empty we will use the default path
17 */ 44 */
18 OTodoAccessXML( const QString& appName, 45 OTodoAccessXML( const QString& appName,
19 const QString& fileName = QString::null ); 46 const QString& fileName = QString::null );
20 ~OTodoAccessXML(); 47 ~OTodoAccessXML();
21 48
22 bool load(); 49 bool load();
23 bool reload(); 50 bool reload();
24 bool save(); 51 bool save();
25 52
26 QArray<int> allRecords()const; 53 QArray<int> allRecords()const;
27 QArray<int> matchRegexp(const QRegExp &r) const; 54 QArray<int> matchRegexp(const QRegExp &r) const;
@@ -44,17 +71,19 @@ public:
44private: 71private:
45 static QBitArray sup(); 72 static QBitArray sup();
46 void todo( QAsciiDict<int>*, OTodo&,const QCString&,const QString& ); 73 void todo( QAsciiDict<int>*, OTodo&,const QCString&,const QString& );
47 QString toString( const OTodo& )const; 74 QString toString( const OTodo& )const;
48 QString toString( const QArray<int>& ints ) const; 75 QString toString( const QArray<int>& ints ) const;
49 QMap<int, OTodo> m_events; 76 QMap<int, OTodo> m_events;
50 QString m_file; 77 QString m_file;
51 QString m_app; 78 QString m_app;
52 bool m_opened : 1; 79 bool m_opened : 1;
53 bool m_changed : 1; 80 bool m_changed : 1;
54 class OTodoAccessXMLPrivate; 81 class OTodoAccessXMLPrivate;
55 OTodoAccessXMLPrivate* d; 82 OTodoAccessXMLPrivate* d;
56 int m_year, m_month, m_day; 83 int m_year, m_month, m_day;
57 84
58}; 85};
59 86
87};
88
60#endif 89#endif
diff --git a/libopie2/opiepim/core/core.pro b/libopie2/opiepim/core/core.pro
new file mode 100644
index 0000000..dae37f1
--- a/dev/null
+++ b/libopie2/opiepim/core/core.pro
@@ -0,0 +1,21 @@
1HEADERS += core/oconversion.h \
2 core/opimcache.h \
3 core/opimmaintainer.h \
4 core/opimresolver.h \
5 core/opimstate.h \
6 core/opimxref.h \
7 core/opimxrefmanager.h \
8 core/opimxrefpartner.h \
9 core/orecur.h \
10 core/otemplatebase.h \
11 core/otimezone.h \
12
13SOURCES += core/oconversion.cpp \
14 core/opimmaintainer.cpp \
15 core/opimresolver.cpp \
16 core/opimstate.cpp \
17 core/opimxref.cpp \
18 core/opimxrefmanager.cpp \
19 core/opimxrefpartner.cpp \
20 core/orecur.cpp \
21 core/otimezone.cpp \
diff --git a/libopie2/opiepim/core/ocontactaccess.cpp b/libopie2/opiepim/core/ocontactaccess.cpp
index 2e3ec1f..f67a40c 100644
--- a/libopie2/opiepim/core/ocontactaccess.cpp
+++ b/libopie2/opiepim/core/ocontactaccess.cpp
@@ -1,90 +1,72 @@
1/* 1/*
2 * Class to manage the Contacts. 2 This file is part of the Opie Project
3 * 3 Copyright (C) The Main Author <main-author@whereever.org>
4 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 * 5 .=l.
6 * ===================================================================== 6 .>+-=
7 *This program is free software; you can redistribute it and/or 7 _;:, .> :=|. This program is free software; you can
8 *modify it under the terms of the GNU Library General Public 8.> <`_, > . <= redistribute it and/or modify it under
9 * License as published by the Free Software Foundation; either 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10 * version 2 of the License, or (at your option) any later version. 10.="- .-=="i, .._ License as published by the Free Software
11 * ===================================================================== 11 - . .-<_> .<> Foundation; either version 2 of the License,
12 * Info: This class could just work with a change in the header-file 12 ._= =} : or (at your option) any later version.
13 * of the Contact class ! Therefore our libopie only compiles 13 .%`+i> _;_.
14 * with our version of libqpe 14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29/*
15 * ===================================================================== 30 * =====================================================================
16 * ToDo: XML-Backend: Automatic reload if something was changed... 31 * ToDo: XML-Backend: Automatic reload if something was changed...
17 * 32 *
18 * 33 *
19 * =====================================================================
20 * Version: $Id$
21 * =====================================================================
22 * History:
23 * $Log$
24 * Revision 1.8 2003/05/08 13:55:09 tille
25 * search stuff
26 * and match, toRichText & toShortText in oevent
27 *
28 * Revision 1.7 2002/11/13 14:14:51 eilers
29 * Added sorted for Contacts..
30 *
31 * Revision 1.6 2002/11/01 15:10:42 eilers
32 * Added regExp-search in database for all fields in a contact.
33 *
34 * Revision 1.5 2002/10/16 10:52:40 eilers
35 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
36 *
37 * Revision 1.4 2002/10/14 16:21:54 eilers
38 * Some minor interface updates
39 *
40 * Revision 1.3 2002/10/07 17:34:24 eilers
41 * added OBackendFactory for advanced backend access
42 *
43 * Revision 1.2 2002/10/02 16:18:11 eilers
44 * debugged and seems to work almost perfectly ..
45 *
46 * Revision 1.1 2002/09/27 17:11:44 eilers
47 * Added API for accessing the Contact-Database ! It is compiling, but
48 * please do not expect that anything is working !
49 * I will debug that stuff in the next time ..
50 * Please read README_COMPILE for compiling !
51 *
52 *
53 */ 34 */
54 35
55#include "ocontactaccess.h" 36#include "ocontactaccess.h"
56#include "obackendfactory.h" 37#include "obackendfactory.h"
57 38
58#include <qasciidict.h> 39#include <qasciidict.h>
59#include <qdatetime.h> 40#include <qdatetime.h>
60#include <qfile.h> 41#include <qfile.h>
61#include <qregexp.h> 42#include <qregexp.h>
62#include <qlist.h> 43#include <qlist.h>
63#include <qcopchannel_qws.h> 44#include <qcopchannel_qws.h>
64 45
65//#include <qpe/qcopenvelope_qws.h> 46//#include <qpe/qcopenvelope_qws.h>
66#include <qpe/global.h> 47#include <qpe/global.h>
67 48
68#include <errno.h> 49#include <errno.h>
69#include <fcntl.h> 50#include <fcntl.h>
70#include <unistd.h> 51#include <unistd.h>
71#include <stdlib.h> 52#include <stdlib.h>
72 53
73#include "ocontactaccessbackend_xml.h" 54#include <opie2/ocontactaccessbackend_xml.h>
74 55
56namespace Opie {
75 57
76OContactAccess::OContactAccess ( const QString appname, const QString , 58OContactAccess::OContactAccess ( const QString appname, const QString ,
77 OContactAccessBackend* end, bool autosync ): 59 OContactAccessBackend* end, bool autosync ):
78 OPimAccessTemplate<OContact>( end ) 60 OPimAccessTemplate<OContact>( end )
79{ 61{
80 /* take care of the backend. If there is no one defined, we 62 /* take care of the backend. If there is no one defined, we
81 * will use the XML-Backend as default (until we have a cute SQL-Backend..). 63 * will use the XML-Backend as default (until we have a cute SQL-Backend..).
82 */ 64 */
83 if( end == 0 ) { 65 if( end == 0 ) {
84 qWarning ("Using BackendFactory !"); 66 qWarning ("Using BackendFactory !");
85 end = OBackendFactory<OContactAccessBackend>::Default( "contact", appname ); 67 end = OBackendFactory<OContactAccessBackend>::Default( "contact", appname );
86 } 68 }
87 // Set backend locally and in template 69 // Set backend locally and in template
88 m_backEnd = end; 70 m_backEnd = end;
89 OPimAccessTemplate<OContact>::setBackEnd (end); 71 OPimAccessTemplate<OContact>::setBackEnd (end);
90 72
@@ -153,16 +135,18 @@ bool OContactAccess::wasChangedExternally()const
153 135
154 136
155void OContactAccess::copMessage( const QCString &msg, const QByteArray & ) 137void OContactAccess::copMessage( const QCString &msg, const QByteArray & )
156{ 138{
157 if ( msg == "addressbookUpdated()" ){ 139 if ( msg == "addressbookUpdated()" ){
158 qWarning ("OContactAccess: Received addressbokUpdated()"); 140 qWarning ("OContactAccess: Received addressbokUpdated()");
159 emit signalChanged ( this ); 141 emit signalChanged ( this );
160 } else if ( msg == "flush()" ) { 142 } else if ( msg == "flush()" ) {
161 qWarning ("OContactAccess: Received flush()"); 143 qWarning ("OContactAccess: Received flush()");
162 save (); 144 save ();
163 } else if ( msg == "reload()" ) { 145 } else if ( msg == "reload()" ) {
164 qWarning ("OContactAccess: Received reload()"); 146 qWarning ("OContactAccess: Received reload()");
165 reload (); 147 reload ();
166 emit signalChanged ( this ); 148 emit signalChanged ( this );
167 } 149 }
168} 150}
151
152}
diff --git a/libopie2/opiepim/core/ocontactaccess.h b/libopie2/opiepim/core/ocontactaccess.h
index bd6da40..505c87b 100644
--- a/libopie2/opiepim/core/ocontactaccess.h
+++ b/libopie2/opiepim/core/ocontactaccess.h
@@ -1,102 +1,64 @@
1/* 1/*
2 * Class to manage the Contacts. 2 This file is part of the Opie Project
3 * 3 Copyright (C) The Main Author <main-author@whereever.org>
4 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 * Copyright (c) 2002 by Holger Freyther (zecke@handhelds.org) 5 .=l.
6 * 6 .>+-=
7 * ===================================================================== 7 _;:, .> :=|. This program is free software; you can
8 *This program is free software; you can redistribute it and/or 8.> <`_, > . <= redistribute it and/or modify it under
9 *modify it under the terms of the GNU Library General Public 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; 10.="- .-=="i, .._ License as published by the Free Software
11 * either version 2 of the License, or (at your option) any later 11 - . .-<_> .<> Foundation; either version 2 of the License,
12 * version. 12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29/*
13 * ===================================================================== 30 * =====================================================================
14 * ToDo: Define enum for query settings 31 * ToDo: Define enum for query settings
15 * ===================================================================== 32 * =====================================================================
16 * Version: $Id$
17 * =====================================================================
18 * History:
19 * $Log$
20 * Revision 1.10 2003/12/22 10:19:26 eilers
21 * Finishing implementation of sql-backend for datebook. But I have to
22 * port the PIM datebook application to use it, before I could debug the
23 * whole stuff.
24 * Thus, PIM-Database backend is finished, but highly experimental. And some
25 * parts are still generic. For instance, the "queryByExample()" methods are
26 * not (or not fully) implemented. Todo: custom-entries not stored.
27 * The big show stopper: matchRegExp() (needed by OpieSearch) needs regular
28 * expression search in the database, which is not supported by sqlite !
29 * Therefore we need either an extended sqlite or a workaround which would
30 * be very slow and memory consuming..
31 *
32 * Revision 1.9 2003/08/01 12:30:16 eilers
33 * Merging changes from BRANCH_1_0 to HEAD
34 *
35 * Revision 1.8.2.1 2003/06/30 14:34:19 eilers
36 * Patches from Zecke:
37 * Fixing and cleaning up extraMap handling
38 * Adding d_ptr for binary compatibility in the future
39 *
40 * Revision 1.8 2003/05/08 13:55:09 tille
41 * search stuff
42 * and match, toRichText & toShortText in oevent
43 *
44 * Revision 1.7 2003/04/13 18:07:10 zecke
45 * More API doc
46 * QString -> const QString&
47 * QString = 0l -> QString::null
48 *
49 * Revision 1.6 2003/01/02 14:27:12 eilers
50 * Improved query by example: Search by date is possible.. First step
51 * for a today plugin for birthdays..
52 *
53 * Revision 1.5 2002/11/13 14:14:51 eilers
54 * Added sorted for Contacts..
55 *
56 * Revision 1.4 2002/11/01 15:10:42 eilers
57 * Added regExp-search in database for all fields in a contact.
58 *
59 * Revision 1.3 2002/10/16 10:52:40 eilers
60 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
61 *
62 * Revision 1.2 2002/10/14 16:21:54 eilers
63 * Some minor interface updates
64 *
65 * Revision 1.1 2002/09/27 17:11:44 eilers
66 * Added API for accessing the Contact-Database ! It is compiling, but
67 * please do not expect that anything is working !
68 * I will debug that stuff in the next time ..
69 * Please read README_COMPILE for compiling !
70 *
71 * =====================================================================
72 */ 33 */
73#ifndef _OCONTACTACCESS_H 34#ifndef _OCONTACTACCESS_H
74#define _OCONTACTACCESS_H 35#define _OCONTACTACCESS_H
75 36
76#include <qobject.h> 37#include <qobject.h>
77 38
78#include <qpe/qcopenvelope_qws.h> 39#include <qpe/qcopenvelope_qws.h>
79 40
80#include <qvaluelist.h> 41#include <qvaluelist.h>
81#include <qfileinfo.h> 42#include <qfileinfo.h>
82 43
83#include "ocontact.h" 44#include <opie2/ocontact.h>
84#include "ocontactaccessbackend.h" 45#include <opie2/ocontactaccessbackend.h>
85#include "opimaccesstemplate.h" 46#include <opie2/opimaccesstemplate.h>
86 47
48namespace Opie {
87/** 49/**
88 * Class to access the contacts database. 50 * Class to access the contacts database.
89 * This is just a frontend for the real database handling which is 51 * This is just a frontend for the real database handling which is
90 * done by the backend. 52 * done by the backend.
91 * This class is used to access the Contacts on a system. This class as any OPIE PIM 53 * This class is used to access the Contacts on a system. This class as any OPIE PIM
92 * class is backend independent. 54 * class is backend independent.
93 * @author Stefan Eilers, Holger Freyther 55 * @author Stefan Eilers, Holger Freyther
94 * @see OPimAccessTemplate 56 * @see OPimAccessTemplate
95 */ 57 */
96class OContactAccess: public QObject, public OPimAccessTemplate<OContact> 58class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
97{ 59{
98 Q_OBJECT 60 Q_OBJECT
99 61
100 public: 62 public:
101 /** 63 /**
102 * Create Database with contacts (addressbook). 64 * Create Database with contacts (addressbook).
@@ -177,17 +139,20 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
177 139
178 140
179 private: 141 private:
180 // class OContactAccessPrivate; 142 // class OContactAccessPrivate;
181 // OContactAccessPrivate* d; 143 // OContactAccessPrivate* d;
182 OContactAccessBackend *m_backEnd; 144 OContactAccessBackend *m_backEnd;
183 bool m_loading:1; 145 bool m_loading:1;
184 146
185 private slots: 147 private slots:
186 void copMessage( const QCString &msg, const QByteArray &data ); 148 void copMessage( const QCString &msg, const QByteArray &data );
187 149
188 private: 150 private:
189 class Private; 151 class Private;
190 Private *d; 152 Private *d;
191 153
192}; 154};
155
156}
157
193#endif 158#endif
diff --git a/libopie2/opiepim/core/oconversion.cpp b/libopie2/opiepim/core/oconversion.cpp
index 0d15414..b7eebef 100644
--- a/libopie2/opiepim/core/oconversion.cpp
+++ b/libopie2/opiepim/core/oconversion.cpp
@@ -1,33 +1,51 @@
1/********************************************************************** 1/*
2** Copyright (C) 2003 by Stefan Eilers (eilers.stefan@epost.de) 2 This file is part of the Opie Project
3** 3 Copyright (C) The Main Author <main-author@whereever.org>
4** This file may be distributed and/or modified under the terms of the 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5** GNU Lesser General Public License version 2 as published by the Free Software 5 .=l.
6** Foundation and appearing in the file LICENSE.GPL included in the 6 .>+-=
7** packaging of this file. 7 _;:, .> :=|. This program is free software; you can
8** 8.> <`_, > . <= redistribute it and/or modify it under
9** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 10.="- .-=="i, .._ License as published by the Free Software
11** 11 - . .-<_> .<> Foundation; either version 2 of the License,
12**********************************************************************/ 12 ._= =} : or (at your option) any later version.
13 13 .%`+i> _;_.
14#include "oconversion.h" 14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
30#include <opie2/oconversion.h>
15#include <qpe/timeconversion.h> 31#include <qpe/timeconversion.h>
16 32
17 33
34namespace Opie {
35
18QString OConversion::dateToString( const QDate &d ) 36QString OConversion::dateToString( const QDate &d )
19{ 37{
20 if ( d.isNull() || !d.isValid() ) 38 if ( d.isNull() || !d.isValid() )
21 return QString::null; 39 return QString::null;
22 40
23 // ISO format in year, month, day (YYYYMMDD); e.g. 20021231 41 // ISO format in year, month, day (YYYYMMDD); e.g. 20021231
24 QString year = QString::number( d.year() ); 42 QString year = QString::number( d.year() );
25 QString month = QString::number( d.month() ); 43 QString month = QString::number( d.month() );
26 month = month.rightJustify( 2, '0' ); 44 month = month.rightJustify( 2, '0' );
27 QString day = QString::number( d.day() ); 45 QString day = QString::number( d.day() );
28 day = day.rightJustify( 2, '0' ); 46 day = day.rightJustify( 2, '0' );
29 47
30 QString str = year + month + day; 48 QString str = year + month + day;
31 //qDebug( "\tPimContact dateToStr = %s", str.latin1() ); 49 //qDebug( "\tPimContact dateToStr = %s", str.latin1() );
32 50
33 return str; 51 return str;
@@ -98,16 +116,17 @@ QString OConversion::dateTimeToString( const QDateTime& dt ) {
98QDateTime OConversion::dateTimeFromString( const QString& str) { 116QDateTime OConversion::dateTimeFromString( const QString& str) {
99 117
100 if ( str.isEmpty() ) return QDateTime(); 118 if ( str.isEmpty() ) return QDateTime();
101 int day = str.mid(0, 2).toInt(); 119 int day = str.mid(0, 2).toInt();
102 int month = str.mid(2, 2).toInt(); 120 int month = str.mid(2, 2).toInt();
103 int year = str.mid(4, 4).toInt(); 121 int year = str.mid(4, 4).toInt();
104 int hour = str.mid(8, 2).toInt(); 122 int hour = str.mid(8, 2).toInt();
105 int min = str.mid(10, 2).toInt(); 123 int min = str.mid(10, 2).toInt();
106 int sec = str.mid(12, 2).toInt(); 124 int sec = str.mid(12, 2).toInt();
107 125
108 QDate date( year, month, day ); 126 QDate date( year, month, day );
109 QTime time( hour, min, sec ); 127 QTime time( hour, min, sec );
110 QDateTime dt( date, time ); 128 QDateTime dt( date, time );
111 return dt; 129 return dt;
112} 130}
113 131
132} \ No newline at end of file
diff --git a/libopie2/opiepim/core/oconversion.h b/libopie2/opiepim/core/oconversion.h
index 4c0a497..3c4fdf3 100644
--- a/libopie2/opiepim/core/oconversion.h
+++ b/libopie2/opiepim/core/oconversion.h
@@ -1,48 +1,62 @@
1/********************************************************************** 1/*
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2 This file is part of the Opie Project
3** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de) 3 Copyright (C) The Main Author <main-author@whereever.org>
4** 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5** This file may be distributed and/or modified under the terms of the 5 .=l.
6** GNU General Public License version 2 as published by the Free Software 6 .>+-=
7** Foundation and appearing in the file LICENSE.GPL included in the 7 _;:, .> :=|. This program is free software; you can
8** packaging of this file. 8.> <`_, > . <= redistribute it and/or modify it under
9** 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10.="- .-=="i, .._ License as published by the Free Software
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11 - . .-<_> .<> Foundation; either version 2 of the License,
12** 12 ._= =} : or (at your option) any later version.
13** See http://www.trolltech.com/gpl/ for GPL licensing information. 13 .%`+i> _;_.
14** 14 .i_,=:_. -<s. This program is distributed in the hope that
15** Contact info@trolltech.com if any conditions of this licensing are 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16** not clear to you. 16 : .. .:, . . . without even the implied warranty of
17**********************************************************************/ 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
18 29
19#ifndef __oconversion_h__ 30#ifndef __oconversion_h__
20#define __oconversion_h__ 31#define __oconversion_h__
21 32
22/* #include <time.h> */ 33/* #include <time.h> */
23/* #include <sys/types.h> */ 34/* #include <sys/types.h> */
24#include <qdatetime.h> 35#include <qdatetime.h>
25 36
26/* FIXME namespace? -zecke */ 37namespace Opie {
38
27class OConversion 39class OConversion
28{ 40{
29public: 41public:
30 static QString dateToString( const QDate &d ); 42 static QString dateToString( const QDate &d );
31 static QDate dateFromString( const QString &datestr ); 43 static QDate dateFromString( const QString &datestr );
32 44
33 /** 45 /**
34 * simple function to store DateTime as string and read from string 46 * simple function to store DateTime as string and read from string
35 * no timezone changing is done 47 * no timezone changing is done
36 * DDMMYYYYHHMMSS is the simple format 48 * DDMMYYYYHHMMSS is the simple format
37 */ 49 */
38 static QString dateTimeToString( const QDateTime& ); 50 static QString dateTimeToString( const QDateTime& );
39 static QDateTime dateTimeFromString( const QString& ); 51 static QDateTime dateTimeFromString( const QString& );
40 52
41private: 53private:
42 class Private; 54 class Private;
43 Private* d; 55 Private* d;
44 56
45}; 57};
46 58
59}
60
47#endif // __oconversion_h__ 61#endif // __oconversion_h__
48 62
diff --git a/libopie2/opiepim/core/odatebookaccess.cpp b/libopie2/opiepim/core/odatebookaccess.cpp
index d95fed6..8c527f6 100644
--- a/libopie2/opiepim/core/odatebookaccess.cpp
+++ b/libopie2/opiepim/core/odatebookaccess.cpp
@@ -1,19 +1,48 @@
1#include "obackendfactory.h" 1/*
2#include "odatebookaccess.h" 2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29#include <opie2/obackendfactory.h>
30#include <opie2/odatebookaccess.h>
3 31
32namespace Opie {
4/** 33/**
5 * Simple constructor 34 * Simple constructor
6 * It takes a ODateBookAccessBackend as parent. If it is 0 the default implementation 35 * It takes a ODateBookAccessBackend as parent. If it is 0 the default implementation
7 * will be used! 36 * will be used!
8 * @param back The backend to be used or 0 for the default backend 37 * @param back The backend to be used or 0 for the default backend
9 * @param ac What kind of access is intended 38 * @param ac What kind of access is intended
10 */ 39 */
11ODateBookAccess::ODateBookAccess( ODateBookAccessBackend* back, enum Access ac ) 40ODateBookAccess::ODateBookAccess( ODateBookAccessBackend* back, enum Access ac )
12 : OPimAccessTemplate<OEvent>( back ) 41 : OPimAccessTemplate<OEvent>( back )
13{ 42{
14 if (!back ) 43 if (!back )
15 back = OBackendFactory<ODateBookAccessBackend>::Default("datebook", QString::null ); 44 back = OBackendFactory<ODateBookAccessBackend>::Default("datebook", QString::null );
16 45
17 m_backEnd = back; 46 m_backEnd = back;
18 setBackEnd( m_backEnd ); 47 setBackEnd( m_backEnd );
19} 48}
@@ -66,16 +95,18 @@ OEffectiveEvent::ValueList ODateBookAccess::effectiveEvents( const QDateTime& st
66} 95}
67 96
68/** 97/**
69 * @return non repeating dates in the time span between from and to 98 * @return non repeating dates in the time span between from and to
70 * @param from Include all events from... 99 * @param from Include all events from...
71 * @param to Include all events to... 100 * @param to Include all events to...
72 */ 101 */
73OEffectiveEvent::ValueList ODateBookAccess::effectiveNonRepeatingEvents( const QDate& from, const QDate& to ) const { 102OEffectiveEvent::ValueList ODateBookAccess::effectiveNonRepeatingEvents( const QDate& from, const QDate& to ) const {
74 return m_backEnd->effectiveNonRepeatingEvents( from, to ); 103 return m_backEnd->effectiveNonRepeatingEvents( from, to );
75} 104}
76/** 105/**
77 * @return all non repeating events at a given datetime 106 * @return all non repeating events at a given datetime
78 */ 107 */
79OEffectiveEvent::ValueList ODateBookAccess::effectiveNonRepeatingEvents( const QDateTime& start ) const { 108OEffectiveEvent::ValueList ODateBookAccess::effectiveNonRepeatingEvents( const QDateTime& start ) const {
80 return m_backEnd->effectiveNonRepeatingEvents( start ); 109 return m_backEnd->effectiveNonRepeatingEvents( start );
81} 110}
111
112}
diff --git a/libopie2/opiepim/core/odatebookaccess.h b/libopie2/opiepim/core/odatebookaccess.h
index 62196da..38dc754 100644
--- a/libopie2/opiepim/core/odatebookaccess.h
+++ b/libopie2/opiepim/core/odatebookaccess.h
@@ -1,24 +1,53 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_DATE_BOOK_ACCESS_H 29#ifndef OPIE_DATE_BOOK_ACCESS_H
2#define OPIE_DATE_BOOK_ACCESS_H 30#define OPIE_DATE_BOOK_ACCESS_H
3 31
4#include "odatebookaccessbackend.h" 32#include "odatebookaccessbackend.h"
5#include "opimaccesstemplate.h" 33#include "opimaccesstemplate.h"
6 34
7#include "oevent.h" 35#include <opie2/oevent.h>
8 36
37namespace Opie {
9/** 38/**
10 * This is the object orientated datebook database. It'll use OBackendFactory 39 * This is the object orientated datebook database. It'll use OBackendFactory
11 * to query for a backend. 40 * to query for a backend.
12 * All access to the datebook should be done via this class. 41 * All access to the datebook should be done via this class.
13 * Make sure to load and save the datebook this is not part of 42 * Make sure to load and save the datebook this is not part of
14 * destructing and creating the object 43 * destructing and creating the object
15 * 44 *
16 * @author Holger Freyther, Stefan Eilers 45 * @author Holger Freyther, Stefan Eilers
17 */ 46 */
18class ODateBookAccess : public OPimAccessTemplate<OEvent> { 47class ODateBookAccess : public OPimAccessTemplate<OEvent> {
19public: 48public:
20 ODateBookAccess( ODateBookAccessBackend* = 0l, enum Access acc = Random ); 49 ODateBookAccess( ODateBookAccessBackend* = 0l, enum Access acc = Random );
21 ~ODateBookAccess(); 50 ~ODateBookAccess();
22 51
23 /* return all events */ 52 /* return all events */
24 List rawEvents()const; 53 List rawEvents()const;
@@ -28,17 +57,19 @@ public:
28 57
29 /* return non repeating events */ 58 /* return non repeating events */
30 List nonRepeats()const; 59 List nonRepeats()const;
31 60
32 /* return non repeating events (from,to) */ 61 /* return non repeating events (from,to) */
33 OEffectiveEvent::ValueList effectiveEvents( const QDate& from, const QDate& to ) const; 62 OEffectiveEvent::ValueList effectiveEvents( const QDate& from, const QDate& to ) const;
34 OEffectiveEvent::ValueList effectiveEvents( const QDateTime& start ) const; 63 OEffectiveEvent::ValueList effectiveEvents( const QDateTime& start ) const;
35 OEffectiveEvent::ValueList effectiveNonRepeatingEvents( const QDate& from, const QDate& to ) const; 64 OEffectiveEvent::ValueList effectiveNonRepeatingEvents( const QDate& from, const QDate& to ) const;
36 OEffectiveEvent::ValueList effectiveNonRepeatingEvents( const QDateTime& start ) const; 65 OEffectiveEvent::ValueList effectiveNonRepeatingEvents( const QDateTime& start ) const;
37 66
38private: 67private:
39 ODateBookAccessBackend* m_backEnd; 68 ODateBookAccessBackend* m_backEnd;
40 class Private; 69 class Private;
41 Private* d; 70 Private* d;
42}; 71};
43 72
73}
74
44#endif 75#endif
diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h
index ecbeb68..5826cbc 100644
--- a/libopie2/opiepim/core/opimaccesstemplate.h
+++ b/libopie2/opiepim/core/opimaccesstemplate.h
@@ -1,27 +1,57 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_PIM_ACCESS_TEMPLATE_H 29#ifndef OPIE_PIM_ACCESS_TEMPLATE_H
2#define OPIE_PIM_ACCESS_TEMPLATE_H 30#define OPIE_PIM_ACCESS_TEMPLATE_H
3 31
4#include <qarray.h> 32#include <qarray.h>
5 33
6#include <opie/opimrecord.h> 34#include <opie2/opimrecord.h>
7#include <opie/opimaccessbackend.h> 35#include <opie2/opimaccessbackend.h>
8#include <opie/orecordlist.h> 36#include <opie2/orecordlist.h>
9 37
10#include "opimcache.h" 38#include <opie2/opimcache.h>
11#include "otemplatebase.h" 39#include <opie2/otemplatebase.h>
40
41namespace Opie {
12 42
13class OPimAccessTemplatePrivate; 43class OPimAccessTemplatePrivate;
14/** 44/**
15 * Thats the frontend to our OPIE PIM 45 * Thats the frontend to our OPIE PIM
16 * Library. Either you want to use it's 46 * Library. Either you want to use it's
17 * interface or you want to implement 47 * interface or you want to implement
18 * your own Access lib 48 * your own Access lib
19 * Just create a OPimRecord and inherit from 49 * Just create a OPimRecord and inherit from
20 * the plugins 50 * the plugins
21 */ 51 */
22 52
23template <class T = OPimRecord > 53template <class T = OPimRecord >
24class OPimAccessTemplate : public OTemplateBase<T> { 54class OPimAccessTemplate : public OTemplateBase<T> {
25public: 55public:
26 enum Access { 56 enum Access {
27 Random = 0, 57 Random = 0,
@@ -286,17 +316,20 @@ void OPimAccessTemplate<T>::setBackEnd( BackEnd* end ) {
286 if (m_backEnd ) 316 if (m_backEnd )
287 m_backEnd->setFrontend( this ); 317 m_backEnd->setFrontend( this );
288} 318}
289template <class T> 319template <class T>
290void OPimAccessTemplate<T>::cache( const T& t ) const{ 320void OPimAccessTemplate<T>::cache( const T& t ) const{
291 /* hacky we need to work around the const*/ 321 /* hacky we need to work around the const*/
292 ((OPimAccessTemplate<T>*)this)->m_cache.add( t ); 322 ((OPimAccessTemplate<T>*)this)->m_cache.add( t );
293} 323}
294template <class T> 324template <class T>
295void OPimAccessTemplate<T>::setSaneCacheSize( int size ) { 325void OPimAccessTemplate<T>::setSaneCacheSize( int size ) {
296 m_cache.setSize( size ); 326 m_cache.setSize( size );
297} 327}
298template <class T> 328template <class T>
299void OPimAccessTemplate<T>::setReadAhead( uint count ) { 329void OPimAccessTemplate<T>::setReadAhead( uint count ) {
300 m_backEnd->setReadAhead( count ); 330 m_backEnd->setReadAhead( count );
301} 331}
332
333}
334
302#endif 335#endif
diff --git a/libopie2/opiepim/core/opimcache.h b/libopie2/opiepim/core/opimcache.h
index 7f7cff5..e70a910 100644
--- a/libopie2/opiepim/core/opimcache.h
+++ b/libopie2/opiepim/core/opimcache.h
@@ -1,23 +1,52 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_PIM_CACHE_H 29#ifndef OPIE_PIM_CACHE_H
2#define OPIE_PIM_CACHE_H 30#define OPIE_PIM_CACHE_H
3 31
4#include <qintcache.h> 32#include <qintcache.h>
5 33
6#include "opimrecord.h" 34#include <opie2/opimrecord.h>
7 35
36namespace Opie {
8class OPimCacheItemPrivate; 37class OPimCacheItemPrivate;
9 38
10template <class T = OPimRecord> 39template <class T = OPimRecord>
11class OPimCacheItem { 40class OPimCacheItem {
12public: 41public:
13 OPimCacheItem( const T& t = T() ); 42 OPimCacheItem( const T& t = T() );
14 OPimCacheItem( const OPimCacheItem& ); 43 OPimCacheItem( const OPimCacheItem& );
15 ~OPimCacheItem(); 44 ~OPimCacheItem();
16 45
17 OPimCacheItem &operator=( const OPimCacheItem& ); 46 OPimCacheItem &operator=( const OPimCacheItem& );
18 47
19 T record()const; 48 T record()const;
20 void setRecord( const T& ); 49 void setRecord( const T& );
21private: 50private:
22 T m_t; 51 T m_t;
23 OPimCacheItemPrivate *d; 52 OPimCacheItemPrivate *d;
@@ -115,17 +144,19 @@ void OPimCache<T>::add( const T& t ) {
115 it = new Item( t ); 144 it = new Item( t );
116 if (!m_cache.insert( t.uid(), it ) ) 145 if (!m_cache.insert( t.uid(), it ) )
117 delete it; 146 delete it;
118} 147}
119template <class T> 148template <class T>
120void OPimCache<T>::remove( int uid ) { 149void OPimCache<T>::remove( int uid ) {
121 m_cache.remove( uid ); 150 m_cache.remove( uid );
122} 151}
123template <class T> 152template <class T>
124void OPimCache<T>::replace( const T& t) { 153void OPimCache<T>::replace( const T& t) {
125 Item *it = m_cache.find( t.uid() ); 154 Item *it = m_cache.find( t.uid() );
126 if ( it ) { 155 if ( it ) {
127 it->setRecord( t ); 156 it->setRecord( t );
128 } 157 }
129} 158}
130 159
160}
161
131#endif 162#endif
diff --git a/libopie2/opiepim/core/opimmaintainer.cpp b/libopie2/opiepim/core/opimmaintainer.cpp
index 92cb25a..b2eff12 100644
--- a/libopie2/opiepim/core/opimmaintainer.cpp
+++ b/libopie2/opiepim/core/opimmaintainer.cpp
@@ -1,18 +1,48 @@
1#include "opimmaintainer.h" 1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
2 29
30#include <opie2/opimmaintainer.h>
31
32namespace Opie {
3OPimMaintainer::OPimMaintainer( int mode, int uid ) 33OPimMaintainer::OPimMaintainer( int mode, int uid )
4 : m_mode(mode), m_uid(uid ) 34 : m_mode(mode), m_uid(uid )
5{} 35{}
6OPimMaintainer::~OPimMaintainer() { 36OPimMaintainer::~OPimMaintainer() {
7} 37}
8OPimMaintainer::OPimMaintainer( const OPimMaintainer& main ) { 38OPimMaintainer::OPimMaintainer( const OPimMaintainer& main ) {
9 *this = main; 39 *this = main;
10} 40}
11OPimMaintainer &OPimMaintainer::operator=( const OPimMaintainer& main ) { 41OPimMaintainer &OPimMaintainer::operator=( const OPimMaintainer& main ) {
12 m_mode = main.m_mode; 42 m_mode = main.m_mode;
13 m_uid = main.m_uid; 43 m_uid = main.m_uid;
14 44
15 return *this; 45 return *this;
16} 46}
17bool OPimMaintainer::operator==( const OPimMaintainer& main ) { 47bool OPimMaintainer::operator==( const OPimMaintainer& main ) {
18 if (m_mode != main.m_mode ) return false; 48 if (m_mode != main.m_mode ) return false;
@@ -22,16 +52,18 @@ bool OPimMaintainer::operator==( const OPimMaintainer& main ) {
22} 52}
23bool OPimMaintainer::operator!=( const OPimMaintainer& main ) { 53bool OPimMaintainer::operator!=( const OPimMaintainer& main ) {
24 return !(*this == main ); 54 return !(*this == main );
25} 55}
26int OPimMaintainer::mode()const { 56int OPimMaintainer::mode()const {
27 return m_mode; 57 return m_mode;
28} 58}
29int OPimMaintainer::uid()const { 59int OPimMaintainer::uid()const {
30 return m_uid; 60 return m_uid;
31} 61}
32void OPimMaintainer::setMode( int mo) { 62void OPimMaintainer::setMode( int mo) {
33 m_mode = mo; 63 m_mode = mo;
34} 64}
35void OPimMaintainer::setUid( int uid ) { 65void OPimMaintainer::setUid( int uid ) {
36 m_uid = uid; 66 m_uid = uid;
37} 67}
68
69}
diff --git a/libopie2/opiepim/core/opimmaintainer.h b/libopie2/opiepim/core/opimmaintainer.h
index 793d066..46bc9d2 100644
--- a/libopie2/opiepim/core/opimmaintainer.h
+++ b/libopie2/opiepim/core/opimmaintainer.h
@@ -1,21 +1,50 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_PIM_MAINTAINER_H 29#ifndef OPIE_PIM_MAINTAINER_H
2#define OPIE_PIM_MAINTAINER_H 30#define OPIE_PIM_MAINTAINER_H
3 31
4#include <qstring.h> 32#include <qstring.h>
5 33
34namespace Opie {
6/** 35/**
7 * Who maintains what? 36 * Who maintains what?
8 */ 37 */
9class OPimMaintainer { 38class OPimMaintainer {
10public: 39public:
11 enum Mode { Undefined = -1, 40 enum Mode { Undefined = -1,
12 Nothing = 0, 41 Nothing = 0,
13 Responsible, 42 Responsible,
14 DoneBy, 43 DoneBy,
15 Coordinating, 44 Coordinating,
16 }; 45 };
17 OPimMaintainer( int mode = Undefined, int uid = 0); 46 OPimMaintainer( int mode = Undefined, int uid = 0);
18 OPimMaintainer( const OPimMaintainer& ); 47 OPimMaintainer( const OPimMaintainer& );
19 ~OPimMaintainer(); 48 ~OPimMaintainer();
20 49
21 OPimMaintainer &operator=( const OPimMaintainer& ); 50 OPimMaintainer &operator=( const OPimMaintainer& );
@@ -24,17 +53,19 @@ public:
24 53
25 54
26 int mode()const; 55 int mode()const;
27 int uid()const; 56 int uid()const;
28 57
29 void setMode( int mode ); 58 void setMode( int mode );
30 void setUid( int uid ); 59 void setUid( int uid );
31 60
32private: 61private:
33 int m_mode; 62 int m_mode;
34 int m_uid; 63 int m_uid;
35 class Private; 64 class Private;
36 Private *d; 65 Private *d;
37 66
38}; 67};
39 68
69}
70
40#endif 71#endif
diff --git a/libopie2/opiepim/core/opimnotify.cpp b/libopie2/opiepim/core/opimnotify.cpp
index af5514b..c61f9da 100644
--- a/libopie2/opiepim/core/opimnotify.cpp
+++ b/libopie2/opiepim/core/opimnotify.cpp
@@ -1,19 +1,49 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#include <qshared.h> 29#include <qshared.h>
2 30
3#include "opimnotify.h" 31#include <opie2/opimnotify.h>
32
33namespace Opie {
4 34
5struct OPimNotify::Data : public QShared { 35struct OPimNotify::Data : public QShared {
6 Data() : QShared(),dur(-1),parent(0) { 36 Data() : QShared(),dur(-1),parent(0) {
7 37
8 } 38 }
9 QDateTime start; 39 QDateTime start;
10 int dur; 40 int dur;
11 QString application; 41 QString application;
12 int parent; 42 int parent;
13}; 43};
14 44
15OPimNotify::OPimNotify( const QDateTime& start, int duration, int parent ) { 45OPimNotify::OPimNotify( const QDateTime& start, int duration, int parent ) {
16 data = new Data; 46 data = new Data;
17 data->start = start; 47 data->start = start;
18 data->dur = duration; 48 data->dur = duration;
19 data->parent = parent; 49 data->parent = parent;
@@ -212,16 +242,17 @@ void OPimReminder::setRecordUid( int uid ) {
212 copyIntern(); 242 copyIntern();
213 data->record = uid; 243 data->record = uid;
214} 244}
215void OPimReminder::deref() { 245void OPimReminder::deref() {
216 if ( data->deref() ) { 246 if ( data->deref() ) {
217 delete data; 247 delete data;
218 data = 0l; 248 data = 0l;
219 } 249 }
220} 250}
221void OPimReminder::copyIntern() { 251void OPimReminder::copyIntern() {
222 if ( data->count != 1 ) { 252 if ( data->count != 1 ) {
223 Data* da = new Data; 253 Data* da = new Data;
224 da->record = data->record; 254 da->record = data->record;
225 data = da; 255 data = da;
226 } 256 }
227} 257}
258}
diff --git a/libopie2/opiepim/core/opimnotify.h b/libopie2/opiepim/core/opimnotify.h
index 58417db..fed3970 100644
--- a/libopie2/opiepim/core/opimnotify.h
+++ b/libopie2/opiepim/core/opimnotify.h
@@ -1,22 +1,52 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_PIM_NOTIFY_H 29#ifndef OPIE_PIM_NOTIFY_H
2#define OPIE_PIM_NOTIFY_H 30#define OPIE_PIM_NOTIFY_H
3 31
4#include <qdatetime.h> 32#include <qdatetime.h>
5#include <qvaluelist.h> 33#include <qvaluelist.h>
6 34
35
36namespace Opie {
7/** 37/**
8 * This is the base class of Notifiers. Possible 38 * This is the base class of Notifiers. Possible
9 * notifiers would be Alarms, Reminders 39 * notifiers would be Alarms, Reminders
10 * What they share is that they have 40 * What they share is that they have
11 * A DateTime, Type, Duration 41 * A DateTime, Type, Duration
12 * This is what this base class takes care of 42 * This is what this base class takes care of
13 * on top of that it's shared 43 * on top of that it's shared
14 */ 44 */
15/* 45/*
16 * TALK to eilers: have a class OPimDuration which sets the Duration 46 * TALK to eilers: have a class OPimDuration which sets the Duration
17 * given on the Due/Start Date? -zecke 47 * given on the Due/Start Date? -zecke
18 * discuss: do we need a uid for the notify? -zecke 48 * discuss: do we need a uid for the notify? -zecke
19 */ 49 */
20class OPimNotify { 50class OPimNotify {
21public: 51public:
22 typedef QValueList<OPimNotify> ValueList; 52 typedef QValueList<OPimNotify> ValueList;
@@ -128,17 +158,19 @@ public:
128 * the uid of the alarm 158 * the uid of the alarm
129 * inside the 'datebook' application 159 * inside the 'datebook' application
130 */ 160 */
131 int recordUid()const; 161 int recordUid()const;
132 void setRecordUid( int uid ); 162 void setRecordUid( int uid );
133 163
134private: 164private:
135 void deref(); 165 void deref();
136 void copyIntern(); 166 void copyIntern();
137 167
138 struct Data; 168 struct Data;
139 Data* data; 169 Data* data;
140 class Private; 170 class Private;
141 Private *d; 171 Private *d;
142}; 172};
143 173
174}
175
144#endif 176#endif
diff --git a/libopie2/opiepim/core/opimnotifymanager.cpp b/libopie2/opiepim/core/opimnotifymanager.cpp
index d6f0ead..1771fad 100644
--- a/libopie2/opiepim/core/opimnotifymanager.cpp
+++ b/libopie2/opiepim/core/opimnotifymanager.cpp
@@ -1,22 +1,52 @@
1#include "opimnotifymanager.h" 1/*
2 2 This file is part of the Opie Project
3#include "oconversion.h" 3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29#include <opie2/opimnotifymanager.h>
30
31#include <opie2/oconversion.h>
4 32
5#include <qstringlist.h> 33#include <qstringlist.h>
6 34
35namespace Opie {
36
7OPimNotifyManager::OPimNotifyManager( const Reminders& rem, const Alarms& al) 37OPimNotifyManager::OPimNotifyManager( const Reminders& rem, const Alarms& al)
8 : m_rem( rem ), m_al( al ) 38 : m_rem( rem ), m_al( al )
9{} 39{}
10OPimNotifyManager::~OPimNotifyManager() { 40OPimNotifyManager::~OPimNotifyManager() {
11} 41}
12/* use static_cast and type instead of dynamic... */ 42/* use static_cast and type instead of dynamic... */
13void OPimNotifyManager::add( const OPimNotify& noti) { 43void OPimNotifyManager::add( const OPimNotify& noti) {
14 if ( noti.type() == QString::fromLatin1("OPimReminder") ) { 44 if ( noti.type() == QString::fromLatin1("OPimReminder") ) {
15 const OPimReminder& rem = static_cast<const OPimReminder&>(noti); 45 const OPimReminder& rem = static_cast<const OPimReminder&>(noti);
16 m_rem.append( rem ); 46 m_rem.append( rem );
17 }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { 47 }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) {
18 const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); 48 const OPimAlarm& al = static_cast<const OPimAlarm&>(noti);
19 m_al.append( al ); 49 m_al.append( al );
20 } 50 }
21} 51}
22void OPimNotifyManager::remove( const OPimNotify& noti) { 52void OPimNotifyManager::remove( const OPimNotify& noti) {
@@ -147,16 +177,17 @@ void OPimNotifyManager::alarmsFromString( const QString& str )
147 OPimAlarm al( alarm[2].toInt(), OConversion::dateTimeFromString( alarm[0] ), 177 OPimAlarm al( alarm[2].toInt(), OConversion::dateTimeFromString( alarm[0] ),
148 alarm[1].toInt() ); 178 alarm[1].toInt() );
149 add( al ); 179 add( al );
150 } 180 }
151} 181}
152 182
153void OPimNotifyManager::remindersFromString( const QString& str ) 183void OPimNotifyManager::remindersFromString( const QString& str )
154{ 184{
155 185
156 QStringList rems = QStringList::split(";", str ); 186 QStringList rems = QStringList::split(";", str );
157 for (QStringList::Iterator it = rems.begin(); it != rems.end(); ++it ) { 187 for (QStringList::Iterator it = rems.begin(); it != rems.end(); ++it ) {
158 OPimReminder rem( (*it).toInt() ); 188 OPimReminder rem( (*it).toInt() );
159 add( rem ); 189 add( rem );
160 } 190 }
161 191
162} 192}
193}
diff --git a/libopie2/opiepim/core/opimnotifymanager.h b/libopie2/opiepim/core/opimnotifymanager.h
index f3c22f9..0272e5d 100644
--- a/libopie2/opiepim/core/opimnotifymanager.h
+++ b/libopie2/opiepim/core/opimnotifymanager.h
@@ -1,23 +1,52 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_PIM_NOTIFY_MANAGER_H 29#ifndef OPIE_PIM_NOTIFY_MANAGER_H
2#define OPIE_PIM_NOTIFY_MANAGER_H 30#define OPIE_PIM_NOTIFY_MANAGER_H
3 31
4#include <qvaluelist.h> 32#include <qvaluelist.h>
5 33
6#include <opie/opimnotify.h> 34#include <opie2/opimnotify.h>
7 35
36namespace Opie {
8/** 37/**
9 * The notify manager keeps track of the Notifiers.... 38 * The notify manager keeps track of the Notifiers....
10 */ 39 */
11class OPimNotifyManager { 40class OPimNotifyManager {
12public: 41public:
13 typedef QValueList<OPimReminder> Reminders; 42 typedef QValueList<OPimReminder> Reminders;
14 typedef QValueList<OPimAlarm> Alarms; 43 typedef QValueList<OPimAlarm> Alarms;
15 OPimNotifyManager( const Reminders& rems = Reminders(), const Alarms& alarms = Alarms() ); 44 OPimNotifyManager( const Reminders& rems = Reminders(), const Alarms& alarms = Alarms() );
16 ~OPimNotifyManager(); 45 ~OPimNotifyManager();
17 46
18 /* we will cast it for you ;) */ 47 /* we will cast it for you ;) */
19 void add( const OPimNotify& ); 48 void add( const OPimNotify& );
20 void remove( const OPimNotify& ); 49 void remove( const OPimNotify& );
21 /* replaces all with this one! */ 50 /* replaces all with this one! */
22 void replace( const OPimNotify& ); 51 void replace( const OPimNotify& );
23 52
@@ -75,17 +104,19 @@ public:
75 * Convert string to reminders 104 * Convert string to reminders
76 * @param str String created by remindersToString() 105 * @param str String created by remindersToString()
77 */ 106 */
78 void remindersFromString( const QString& str ); 107 void remindersFromString( const QString& str );
79 108
80 109
81 110
82private: 111private:
83 Reminders m_rem; 112 Reminders m_rem;
84 Alarms m_al; 113 Alarms m_al;
85 114
86 class Private; 115 class Private;
87 Private *d; 116 Private *d;
88 117
89}; 118};
90 119
120}
121
91#endif 122#endif
diff --git a/libopie2/opiepim/core/opimrecord.cpp b/libopie2/opiepim/core/opimrecord.cpp
index 2365748..72bb372 100644
--- a/libopie2/opiepim/core/opimrecord.cpp
+++ b/libopie2/opiepim/core/opimrecord.cpp
@@ -1,23 +1,52 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#include <qarray.h> 29#include <qarray.h>
2 30
3#include <qpe/categories.h> 31#include <qpe/categories.h>
4#include <qpe/categoryselect.h> 32#include <qpe/categoryselect.h>
5 33
6#include "opimrecord.h" 34#include <opie2/opimrecord.h>
7 35
36namespace Opie {
8Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia ); 37Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia );
9 38
10 39
11OPimRecord::OPimRecord( int uid ) 40OPimRecord::OPimRecord( int uid )
12 : Qtopia::Record() { 41 : Qtopia::Record() {
13 42
14 m_lastHit = -1; 43 m_lastHit = -1;
15 setUid( uid ); 44 setUid( uid );
16} 45}
17OPimRecord::~OPimRecord() { 46OPimRecord::~OPimRecord() {
18} 47}
19OPimRecord::OPimRecord( const OPimRecord& rec ) 48OPimRecord::OPimRecord( const OPimRecord& rec )
20 : Qtopia::Record( rec ) 49 : Qtopia::Record( rec )
21{ 50{
22 (*this) = rec; 51 (*this) = rec;
23} 52}
@@ -167,16 +196,18 @@ OPimXRefPartner OPimRecord::partner( QDataStream& stream ) {
167 par.setField( i ); 196 par.setField( i );
168 197
169 return par; 198 return par;
170} 199}
171void OPimRecord::setLastHitField( int lastHit )const { 200void OPimRecord::setLastHitField( int lastHit )const {
172 m_lastHit = lastHit; 201 m_lastHit = lastHit;
173} 202}
174int OPimRecord::lastHitField()const{ 203int OPimRecord::lastHitField()const{
175 return m_lastHit; 204 return m_lastHit;
176} 205}
177QMap<QString, QString> OPimRecord::toExtraMap()const { 206QMap<QString, QString> OPimRecord::toExtraMap()const {
178 return customMap; 207 return customMap;
179} 208}
180void OPimRecord::setExtraMap( const QMap<QString, QString>& map) { 209void OPimRecord::setExtraMap( const QMap<QString, QString>& map) {
181 customMap = map; 210 customMap = map;
182} 211}
212
213}
diff --git a/libopie2/opiepim/core/opimrecord.h b/libopie2/opiepim/core/opimrecord.h
index 3d774e2..63a3a98 100644
--- a/libopie2/opiepim/core/opimrecord.h
+++ b/libopie2/opiepim/core/opimrecord.h
@@ -1,33 +1,62 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_PIM_RECORD_H 29#ifndef OPIE_PIM_RECORD_H
2#define OPIE_PIM_RECORD_H 30#define OPIE_PIM_RECORD_H
3 31
4#include <qdatastream.h> 32#include <qdatastream.h>
5#include <qmap.h> 33#include <qmap.h>
6#include <qstring.h> 34#include <qstring.h>
7#include <qstringlist.h> 35#include <qstringlist.h>
8 36
9/* 37/*
10 * we need to get customMap which is private... 38 * we need to get customMap which is private...
11 */ 39 */
12#define private protected 40#define private protected
13#include <qpe/palmtoprecord.h> 41#include <qpe/palmtoprecord.h>
14#undef private 42#undef private
15 43
16#include <opie/opimxrefmanager.h> 44#include <opie2/opimxrefmanager.h>
17 45
46namespace Opie {
18/** 47/**
19 * This is the base class for 48 * This is the base class for
20 * all PIM Records 49 * all PIM Records
21 * 50 *
22 */ 51 */
23class OPimRecord : public Qtopia::Record { 52class OPimRecord : public Qtopia::Record {
24public: 53public:
25 /** 54 /**
26 * c'tor 55 * c'tor
27 * uid of 0 isEmpty 56 * uid of 0 isEmpty
28 * uid of 1 will be assigned a new one 57 * uid of 1 will be assigned a new one
29 */ 58 */
30 OPimRecord(int uid = 0); 59 OPimRecord(int uid = 0);
31 ~OPimRecord(); 60 ~OPimRecord();
32 61
33 /** 62 /**
@@ -140,19 +169,19 @@ protected:
140 mutable int m_lastHit; 169 mutable int m_lastHit;
141 void setLastHitField( int lastHit )const; 170 void setLastHitField( int lastHit )const;
142 Qtopia::UidGen &uidGen(); 171 Qtopia::UidGen &uidGen();
143// QString crossToString()const; 172// QString crossToString()const;
144 173
145private: 174private:
146 class OPimRecordPrivate; 175 class OPimRecordPrivate;
147 OPimRecordPrivate *d; 176 OPimRecordPrivate *d;
148 OPimXRefManager m_xrefman; 177 OPimXRefManager m_xrefman;
149 static Qtopia::UidGen m_uidGen; 178 static Qtopia::UidGen m_uidGen;
150 179
151private: 180private:
152 void flush( const OPimXRefPartner&, QDataStream& stream )const; 181 void flush( const OPimXRefPartner&, QDataStream& stream )const;
153 OPimXRefPartner partner( QDataStream& ); 182 OPimXRefPartner partner( QDataStream& );
154}; 183};
155 184
156 185}
157 186
158#endif 187#endif
diff --git a/libopie2/opiepim/core/opimresolver.cpp b/libopie2/opiepim/core/opimresolver.cpp
index 4ebbd6e..eceabcb 100644
--- a/libopie2/opiepim/core/opimresolver.cpp
+++ b/libopie2/opiepim/core/opimresolver.cpp
@@ -1,25 +1,55 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#include <qcopchannel_qws.h> 29#include <qcopchannel_qws.h>
2 30
3#include <qpe/qcopenvelope_qws.h> 31#include <qpe/qcopenvelope_qws.h>
4 32
5#include "otodoaccess.h" 33#include <opie2/otodoaccess.h>
6#include "ocontactaccess.h" 34#include <opie2/ocontactaccess.h>
7 35
8//#include "opimfactory.h" 36//#include "opimfactory.h"
9#include "opimresolver.h" 37#include <opie2/opimresolver.h>
38
39namespace Opie {
10 40
11OPimResolver* OPimResolver::m_self = 0l; 41OPimResolver* OPimResolver::m_self = 0l;
12 42
13OPimResolver::OPimResolver() { 43OPimResolver::OPimResolver() {
14 /* the built in channels */ 44 /* the built in channels */
15 m_builtIns << "Todolist" << "Addressbook" << "Datebook"; 45 m_builtIns << "Todolist" << "Addressbook" << "Datebook";
16} 46}
17OPimResolver* OPimResolver::self() { 47OPimResolver* OPimResolver::self() {
18 if (!m_self) 48 if (!m_self)
19 m_self = new OPimResolver(); 49 m_self = new OPimResolver();
20 50
21 return m_self; 51 return m_self;
22} 52}
23 53
24/* 54/*
25 * FIXME use a cache here too 55 * FIXME use a cache here too
@@ -183,16 +213,18 @@ OPimBase* OPimResolver::backend( int rtti ) {
183 base = new OTodoAccess(); 213 base = new OTodoAccess();
184 break; 214 break;
185 case DateBook: 215 case DateBook:
186 break; 216 break;
187 case AddressBook: 217 case AddressBook:
188 base = new OContactAccess("Resolver"); 218 base = new OContactAccess("Resolver");
189 break; 219 break;
190 default: 220 default:
191 break; 221 break;
192 } 222 }
193 // FIXME for 3rd party 223 // FIXME for 3rd party
194 if (!base ) 224 if (!base )
195 ; 225 ;
196 226
197 return base; 227 return base;
198} 228}
229
230}
diff --git a/libopie2/opiepim/core/opimresolver.h b/libopie2/opiepim/core/opimresolver.h
index 1ce1619..adc7c16 100644
--- a/libopie2/opiepim/core/opimresolver.h
+++ b/libopie2/opiepim/core/opimresolver.h
@@ -1,24 +1,53 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_PIM_RESOLVER 29#ifndef OPIE_PIM_RESOLVER
2#define OPIE_PIM_RESOLVER 30#define OPIE_PIM_RESOLVER
3 31
4#include <qstring.h> 32#include <qstring.h>
5#include <qvaluelist.h> 33#include <qvaluelist.h>
6 34
7#include <opie/otemplatebase.h> 35#include <opie2/otemplatebase.h>
8 36
37namespace Opie {
9/** 38/**
10 * OPimResolver is a MetaClass to access 39 * OPimResolver is a MetaClass to access
11 * available backends read only. 40 * available backends read only.
12 * It will be used to resolve uids + app names 41 * It will be used to resolve uids + app names
13 * to full informations 42 * to full informations
14 * to traverse through a list of alarms, reminders 43 * to traverse through a list of alarms, reminders
15 * to get access to built in PIM functionality 44 * to get access to built in PIM functionality
16 * and to more stuff 45 * and to more stuff
17 * THE PERFORMANCE will depend on THE BACKEND 46 * THE PERFORMANCE will depend on THE BACKEND
18 * USING XML is a waste of memory!!!!! 47 * USING XML is a waste of memory!!!!!
19 */ 48 */
20class OPimResolver { 49class OPimResolver {
21public: 50public:
22 enum BuiltIn { TodoList = 0, 51 enum BuiltIn { TodoList = 0,
23 DateBook, 52 DateBook,
24 AddressBook 53 AddressBook
@@ -74,17 +103,19 @@ public:
74private: 103private:
75 OPimResolver(); 104 OPimResolver();
76 void loadData(); 105 void loadData();
77 inline bool isBuiltIn( const QString& )const; 106 inline bool isBuiltIn( const QString& )const;
78 OPimRecord* recordExtern( const QString&, int ); 107 OPimRecord* recordExtern( const QString&, int );
79 OPimRecord* recordExtern( const QString& ); 108 OPimRecord* recordExtern( const QString& );
80 109
81 static OPimResolver* m_self; 110 static OPimResolver* m_self;
82 struct Data; 111 struct Data;
83 class Private; 112 class Private;
84 113
85 Data* data; 114 Data* data;
86 Private* d; 115 Private* d;
87 QStringList m_builtIns; 116 QStringList m_builtIns;
88}; 117};
89 118
119}
120
90#endif 121#endif
diff --git a/libopie2/opiepim/core/opimstate.cpp b/libopie2/opiepim/core/opimstate.cpp
index 6fb2feb..1013a1c 100644
--- a/libopie2/opiepim/core/opimstate.cpp
+++ b/libopie2/opiepim/core/opimstate.cpp
@@ -1,20 +1,49 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#include <qshared.h> 29#include <qshared.h>
2 30
3#include "opimstate.h" 31#include "opimstate.h"
4 32
33namespace Opie {
5/* 34/*
6 * for one int this does not make 35 * for one int this does not make
7 * much sense but never the less 36 * much sense but never the less
8 * we will do it for the future 37 * we will do it for the future
9 */ 38 */
10struct OPimState::Data : public QShared { 39struct OPimState::Data : public QShared {
11 Data() : QShared(),state(Undefined) { 40 Data() : QShared(),state(Undefined) {
12 } 41 }
13 int state; 42 int state;
14}; 43};
15 44
16OPimState::OPimState( int state ) { 45OPimState::OPimState( int state ) {
17 data = new Data; 46 data = new Data;
18 data->state = state; 47 data->state = state;
19} 48}
20OPimState::OPimState( const OPimState& st) : 49OPimState::OPimState( const OPimState& st) :
@@ -49,16 +78,18 @@ int OPimState::state()const {
49} 78}
50void OPimState::deref() { 79void OPimState::deref() {
51 if ( data->deref() ) { 80 if ( data->deref() ) {
52 delete data; 81 delete data;
53 data = 0l; 82 data = 0l;
54 } 83 }
55} 84}
56void OPimState::copyInternally() { 85void OPimState::copyInternally() {
57 /* we need to change it */ 86 /* we need to change it */
58 if ( data->count != 1 ) { 87 if ( data->count != 1 ) {
59 data->deref(); 88 data->deref();
60 Data* d2 = new Data; 89 Data* d2 = new Data;
61 d2->state = data->state; 90 d2->state = data->state;
62 data = d2; 91 data = d2;
63 } 92 }
64} 93}
94
95}
diff --git a/libopie2/opiepim/core/opimstate.h b/libopie2/opiepim/core/opimstate.h
index cf6af46..78e8cd0 100644
--- a/libopie2/opiepim/core/opimstate.h
+++ b/libopie2/opiepim/core/opimstate.h
@@ -1,21 +1,50 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_PIM_STATE_H 29#ifndef OPIE_PIM_STATE_H
2#define OPIE_PIM_STATE_H 30#define OPIE_PIM_STATE_H
3 31
4#include <qstring.h> 32#include <qstring.h>
5 33
34namespace Opie {
6/** 35/**
7 * The State of a Task 36 * The State of a Task
8 * This class encapsules the state of a todo 37 * This class encapsules the state of a todo
9 * and it's shared too 38 * and it's shared too
10 */ 39 */
11/* 40/*
12 * in c a simple struct would be enough ;) 41 * in c a simple struct would be enough ;)
13 * g_new_state(); 42 * g_new_state();
14 * g_do_some_thing( state_t* ); 43 * g_do_some_thing( state_t* );
15 * ;) 44 * ;)
16 */ 45 */
17class OPimState { 46class OPimState {
18public: 47public:
19 enum State { 48 enum State {
20 Started = 0, 49 Started = 0,
21 Postponed, 50 Postponed,
@@ -29,18 +58,18 @@ public:
29 58
30 bool operator==( const OPimState& ); 59 bool operator==( const OPimState& );
31 OPimState &operator=( const OPimState& ); 60 OPimState &operator=( const OPimState& );
32 void setState( int state); 61 void setState( int state);
33 int state()const; 62 int state()const;
34private: 63private:
35 void deref(); 64 void deref();
36 inline void copyInternally(); 65 inline void copyInternally();
37 66
38 struct Data; 67 struct Data;
39 Data* data; 68 Data* data;
40 69
41 class Private; 70 class Private;
42 Private *d; 71 Private *d;
43}; 72};
44 73
45 74}
46#endif 75#endif
diff --git a/libopie2/opiepim/core/opimxref.cpp b/libopie2/opiepim/core/opimxref.cpp
index 8eefbd8..85d3345 100644
--- a/libopie2/opiepim/core/opimxref.cpp
+++ b/libopie2/opiepim/core/opimxref.cpp
@@ -1,17 +1,47 @@
1#include "opimxref.h" 1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29#include <opie2/opimxref.h>
30
31namespace Opie {
2 32
3OPimXRef::OPimXRef( const OPimXRefPartner& one, const OPimXRefPartner& two ) 33OPimXRef::OPimXRef( const OPimXRefPartner& one, const OPimXRefPartner& two )
4 : m_partners(2) 34 : m_partners(2)
5{ 35{
6 m_partners[0] = one; 36 m_partners[0] = one;
7 m_partners[1] = two; 37 m_partners[1] = two;
8} 38}
9OPimXRef::OPimXRef() 39OPimXRef::OPimXRef()
10 : m_partners(2) 40 : m_partners(2)
11{ 41{
12 42
13} 43}
14OPimXRef::OPimXRef( const OPimXRef& ref) { 44OPimXRef::OPimXRef( const OPimXRef& ref) {
15 *this = ref; 45 *this = ref;
16} 46}
17OPimXRef::~OPimXRef() { 47OPimXRef::~OPimXRef() {
@@ -32,16 +62,18 @@ OPimXRefPartner OPimXRef::partner( enum Partners par) const{
32} 62}
33void OPimXRef::setPartner( enum Partners par, const OPimXRefPartner& part) { 63void OPimXRef::setPartner( enum Partners par, const OPimXRefPartner& part) {
34 m_partners[par] = part; 64 m_partners[par] = part;
35} 65}
36bool OPimXRef::containsString( const QString& string ) const{ 66bool OPimXRef::containsString( const QString& string ) const{
37 if ( m_partners[One].service() == string || 67 if ( m_partners[One].service() == string ||
38 m_partners[Two].service() == string ) return true; 68 m_partners[Two].service() == string ) return true;
39 69
40 return false; 70 return false;
41} 71}
42bool OPimXRef::containsUid( int uid ) const{ 72bool OPimXRef::containsUid( int uid ) const{
43 if ( m_partners[One].uid() == uid || 73 if ( m_partners[One].uid() == uid ||
44 m_partners[Two].uid() == uid ) return true; 74 m_partners[Two].uid() == uid ) return true;
45 75
46 return false; 76 return false;
47} 77}
78
79}
diff --git a/libopie2/opiepim/core/opimxref.h b/libopie2/opiepim/core/opimxref.h
index 6852651..820c9c4 100644
--- a/libopie2/opiepim/core/opimxref.h
+++ b/libopie2/opiepim/core/opimxref.h
@@ -1,39 +1,71 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
1#ifndef OPIM_XREF_H 30#ifndef OPIM_XREF_H
2#define OPIM_XREF_H 31#define OPIM_XREF_H
3 32
4#include <qarray.h> 33#include <qarray.h>
5#include <qvaluelist.h> 34#include <qvaluelist.h>
6 35
7#include <opie/opimxrefpartner.h> 36#include <opie2/opimxrefpartner.h>
8 37
38namespace Opie {
9/** 39/**
10 * this is a Cross Referecne between 40 * this is a Cross Referecne between
11 * two Cross Reference Partners 41 * two Cross Reference Partners
12 */ 42 */
13class OPimXRef { 43class OPimXRef {
14public: 44public:
15 typedef QValueList<OPimXRef> ValueList; 45 typedef QValueList<OPimXRef> ValueList;
16 enum Partners { One, Two }; 46 enum Partners { One, Two };
17 OPimXRef( const OPimXRefPartner& ONE, const OPimXRefPartner& ); 47 OPimXRef( const OPimXRefPartner& ONE, const OPimXRefPartner& );
18 OPimXRef(); 48 OPimXRef();
19 OPimXRef( const OPimXRef& ); 49 OPimXRef( const OPimXRef& );
20 ~OPimXRef(); 50 ~OPimXRef();
21 51
22 OPimXRef &operator=( const OPimXRef& ); 52 OPimXRef &operator=( const OPimXRef& );
23 bool operator==( const OPimXRef& ); 53 bool operator==( const OPimXRef& );
24 54
25 OPimXRefPartner partner( enum Partners )const; 55 OPimXRefPartner partner( enum Partners )const;
26 56
27 void setPartner( enum Partners, const OPimXRefPartner& ); 57 void setPartner( enum Partners, const OPimXRefPartner& );
28 58
29 bool containsString( const QString& service)const; 59 bool containsString( const QString& service)const;
30 bool containsUid( int uid )const; 60 bool containsUid( int uid )const;
31 61
32private: 62private:
33 QArray<OPimXRefPartner> m_partners; 63 QArray<OPimXRefPartner> m_partners;
34 64
35 class Private; 65 class Private;
36 Private *d; 66 Private *d;
37}; 67};
38 68
69}
70
39#endif 71#endif
diff --git a/libopie2/opiepim/core/opimxrefmanager.cpp b/libopie2/opiepim/core/opimxrefmanager.cpp
index 58bfd24..bf6fed6 100644
--- a/libopie2/opiepim/core/opimxrefmanager.cpp
+++ b/libopie2/opiepim/core/opimxrefmanager.cpp
@@ -1,18 +1,47 @@
1#include "opimxrefmanager.h" 1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29#include <opie2/opimxrefmanager.h>
2 30
31namespace Opie {
3 32
4OPimXRefManager::OPimXRefManager() { 33OPimXRefManager::OPimXRefManager() {
5} 34}
6OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) { 35OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) {
7 m_list = ref.m_list; 36 m_list = ref.m_list;
8} 37}
9OPimXRefManager::~OPimXRefManager() { 38OPimXRefManager::~OPimXRefManager() {
10} 39}
11OPimXRefManager &OPimXRefManager::operator=( const OPimXRefManager& ref) { 40OPimXRefManager &OPimXRefManager::operator=( const OPimXRefManager& ref) {
12 m_list = ref.m_list; 41 m_list = ref.m_list;
13 return *this; 42 return *this;
14} 43}
15bool OPimXRefManager::operator==( const OPimXRefManager& /*ref*/) { 44bool OPimXRefManager::operator==( const OPimXRefManager& /*ref*/) {
16 // if ( m_list == ref.m_list ) return true; 45 // if ( m_list == ref.m_list ) return true;
17 46
18 return false; 47 return false;
@@ -56,16 +85,18 @@ OPimXRef::ValueList OPimXRefManager::list( const QString& appName )const{
56 list.append( (*it) ); 85 list.append( (*it) );
57 } 86 }
58 87
59 return list; 88 return list;
60} 89}
61OPimXRef::ValueList OPimXRefManager::list( int uid )const { 90OPimXRef::ValueList OPimXRefManager::list( int uid )const {
62 OPimXRef::ValueList list; 91 OPimXRef::ValueList list;
63 OPimXRef::ValueList::ConstIterator it; 92 OPimXRef::ValueList::ConstIterator it;
64 93
65 for ( it = m_list.begin(); it != m_list.end(); ++it ) { 94 for ( it = m_list.begin(); it != m_list.end(); ++it ) {
66 if ( (*it).containsUid( uid ) ) 95 if ( (*it).containsUid( uid ) )
67 list.append( (*it) ); 96 list.append( (*it) );
68 } 97 }
69 98
70 return list; 99 return list;
71} 100}
101
102}
diff --git a/libopie2/opiepim/core/opimxrefmanager.h b/libopie2/opiepim/core/opimxrefmanager.h
index c485e98..fa2d7f4 100644
--- a/libopie2/opiepim/core/opimxrefmanager.h
+++ b/libopie2/opiepim/core/opimxrefmanager.h
@@ -1,23 +1,52 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIM_XREF_MANAGER_H 29#ifndef OPIM_XREF_MANAGER_H
2#define OPIM_XREF_MANAGER_H 30#define OPIM_XREF_MANAGER_H
3 31
4#include <qstringlist.h> 32#include <qstringlist.h>
5 33
6#include <opie/opimxref.h> 34#include <opie2/opimxref.h>
7 35
36namespace Opie {
8/** 37/**
9 * This is a simple manager for 38 * This is a simple manager for
10 * OPimXRefs. 39 * OPimXRefs.
11 * It allows addition, removing, replacing 40 * It allows addition, removing, replacing
12 * clearing and 'querying' the XRef... 41 * clearing and 'querying' the XRef...
13 */ 42 */
14class OPimXRefManager { 43class OPimXRefManager {
15public: 44public:
16 OPimXRefManager(); 45 OPimXRefManager();
17 OPimXRefManager( const OPimXRefManager& ); 46 OPimXRefManager( const OPimXRefManager& );
18 ~OPimXRefManager(); 47 ~OPimXRefManager();
19 48
20 OPimXRefManager& operator=( const OPimXRefManager& ); 49 OPimXRefManager& operator=( const OPimXRefManager& );
21 bool operator==( const OPimXRefManager& ); 50 bool operator==( const OPimXRefManager& );
22 51
23 void add( const OPimXRef& ); 52 void add( const OPimXRef& );
@@ -27,17 +56,19 @@ public:
27 void clear(); 56 void clear();
28 57
29 /** 58 /**
30 * apps participating 59 * apps participating
31 */ 60 */
32 QStringList apps()const; 61 QStringList apps()const;
33 OPimXRef::ValueList list()const; 62 OPimXRef::ValueList list()const;
34 OPimXRef::ValueList list( const QString& service )const; 63 OPimXRef::ValueList list( const QString& service )const;
35 OPimXRef::ValueList list( int uid )const; 64 OPimXRef::ValueList list( int uid )const;
36 65
37private: 66private:
38 OPimXRef::ValueList m_list; 67 OPimXRef::ValueList m_list;
39 class Private; 68 class Private;
40 Private *d; 69 Private *d;
41}; 70};
42 71
72}
73
43#endif 74#endif
diff --git a/libopie2/opiepim/core/opimxrefpartner.cpp b/libopie2/opiepim/core/opimxrefpartner.cpp
index 6ef3efb..f6ccc7f 100644
--- a/libopie2/opiepim/core/opimxrefpartner.cpp
+++ b/libopie2/opiepim/core/opimxrefpartner.cpp
@@ -1,17 +1,47 @@
1#include "opimxrefpartner.h" 1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29#include <opie2/opimxrefpartner.h>
30
31namespace Opie {
2 32
3OPimXRefPartner::OPimXRefPartner( const QString& appName, 33OPimXRefPartner::OPimXRefPartner( const QString& appName,
4 int uid, int field ) 34 int uid, int field )
5 : m_app(appName), m_uid(uid), m_field( field ) { 35 : m_app(appName), m_uid(uid), m_field( field ) {
6} 36}
7OPimXRefPartner::OPimXRefPartner( const OPimXRefPartner& ref ) { 37OPimXRefPartner::OPimXRefPartner( const OPimXRefPartner& ref ) {
8 *this = ref; 38 *this = ref;
9} 39}
10OPimXRefPartner::~OPimXRefPartner() { 40OPimXRefPartner::~OPimXRefPartner() {
11} 41}
12OPimXRefPartner &OPimXRefPartner::operator=( const OPimXRefPartner& par ) { 42OPimXRefPartner &OPimXRefPartner::operator=( const OPimXRefPartner& par ) {
13 m_app = par.m_app; 43 m_app = par.m_app;
14 m_uid = par.m_uid; 44 m_uid = par.m_uid;
15 m_field = par.m_field; 45 m_field = par.m_field;
16 46
17 return *this; 47 return *this;
@@ -28,16 +58,18 @@ QString OPimXRefPartner::service()const {
28} 58}
29int OPimXRefPartner::uid()const { 59int OPimXRefPartner::uid()const {
30 return m_uid; 60 return m_uid;
31} 61}
32int OPimXRefPartner::field()const { 62int OPimXRefPartner::field()const {
33 return m_field; 63 return m_field;
34} 64}
35void OPimXRefPartner::setService( const QString& appName ) { 65void OPimXRefPartner::setService( const QString& appName ) {
36 m_app = appName; 66 m_app = appName;
37} 67}
38void OPimXRefPartner::setUid( int uid ) { 68void OPimXRefPartner::setUid( int uid ) {
39 m_uid = uid; 69 m_uid = uid;
40} 70}
41void OPimXRefPartner::setField( int field ) { 71void OPimXRefPartner::setField( int field ) {
42 m_field = field; 72 m_field = field;
43} 73}
74
75}
diff --git a/libopie2/opiepim/core/opimxrefpartner.h b/libopie2/opiepim/core/opimxrefpartner.h
index d76e384..6853d5b 100644
--- a/libopie2/opiepim/core/opimxrefpartner.h
+++ b/libopie2/opiepim/core/opimxrefpartner.h
@@ -1,21 +1,50 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIM_XREF_PARTNER_H 29#ifndef OPIM_XREF_PARTNER_H
2#define OPIM_XREF_PARTNER_H 30#define OPIM_XREF_PARTNER_H
3 31
4#include <qstring.h> 32#include <qstring.h>
5 33
34namespace Opie {
6/** 35/**
7 * This class represents one partner 36 * This class represents one partner
8 * of a Cross Reference. 37 * of a Cross Reference.
9 * In Opie one application 38 * In Opie one application
10 * can link one uid 39 * can link one uid
11 * with one tableId( fieldId ) to another. 40 * with one tableId( fieldId ) to another.
12 */ 41 */
13class OPimXRefPartner { 42class OPimXRefPartner {
14public: 43public:
15 OPimXRefPartner( const QString& service = QString::null, 44 OPimXRefPartner( const QString& service = QString::null,
16 int uid = 0, int field = -1 ); 45 int uid = 0, int field = -1 );
17 OPimXRefPartner( const OPimXRefPartner& ); 46 OPimXRefPartner( const OPimXRefPartner& );
18 OPimXRefPartner& operator=( const OPimXRefPartner& ); 47 OPimXRefPartner& operator=( const OPimXRefPartner& );
19 ~OPimXRefPartner(); 48 ~OPimXRefPartner();
20 49
21 bool operator==(const OPimXRefPartner& ); 50 bool operator==(const OPimXRefPartner& );
@@ -23,18 +52,19 @@ public:
23 QString service()const; 52 QString service()const;
24 int uid()const; 53 int uid()const;
25 int field()const; 54 int field()const;
26 55
27 void setService( const QString& service ); 56 void setService( const QString& service );
28 void setUid( int uid ); 57 void setUid( int uid );
29 void setField( int field ); 58 void setField( int field );
30private: 59private:
31 QString m_app; 60 QString m_app;
32 int m_uid; 61 int m_uid;
33 int m_field; 62 int m_field;
34 63
35 class Private; 64 class Private;
36 Private* d; 65 Private* d;
37}; 66};
38 67
68}
39 69
40#endif 70#endif
diff --git a/libopie2/opiepim/core/orecur.cpp b/libopie2/opiepim/core/orecur.cpp
index f46f22e..033f264 100644
--- a/libopie2/opiepim/core/orecur.cpp
+++ b/libopie2/opiepim/core/orecur.cpp
@@ -1,25 +1,55 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
1#include <time.h> 30#include <time.h>
2 31
3#include <qshared.h> 32#include <qshared.h>
4 33
5#include <qtopia/timeconversion.h> 34#include <qtopia/timeconversion.h>
6 35
7#include "otimezone.h" 36#include <opie2/otimezone.h>
8#include "orecur.h" 37#include <opie2/orecur.h>
9 38
39namespace Opie {
10struct ORecur::Data : public QShared { 40struct ORecur::Data : public QShared {
11 Data() : QShared() { 41 Data() : QShared() {
12 type = ORecur::NoRepeat; 42 type = ORecur::NoRepeat;
13 freq = -1; 43 freq = -1;
14 days = 0; 44 days = 0;
15 pos = 0; 45 pos = 0;
16 create = QDateTime::currentDateTime(); 46 create = QDateTime::currentDateTime();
17 hasEnd = FALSE; 47 hasEnd = FALSE;
18 end = QDate::currentDate(); 48 end = QDate::currentDate();
19 } 49 }
20 char days; // Q_UINT8 for 8 seven days;) 50 char days; // Q_UINT8 for 8 seven days;)
21 ORecur::RepeatType type; 51 ORecur::RepeatType type;
22 int freq; 52 int freq;
23 int pos; 53 int pos;
24 bool hasEnd : 1; 54 bool hasEnd : 1;
25 QDate end; 55 QDate end;
@@ -578,16 +608,18 @@ void ORecur::fromMap( const QMap<int, QString>& map )
578 if ( data -> hasEnd ){ 608 if ( data -> hasEnd ){
579 data -> end = utc.fromUTCDateTime( (time_t) map[ ORecur::EndDate ].toLong() ).date(); 609 data -> end = utc.fromUTCDateTime( (time_t) map[ ORecur::EndDate ].toLong() ).date();
580 } 610 }
581 data -> create = utc.fromUTCDateTime( (time_t) map[ ORecur::Created ].toLong() ).date(); 611 data -> create = utc.fromUTCDateTime( (time_t) map[ ORecur::Created ].toLong() ).date();
582 612
583#if 0 613#if 0
584 // FIXME: Exceptions currently not supported... 614 // FIXME: Exceptions currently not supported...
585 // Convert the list of exceptions from QString into ExceptionList 615 // Convert the list of exceptions from QString into ExceptionList
586 data -> list.clear(); 616 data -> list.clear();
587 QString exceptStr = map[ ORecur::Exceptions ]; 617 QString exceptStr = map[ ORecur::Exceptions ];
588 QStringList exceptList = QStringList::split( " ", exceptStr ); 618 QStringList exceptList = QStringList::split( " ", exceptStr );
589 ... 619 ...
590#endif 620#endif
591 621
592 622
593} 623}
624
625} \ No newline at end of file
diff --git a/libopie2/opiepim/core/orecur.h b/libopie2/opiepim/core/orecur.h
index d7ecd90..60508f5 100644
--- a/libopie2/opiepim/core/orecur.h
+++ b/libopie2/opiepim/core/orecur.h
@@ -1,30 +1,56 @@
1/* 1/*
2 * GPL from TT 2 This file is part of the Opie Project
3 */ 3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
4 29
5#ifndef OPIE_RECUR_H 30#ifndef OPIE_RECUR_H
6#define OPIE_RECUR_H 31#define OPIE_RECUR_H
7 32
8#include <sys/types.h> 33#include <sys/types.h>
9 34
10#include <qdatetime.h> 35#include <qdatetime.h>
11#include <qvaluelist.h> 36#include <qvaluelist.h>
12#include <qmap.h> 37#include <qmap.h>
13 38
14 39
40namespace Opie {
15/** 41/**
16 * Class to handle Recurrencies.. 42 * Class to handle Recurrencies..
17 */ 43 */
18 44
19class ORecur { 45class ORecur {
20public: 46public:
21 typedef QValueList<QDate> ExceptionList; 47 typedef QValueList<QDate> ExceptionList;
22 enum RepeatType{ NoRepeat = -1, Daily, Weekly, MonthlyDay, 48 enum RepeatType{ NoRepeat = -1, Daily, Weekly, MonthlyDay,
23 MonthlyDate, Yearly }; 49 MonthlyDate, Yearly };
24 enum Days { MON = 0x01, TUE = 0x02, WED = 0x04, THU = 0x08, 50 enum Days { MON = 0x01, TUE = 0x02, WED = 0x04, THU = 0x08,
25 FRI = 0x10, SAT = 0x20, SUN = 0x40 }; 51 FRI = 0x10, SAT = 0x20, SUN = 0x40 };
26 enum Fields{ RType = 0, RWeekdays, RPosition, RFreq, RHasEndDate, 52 enum Fields{ RType = 0, RWeekdays, RPosition, RFreq, RHasEndDate,
27 EndDate, Created, Exceptions }; 53 EndDate, Created, Exceptions };
28 54
29 ORecur(); 55 ORecur();
30 ORecur( const QMap<int, QString>& map ); 56 ORecur( const QMap<int, QString>& map );
@@ -91,17 +117,18 @@ public:
91private: 117private:
92 bool p_nextOccurrence( const QDate& from, QDate& next ); 118 bool p_nextOccurrence( const QDate& from, QDate& next );
93 void deref(); 119 void deref();
94 inline void checkOrModify(); 120 inline void checkOrModify();
95 121
96 /* Converts rType to String */ 122 /* Converts rType to String */
97 QString rTypeString() const; 123 QString rTypeString() const;
98 /* Returns a map to convert Stringname for RType to RepeatType */ 124 /* Returns a map to convert Stringname for RType to RepeatType */
99 QMap<QString, RepeatType> rTypeValueConvertMap() const; 125 QMap<QString, RepeatType> rTypeValueConvertMap() const;
100 126
101 class Data; 127 class Data;
102 Data* data; 128 Data* data;
103 class ORecurPrivate; 129 class ORecurPrivate;
104 ORecurPrivate *d; 130 ORecurPrivate *d;
105}; 131};
106 132
133}
107#endif 134#endif
diff --git a/libopie2/opiepim/core/otemplatebase.h b/libopie2/opiepim/core/otemplatebase.h
index cadac74..17d9961 100644
--- a/libopie2/opiepim/core/otemplatebase.h
+++ b/libopie2/opiepim/core/otemplatebase.h
@@ -1,24 +1,53 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_TEMPLATE_BASE_H 29#ifndef OPIE_TEMPLATE_BASE_H
2#define OPIE_TEMPLATE_BASE_H 30#define OPIE_TEMPLATE_BASE_H
3 31
4#include <qarray.h> 32#include <qarray.h>
5 33
6#include <opie/opimrecord.h> 34#include <opie2/opimrecord.h>
7 35
8 36
37namespace Opie {
9/** 38/**
10 * Templates do not have a base class, This is why 39 * Templates do not have a base class, This is why
11 * we've this class 40 * we've this class
12 * this is here to give us the possibility 41 * this is here to give us the possibility
13 * to have a common base class 42 * to have a common base class
14 * You may not want to use that interface internaly 43 * You may not want to use that interface internaly
15 * POOR mans interface 44 * POOR mans interface
16 */ 45 */
17class OPimBasePrivate; 46class OPimBasePrivate;
18struct OPimBase { 47struct OPimBase {
19 /** 48 /**
20 * return the rtti 49 * return the rtti
21 */ 50 */
22 virtual int rtti()= 0; 51 virtual int rtti()= 0;
23 virtual OPimRecord* record()const = 0; 52 virtual OPimRecord* record()const = 0;
24 virtual OPimRecord* record(int uid)const = 0; 53 virtual OPimRecord* record(int uid)const = 0;
@@ -82,17 +111,19 @@ template <class T>
82OPimRecord* OTemplateBase<T>::record()const { 111OPimRecord* OTemplateBase<T>::record()const {
83 T* t = new T; 112 T* t = new T;
84 return t; 113 return t;
85} 114}
86template <class T> 115template <class T>
87OPimRecord* OTemplateBase<T>::record(int uid )const { 116OPimRecord* OTemplateBase<T>::record(int uid )const {
88 T t2 = find(uid ); 117 T t2 = find(uid );
89 T* t1 = new T(t2); 118 T* t1 = new T(t2);
90 119
91 return t1; 120 return t1;
92}; 121};
93template <class T> 122template <class T>
94T* OTemplateBase<T>::rec() { 123T* OTemplateBase<T>::rec() {
95 return new T; 124 return new T;
96} 125}
97 126
127}
128
98#endif 129#endif
diff --git a/libopie2/opiepim/core/otimezone.cpp b/libopie2/opiepim/core/otimezone.cpp
index 34659c3..dab68af 100644
--- a/libopie2/opiepim/core/otimezone.cpp
+++ b/libopie2/opiepim/core/otimezone.cpp
@@ -1,24 +1,53 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
1#include <stdio.h> 30#include <stdio.h>
2#include <stdlib.h> 31#include <stdlib.h>
3 32
4#include <sys/types.h> 33#include <sys/types.h>
5 34
6#include "otimezone.h" 35#include <opie2/otimezone.h>
7 36
8namespace { 37namespace Opie {
9 38
10 QDateTime utcTime( time_t t) { 39 QDateTime utcTime( time_t t) {
11 tm* broken = ::gmtime( &t ); 40 tm* broken = ::gmtime( &t );
12 QDateTime ret; 41 QDateTime ret;
13 ret.setDate( QDate( broken->tm_year + 1900, broken->tm_mon +1, broken->tm_mday ) ); 42 ret.setDate( QDate( broken->tm_year + 1900, broken->tm_mon +1, broken->tm_mday ) );
14 ret.setTime( QTime( broken->tm_hour, broken->tm_min, broken->tm_sec ) ); 43 ret.setTime( QTime( broken->tm_hour, broken->tm_min, broken->tm_sec ) );
15 return ret; 44 return ret;
16 } 45 }
17 QDateTime utcTime( time_t t, const QString& zone) { 46 QDateTime utcTime( time_t t, const QString& zone) {
18 QCString org = ::getenv( "TZ" ); 47 QCString org = ::getenv( "TZ" );
19#ifndef Q_OS_MACX // Following line causes bus errors on Mac 48#ifndef Q_OS_MACX // Following line causes bus errors on Mac
20 ::setenv( "TZ", zone.latin1(), true ); 49 ::setenv( "TZ", zone.latin1(), true );
21 ::tzset(); 50 ::tzset();
22 51
23 tm* broken = ::localtime( &t ); 52 tm* broken = ::localtime( &t );
24 ::setenv( "TZ", org, true ); 53 ::setenv( "TZ", org, true );
@@ -46,32 +75,34 @@ namespace {
46 broken.tm_sec = t.second(); 75 broken.tm_sec = t.second();
47 76
48 QCString org = ::getenv( "TZ" ); 77 QCString org = ::getenv( "TZ" );
49#ifndef Q_OS_MACX // Following line causes bus errors on Mac 78#ifndef Q_OS_MACX // Following line causes bus errors on Mac
50 ::setenv( "TZ", str.latin1(), true ); 79 ::setenv( "TZ", str.latin1(), true );
51 ::tzset(); 80 ::tzset();
52 81
53 time_t ti = ::mktime( &broken ); 82 time_t ti = ::mktime( &broken );
54 ::setenv( "TZ", org, true ); 83 ::setenv( "TZ", org, true );
55#else 84#else
56#warning "Need a replacement for MacOSX!!" 85#warning "Need a replacement for MacOSX!!"
57 time_t ti = ::mktime( &broken ); 86 time_t ti = ::mktime( &broken );
58#endif 87#endif
59 return ti; 88 return ti;
60 } 89 }
61} 90}
91
92namespace Opie {
62OTimeZone::OTimeZone( const ZoneName& zone ) 93OTimeZone::OTimeZone( const ZoneName& zone )
63 : m_name(zone) { 94 : m_name(zone) {
64} 95}
65OTimeZone::~OTimeZone() { 96OTimeZone::~OTimeZone() {
66} 97}
67 98
68bool OTimeZone::isValid()const { 99bool OTimeZone::isValid()const {
69 return !m_name.isEmpty(); 100 return !m_name.isEmpty();
70} 101}
71 102
72/* 103/*
73 * we will get the current timezone 104 * we will get the current timezone
74 * and ask it to convert to the timezone date 105 * and ask it to convert to the timezone date
75 */ 106 */
76QDateTime OTimeZone::toLocalDateTime( const QDateTime& dt) { 107QDateTime OTimeZone::toLocalDateTime( const QDateTime& dt) {
77 return OTimeZone::current().toDateTime( dt, *this ); 108 return OTimeZone::current().toDateTime( dt, *this );
@@ -98,16 +129,18 @@ time_t OTimeZone::fromDateTime( const QDateTime& time ) {
98 return to_Time_t( time, m_name ); 129 return to_Time_t( time, m_name );
99} 130}
100time_t OTimeZone::fromUTCDateTime( const QDateTime& time ) { 131time_t OTimeZone::fromUTCDateTime( const QDateTime& time ) {
101 return to_Time_t( time, "UTC" ); 132 return to_Time_t( time, "UTC" );
102} 133}
103OTimeZone OTimeZone::current() { 134OTimeZone OTimeZone::current() {
104 QCString str = ::getenv("TZ"); 135 QCString str = ::getenv("TZ");
105 OTimeZone zone( str ); 136 OTimeZone zone( str );
106 return zone; 137 return zone;
107} 138}
108OTimeZone OTimeZone::utc() { 139OTimeZone OTimeZone::utc() {
109 return OTimeZone("UTC"); 140 return OTimeZone("UTC");
110} 141}
111QString OTimeZone::timeZone()const { 142QString OTimeZone::timeZone()const {
112 return m_name; 143 return m_name;
113} 144}
145
146}
diff --git a/libopie2/opiepim/core/otimezone.h b/libopie2/opiepim/core/otimezone.h
index bb08349..28ae6cb 100644
--- a/libopie2/opiepim/core/otimezone.h
+++ b/libopie2/opiepim/core/otimezone.h
@@ -1,22 +1,53 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
1#ifndef OPIE_TIME_ZONE_H 30#ifndef OPIE_TIME_ZONE_H
2#define OPIE_TIME_ZONE_H 31#define OPIE_TIME_ZONE_H
3 32
4#include <time.h> 33#include <time.h>
5#include <qdatetime.h> 34#include <qdatetime.h>
6 35
36namespace Opie
37{
7/** 38/**
8 * A very primitive class to convert time 39 * A very primitive class to convert time
9 * from one timezone to another 40 * from one timezone to another
10 * and to localtime 41 * and to localtime
11 * and time_t 42 * and time_t
12 */ 43 */
13class OTimeZone { 44class OTimeZone {
14 public: 45 public:
15 typedef QString ZoneName; 46 typedef QString ZoneName;
16 OTimeZone( const ZoneName& = ZoneName::null ); 47 OTimeZone( const ZoneName& = ZoneName::null );
17 virtual ~OTimeZone(); // just in case. 48 virtual ~OTimeZone(); // just in case.
18 49
19 bool isValid()const; 50 bool isValid()const;
20 51
21 /** 52 /**
22 * converts the QDateTime to a DateTime 53 * converts the QDateTime to a DateTime
@@ -53,19 +84,19 @@ class OTimeZone {
53 time_t fromDateTime( const QDateTime& ); 84 time_t fromDateTime( const QDateTime& );
54 85
55 /** 86 /**
56 * converts the datetime with timezone UTC 87 * converts the datetime with timezone UTC
57 */ 88 */
58 time_t fromUTCDateTime( const QDateTime& ); 89 time_t fromUTCDateTime( const QDateTime& );
59 90
60 static OTimeZone current(); 91 static OTimeZone current();
61 static OTimeZone utc(); 92 static OTimeZone utc();
62 93
63 QString timeZone()const; 94 QString timeZone()const;
64 private: 95 private:
65 ZoneName m_name; 96 ZoneName m_name;
66 class Private; 97 class Private;
67 Private* d; 98 Private* d;
68}; 99};
69 100};
70 101
71#endif 102#endif
diff --git a/libopie2/opiepim/core/otodoaccess.cpp b/libopie2/opiepim/core/otodoaccess.cpp
index 37f6fbc..2a3695d 100644
--- a/libopie2/opiepim/core/otodoaccess.cpp
+++ b/libopie2/opiepim/core/otodoaccess.cpp
@@ -1,31 +1,60 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#include <qdatetime.h> 29#include <qdatetime.h>
2 30
3#include <qpe/alarmserver.h> 31#include <qpe/alarmserver.h>
4 32
5// #include "otodoaccesssql.h" 33// #include "otodoaccesssql.h"
6#include "otodoaccess.h" 34#include <opie2/otodoaccess.h>
7#include "obackendfactory.h" 35#include <opie2/obackendfactory.h>
8 36
37namespace Opie {
9OTodoAccess::OTodoAccess( OTodoAccessBackend* end, enum Access ) 38OTodoAccess::OTodoAccess( OTodoAccessBackend* end, enum Access )
10 : QObject(), OPimAccessTemplate<OTodo>( end ), m_todoBackEnd( end ) 39 : QObject(), OPimAccessTemplate<OTodo>( end ), m_todoBackEnd( end )
11{ 40{
12// if (end == 0l ) 41// if (end == 0l )
13// m_todoBackEnd = new OTodoAccessBackendSQL( QString::null); 42// m_todoBackEnd = new OTodoAccessBackendSQL( QString::null);
14 43
15 // Zecke: Du musst hier noch für das XML-Backend einen Appnamen übergeben ! 44 // Zecke: Du musst hier noch fr das XML-Backend einen Appnamen bergeben !
16 if (end == 0l ) 45 if (end == 0l )
17 m_todoBackEnd = OBackendFactory<OTodoAccessBackend>::Default ("todo", QString::null); 46 m_todoBackEnd = OBackendFactory<OTodoAccessBackend>::Default ("todo", QString::null);
18 47
19 setBackEnd( m_todoBackEnd ); 48 setBackEnd( m_todoBackEnd );
20} 49}
21OTodoAccess::~OTodoAccess() { 50OTodoAccess::~OTodoAccess() {
22// qWarning("~OTodoAccess"); 51// qWarning("~OTodoAccess");
23} 52}
24void OTodoAccess::mergeWith( const QValueList<OTodo>& list ) { 53void OTodoAccess::mergeWith( const QValueList<OTodo>& list ) {
25 QValueList<OTodo>::ConstIterator it; 54 QValueList<OTodo>::ConstIterator it;
26 for ( it = list.begin(); it != list.end(); ++it ) { 55 for ( it = list.begin(); it != list.end(); ++it ) {
27 replace( (*it) ); 56 replace( (*it) );
28 } 57 }
29} 58}
30OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start, 59OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start,
31 const QDate& end, 60 const QDate& end,
@@ -47,16 +76,18 @@ OTodoAccess::List OTodoAccess::overDue() {
47/* sort order */ 76/* sort order */
48OTodoAccess::List OTodoAccess::sorted( bool ascending, int sort,int filter, int cat ) { 77OTodoAccess::List OTodoAccess::sorted( bool ascending, int sort,int filter, int cat ) {
49 QArray<int> ints = m_todoBackEnd->sorted( ascending, sort, 78 QArray<int> ints = m_todoBackEnd->sorted( ascending, sort,
50 filter, cat ); 79 filter, cat );
51 OTodoAccess::List list( ints, this ); 80 OTodoAccess::List list( ints, this );
52 return list; 81 return list;
53} 82}
54void OTodoAccess::removeAllCompleted() { 83void OTodoAccess::removeAllCompleted() {
55 m_todoBackEnd->removeAllCompleted(); 84 m_todoBackEnd->removeAllCompleted();
56} 85}
57QBitArray OTodoAccess::backendSupport( const QString& ) const{ 86QBitArray OTodoAccess::backendSupport( const QString& ) const{
58 return m_todoBackEnd->supports(); 87 return m_todoBackEnd->supports();
59} 88}
60bool OTodoAccess::backendSupports( int attr, const QString& ar) const{ 89bool OTodoAccess::backendSupports( int attr, const QString& ar) const{
61 return backendSupport(ar).testBit( attr ); 90 return backendSupport(ar).testBit( attr );
62} 91}
92
93}
diff --git a/libopie2/opiepim/core/otodoaccess.h b/libopie2/opiepim/core/otodoaccess.h
index 916923f..e13d277 100644
--- a/libopie2/opiepim/core/otodoaccess.h
+++ b/libopie2/opiepim/core/otodoaccess.h
@@ -1,26 +1,55 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_TODO_ACCESS_H 29#ifndef OPIE_TODO_ACCESS_H
2#define OPIE_TODO_ACCESS_H 30#define OPIE_TODO_ACCESS_H
3 31
4#include <qobject.h> 32#include <qobject.h>
5#include <qvaluelist.h> 33#include <qvaluelist.h>
6 34
7#include "otodo.h" 35#include <opie2/otodo.h>
8#include "otodoaccessbackend.h" 36#include <opie2/otodoaccessbackend.h>
9#include "opimaccesstemplate.h" 37#include <opie2/opimaccesstemplate.h>
10 38
39namespace Opie {
11 40
12/** 41/**
13 * OTodoAccess 42 * OTodoAccess
14 * the class to get access to 43 * the class to get access to
15 * the todolist 44 * the todolist
16 */ 45 */
17class OTodoAccess : public QObject, public OPimAccessTemplate<OTodo> { 46class OTodoAccess : public QObject, public OPimAccessTemplate<OTodo> {
18 Q_OBJECT 47 Q_OBJECT
19public: 48public:
20 enum SortOrder { Completed = 0, 49 enum SortOrder { Completed = 0,
21 Priority, 50 Priority,
22 Description, 51 Description,
23 Deadline }; 52 Deadline };
24 enum SortFilter{ Category =1, 53 enum SortFilter{ Category =1,
25 OnlyOverDue= 2, 54 OnlyOverDue= 2,
26 DoNotShowCompleted =4 }; 55 DoNotShowCompleted =4 };
@@ -89,17 +118,19 @@ public:
89 bool backendSupports( int attr, const QString& backend = QString::null )const; 118 bool backendSupports( int attr, const QString& backend = QString::null )const;
90signals: 119signals:
91 /** 120 /**
92 * if the OTodoAccess was changed 121 * if the OTodoAccess was changed
93 */ 122 */
94 void changed( const OTodoAccess* ); 123 void changed( const OTodoAccess* );
95 void changed( const OTodoAccess*, int uid ); 124 void changed( const OTodoAccess*, int uid );
96 void added( const OTodoAccess*, int uid ); 125 void added( const OTodoAccess*, int uid );
97 void removed( const OTodoAccess*, int uid ); 126 void removed( const OTodoAccess*, int uid );
98private: 127private:
99 int m_cat; 128 int m_cat;
100 OTodoAccessBackend* m_todoBackEnd; 129 OTodoAccessBackend* m_todoBackEnd;
101 class OTodoAccessPrivate; 130 class OTodoAccessPrivate;
102 OTodoAccessPrivate* d; 131 OTodoAccessPrivate* d;
103}; 132};
104 133
134}
135
105#endif 136#endif
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp
index fcf3b26..f1a22a7 100644
--- a/libopie2/opiepim/ocontact.cpp
+++ b/libopie2/opiepim/ocontact.cpp
@@ -1,65 +1,95 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
1/********************************************************************** 30/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 31** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de) 32** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de)
4** 33**
5** This file may be distributed and/or modified under the terms of the 34** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 35** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 36** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 37** packaging of this file.
9** 38**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 39** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 40** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 41**
13** See http://www.trolltech.com/gpl/ for GPL licensing information. 42** See http://www.trolltech.com/gpl/ for GPL licensing information.
14** 43**
15** Contact info@trolltech.com if any conditions of this licensing are 44** Contact info@trolltech.com if any conditions of this licensing are
16** not clear to you. 45** not clear to you.
17** 46**
18**********************************************************************/ 47**********************************************************************/
19 48
20#define QTOPIA_INTERNAL_CONTACT_MRE 49#define QTOPIA_INTERNAL_CONTACT_MRE
21 50
22#include "ocontact.h" 51#include <opie2/ocontact.h>
23#include "opimresolver.h" 52#include <opie2/opimresolver.h>
24#include "oconversion.h" 53#include <opie2/oconversion.h>
25 54
26#include <qpe/stringutil.h> 55#include <qpe/stringutil.h>
27#include <qpe/timestring.h> 56#include <qpe/timestring.h>
28#include <qpe/config.h> 57#include <qpe/config.h>
29 58
30#include <qobject.h> 59#include <qobject.h>
31#include <qregexp.h> 60#include <qregexp.h>
32#include <qstylesheet.h> 61#include <qstylesheet.h>
33#include <qfileinfo.h> 62#include <qfileinfo.h>
34#include <qmap.h> 63#include <qmap.h>
35 64
36#include <stdio.h> 65#include <stdio.h>
37 66
38/*! 67/*!
39 \class Contact contact.h 68 \class Contact contact.h
40 \brief The Contact class holds the data of an address book entry. 69 \brief The Contact class holds the data of an address book entry.
41 70
42 This data includes information the name of the person, contact 71 This data includes information the name of the person, contact
43 information, and business information such as deparment and job title. 72 information, and business information such as deparment and job title.
44 73
45 \ingroup qtopiaemb 74 \ingroup qtopiaemb
46 \ingroup qtopiadesktop 75 \ingroup qtopiadesktop
47*/ 76*/
48 77
49 78
79namespace Opie {
50/*! 80/*!
51 Creates a new, empty contact. 81 Creates a new, empty contact.
52*/ 82*/
53OContact::OContact() 83OContact::OContact()
54 : OPimRecord(), mMap(), d( 0 ) 84 : OPimRecord(), mMap(), d( 0 )
55{ 85{
56} 86}
57 87
58/*! 88/*!
59 \internal 89 \internal
60 Creates a new contact. The properties of the contact are 90 Creates a new contact. The properties of the contact are
61 set from \a fromMap. 91 set from \a fromMap.
62*/ 92*/
63OContact::OContact( const QMap<int, QString> &fromMap ) : 93OContact::OContact( const QMap<int, QString> &fromMap ) :
64 OPimRecord(), mMap( fromMap ), d( 0 ) 94 OPimRecord(), mMap( fromMap ), d( 0 )
65{ 95{
@@ -1192,16 +1222,17 @@ void OContact::setDefaultEmail( const QString &v )
1192 1222
1193} 1223}
1194 1224
1195void OContact::insertEmails( const QStringList &v ) 1225void OContact::insertEmails( const QStringList &v )
1196{ 1226{
1197 for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it ) 1227 for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it )
1198 insertEmail( *it ); 1228 insertEmail( *it );
1199} 1229}
1200int OContact::rtti() { 1230int OContact::rtti() {
1201 return OPimResolver::AddressBook; 1231 return OPimResolver::AddressBook;
1202} 1232}
1203void OContact::setUid( int i ) 1233void OContact::setUid( int i )
1204{ 1234{
1205 OPimRecord::setUid(i); 1235 OPimRecord::setUid(i);
1206 replace( Qtopia::AddressUid , QString::number(i)); 1236 replace( Qtopia::AddressUid , QString::number(i));
1207} 1237}
1238}
diff --git a/libopie2/opiepim/ocontact.h b/libopie2/opiepim/ocontact.h
index 1d46b81..34888dc 100644
--- a/libopie2/opiepim/ocontact.h
+++ b/libopie2/opiepim/ocontact.h
@@ -1,50 +1,60 @@
1/********************************************************************** 1/*
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2 This file is part of the Opie Project
3** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de) 3 Copyright (C) The Main Author <main-author@whereever.org>
4** 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5** This file may be distributed and/or modified under the terms of the 5 .=l.
6** GNU General Public License version 2 as published by the Free Software 6 .>+-=
7** Foundation and appearing in the file LICENSE.GPL included in the 7 _;:, .> :=|. This program is free software; you can
8** packaging of this file. 8.> <`_, > . <= redistribute it and/or modify it under
9** 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10.="- .-=="i, .._ License as published by the Free Software
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11 - . .-<_> .<> Foundation; either version 2 of the License,
12** 12 ._= =} : or (at your option) any later version.
13** See http://www.trolltech.com/gpl/ for GPL licensing information. 13 .%`+i> _;_.
14** 14 .i_,=:_. -<s. This program is distributed in the hope that
15** Contact info@trolltech.com if any conditions of this licensing are 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16** not clear to you. 16 : .. .:, . . . without even the implied warranty of
17** 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18**********************************************************************/ 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19 19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
20#ifndef __OCONTACT_H__ 29#ifndef __OCONTACT_H__
21#define __OCONTACT_H__ 30#define __OCONTACT_H__
22 31
23#include <opie/opimrecord.h> 32#include <opie2/opimrecord.h>
24#include <qpe/recordfields.h> 33#include <qpe/recordfields.h>
25 34
26#include <qdatetime.h> 35#include <qdatetime.h>
27#include <qstringlist.h> 36#include <qstringlist.h>
28 37
29#if defined(QPC_TEMPLATEDLL) 38#if defined(QPC_TEMPLATEDLL)
30// MOC_SKIP_BEGIN 39// MOC_SKIP_BEGIN
31QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>; 40QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>;
32// MOC_SKIP_END 41// MOC_SKIP_END
33#endif 42#endif
34 43
44namespace Opie {
35class OContactPrivate; 45class OContactPrivate;
36 46
37/** 47/**
38 * OContact class represents a specialised PIM Record for contacts. 48 * OContact class represents a specialised PIM Record for contacts.
39 * It does store all kind of persopn related information. 49 * It does store all kind of persopn related information.
40 * 50 *
41 * @short Contact Container 51 * @short Contact Container
42 * @author TT, Stefan Eiler, Holger Freyther 52 * @author TT, Stefan Eiler, Holger Freyther
43 */ 53 */
44class QPC_EXPORT OContact : public OPimRecord 54class QPC_EXPORT OContact : public OPimRecord
45{ 55{
46 friend class DataSet; 56 friend class DataSet;
47public: 57public:
48 OContact(); 58 OContact();
49 OContact( const QMap<int, QString> &fromMap ); 59 OContact( const QMap<int, QString> &fromMap );
50 virtual ~OContact(); 60 virtual ~OContact();
@@ -223,18 +233,19 @@ private:
223 void replace( int key, const QString &value ); 233 void replace( int key, const QString &value );
224 QString find( int key ) const; 234 QString find( int key ) const;
225 static QStringList fields(); 235 static QStringList fields();
226 236
227 void save( QString &buf ) const; 237 void save( QString &buf ) const;
228 238
229 QString displayAddress( const QString &street, 239 QString displayAddress( const QString &street,
230 const QString &city, 240 const QString &city,
231 const QString &state, 241 const QString &state,
232 const QString &zip, 242 const QString &zip,
233 const QString &country ) const; 243 const QString &country ) const;
234 244
235 QMap<int, QString> mMap; 245 QMap<int, QString> mMap;
236 OContactPrivate *d; 246 OContactPrivate *d;
237}; 247};
238 248
249}
239 250
240#endif 251#endif
diff --git a/libopie2/opiepim/ocontactfields.cpp b/libopie2/opiepim/ocontactfields.cpp
index 0f08a5a..deaa1e5 100644
--- a/libopie2/opiepim/ocontactfields.cpp
+++ b/libopie2/opiepim/ocontactfields.cpp
@@ -1,27 +1,56 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1 29
2#include "ocontactfields.h" 30#include <opie2/ocontactfields.h>
3 31
4#include <qstringlist.h> 32#include <qstringlist.h>
5#include <qobject.h> 33#include <qobject.h>
6 34
7// We should use our own enum in the future .. 35// We should use our own enum in the future ..
8#include <qpe/recordfields.h> 36#include <qpe/recordfields.h>
9#include <qpe/config.h> 37#include <qpe/config.h>
10#include <opie/ocontact.h> 38#include <opie2/ocontact.h>
11 39
40namespace Opie {
12/*! 41/*!
13 \internal 42 \internal
14 Returns a list of personal field names for a contact. 43 Returns a list of personal field names for a contact.
15*/ 44*/
16QStringList OContactFields::personalfields( bool sorted, bool translated ) 45QStringList OContactFields::personalfields( bool sorted, bool translated )
17{ 46{
18 QStringList list; 47 QStringList list;
19 QMap<int, QString> mapIdToStr; 48 QMap<int, QString> mapIdToStr;
20 if ( translated ) 49 if ( translated )
21 mapIdToStr = idToTrFields(); 50 mapIdToStr = idToTrFields();
22 else 51 else
23 mapIdToStr = idToUntrFields(); 52 mapIdToStr = idToUntrFields();
24 53
25 list.append( mapIdToStr[ Qtopia::AddressUid ] ); 54 list.append( mapIdToStr[ Qtopia::AddressUid ] );
26 list.append( mapIdToStr[ Qtopia::AddressCategory ] ); 55 list.append( mapIdToStr[ Qtopia::AddressCategory ] );
27 56
@@ -462,16 +491,18 @@ int OContactFields::getFieldOrder( int num, int defIndex ){
462 int ret = 0; 491 int ret = 0;
463 // Convert char to number.. 492 // Convert char to number..
464 if ( !( poschar == QChar::null ) ) 493 if ( !( poschar == QChar::null ) )
465 ret = QString( poschar ).toInt(&ok, 16); 494 ret = QString( poschar ).toInt(&ok, 16);
466 else 495 else
467 ok = false; 496 ok = false;
468 497
469 // Return default value if index for 498 // Return default value if index for
470 // num was not set or if anything else happened.. 499 // num was not set or if anything else happened..
471 if ( !ok ) ret = defIndex; 500 if ( !ok ) ret = defIndex;
472 501
473 qDebug("returning >%i<",ret); 502 qDebug("returning >%i<",ret);
474 503
475 return ret; 504 return ret;
476 505
477} 506}
507
508}
diff --git a/libopie2/opiepim/ocontactfields.h b/libopie2/opiepim/ocontactfields.h
index f105de7..993ce3b 100644
--- a/libopie2/opiepim/ocontactfields.h
+++ b/libopie2/opiepim/ocontactfields.h
@@ -1,28 +1,57 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_CONTACTS_FIELDS 29#ifndef OPIE_CONTACTS_FIELDS
2#define OPIE_CONTACTS_FIELDS 30#define OPIE_CONTACTS_FIELDS
3 31
4class QStringList; 32class QStringList;
5 33
6#include <qmap.h> 34#include <qmap.h>
7#include <qstring.h> 35#include <qstring.h>
8#include <opie/ocontact.h> 36#include <opie2/ocontact.h>
9 37
10#define CONTACT_FIELD_ORDER_NAME "opie-contactfield-order" 38#define CONTACT_FIELD_ORDER_NAME "opie-contactfield-order"
11#define DEFAULT_FIELD_ORDER "__________" 39#define DEFAULT_FIELD_ORDER "__________"
12 40
41namespace Opie {
13class OContactFields{ 42class OContactFields{
14 43
15 public: 44 public:
16 OContactFields(); 45 OContactFields();
17 ~OContactFields(); 46 ~OContactFields();
18 /** Set the index for combo boxes. 47 /** Set the index for combo boxes.
19 * Sets the <b>index</b> of combo <b>num</b>. 48 * Sets the <b>index</b> of combo <b>num</b>.
20 * @param num selects the number of the combo 49 * @param num selects the number of the combo
21 * @param index sets the index in the combo 50 * @param index sets the index in the combo
22 */ 51 */
23 void setFieldOrder( int num, int index ); 52 void setFieldOrder( int num, int index );
24 53
25 /** Get the index for combo boxes. 54 /** Get the index for combo boxes.
26 * Returns the index of combo <b>num</b> or defindex 55 * Returns the index of combo <b>num</b> or defindex
27 * if none was defined.. 56 * if none was defined..
28 * @param num Selects the number of the combo 57 * @param num Selects the number of the combo
@@ -50,18 +79,18 @@ class OContactFields{
50 79
51 static QStringList trpersonalfields( bool sorted = true ); 80 static QStringList trpersonalfields( bool sorted = true );
52 static QStringList untrpersonalfields( bool sorted = true ); 81 static QStringList untrpersonalfields( bool sorted = true );
53 static QStringList trphonefields( bool sorted = true ); 82 static QStringList trphonefields( bool sorted = true );
54 static QStringList untrphonefields( bool sorted = true ); 83 static QStringList untrphonefields( bool sorted = true );
55 static QStringList trdetailsfields( bool sorted = true ); 84 static QStringList trdetailsfields( bool sorted = true );
56 static QStringList untrdetailsfields( bool sorted = true ); 85 static QStringList untrdetailsfields( bool sorted = true );
57 static QStringList trfields( bool sorted = true ); 86 static QStringList trfields( bool sorted = true );
58 static QStringList untrfields( bool sorted = true ); 87 static QStringList untrfields( bool sorted = true );
59 88
60 static QMap<int, QString> idToTrFields(); 89 static QMap<int, QString> idToTrFields();
61 static QMap<QString, int> trFieldsToId(); 90 static QMap<QString, int> trFieldsToId();
62 static QMap<int, QString> idToUntrFields(); 91 static QMap<int, QString> idToUntrFields();
63 static QMap<QString, int> untrFieldsToId(); 92 static QMap<QString, int> untrFieldsToId();
64 93
65}; 94};
66 95}
67#endif 96#endif
diff --git a/libopie2/opiepim/oevent.cpp b/libopie2/opiepim/oevent.cpp
index 9b31957..de5e30b 100644
--- a/libopie2/opiepim/oevent.cpp
+++ b/libopie2/opiepim/oevent.cpp
@@ -1,28 +1,58 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#include <qshared.h> 29#include <qshared.h>
2#include <qarray.h> 30#include <qarray.h>
3 31
4#include <qpe/palmtopuidgen.h> 32#include <qpe/palmtopuidgen.h>
5#include <qpe/categories.h> 33#include <qpe/categories.h>
6#include <qpe/stringutil.h> 34#include <qpe/stringutil.h>
7 35
8#include "orecur.h" 36#include <opie2/orecur.h>
9#include "opimresolver.h" 37#include <opie2/opimresolver.h>
10#include "opimnotifymanager.h" 38#include <opie2/opimnotifymanager.h>
11 39
12#include "oevent.h" 40#include <opie2/oevent.h>
41
42namespace Opie {
13 43
14int OCalendarHelper::week( const QDate& date) { 44int OCalendarHelper::week( const QDate& date) {
15 // Calculates the week this date is in within that 45 // Calculates the week this date is in within that
16 // month. Equals the "row" is is in in the month view 46 // month. Equals the "row" is is in in the month view
17 int week = 1; 47 int week = 1;
18 QDate tmp( date.year(), date.month(), 1 ); 48 QDate tmp( date.year(), date.month(), 1 );
19 if ( date.dayOfWeek() < tmp.dayOfWeek() ) 49 if ( date.dayOfWeek() < tmp.dayOfWeek() )
20 ++week; 50 ++week;
21 51
22 week += ( date.day() - 1 ) / 7; 52 week += ( date.day() - 1 ) / 7;
23 53
24 return week; 54 return week;
25} 55}
26int OCalendarHelper::ocurrence( const QDate& date) { 56int OCalendarHelper::ocurrence( const QDate& date) {
27 // calculates the number of occurrances of this day of the 57 // calculates the number of occurrances of this day of the
28 // week till the given date (e.g 3rd Wednesday of the month) 58 // week till the given date (e.g 3rd Wednesday of the month)
@@ -702,16 +732,18 @@ bool OEffectiveEvent::operator<=( const OEffectiveEvent &e ) const{
702} 732}
703bool OEffectiveEvent::operator==( const OEffectiveEvent &e ) const { 733bool OEffectiveEvent::operator==( const OEffectiveEvent &e ) const {
704 return ( date() == e.date() 734 return ( date() == e.date()
705 && startTime() == e.startTime() 735 && startTime() == e.startTime()
706 && endTime()== e.endTime() 736 && endTime()== e.endTime()
707 && event() == e.event() ); 737 && event() == e.event() );
708} 738}
709bool OEffectiveEvent::operator!=( const OEffectiveEvent &e ) const { 739bool OEffectiveEvent::operator!=( const OEffectiveEvent &e ) const {
710 return !(*this == e ); 740 return !(*this == e );
711} 741}
712bool OEffectiveEvent::operator>( const OEffectiveEvent &e ) const { 742bool OEffectiveEvent::operator>( const OEffectiveEvent &e ) const {
713 return !(*this <= e ); 743 return !(*this <= e );
714} 744}
715bool OEffectiveEvent::operator>= ( const OEffectiveEvent &e ) const { 745bool OEffectiveEvent::operator>= ( const OEffectiveEvent &e ) const {
716 return !(*this < e); 746 return !(*this < e);
717} 747}
748
749}
diff --git a/libopie2/opiepim/oevent.h b/libopie2/opiepim/oevent.h
index 9eb948f..9502efa 100644
--- a/libopie2/opiepim/oevent.h
+++ b/libopie2/opiepim/oevent.h
@@ -1,31 +1,60 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1// CONTAINS GPLed code of TT 29// CONTAINS GPLed code of TT
2 30
3#ifndef OPIE_PIM_EVENT_H 31#ifndef OPIE_PIM_EVENT_H
4#define OPIE_PIM_EVENT_H 32#define OPIE_PIM_EVENT_H
5 33
6#include <qstring.h> 34#include <qstring.h>
7#include <qdatetime.h> 35#include <qdatetime.h>
8#include <qvaluelist.h> 36#include <qvaluelist.h>
9 37
10#include <qpe/recordfields.h> 38#include <qpe/recordfields.h>
11#include <qpe/palmtopuidgen.h> 39#include <qpe/palmtopuidgen.h>
12 40
13#include "otimezone.h" 41#include <opie2/otimezone.h>
14#include "opimrecord.h" 42#include <opie2/opimrecord.h>
15 43
44namespace Opie {
16struct OCalendarHelper { 45struct OCalendarHelper {
17 /** calculate the week number of the date */ 46 /** calculate the week number of the date */
18 static int week( const QDate& ); 47 static int week( const QDate& );
19 /** calculate the occurence of week days since the start of the month */ 48 /** calculate the occurence of week days since the start of the month */
20 static int ocurrence( const QDate& ); 49 static int ocurrence( const QDate& );
21 50
22 // returns the dayOfWeek for the *first* day it finds (ignores 51 // returns the dayOfWeek for the *first* day it finds (ignores
23 // any further days!). Returns 1 (Monday) if there isn't any day found 52 // any further days!). Returns 1 (Monday) if there isn't any day found
24 static int dayOfWeek( char day ); 53 static int dayOfWeek( char day );
25 54
26 /** returns the diff of month */ 55 /** returns the diff of month */
27 static int monthDiff( const QDate& first, const QDate& second ); 56 static int monthDiff( const QDate& first, const QDate& second );
28 57
29}; 58};
30 59
31class OPimNotifyManager; 60class OPimNotifyManager;
@@ -220,17 +249,20 @@ public:
220 bool operator<( const OEffectiveEvent &e ) const; 249 bool operator<( const OEffectiveEvent &e ) const;
221 bool operator<=( const OEffectiveEvent &e ) const; 250 bool operator<=( const OEffectiveEvent &e ) const;
222 bool operator==( const OEffectiveEvent &e ) const; 251 bool operator==( const OEffectiveEvent &e ) const;
223 bool operator!=( const OEffectiveEvent &e ) const; 252 bool operator!=( const OEffectiveEvent &e ) const;
224 bool operator>( const OEffectiveEvent &e ) const; 253 bool operator>( const OEffectiveEvent &e ) const;
225 bool operator>= ( const OEffectiveEvent &e ) const; 254 bool operator>= ( const OEffectiveEvent &e ) const;
226 255
227private: 256private:
228 void deref(); 257 void deref();
229 inline void changeOrModify(); 258 inline void changeOrModify();
230 class Private; 259 class Private;
231 Private* priv; 260 Private* priv;
232 struct Data; 261 struct Data;
233 Data* data; 262 Data* data;
234 263
235}; 264};
265
266}
267
236#endif 268#endif
diff --git a/libopie2/opiepim/opiepim.pro b/libopie2/opiepim/opiepim.pro
index 3972c3f..82737f4 100644
--- a/libopie2/opiepim/opiepim.pro
+++ b/libopie2/opiepim/opiepim.pro
@@ -1,24 +1,30 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on debug 2CONFIG += qt warn_on debug
3DESTDIR = $(OPIEDIR)/lib 3DESTDIR = $(OPIEDIR)/lib
4HEADERS = 4HEADERS = ocontact.h ocontactfields.h opimrecord.h otodo.h opimnotify.h opimnotifymanager.h oevent.h
5 5
6SOURCES = 6SOURCES = ocontact.cpp ocontactfields.cpp opimrecord.cpp otodo.cpp opimnotify.cpp \
7 opimnotifymanager.cpp oevent.cpp
7INTERFACES = 8INTERFACES =
8TARGET = opiepim2 9TARGET = opiepim2
9VERSION = 1.8.2 10VERSION = 1.8.2
10INCLUDEPATH += $(OPIEDIR)/include 11INCLUDEPATH += $(OPIEDIR)/include
11DEPENDPATH += $(OPIEDIR)/include 12DEPENDPATH += $(OPIEDIR)/include
12 13
14include ( core/core.pro )
15include ( core/backends/backends.pro )
16include ( ui/ui.pro )
17
13MOC_DIR = moc 18MOC_DIR = moc
14OBJECTS_DIR = obj 19OBJECTS_DIR = obj
15 20
16 21
17!contains( platform, x11 ) { 22!contains( platform, x11 ) {
18 include ( $(OPIEDIR)/include.pro ) 23 include ( $(OPIEDIR)/include.pro )
19} 24}
20 25
21contains( platform, x11 ) { 26contains( platform, x11 ) {
22 LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib 27 LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
23} 28}
24 29
30LIBS += -lopiecore2
diff --git a/libopie2/opiepim/orecordlist.h b/libopie2/opiepim/orecordlist.h
index 5211f57..8f0011b 100644
--- a/libopie2/opiepim/orecordlist.h
+++ b/libopie2/opiepim/orecordlist.h
@@ -1,24 +1,54 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1 29
2#ifndef OPIE_RECORD_LIST_H 30#ifndef OPIE_RECORD_LIST_H
3#define OPIE_RECORD_LIST_H 31#define OPIE_RECORD_LIST_H
4 32
5#include <qarray.h> 33#include <qarray.h>
6 34
7#include "otemplatebase.h" 35#include <opie2/otemplatebase.h>
8#include "opimrecord.h" 36#include <opie2/opimrecord.h>
37
38namespace Opie {
9 39
10class ORecordListIteratorPrivate; 40class ORecordListIteratorPrivate;
11/** 41/**
12 * Our List Iterator 42 * Our List Iterator
13 * it behaves like STL or Qt 43 * it behaves like STL or Qt
14 * 44 *
15 * for(it = list.begin(); it != list.end(); ++it ) 45 * for(it = list.begin(); it != list.end(); ++it )
16 * doSomeCoolStuff( (*it) ); 46 * doSomeCoolStuff( (*it) );
17 */ 47 */
18template <class T> class ORecordList; 48template <class T> class ORecordList;
19template <class T = OPimRecord> 49template <class T = OPimRecord>
20class ORecordListIterator { 50class ORecordListIterator {
21 friend class ORecordList<T>; 51 friend class ORecordList<T>;
22public: 52public:
23 typedef OTemplateBase<T> Base; 53 typedef OTemplateBase<T> Base;
24 54
@@ -289,18 +319,18 @@ bool ORecordList<T>::remove( int uid ) {
289 319
290 for (uint i = 0; i < m_ids.count(); i++){ 320 for (uint i = 0; i < m_ids.count(); i++){
291 if ( m_ids[i] != uid ){ 321 if ( m_ids[i] != uid ){
292 copy[counter++] = m_ids[i]; 322 copy[counter++] = m_ids[i];
293 323
294 }else 324 }else
295 ret_val = true; 325 ret_val = true;
296 } 326 }
297 327
298 copy.resize( counter ); 328 copy.resize( counter );
299 m_ids = copy; 329 m_ids = copy;
300 330
301 331
302 return ret_val; 332 return ret_val;
303} 333}
304 334
305 335}
306#endif 336#endif
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp
index 189bf94..3eb0026 100644
--- a/libopie2/opiepim/otodo.cpp
+++ b/libopie2/opiepim/otodo.cpp
@@ -1,38 +1,66 @@
1 1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
2#include <qobject.h> 29#include <qobject.h>
3#include <qshared.h> 30#include <qshared.h>
4 31
5 32
6 33
7#include <qpe/palmtopuidgen.h> 34#include <qpe/palmtopuidgen.h>
8#include <qpe/stringutil.h> 35#include <qpe/stringutil.h>
9#include <qpe/palmtoprecord.h> 36#include <qpe/palmtoprecord.h>
10#include <qpe/stringutil.h> 37#include <qpe/stringutil.h>
11#include <qpe/categories.h> 38#include <qpe/categories.h>
12#include <qpe/categoryselect.h> 39#include <qpe/categoryselect.h>
13 40
14 41
15#include "opimstate.h" 42#include <opie2/opimstate.h>
16#include "orecur.h" 43#include <opie2/orecur.h>
17#include "opimmaintainer.h" 44#include <opie2/opimmaintainer.h>
18#include "opimnotifymanager.h" 45#include <opie2/opimnotifymanager.h>
19#include "opimresolver.h" 46#include <opie2/opimresolver.h>
20 47
21#include "otodo.h" 48#include <opie2/otodo.h>
22 49
50namespace Opie {
23 51
24struct OTodo::OTodoData : public QShared { 52struct OTodo::OTodoData : public QShared {
25 OTodoData() : QShared() { 53 OTodoData() : QShared() {
26 recur = 0; 54 recur = 0;
27 state = 0; 55 state = 0;
28 maintainer = 0; 56 maintainer = 0;
29 notifiers = 0; 57 notifiers = 0;
30 }; 58 };
31 ~OTodoData() { 59 ~OTodoData() {
32 delete recur; 60 delete recur;
33 delete maintainer; 61 delete maintainer;
34 delete notifiers; 62 delete notifiers;
35 } 63 }
36 64
37 QDate date; 65 QDate date;
38 bool isCompleted:1; 66 bool isCompleted:1;
@@ -505,16 +533,18 @@ void OTodo::copy( OTodoData* src, OTodoData* dest ) {
505 dest->start = src->start; 533 dest->start = src->start;
506 dest->completed = src->completed; 534 dest->completed = src->completed;
507 535
508 if (src->notifiers ) 536 if (src->notifiers )
509 dest->notifiers = new OPimNotifyManager( *src->notifiers ); 537 dest->notifiers = new OPimNotifyManager( *src->notifiers );
510} 538}
511QString OTodo::type() const { 539QString OTodo::type() const {
512 return QString::fromLatin1("OTodo"); 540 return QString::fromLatin1("OTodo");
513} 541}
514QString OTodo::recordField(int /*id*/ )const { 542QString OTodo::recordField(int /*id*/ )const {
515 return QString::null; 543 return QString::null;
516} 544}
517 545
518int OTodo::rtti(){ 546int OTodo::rtti(){
519 return OPimResolver::TodoList; 547 return OPimResolver::TodoList;
520} 548}
549
550}
diff --git a/libopie2/opiepim/otodo.h b/libopie2/opiepim/otodo.h
index 6df98b9..61add04 100644
--- a/libopie2/opiepim/otodo.h
+++ b/libopie2/opiepim/otodo.h
@@ -1,33 +1,62 @@
1 1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
2#ifndef OPIE_TODO_EVENT_H 29#ifndef OPIE_TODO_EVENT_H
3#define OPIE_TODO_EVENT_H 30#define OPIE_TODO_EVENT_H
4 31
5 32
6#include <qarray.h> 33#include <qarray.h>
7#include <qmap.h> 34#include <qmap.h>
8#include <qregexp.h> 35#include <qregexp.h>
9#include <qstringlist.h> 36#include <qstringlist.h>
10#include <qdatetime.h> 37#include <qdatetime.h>
11#include <qvaluelist.h> 38#include <qvaluelist.h>
12 39
13#include <qpe/recordfields.h> 40#include <qpe/recordfields.h>
14#include <qpe/palmtopuidgen.h> 41#include <qpe/palmtopuidgen.h>
15 42
16#include <opie/opimrecord.h> 43#include <opie2/opimrecord.h>
44
17 45
46namespace Opie {
18 47
19class OPimState; 48class OPimState;
20class ORecur; 49class ORecur;
21class OPimMaintainer; 50class OPimMaintainer;
22class OPimNotifyManager; 51class OPimNotifyManager;
23class OTodo : public OPimRecord { 52class OTodo : public OPimRecord {
24public: 53public:
25 typedef QValueList<OTodo> ValueList; 54 typedef QValueList<OTodo> ValueList;
26 enum RecordFields { 55 enum RecordFields {
27 Uid = Qtopia::UID_ID, 56 Uid = Qtopia::UID_ID,
28 Category = Qtopia::CATEGORY_ID, 57 Category = Qtopia::CATEGORY_ID,
29 HasDate, 58 HasDate,
30 Completed, 59 Completed,
31 Description, 60 Description,
32 Summary, 61 Summary,
33 Priority, 62 Priority,
@@ -268,18 +297,19 @@ public:
268 297
269 private: 298 private:
270 class OTodoPrivate; 299 class OTodoPrivate;
271 struct OTodoData; 300 struct OTodoData;
272 301
273 void deref(); 302 void deref();
274 inline void changeOrModify(); 303 inline void changeOrModify();
275 void copy( OTodoData* src, OTodoData* dest ); 304 void copy( OTodoData* src, OTodoData* dest );
276 OTodoPrivate *d; 305 OTodoPrivate *d;
277 OTodoData *data; 306 OTodoData *data;
278 307
279}; 308};
280inline bool OTodo::operator!=(const OTodo &toDoEvent )const { 309inline bool OTodo::operator!=(const OTodo &toDoEvent )const {
281 return !(*this == toDoEvent); 310 return !(*this == toDoEvent);
282} 311}
283 312
313}
284 314
285#endif 315#endif
diff --git a/libopie2/opiepim/ui/opimmainwindow.cpp b/libopie2/opiepim/ui/opimmainwindow.cpp
index 2739e26..10ed743 100644
--- a/libopie2/opiepim/ui/opimmainwindow.cpp
+++ b/libopie2/opiepim/ui/opimmainwindow.cpp
@@ -1,27 +1,56 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#include <qapplication.h> 29#include <qapplication.h>
2#include <qdatetime.h> 30#include <qdatetime.h>
3#include <qcopchannel_qws.h> 31#include <qcopchannel_qws.h>
4 32
5#include <qpe/sound.h> 33#include <qpe/sound.h>
6#include <qpe/qcopenvelope_qws.h> 34#include <qpe/qcopenvelope_qws.h>
7#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
8 36
9#include "opimresolver.h" 37#include <opie2/opimresolver.h>
10#include "opimmainwindow.h" 38#include "opimmainwindow.h"
11 39
40namespace Opie {
12OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent, 41OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent,
13 const char* name, WFlags flag ) 42 const char* name, WFlags flag )
14 : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) { 43 : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) {
15 44
16 /* 45 /*
17 * let's generate our QCopChannel 46 * let's generate our QCopChannel
18 */ 47 */
19 m_str = QString("QPE/"+m_service).local8Bit(); 48 m_str = QString("QPE/"+m_service).local8Bit();
20 m_channel= new QCopChannel(m_str, this ); 49 m_channel= new QCopChannel(m_str, this );
21 connect(m_channel, SIGNAL(received(const QCString&, const QByteArray& ) ), 50 connect(m_channel, SIGNAL(received(const QCString&, const QByteArray& ) ),
22 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); 51 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) );
23 connect(qApp, SIGNAL(appMessage(const QCString&, const QByteArray& ) ), 52 connect(qApp, SIGNAL(appMessage(const QCString&, const QByteArray& ) ),
24 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); 53 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) );
25 54
26 /* connect flush and reload */ 55 /* connect flush and reload */
27 connect(qApp, SIGNAL(flush() ), 56 connect(qApp, SIGNAL(flush() ),
@@ -135,16 +164,18 @@ void OPimMainWindow::startAlarm(int count ) {
135 m_alarmCount = count; 164 m_alarmCount = count;
136 m_playedCount = 0; 165 m_playedCount = 0;
137 Sound::soundAlarm(); 166 Sound::soundAlarm();
138 m_timerId = startTimer( 5000 ); 167 m_timerId = startTimer( 5000 );
139} 168}
140void OPimMainWindow::killAlarm() { 169void OPimMainWindow::killAlarm() {
141 killTimer( m_timerId ); 170 killTimer( m_timerId );
142} 171}
143void OPimMainWindow::timerEvent( QTimerEvent* e) { 172void OPimMainWindow::timerEvent( QTimerEvent* e) {
144 if ( m_playedCount <m_alarmCount ) { 173 if ( m_playedCount <m_alarmCount ) {
145 m_playedCount++; 174 m_playedCount++;
146 Sound::soundAlarm(); 175 Sound::soundAlarm();
147 }else { 176 }else {
148 killTimer( e->timerId() ); 177 killTimer( e->timerId() );
149 } 178 }
150} 179}
180
181}
diff --git a/libopie2/opiepim/ui/opimmainwindow.h b/libopie2/opiepim/ui/opimmainwindow.h
index 855d364..abad630 100644
--- a/libopie2/opiepim/ui/opimmainwindow.h
+++ b/libopie2/opiepim/ui/opimmainwindow.h
@@ -1,39 +1,68 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#ifndef OPIE_PIM_MAINWINDOW_H 29#ifndef OPIE_PIM_MAINWINDOW_H
2#define OPIE_PIM_MAINWINDOW_H 30#define OPIE_PIM_MAINWINDOW_H
3 31
4#include <qmainwindow.h> 32#include <qmainwindow.h>
5 33
6#include <opie/opimrecord.h> 34#include <opie2/opimrecord.h>
35class QCopChannel;
36class QDateTime;
7 37
38namespace Opie {
8/** 39/**
9 * This is a common Opie PIM MainWindow 40 * This is a common Opie PIM MainWindow
10 * it takes care of the QCOP internals 41 * it takes care of the QCOP internals
11 * and implements some functions 42 * and implements some functions
12 * for the URL scripting schema 43 * for the URL scripting schema
13 */ 44 */
14/* 45/*
15 * due Qt and Templates with signal and slots 46 * due Qt and Templates with signal and slots
16 * do not work that good :( 47 * do not work that good :(
17 * (Ok how to moc a template ;) ) 48 * (Ok how to moc a template ;) )
18 * We will have the mainwindow which calls a struct which 49 * We will have the mainwindow which calls a struct which
19 * is normally reimplemented as a template ;) 50 * is normally reimplemented as a template ;)
20 */ 51 */
21 52
22class QCopChannel;
23class QDateTime;
24class OPimMainWindow : public QMainWindow { 53class OPimMainWindow : public QMainWindow {
25 Q_OBJECT 54 Q_OBJECT
26public: 55public:
27 enum TransPort { BlueTooth=0, 56 enum TransPort { BlueTooth=0,
28 IrDa }; 57 IrDa };
29 58
30 OPimMainWindow( const QString& service, QWidget *parent = 0, const char* name = 0, 59 OPimMainWindow( const QString& service, QWidget *parent = 0, const char* name = 0,
31 WFlags f = WType_TopLevel); 60 WFlags f = WType_TopLevel);
32 virtual ~OPimMainWindow(); 61 virtual ~OPimMainWindow();
33 62
34 63
35protected slots: 64protected slots:
36 /* 65 /*
37 * called when a setDocument 66 * called when a setDocument
38 * couldn't be handled by this window 67 * couldn't be handled by this window
39 */ 68 */
@@ -82,18 +111,19 @@ private:
82 int m_rtti; 111 int m_rtti;
83 QCopChannel* m_channel; 112 QCopChannel* m_channel;
84 QString m_service; 113 QString m_service;
85 QCString m_str; 114 QCString m_str;
86 OPimRecord* m_fallBack; 115 OPimRecord* m_fallBack;
87 int m_alarmCount; 116 int m_alarmCount;
88 int m_playedCount; 117 int m_playedCount;
89 int m_timerId; 118 int m_timerId;
90 /* I would love to do this as a template 119 /* I would love to do this as a template
91 * but can't think of a right way 120 * but can't think of a right way
92 * because I need signal and slots -zecke 121 * because I need signal and slots -zecke
93 */ 122 */
94 virtual OPimRecord* record( int rtti, const QByteArray& ) ; 123 virtual OPimRecord* record( int rtti, const QByteArray& ) ;
95 int service(); 124 int service();
96}; 125};
97 126
127}
98 128
99#endif 129#endif
diff --git a/libopie2/opiepim/ui/ui.pro b/libopie2/opiepim/ui/ui.pro
new file mode 100644
index 0000000..db19bca
--- a/dev/null
+++ b/libopie2/opiepim/ui/ui.pro
@@ -0,0 +1,3 @@
1HEADERS += ui/opimmainwindow.h
2
3SOURCES += ui/opimmainwindow.cpp