34 files changed, 1096 insertions, 192 deletions
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 @@ | |||
1 | HEADERS += 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 | |||
13 | SOURCES += 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,86 +1,68 @@ | |||
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 | ||
56 | namespace Opie { | ||
75 | 57 | ||
76 | OContactAccess::OContactAccess ( const QString appname, const QString , | 58 | OContactAccess::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 | } |
@@ -157,12 +139,14 @@ void OContactAccess::copMessage( const QCString &msg, const QByteArray & ) | |||
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,98 +1,60 @@ | |||
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 | ||
48 | namespace 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 | */ |
96 | class OContactAccess: public QObject, public OPimAccessTemplate<OContact> | 58 | class OContactAccess: public QObject, public OPimAccessTemplate<OContact> |
97 | { | 59 | { |
98 | Q_OBJECT | 60 | Q_OBJECT |
@@ -181,13 +143,16 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact> | |||
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,29 +1,47 @@ | |||
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 | ||
34 | namespace Opie { | ||
35 | |||
18 | QString OConversion::dateToString( const QDate &d ) | 36 | QString 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 | ||
@@ -102,12 +120,13 @@ QDateTime OConversion::dateTimeFromString( const QString& str) { | |||
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 */ | 37 | namespace Opie { |
38 | |||
27 | class OConversion | 39 | class OConversion |
28 | { | 40 | { |
29 | public: | 41 | public: |
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 | ||
41 | private: | 53 | private: |
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,15 +1,44 @@ | |||
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 | ||
32 | namespace 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 | */ |
11 | ODateBookAccess::ODateBookAccess( ODateBookAccessBackend* back, enum Access ac ) | 40 | ODateBookAccess::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 ); |
@@ -70,12 +99,14 @@ OEffectiveEvent::ValueList ODateBookAccess::effectiveEvents( const QDateTime& st | |||
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 | */ |
73 | OEffectiveEvent::ValueList ODateBookAccess::effectiveNonRepeatingEvents( const QDate& from, const QDate& to ) const { | 102 | OEffectiveEvent::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 | */ |
79 | OEffectiveEvent::ValueList ODateBookAccess::effectiveNonRepeatingEvents( const QDateTime& start ) const { | 108 | OEffectiveEvent::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,20 +1,49 @@ | |||
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 | ||
37 | namespace 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 | */ |
18 | class ODateBookAccess : public OPimAccessTemplate<OEvent> { | 47 | class ODateBookAccess : public OPimAccessTemplate<OEvent> { |
19 | public: | 48 | public: |
20 | ODateBookAccess( ODateBookAccessBackend* = 0l, enum Access acc = Random ); | 49 | ODateBookAccess( ODateBookAccessBackend* = 0l, enum Access acc = Random ); |
@@ -32,13 +61,15 @@ public: | |||
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 | ||
38 | private: | 67 | private: |
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,23 +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_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 | |||
41 | namespace Opie { | ||
12 | 42 | ||
13 | class OPimAccessTemplatePrivate; | 43 | class 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 | ||
23 | template <class T = OPimRecord > | 53 | template <class T = OPimRecord > |
@@ -290,13 +320,16 @@ template <class T> | |||
290 | void OPimAccessTemplate<T>::cache( const T& t ) const{ | 320 | void 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 | } |
294 | template <class T> | 324 | template <class T> |
295 | void OPimAccessTemplate<T>::setSaneCacheSize( int size ) { | 325 | void OPimAccessTemplate<T>::setSaneCacheSize( int size ) { |
296 | m_cache.setSize( size ); | 326 | m_cache.setSize( size ); |
297 | } | 327 | } |
298 | template <class T> | 328 | template <class T> |
299 | void OPimAccessTemplate<T>::setReadAhead( uint count ) { | 329 | void 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,19 +1,48 @@ | |||
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 | ||
36 | namespace Opie { | ||
8 | class OPimCacheItemPrivate; | 37 | class OPimCacheItemPrivate; |
9 | 38 | ||
10 | template <class T = OPimRecord> | 39 | template <class T = OPimRecord> |
11 | class OPimCacheItem { | 40 | class OPimCacheItem { |
12 | public: | 41 | public: |
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; |
@@ -119,13 +148,15 @@ void OPimCache<T>::add( const T& t ) { | |||
119 | template <class T> | 148 | template <class T> |
120 | void OPimCache<T>::remove( int uid ) { | 149 | void OPimCache<T>::remove( int uid ) { |
121 | m_cache.remove( uid ); | 150 | m_cache.remove( uid ); |
122 | } | 151 | } |
123 | template <class T> | 152 | template <class T> |
124 | void OPimCache<T>::replace( const T& t) { | 153 | void 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,14 +1,44 @@ | |||
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 | |||
32 | namespace Opie { | ||
3 | OPimMaintainer::OPimMaintainer( int mode, int uid ) | 33 | OPimMaintainer::OPimMaintainer( int mode, int uid ) |
4 | : m_mode(mode), m_uid(uid ) | 34 | : m_mode(mode), m_uid(uid ) |
5 | {} | 35 | {} |
6 | OPimMaintainer::~OPimMaintainer() { | 36 | OPimMaintainer::~OPimMaintainer() { |
7 | } | 37 | } |
8 | OPimMaintainer::OPimMaintainer( const OPimMaintainer& main ) { | 38 | OPimMaintainer::OPimMaintainer( const OPimMaintainer& main ) { |
9 | *this = main; | 39 | *this = main; |
10 | } | 40 | } |
11 | OPimMaintainer &OPimMaintainer::operator=( const OPimMaintainer& main ) { | 41 | OPimMaintainer &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 | ||
@@ -26,12 +56,14 @@ bool OPimMaintainer::operator!=( const OPimMaintainer& main ) { | |||
26 | int OPimMaintainer::mode()const { | 56 | int OPimMaintainer::mode()const { |
27 | return m_mode; | 57 | return m_mode; |
28 | } | 58 | } |
29 | int OPimMaintainer::uid()const { | 59 | int OPimMaintainer::uid()const { |
30 | return m_uid; | 60 | return m_uid; |
31 | } | 61 | } |
32 | void OPimMaintainer::setMode( int mo) { | 62 | void OPimMaintainer::setMode( int mo) { |
33 | m_mode = mo; | 63 | m_mode = mo; |
34 | } | 64 | } |
35 | void OPimMaintainer::setUid( int uid ) { | 65 | void 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,17 +1,46 @@ | |||
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 | ||
34 | namespace Opie { | ||
6 | /** | 35 | /** |
7 | * Who maintains what? | 36 | * Who maintains what? |
8 | */ | 37 | */ |
9 | class OPimMaintainer { | 38 | class OPimMaintainer { |
10 | public: | 39 | public: |
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); |
@@ -28,13 +57,15 @@ public: | |||
28 | 57 | ||
29 | void setMode( int mode ); | 58 | void setMode( int mode ); |
30 | void setUid( int uid ); | 59 | void setUid( int uid ); |
31 | 60 | ||
32 | private: | 61 | private: |
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,15 +1,45 @@ | |||
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 | |||
33 | namespace Opie { | ||
4 | 34 | ||
5 | struct OPimNotify::Data : public QShared { | 35 | struct 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 | ||
15 | OPimNotify::OPimNotify( const QDateTime& start, int duration, int parent ) { | 45 | OPimNotify::OPimNotify( const QDateTime& start, int duration, int parent ) { |
@@ -216,12 +246,13 @@ void 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 | } |
221 | void OPimReminder::copyIntern() { | 251 | void 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,18 +1,48 @@ | |||
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 | |||
36 | namespace 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 |
@@ -132,13 +162,15 @@ public: | |||
132 | void setRecordUid( int uid ); | 162 | void setRecordUid( int uid ); |
133 | 163 | ||
134 | private: | 164 | private: |
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,18 +1,48 @@ | |||
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 | ||
35 | namespace Opie { | ||
36 | |||
7 | OPimNotifyManager::OPimNotifyManager( const Reminders& rem, const Alarms& al) | 37 | OPimNotifyManager::OPimNotifyManager( const Reminders& rem, const Alarms& al) |
8 | : m_rem( rem ), m_al( al ) | 38 | : m_rem( rem ), m_al( al ) |
9 | {} | 39 | {} |
10 | OPimNotifyManager::~OPimNotifyManager() { | 40 | OPimNotifyManager::~OPimNotifyManager() { |
11 | } | 41 | } |
12 | /* use static_cast and type instead of dynamic... */ | 42 | /* use static_cast and type instead of dynamic... */ |
13 | void OPimNotifyManager::add( const OPimNotify& noti) { | 43 | void 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); |
@@ -151,12 +181,13 @@ void OPimNotifyManager::alarmsFromString( const QString& str ) | |||
151 | } | 181 | } |
152 | 182 | ||
153 | void OPimNotifyManager::remindersFromString( const QString& str ) | 183 | void 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,19 +1,48 @@ | |||
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 | ||
36 | namespace Opie { | ||
8 | /** | 37 | /** |
9 | * The notify manager keeps track of the Notifiers.... | 38 | * The notify manager keeps track of the Notifiers.... |
10 | */ | 39 | */ |
11 | class OPimNotifyManager { | 40 | class OPimNotifyManager { |
12 | public: | 41 | public: |
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& ); |
@@ -79,13 +108,15 @@ public: | |||
79 | 108 | ||
80 | 109 | ||
81 | 110 | ||
82 | private: | 111 | private: |
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,19 +1,48 @@ | |||
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 | ||
36 | namespace Opie { | ||
8 | Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia ); | 37 | Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia ); |
9 | 38 | ||
10 | 39 | ||
11 | OPimRecord::OPimRecord( int uid ) | 40 | OPimRecord::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 | } |
17 | OPimRecord::~OPimRecord() { | 46 | OPimRecord::~OPimRecord() { |
18 | } | 47 | } |
19 | OPimRecord::OPimRecord( const OPimRecord& rec ) | 48 | OPimRecord::OPimRecord( const OPimRecord& rec ) |
@@ -171,12 +200,14 @@ OPimXRefPartner OPimRecord::partner( QDataStream& stream ) { | |||
171 | void OPimRecord::setLastHitField( int lastHit )const { | 200 | void OPimRecord::setLastHitField( int lastHit )const { |
172 | m_lastHit = lastHit; | 201 | m_lastHit = lastHit; |
173 | } | 202 | } |
174 | int OPimRecord::lastHitField()const{ | 203 | int OPimRecord::lastHitField()const{ |
175 | return m_lastHit; | 204 | return m_lastHit; |
176 | } | 205 | } |
177 | QMap<QString, QString> OPimRecord::toExtraMap()const { | 206 | QMap<QString, QString> OPimRecord::toExtraMap()const { |
178 | return customMap; | 207 | return customMap; |
179 | } | 208 | } |
180 | void OPimRecord::setExtraMap( const QMap<QString, QString>& map) { | 209 | void 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,29 +1,58 @@ | |||
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 | ||
46 | namespace 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 | */ |
23 | class OPimRecord : public Qtopia::Record { | 52 | class OPimRecord : public Qtopia::Record { |
24 | public: | 53 | public: |
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 | */ |
@@ -144,15 +173,15 @@ protected: | |||
144 | 173 | ||
145 | private: | 174 | private: |
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 | ||
151 | private: | 180 | private: |
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,21 +1,51 @@ | |||
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 | |||
39 | namespace Opie { | ||
10 | 40 | ||
11 | OPimResolver* OPimResolver::m_self = 0l; | 41 | OPimResolver* OPimResolver::m_self = 0l; |
12 | 42 | ||
13 | OPimResolver::OPimResolver() { | 43 | OPimResolver::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 | } |
17 | OPimResolver* OPimResolver::self() { | 47 | OPimResolver* 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; |
@@ -187,12 +217,14 @@ OPimBase* OPimResolver::backend( int rtti ) { | |||
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,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 | #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 | ||
37 | namespace 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 | */ |
20 | class OPimResolver { | 49 | class OPimResolver { |
@@ -78,13 +107,15 @@ private: | |||
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,16 +1,45 @@ | |||
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 | ||
33 | namespace 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 | */ |
10 | struct OPimState::Data : public QShared { | 39 | struct 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 | ||
16 | OPimState::OPimState( int state ) { | 45 | OPimState::OPimState( int state ) { |
@@ -53,12 +82,14 @@ void OPimState::deref() { | |||
53 | data = 0l; | 82 | data = 0l; |
54 | } | 83 | } |
55 | } | 84 | } |
56 | void OPimState::copyInternally() { | 85 | void 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,17 +1,46 @@ | |||
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 | ||
34 | namespace 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 | */ |
17 | class OPimState { | 46 | class OPimState { |
@@ -33,14 +62,14 @@ public: | |||
33 | int state()const; | 62 | int state()const; |
34 | private: | 63 | private: |
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,13 +1,43 @@ | |||
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 | |||
31 | namespace Opie { | ||
2 | 32 | ||
3 | OPimXRef::OPimXRef( const OPimXRefPartner& one, const OPimXRefPartner& two ) | 33 | OPimXRef::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 | } |
9 | OPimXRef::OPimXRef() | 39 | OPimXRef::OPimXRef() |
10 | : m_partners(2) | 40 | : m_partners(2) |
11 | { | 41 | { |
12 | 42 | ||
13 | } | 43 | } |
@@ -36,12 +66,14 @@ void OPimXRef::setPartner( enum Partners par, const OPimXRefPartner& part) { | |||
36 | bool OPimXRef::containsString( const QString& string ) const{ | 66 | bool 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 | } |
42 | bool OPimXRef::containsUid( int uid ) const{ | 72 | bool 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,20 +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 | */ | ||
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 | ||
38 | namespace 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 | */ |
13 | class OPimXRef { | 43 | class OPimXRef { |
14 | public: | 44 | public: |
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(); |
@@ -27,13 +57,15 @@ public: | |||
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 | ||
32 | private: | 62 | private: |
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,14 +1,43 @@ | |||
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 | ||
31 | namespace Opie { | ||
3 | 32 | ||
4 | OPimXRefManager::OPimXRefManager() { | 33 | OPimXRefManager::OPimXRefManager() { |
5 | } | 34 | } |
6 | OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) { | 35 | OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) { |
7 | m_list = ref.m_list; | 36 | m_list = ref.m_list; |
8 | } | 37 | } |
9 | OPimXRefManager::~OPimXRefManager() { | 38 | OPimXRefManager::~OPimXRefManager() { |
10 | } | 39 | } |
11 | OPimXRefManager &OPimXRefManager::operator=( const OPimXRefManager& ref) { | 40 | OPimXRefManager &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 | } |
@@ -60,12 +89,14 @@ OPimXRef::ValueList OPimXRefManager::list( const QString& appName )const{ | |||
60 | } | 89 | } |
61 | OPimXRef::ValueList OPimXRefManager::list( int uid )const { | 90 | OPimXRef::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,19 +1,48 @@ | |||
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 | ||
36 | namespace 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 | */ |
14 | class OPimXRefManager { | 43 | class OPimXRefManager { |
15 | public: | 44 | public: |
16 | OPimXRefManager(); | 45 | OPimXRefManager(); |
17 | OPimXRefManager( const OPimXRefManager& ); | 46 | OPimXRefManager( const OPimXRefManager& ); |
18 | ~OPimXRefManager(); | 47 | ~OPimXRefManager(); |
19 | 48 | ||
@@ -31,13 +60,15 @@ public: | |||
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 | ||
37 | private: | 66 | private: |
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,13 +1,43 @@ | |||
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 | |||
31 | namespace Opie { | ||
2 | 32 | ||
3 | OPimXRefPartner::OPimXRefPartner( const QString& appName, | 33 | OPimXRefPartner::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 | } |
7 | OPimXRefPartner::OPimXRefPartner( const OPimXRefPartner& ref ) { | 37 | OPimXRefPartner::OPimXRefPartner( const OPimXRefPartner& ref ) { |
8 | *this = ref; | 38 | *this = ref; |
9 | } | 39 | } |
10 | OPimXRefPartner::~OPimXRefPartner() { | 40 | OPimXRefPartner::~OPimXRefPartner() { |
11 | } | 41 | } |
12 | OPimXRefPartner &OPimXRefPartner::operator=( const OPimXRefPartner& par ) { | 42 | OPimXRefPartner &OPimXRefPartner::operator=( const OPimXRefPartner& par ) { |
13 | m_app = par.m_app; | 43 | m_app = par.m_app; |
@@ -32,12 +62,14 @@ int OPimXRefPartner::uid()const { | |||
32 | int OPimXRefPartner::field()const { | 62 | int OPimXRefPartner::field()const { |
33 | return m_field; | 63 | return m_field; |
34 | } | 64 | } |
35 | void OPimXRefPartner::setService( const QString& appName ) { | 65 | void OPimXRefPartner::setService( const QString& appName ) { |
36 | m_app = appName; | 66 | m_app = appName; |
37 | } | 67 | } |
38 | void OPimXRefPartner::setUid( int uid ) { | 68 | void OPimXRefPartner::setUid( int uid ) { |
39 | m_uid = uid; | 69 | m_uid = uid; |
40 | } | 70 | } |
41 | void OPimXRefPartner::setField( int field ) { | 71 | void 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,17 +1,46 @@ | |||
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 | ||
34 | namespace 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 | */ |
13 | class OPimXRefPartner { | 42 | class OPimXRefPartner { |
14 | public: | 43 | public: |
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& ); |
@@ -27,14 +56,15 @@ public: | |||
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 ); |
30 | private: | 59 | private: |
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,21 +1,51 @@ | |||
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 | ||
39 | namespace Opie { | ||
10 | struct ORecur::Data : public QShared { | 40 | struct 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; |
@@ -582,12 +612,14 @@ void ORecur::fromMap( const QMap<int, QString>& map ) | |||
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,26 +1,52 @@ | |||
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 | ||
40 | namespace Opie { | ||
15 | /** | 41 | /** |
16 | * Class to handle Recurrencies.. | 42 | * Class to handle Recurrencies.. |
17 | */ | 43 | */ |
18 | 44 | ||
19 | class ORecur { | 45 | class ORecur { |
20 | public: | 46 | public: |
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, |
@@ -95,13 +121,14 @@ private: | |||
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,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 | #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 | ||
37 | namespace 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 | */ |
17 | class OPimBasePrivate; | 46 | class OPimBasePrivate; |
18 | struct OPimBase { | 47 | struct OPimBase { |
19 | /** | 48 | /** |
20 | * return the rtti | 49 | * return the rtti |
@@ -86,13 +115,15 @@ OPimRecord* OTemplateBase<T>::record()const { | |||
86 | template <class T> | 115 | template <class T> |
87 | OPimRecord* OTemplateBase<T>::record(int uid )const { | 116 | OPimRecord* 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 | }; |
93 | template <class T> | 122 | template <class T> |
94 | T* OTemplateBase<T>::rec() { | 123 | T* 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,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 | */ | ||
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 | ||
8 | namespace { | 37 | namespace 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 ); |
@@ -50,24 +79,26 @@ namespace { | |||
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 | |||
92 | namespace Opie { | ||
62 | OTimeZone::OTimeZone( const ZoneName& zone ) | 93 | OTimeZone::OTimeZone( const ZoneName& zone ) |
63 | : m_name(zone) { | 94 | : m_name(zone) { |
64 | } | 95 | } |
65 | OTimeZone::~OTimeZone() { | 96 | OTimeZone::~OTimeZone() { |
66 | } | 97 | } |
67 | 98 | ||
68 | bool OTimeZone::isValid()const { | 99 | bool 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 |
@@ -102,12 +133,14 @@ time_t OTimeZone::fromUTCDateTime( const QDateTime& time ) { | |||
102 | } | 133 | } |
103 | OTimeZone OTimeZone::current() { | 134 | OTimeZone 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 | } |
108 | OTimeZone OTimeZone::utc() { | 139 | OTimeZone OTimeZone::utc() { |
109 | return OTimeZone("UTC"); | 140 | return OTimeZone("UTC"); |
110 | } | 141 | } |
111 | QString OTimeZone::timeZone()const { | 142 | QString 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,18 +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 | */ | ||
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 | ||
36 | namespace 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 | */ |
13 | class OTimeZone { | 44 | class 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 | ||
@@ -57,15 +88,15 @@ class OTimeZone { | |||
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,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 | #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 | ||
37 | namespace Opie { | ||
9 | OTodoAccess::OTodoAccess( OTodoAccessBackend* end, enum Access ) | 38 | OTodoAccess::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 | } |
21 | OTodoAccess::~OTodoAccess() { | 50 | OTodoAccess::~OTodoAccess() { |
22 | // qWarning("~OTodoAccess"); | 51 | // qWarning("~OTodoAccess"); |
23 | } | 52 | } |
24 | void OTodoAccess::mergeWith( const QValueList<OTodo>& list ) { | 53 | void 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) ); |
@@ -51,12 +80,14 @@ OTodoAccess::List OTodoAccess::sorted( bool ascending, int sort,int filter, int | |||
51 | OTodoAccess::List list( ints, this ); | 80 | OTodoAccess::List list( ints, this ); |
52 | return list; | 81 | return list; |
53 | } | 82 | } |
54 | void OTodoAccess::removeAllCompleted() { | 83 | void OTodoAccess::removeAllCompleted() { |
55 | m_todoBackEnd->removeAllCompleted(); | 84 | m_todoBackEnd->removeAllCompleted(); |
56 | } | 85 | } |
57 | QBitArray OTodoAccess::backendSupport( const QString& ) const{ | 86 | QBitArray OTodoAccess::backendSupport( const QString& ) const{ |
58 | return m_todoBackEnd->supports(); | 87 | return m_todoBackEnd->supports(); |
59 | } | 88 | } |
60 | bool OTodoAccess::backendSupports( int attr, const QString& ar) const{ | 89 | bool 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,22 +1,51 @@ | |||
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 | ||
39 | namespace 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 | */ |
17 | class OTodoAccess : public QObject, public OPimAccessTemplate<OTodo> { | 46 | class OTodoAccess : public QObject, public OPimAccessTemplate<OTodo> { |
18 | Q_OBJECT | 47 | Q_OBJECT |
19 | public: | 48 | public: |
20 | enum SortOrder { Completed = 0, | 49 | enum SortOrder { Completed = 0, |
21 | Priority, | 50 | Priority, |
22 | Description, | 51 | Description, |
@@ -93,13 +122,15 @@ signals: | |||
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 ); |
98 | private: | 127 | private: |
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 |