-rw-r--r-- | libopie2/opiepim/backend/obackendfactory.h | 12 | ||||
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend.h | 14 | ||||
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp | 22 | ||||
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp | 3 | ||||
-rw-r--r-- | libopie2/opiepim/backend/odatebookaccessbackend.h | 4 | ||||
-rw-r--r-- | libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp | 6 | ||||
-rw-r--r-- | libopie2/opiepim/backend/opimaccessbackend.h | 4 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessbackend.h | 4 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessvcal.cpp | 26 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessxml.cpp | 6 |
10 files changed, 90 insertions, 11 deletions
diff --git a/libopie2/opiepim/backend/obackendfactory.h b/libopie2/opiepim/backend/obackendfactory.h index ad6cf5a..f3c339d 100644 --- a/libopie2/opiepim/backend/obackendfactory.h +++ b/libopie2/opiepim/backend/obackendfactory.h | |||
@@ -7,24 +7,32 @@ | |||
7 | *This program is free software; you can redistribute it and/or | 7 | *This program is free software; you can redistribute it and/or |
8 | *modify it under the terms of the GNU Library General Public | 8 | *modify it under the terms of the GNU Library General Public |
9 | * License as published by the Free Software Foundation; | 9 | * License as published by the Free Software Foundation; |
10 | * either version 2 of the License, or (at your option) any later | 10 | * either version 2 of the License, or (at your option) any later |
11 | * version. | 11 | * version. |
12 | * ===================================================================== | 12 | * ===================================================================== |
13 | * ToDo: Use plugins | 13 | * ToDo: Use plugins |
14 | * ===================================================================== | 14 | * ===================================================================== |
15 | * Version: $Id$ | 15 | * Version: $Id$ |
16 | * ===================================================================== | 16 | * ===================================================================== |
17 | * History: | 17 | * History: |
18 | * $Log$ | 18 | * $Log$ |
19 | * Revision 1.7 2003/08/01 12:30:16 eilers | ||
20 | * Merging changes from BRANCH_1_0 to HEAD | ||
21 | * | ||
22 | * Revision 1.6.4.1 2003/06/30 14:34:19 eilers | ||
23 | * Patches from Zecke: | ||
24 | * Fixing and cleaning up extraMap handling | ||
25 | * Adding d_ptr for binary compatibility in the future | ||
26 | * | ||
19 | * Revision 1.6 2003/04/13 18:07:10 zecke | 27 | * Revision 1.6 2003/04/13 18:07:10 zecke |
20 | * More API doc | 28 | * More API doc |
21 | * QString -> const QString& | 29 | * QString -> const QString& |
22 | * QString = 0l -> QString::null | 30 | * QString = 0l -> QString::null |
23 | * | 31 | * |
24 | * Revision 1.5 2003/02/21 23:31:52 zecke | 32 | * Revision 1.5 2003/02/21 23:31:52 zecke |
25 | * Add XML datebookresource | 33 | * Add XML datebookresource |
26 | * -clean up todoaccessxml header | 34 | * -clean up todoaccessxml header |
27 | * -implement some more stuff in the oeven tester | 35 | * -implement some more stuff in the oeven tester |
28 | * -extend DefaultFactory to not crash and to use datebook | 36 | * -extend DefaultFactory to not crash and to use datebook |
29 | * | 37 | * |
30 | * -reading of OEvents is working nicely.. saving will be added | 38 | * -reading of OEvents is working nicely.. saving will be added |
@@ -59,24 +67,26 @@ | |||
59 | #include <qstring.h> | 67 | #include <qstring.h> |
60 | #include <qasciidict.h> | 68 | #include <qasciidict.h> |
61 | #include <qpe/config.h> | 69 | #include <qpe/config.h> |
62 | 70 | ||
63 | #include "otodoaccessxml.h" | 71 | #include "otodoaccessxml.h" |
64 | #include "ocontactaccessbackend_xml.h" | 72 | #include "ocontactaccessbackend_xml.h" |
65 | #include "odatebookaccessbackend_xml.h" | 73 | #include "odatebookaccessbackend_xml.h" |
66 | 74 | ||
67 | #ifdef __USE_SQL | 75 | #ifdef __USE_SQL |
68 | #include "otodoaccesssql.h" | 76 | #include "otodoaccesssql.h" |
69 | #endif | 77 | #endif |
70 | 78 | ||
79 | class OBackendPrivate; | ||
80 | |||
71 | /** | 81 | /** |
72 | * This class is our factory. It will give us the default implementations | 82 | * This class is our factory. It will give us the default implementations |
73 | * of at least Todolist, Contacts and Datebook. In the future this class will | 83 | * of at least Todolist, Contacts and Datebook. In the future this class will |
74 | * allow users to switch the backend with ( XML->SQLite ) without the need | 84 | * allow users to switch the backend with ( XML->SQLite ) without the need |
75 | * to recompile.# | 85 | * to recompile.# |
76 | * This class as the whole PIM Api is making use of templates | 86 | * This class as the whole PIM Api is making use of templates |
77 | * | 87 | * |
78 | * <pre> | 88 | * <pre> |
79 | * OTodoAccessBackend* backend = OBackEndFactory<OTodoAccessBackend>::Default("todo", QString::null ); | 89 | * OTodoAccessBackend* backend = OBackEndFactory<OTodoAccessBackend>::Default("todo", QString::null ); |
80 | * backend->load(); | 90 | * backend->load(); |
81 | * </pre> | 91 | * </pre> |
82 | * | 92 | * |
@@ -139,16 +149,18 @@ class OBackendFactory | |||
139 | return (T*) new OContactAccessBackend_XML( appName ); | 149 | return (T*) new OContactAccessBackend_XML( appName ); |
140 | case DATE: | 150 | case DATE: |
141 | if ( backend == "sql" ) | 151 | if ( backend == "sql" ) |
142 | qWarning("OBackendFactory:: sql Backend not implemented! Using XML instead!"); | 152 | qWarning("OBackendFactory:: sql Backend not implemented! Using XML instead!"); |
143 | 153 | ||
144 | return (T*) new ODateBookAccessBackend_XML( appName ); | 154 | return (T*) new ODateBookAccessBackend_XML( appName ); |
145 | default: | 155 | default: |
146 | return NULL; | 156 | return NULL; |
147 | } | 157 | } |
148 | 158 | ||
149 | 159 | ||
150 | } | 160 | } |
161 | private: | ||
162 | OBackendPrivate* d; | ||
151 | }; | 163 | }; |
152 | 164 | ||
153 | 165 | ||
154 | #endif | 166 | #endif |
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend.h b/libopie2/opiepim/backend/ocontactaccessbackend.h index ebeb42d..280e05c 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend.h +++ b/libopie2/opiepim/backend/ocontactaccessbackend.h | |||
@@ -10,24 +10,32 @@ | |||
10 | *This program is free software; you can redistribute it and/or | 10 | *This program is free software; you can redistribute it and/or |
11 | *modify it under the terms of the GNU Library General Public | 11 | *modify it under the terms of the GNU Library General Public |
12 | * License as published by the Free Software Foundation; | 12 | * License as published by the Free Software Foundation; |
13 | * either version 2 of the License, or (at your option) any later | 13 | * either version 2 of the License, or (at your option) any later |
14 | * version. | 14 | * version. |
15 | * ===================================================================== | 15 | * ===================================================================== |
16 | * ToDo: Define enum for query settings | 16 | * ToDo: Define enum for query settings |
17 | * ===================================================================== | 17 | * ===================================================================== |
18 | * Version: $Id$ | 18 | * Version: $Id$ |
19 | * ===================================================================== | 19 | * ===================================================================== |
20 | * History: | 20 | * History: |
21 | * $Log$ | 21 | * $Log$ |
22 | * Revision 1.6 2003/08/01 12:30:16 eilers | ||
23 | * Merging changes from BRANCH_1_0 to HEAD | ||
24 | * | ||
25 | * Revision 1.5.4.1 2003/06/30 14:34:19 eilers | ||
26 | * Patches from Zecke: | ||
27 | * Fixing and cleaning up extraMap handling | ||
28 | * Adding d_ptr for binary compatibility in the future | ||
29 | * | ||
22 | * Revision 1.5 2003/04/13 18:07:10 zecke | 30 | * Revision 1.5 2003/04/13 18:07:10 zecke |
23 | * More API doc | 31 | * More API doc |
24 | * QString -> const QString& | 32 | * QString -> const QString& |
25 | * QString = 0l -> QString::null | 33 | * QString = 0l -> QString::null |
26 | * | 34 | * |
27 | * Revision 1.4 2002/11/13 14:14:51 eilers | 35 | * Revision 1.4 2002/11/13 14:14:51 eilers |
28 | * Added sorted for Contacts.. | 36 | * Added sorted for Contacts.. |
29 | * | 37 | * |
30 | * Revision 1.3 2002/11/01 15:10:42 eilers | 38 | * Revision 1.3 2002/11/01 15:10:42 eilers |
31 | * Added regExp-search in database for all fields in a contact. | 39 | * Added regExp-search in database for all fields in a contact. |
32 | * | 40 | * |
33 | * Revision 1.2 2002/10/07 17:34:24 eilers | 41 | * Revision 1.2 2002/10/07 17:34:24 eilers |
@@ -93,15 +101,19 @@ class OContactAccessBackend: public OPimAccessBackend<OContact> { | |||
93 | 101 | ||
94 | /** | 102 | /** |
95 | * Check whether settings are correct. | 103 | * Check whether settings are correct. |
96 | * @return <i>true</i> if the given settings are correct and possible. | 104 | * @return <i>true</i> if the given settings are correct and possible. |
97 | */ | 105 | */ |
98 | virtual bool hasQuerySettings (uint querySettings) const = 0; | 106 | virtual bool hasQuerySettings (uint querySettings) const = 0; |
99 | 107 | ||
100 | /** | 108 | /** |
101 | * FIXME!!! | 109 | * FIXME!!! |
102 | * Returns a sorted list of records either ascendinf or descending for a giving criteria and category | 110 | * Returns a sorted list of records either ascendinf or descending for a giving criteria and category |
103 | */ | 111 | */ |
104 | virtual QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat ) = 0; | 112 | virtual QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat ) = 0; |
105 | 113 | ||
114 | |||
115 | private: | ||
116 | class Private; | ||
117 | Private *d; | ||
106 | }; | 118 | }; |
107 | #endif | 119 | #endif |
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp index 270bef3..b60c5be 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp | |||
@@ -8,24 +8,39 @@ | |||
8 | *This program is free software; you can redistribute it and/or | 8 | *This program is free software; you can redistribute it and/or |
9 | *modify it under the terms of the GNU Library General Public | 9 | *modify it under the terms of the GNU Library General Public |
10 | * License as published by the Free Software Foundation; either | 10 | * License as published by the Free Software Foundation; either |
11 | * version 2 of the License, or (at your option) any later version. | 11 | * version 2 of the License, or (at your option) any later version. |
12 | * ===================================================================== | 12 | * ===================================================================== |
13 | * ToDo: | 13 | * ToDo: |
14 | * | 14 | * |
15 | * ===================================================================== | 15 | * ===================================================================== |
16 | * Version: $Id$ | 16 | * Version: $Id$ |
17 | * ===================================================================== | 17 | * ===================================================================== |
18 | * History: | 18 | * History: |
19 | * $Log$ | 19 | * $Log$ |
20 | * Revision 1.11 2003/08/01 12:30:16 eilers | ||
21 | * Merging changes from BRANCH_1_0 to HEAD | ||
22 | * | ||
23 | * Revision 1.10.4.3 2003/07/23 08:54:37 eilers | ||
24 | * Default email was added to the list of all emails, which already contains | ||
25 | * the default email.. | ||
26 | * This closes bug #1045 | ||
27 | * | ||
28 | * Revision 1.10.4.2 2003/07/23 08:44:45 eilers | ||
29 | * Importing of Notes in vcard files wasn't implemented. | ||
30 | * Closes bug #1044 | ||
31 | * | ||
32 | * Revision 1.10.4.1 2003/06/02 13:37:49 eilers | ||
33 | * Fixing memory leak | ||
34 | * | ||
20 | * Revision 1.10 2003/04/13 18:07:10 zecke | 35 | * Revision 1.10 2003/04/13 18:07:10 zecke |
21 | * More API doc | 36 | * More API doc |
22 | * QString -> const QString& | 37 | * QString -> const QString& |
23 | * QString = 0l -> QString::null | 38 | * QString = 0l -> QString::null |
24 | * | 39 | * |
25 | * Revision 1.9 2003/03/21 10:33:09 eilers | 40 | * Revision 1.9 2003/03/21 10:33:09 eilers |
26 | * Merged speed optimized xml backend for contacts to main. | 41 | * Merged speed optimized xml backend for contacts to main. |
27 | * Added QDateTime to querybyexample. For instance, it is now possible to get | 42 | * Added QDateTime to querybyexample. For instance, it is now possible to get |
28 | * all Birthdays/Anniversaries between two dates. This should be used | 43 | * all Birthdays/Anniversaries between two dates. This should be used |
29 | * to show all birthdays in the datebook.. | 44 | * to show all birthdays in the datebook.. |
30 | * This change is sourcecode backward compatible but you have to upgrade | 45 | * This change is sourcecode backward compatible but you have to upgrade |
31 | * the binaries for today-addressbook. | 46 | * the binaries for today-addressbook. |
@@ -142,24 +157,25 @@ bool OContactAccessBackend_VCard::save() | |||
142 | 157 | ||
143 | VObject *obj; | 158 | VObject *obj; |
144 | obj = newVObject( VCCalProp ); | 159 | obj = newVObject( VCCalProp ); |
145 | addPropValue( obj, VCVersionProp, "1.0" ); | 160 | addPropValue( obj, VCVersionProp, "1.0" ); |
146 | 161 | ||
147 | VObject *vo; | 162 | VObject *vo; |
148 | for(QMap<int, OContact>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){ | 163 | for(QMap<int, OContact>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){ |
149 | vo = createVObject( *it ); | 164 | vo = createVObject( *it ); |
150 | writeVObject( file.directHandle() , vo ); | 165 | writeVObject( file.directHandle() , vo ); |
151 | cleanVObject( vo ); | 166 | cleanVObject( vo ); |
152 | } | 167 | } |
153 | cleanStrTbl(); | 168 | cleanStrTbl(); |
169 | deleteVObject( obj ); | ||
154 | 170 | ||
155 | m_dirty = false; | 171 | m_dirty = false; |
156 | return true; | 172 | return true; |
157 | 173 | ||
158 | 174 | ||
159 | } | 175 | } |
160 | void OContactAccessBackend_VCard::clear () | 176 | void OContactAccessBackend_VCard::clear () |
161 | { | 177 | { |
162 | m_map.clear(); | 178 | m_map.clear(); |
163 | m_dirty = true; // ??? sure ? (se) | 179 | m_dirty = true; // ??? sure ? (se) |
164 | } | 180 | } |
165 | 181 | ||
@@ -437,25 +453,27 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) | |||
437 | } | 453 | } |
438 | else if ( name == "X-Qtopia-Nickname" ) { | 454 | else if ( name == "X-Qtopia-Nickname" ) { |
439 | c.setNickname( value ); | 455 | c.setNickname( value ); |
440 | } | 456 | } |
441 | else if ( name == "X-Qtopia-Children" ) { | 457 | else if ( name == "X-Qtopia-Children" ) { |
442 | c.setChildren( value ); | 458 | c.setChildren( value ); |
443 | } | 459 | } |
444 | else if ( name == VCBirthDateProp ) { | 460 | else if ( name == VCBirthDateProp ) { |
445 | // Reading Birthdate regarding RFC 2425 (5.8.4) | 461 | // Reading Birthdate regarding RFC 2425 (5.8.4) |
446 | c.setBirthday( convVCardDateToDate( value ) ); | 462 | c.setBirthday( convVCardDateToDate( value ) ); |
447 | 463 | ||
448 | } | 464 | } |
449 | 465 | else if ( name == VCCommentProp ) { | |
466 | c.setNotes( value ); | ||
467 | } | ||
450 | #if 0 | 468 | #if 0 |
451 | else { | 469 | else { |
452 | printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); | 470 | printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); |
453 | VObjectIterator nit; | 471 | VObjectIterator nit; |
454 | initPropIterator( &nit, o ); | 472 | initPropIterator( &nit, o ); |
455 | while( moreIteration( &nit ) ) { | 473 | while( moreIteration( &nit ) ) { |
456 | VObject *o = nextVObject( &nit ); | 474 | VObject *o = nextVObject( &nit ); |
457 | QCString name = vObjectName( o ); | 475 | QCString name = vObjectName( o ); |
458 | QString value = vObjectStringZValue( o ); | 476 | QString value = vObjectStringZValue( o ); |
459 | printf(" subprop: %s = %s\n", name.data(), value.latin1() ); | 477 | printf(" subprop: %s = %s\n", name.data(), value.latin1() ); |
460 | } | 478 | } |
461 | } | 479 | } |
@@ -525,25 +543,25 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) | |||
525 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() ); | 543 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() ); |
526 | safeAddProp( work_phone, VCWorkProp ); | 544 | safeAddProp( work_phone, VCWorkProp ); |
527 | safeAddProp( work_phone, VCPagerProp ); | 545 | safeAddProp( work_phone, VCPagerProp ); |
528 | 546 | ||
529 | url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() ); | 547 | url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() ); |
530 | safeAddProp( url, VCWorkProp ); | 548 | safeAddProp( url, VCWorkProp ); |
531 | 549 | ||
532 | VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() ); | 550 | VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() ); |
533 | safeAddProp( title, VCWorkProp ); | 551 | safeAddProp( title, VCWorkProp ); |
534 | 552 | ||
535 | 553 | ||
536 | QStringList emails = c.emailList(); | 554 | QStringList emails = c.emailList(); |
537 | emails.prepend( c.defaultEmail() ); | 555 | // emails.prepend( c.defaultEmail() ); Fix for bugreport #1045 |
538 | for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { | 556 | for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { |
539 | VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); | 557 | VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); |
540 | safeAddProp( email, VCInternetProp ); | 558 | safeAddProp( email, VCInternetProp ); |
541 | } | 559 | } |
542 | 560 | ||
543 | safeAddPropValue( vcard, VCNoteProp, c.notes() ); | 561 | safeAddPropValue( vcard, VCNoteProp, c.notes() ); |
544 | 562 | ||
545 | // Exporting Birthday regarding RFC 2425 (5.8.4) | 563 | // Exporting Birthday regarding RFC 2425 (5.8.4) |
546 | if ( c.birthday().isValid() ){ | 564 | if ( c.birthday().isValid() ){ |
547 | qWarning("Exporting birthday as: %s", convDateToVCardDate( c.birthday() ).latin1() ); | 565 | qWarning("Exporting birthday as: %s", convDateToVCardDate( c.birthday() ).latin1() ); |
548 | safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) ); | 566 | safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) ); |
549 | } | 567 | } |
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp index 097142b..1c21619 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp | |||
@@ -8,24 +8,27 @@ | |||
8 | *modify it under the terms of the GNU Library General Public | 8 | *modify it under the terms of the GNU Library General Public |
9 | * License as published by the Free Software Foundation; either | 9 | * License as published by the Free Software Foundation; either |
10 | * version 2 of the License, or (at your option) any later version. | 10 | * version 2 of the License, or (at your option) any later version. |
11 | * ===================================================================== | 11 | * ===================================================================== |
12 | * ToDo: XML-Backend: Automatic reload if something was changed... | 12 | * ToDo: XML-Backend: Automatic reload if something was changed... |
13 | * | 13 | * |
14 | * | 14 | * |
15 | * ===================================================================== | 15 | * ===================================================================== |
16 | * Version: $Id$ | 16 | * Version: $Id$ |
17 | * ===================================================================== | 17 | * ===================================================================== |
18 | * History: | 18 | * History: |
19 | * $Log$ | 19 | * $Log$ |
20 | * Revision 1.7 2003/08/01 12:30:16 eilers | ||
21 | * Merging changes from BRANCH_1_0 to HEAD | ||
22 | * | ||
20 | * Revision 1.6 2003/07/07 16:19:47 eilers | 23 | * Revision 1.6 2003/07/07 16:19:47 eilers |
21 | * Fixing serious bug in hasQuerySettings() | 24 | * Fixing serious bug in hasQuerySettings() |
22 | * | 25 | * |
23 | * Revision 1.5 2003/04/13 18:07:10 zecke | 26 | * Revision 1.5 2003/04/13 18:07:10 zecke |
24 | * More API doc | 27 | * More API doc |
25 | * QString -> const QString& | 28 | * QString -> const QString& |
26 | * QString = 0l -> QString::null | 29 | * QString = 0l -> QString::null |
27 | * | 30 | * |
28 | * Revision 1.4 2003/03/21 14:32:54 mickeyl | 31 | * Revision 1.4 2003/03/21 14:32:54 mickeyl |
29 | * g++ compliance fix: default arguments belong into the declaration, but not the definition | 32 | * g++ compliance fix: default arguments belong into the declaration, but not the definition |
30 | * | 33 | * |
31 | * Revision 1.3 2003/03/21 12:26:28 eilers | 34 | * Revision 1.3 2003/03/21 12:26:28 eilers |
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend.h b/libopie2/opiepim/backend/odatebookaccessbackend.h index 86ff298..3c02c42 100644 --- a/libopie2/opiepim/backend/odatebookaccessbackend.h +++ b/libopie2/opiepim/backend/odatebookaccessbackend.h | |||
@@ -59,15 +59,19 @@ public: | |||
59 | * Effective Events are special event occuring during a time frame. This method does calcualte | 59 | * Effective Events are special event occuring during a time frame. This method does calcualte |
60 | * EffectiveEvents bases on the directNonRepeats and directRawRepeats. You may implement this method | 60 | * EffectiveEvents bases on the directNonRepeats and directRawRepeats. You may implement this method |
61 | * yourself | 61 | * yourself |
62 | */ | 62 | */ |
63 | virtual OEffectiveEvent::ValueList effecticeEvents( const QDate& from, const QDate& to ); | 63 | virtual OEffectiveEvent::ValueList effecticeEvents( const QDate& from, const QDate& to ); |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * this is an overloaded member function | 66 | * this is an overloaded member function |
67 | * @see effecticeEvents | 67 | * @see effecticeEvents |
68 | */ | 68 | */ |
69 | virtual OEffectiveEvent::ValueList effecticeEvents( const QDateTime& start ); | 69 | virtual OEffectiveEvent::ValueList effecticeEvents( const QDateTime& start ); |
70 | 70 | ||
71 | private: | ||
72 | class Private; | ||
73 | Private *d; | ||
74 | |||
71 | }; | 75 | }; |
72 | 76 | ||
73 | #endif | 77 | #endif |
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp index ab2eea4..5ea945c 100644 --- a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp +++ b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp | |||
@@ -421,48 +421,48 @@ bool ODateBookAccessBackend_XML::loadFile() { | |||
421 | i = j + 1; | 421 | i = j + 1; |
422 | 422 | ||
423 | QString str = (haveUtf ? QString::fromUtf8( value ) | 423 | QString str = (haveUtf ? QString::fromUtf8( value ) |
424 | : QString::fromLatin1( value ) ); | 424 | : QString::fromLatin1( value ) ); |
425 | if ( haveEnt ) | 425 | if ( haveEnt ) |
426 | str = Qtopia::plainString( str ); | 426 | str = Qtopia::plainString( str ); |
427 | 427 | ||
428 | /* | 428 | /* |
429 | * add key + value | 429 | * add key + value |
430 | */ | 430 | */ |
431 | find = dict[attr.data()]; | 431 | find = dict[attr.data()]; |
432 | if (!find) | 432 | if (!find) |
433 | ev.setCustomField( attr, value ); | 433 | ev.setCustomField( attr, str ); |
434 | else { | 434 | else { |
435 | setField( ev, *find, value ); | 435 | setField( ev, *find, str ); |
436 | } | 436 | } |
437 | } | 437 | } |
438 | /* time to finalize */ | 438 | /* time to finalize */ |
439 | finalizeRecord( ev ); | 439 | finalizeRecord( ev ); |
440 | delete rec; | 440 | delete rec; |
441 | } | 441 | } |
442 | ::munmap(map_addr, attribute.st_size ); | 442 | ::munmap(map_addr, attribute.st_size ); |
443 | m_changed = false; // changed during add | 443 | m_changed = false; // changed during add |
444 | 444 | ||
445 | return true; | 445 | return true; |
446 | } | 446 | } |
447 | void ODateBookAccessBackend_XML::finalizeRecord( OEvent& ev ) { | 447 | void ODateBookAccessBackend_XML::finalizeRecord( OEvent& ev ) { |
448 | /* AllDay is alway in UTC */ | 448 | /* AllDay is alway in UTC */ |
449 | if ( ev.isAllDay() ) { | 449 | if ( ev.isAllDay() ) { |
450 | OTimeZone utc = OTimeZone::utc(); | 450 | OTimeZone utc = OTimeZone::utc(); |
451 | ev.setStartDateTime( utc.fromUTCDateTime( start ) ); | 451 | ev.setStartDateTime( utc.fromUTCDateTime( start ) ); |
452 | ev.setEndDateTime ( utc.fromUTCDateTime( end ) ); | 452 | ev.setEndDateTime ( utc.fromUTCDateTime( end ) ); |
453 | ev.setTimeZone( "UTC"); // make sure it is really utc | 453 | ev.setTimeZone( "UTC"); // make sure it is really utc |
454 | }else { | 454 | }else { |
455 | /* to current date time */ | 455 | /* to current date time */ |
456 | qWarning(" Start is %d", start ); | 456 | // qWarning(" Start is %d", start ); |
457 | OTimeZone zone( ev.timeZone().isEmpty() ? OTimeZone::current() : ev.timeZone() ); | 457 | OTimeZone zone( ev.timeZone().isEmpty() ? OTimeZone::current() : ev.timeZone() ); |
458 | QDateTime date = zone.toDateTime( start ); | 458 | QDateTime date = zone.toDateTime( start ); |
459 | qWarning(" Start is %s", date.toString().latin1() ); | 459 | qWarning(" Start is %s", date.toString().latin1() ); |
460 | ev.setStartDateTime( zone.toDateTime( date, OTimeZone::current() ) ); | 460 | ev.setStartDateTime( zone.toDateTime( date, OTimeZone::current() ) ); |
461 | 461 | ||
462 | date = zone.toDateTime( end ); | 462 | date = zone.toDateTime( end ); |
463 | ev.setEndDateTime ( zone.toDateTime( date, OTimeZone::current() ) ); | 463 | ev.setEndDateTime ( zone.toDateTime( date, OTimeZone::current() ) ); |
464 | } | 464 | } |
465 | if ( rec && rec->doesRecur() ) { | 465 | if ( rec && rec->doesRecur() ) { |
466 | OTimeZone utc = OTimeZone::utc(); | 466 | OTimeZone utc = OTimeZone::utc(); |
467 | ORecur recu( *rec ); // call copy c'tor; | 467 | ORecur recu( *rec ); // call copy c'tor; |
468 | recu.setEndDate ( utc.fromUTCDateTime( rp_end ).date() ); | 468 | recu.setEndDate ( utc.fromUTCDateTime( rp_end ).date() ); |
diff --git a/libopie2/opiepim/backend/opimaccessbackend.h b/libopie2/opiepim/backend/opimaccessbackend.h index f4bbe35..c3d91f7 100644 --- a/libopie2/opiepim/backend/opimaccessbackend.h +++ b/libopie2/opiepim/backend/opimaccessbackend.h | |||
@@ -1,21 +1,22 @@ | |||
1 | #ifndef OPIE_PIM_ACCESS_BACKEND | 1 | #ifndef OPIE_PIM_ACCESS_BACKEND |
2 | #define OPIE_PIM_ACCESS_BACKEND | 2 | #define OPIE_PIM_ACCESS_BACKEND |
3 | 3 | ||
4 | #include <qarray.h> | 4 | #include <qarray.h> |
5 | 5 | ||
6 | #include <opie/otemplatebase.h> | 6 | #include <opie/otemplatebase.h> |
7 | #include <opie/opimrecord.h> | 7 | #include <opie/opimrecord.h> |
8 | 8 | ||
9 | 9 | ||
10 | class OPimAccessBackendPrivate; | ||
10 | /** | 11 | /** |
11 | * OPimAccessBackend is the base class | 12 | * OPimAccessBackend is the base class |
12 | * for all private backends | 13 | * for all private backends |
13 | * it operates on OPimRecord as the base class | 14 | * it operates on OPimRecord as the base class |
14 | * and it's responsible for fast manipulating | 15 | * and it's responsible for fast manipulating |
15 | * the resource the implementation takes care | 16 | * the resource the implementation takes care |
16 | * of | 17 | * of |
17 | */ | 18 | */ |
18 | template <class T = OPimRecord> | 19 | template <class T = OPimRecord> |
19 | class OPimAccessBackend { | 20 | class OPimAccessBackend { |
20 | public: | 21 | public: |
21 | typedef OTemplateBase<T> Frontend; | 22 | typedef OTemplateBase<T> Frontend; |
@@ -98,26 +99,25 @@ public: | |||
98 | protected: | 99 | protected: |
99 | int access()const; | 100 | int access()const; |
100 | void cache( const T& t )const; | 101 | void cache( const T& t )const; |
101 | 102 | ||
102 | /** | 103 | /** |
103 | * use a prime number here! | 104 | * use a prime number here! |
104 | */ | 105 | */ |
105 | void setSaneCacheSize( int ); | 106 | void setSaneCacheSize( int ); |
106 | 107 | ||
107 | uint readAhead()const; | 108 | uint readAhead()const; |
108 | 109 | ||
109 | private: | 110 | private: |
110 | class Private; | 111 | OPimAccessBackendPrivate *d; |
111 | Private* d; | ||
112 | Frontend* m_front; | 112 | Frontend* m_front; |
113 | uint m_read; | 113 | uint m_read; |
114 | int m_acc; | 114 | int m_acc; |
115 | 115 | ||
116 | }; | 116 | }; |
117 | 117 | ||
118 | template <class T> | 118 | template <class T> |
119 | OPimAccessBackend<T>::OPimAccessBackend(int acc) | 119 | OPimAccessBackend<T>::OPimAccessBackend(int acc) |
120 | : m_acc( acc ) | 120 | : m_acc( acc ) |
121 | { | 121 | { |
122 | m_front = 0l; | 122 | m_front = 0l; |
123 | } | 123 | } |
diff --git a/libopie2/opiepim/backend/otodoaccessbackend.h b/libopie2/opiepim/backend/otodoaccessbackend.h index 05e8ca9..6be95bc 100644 --- a/libopie2/opiepim/backend/otodoaccessbackend.h +++ b/libopie2/opiepim/backend/otodoaccessbackend.h | |||
@@ -9,16 +9,20 @@ | |||
9 | class OTodoAccessBackend : public OPimAccessBackend<OTodo> { | 9 | class OTodoAccessBackend : public OPimAccessBackend<OTodo> { |
10 | public: | 10 | public: |
11 | OTodoAccessBackend(); | 11 | OTodoAccessBackend(); |
12 | ~OTodoAccessBackend(); | 12 | ~OTodoAccessBackend(); |
13 | virtual QArray<int> effectiveToDos( const QDate& start, | 13 | virtual QArray<int> effectiveToDos( const QDate& start, |
14 | const QDate& end, | 14 | const QDate& end, |
15 | bool includeNoDates ) = 0; | 15 | bool includeNoDates ) = 0; |
16 | virtual QArray<int> overDue() = 0; | 16 | virtual QArray<int> overDue() = 0; |
17 | virtual QArray<int> sorted( bool asc, int sortOrder, int sortFilter, | 17 | virtual QArray<int> sorted( bool asc, int sortOrder, int sortFilter, |
18 | int cat ) = 0; | 18 | int cat ) = 0; |
19 | virtual void removeAllCompleted() = 0; | 19 | virtual void removeAllCompleted() = 0; |
20 | virtual QBitArray supports()const = 0; | 20 | virtual QBitArray supports()const = 0; |
21 | |||
22 | private: | ||
23 | class Private; | ||
24 | Private *d; | ||
21 | 25 | ||
22 | }; | 26 | }; |
23 | 27 | ||
24 | #endif | 28 | #endif |
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.cpp b/libopie2/opiepim/backend/otodoaccessvcal.cpp index 3577e14..6415952 100644 --- a/libopie2/opiepim/backend/otodoaccessvcal.cpp +++ b/libopie2/opiepim/backend/otodoaccessvcal.cpp | |||
@@ -6,30 +6,38 @@ | |||
6 | 6 | ||
7 | #include "otodoaccessvcal.h" | 7 | #include "otodoaccessvcal.h" |
8 | 8 | ||
9 | namespace { | 9 | namespace { |
10 | static OTodo eventByVObj( VObject *obj ){ | 10 | static OTodo eventByVObj( VObject *obj ){ |
11 | OTodo event; | 11 | OTodo event; |
12 | VObject *ob; | 12 | VObject *ob; |
13 | QCString name; | 13 | QCString name; |
14 | // no uid, attendees, ... and no fun | 14 | // no uid, attendees, ... and no fun |
15 | // description | 15 | // description |
16 | if( ( ob = isAPropertyOf( obj, VCDescriptionProp )) != 0 ){ | 16 | if( ( ob = isAPropertyOf( obj, VCDescriptionProp )) != 0 ){ |
17 | name = vObjectStringZValue( ob ); | 17 | name = vObjectStringZValue( ob ); |
18 | #if 0 | ||
18 | event.setDescription( name ); | 19 | event.setDescription( name ); |
20 | #else | ||
21 | event.setSummary( name ); | ||
22 | #endif | ||
19 | } | 23 | } |
20 | // summary | 24 | // summary |
21 | if ( ( ob = isAPropertyOf( obj, VCSummaryProp ) ) != 0 ) { | 25 | if ( ( ob = isAPropertyOf( obj, VCSummaryProp ) ) != 0 ) { |
22 | name = vObjectStringZValue( ob ); | 26 | name = vObjectStringZValue( ob ); |
27 | #if 0 | ||
23 | event.setSummary( name ); | 28 | event.setSummary( name ); |
29 | #else | ||
30 | event.setDescription( name ); | ||
31 | #endif | ||
24 | } | 32 | } |
25 | // completed | 33 | // completed |
26 | if( ( ob = isAPropertyOf( obj, VCStatusProp )) != 0 ){ | 34 | if( ( ob = isAPropertyOf( obj, VCStatusProp )) != 0 ){ |
27 | name = vObjectStringZValue( ob ); | 35 | name = vObjectStringZValue( ob ); |
28 | if( name == "COMPLETED" ){ | 36 | if( name == "COMPLETED" ){ |
29 | event.setCompleted( true ); | 37 | event.setCompleted( true ); |
30 | }else{ | 38 | }else{ |
31 | event.setCompleted( false ); | 39 | event.setCompleted( false ); |
32 | } | 40 | } |
33 | }else | 41 | }else |
34 | event.setCompleted( false ); | 42 | event.setCompleted( false ); |
35 | // priority | 43 | // priority |
@@ -65,29 +73,45 @@ namespace { | |||
65 | TimeConversion::toISO8601( date ) ); | 73 | TimeConversion::toISO8601( date ) ); |
66 | } | 74 | } |
67 | 75 | ||
68 | if( event.isCompleted() ) | 76 | if( event.isCompleted() ) |
69 | addPropValue( task, VCStatusProp, "COMPLETED"); | 77 | addPropValue( task, VCStatusProp, "COMPLETED"); |
70 | 78 | ||
71 | QString string = QString::number(event.priority() ); | 79 | QString string = QString::number(event.priority() ); |
72 | addPropValue( task, VCPriorityProp, string.local8Bit() ); | 80 | addPropValue( task, VCPriorityProp, string.local8Bit() ); |
73 | 81 | ||
74 | addPropValue( task, VCCategoriesProp, | 82 | addPropValue( task, VCCategoriesProp, |
75 | event.idsToString( event.categories() ).local8Bit() ); | 83 | event.idsToString( event.categories() ).local8Bit() ); |
76 | 84 | ||
85 | #if 0 | ||
86 | |||
87 | // There seems a misrepresentation between summary in otodoevent | ||
88 | // and summary in vcard. | ||
89 | // The same with description.. | ||
90 | // Description is summary and vice versa.. Argh.. (eilers) | ||
91 | |||
92 | |||
77 | addPropValue( task, VCDescriptionProp, | 93 | addPropValue( task, VCDescriptionProp, |
78 | event.description().local8Bit() ); | 94 | event.description().local8Bit() ); |
79 | 95 | ||
80 | addPropValue( task, VCSummaryProp, | 96 | addPropValue( task, VCSummaryProp, |
81 | event.summary().local8Bit() ); | 97 | event.summary().local8Bit() ); |
98 | |||
99 | #else | ||
100 | addPropValue( task, VCDescriptionProp, | ||
101 | event.summary().local8Bit() ); | ||
102 | |||
103 | addPropValue( task, VCSummaryProp, | ||
104 | event.description().local8Bit() ); | ||
105 | #endif | ||
82 | return task; | 106 | return task; |
83 | }; | 107 | }; |
84 | } | 108 | } |
85 | 109 | ||
86 | OTodoAccessVCal::OTodoAccessVCal( const QString& path ) | 110 | OTodoAccessVCal::OTodoAccessVCal( const QString& path ) |
87 | : m_dirty(false), m_file( path ) | 111 | : m_dirty(false), m_file( path ) |
88 | { | 112 | { |
89 | } | 113 | } |
90 | OTodoAccessVCal::~OTodoAccessVCal() { | 114 | OTodoAccessVCal::~OTodoAccessVCal() { |
91 | } | 115 | } |
92 | bool OTodoAccessVCal::load() { | 116 | bool OTodoAccessVCal::load() { |
93 | m_map.clear(); | 117 | m_map.clear(); |
@@ -176,25 +200,25 @@ QArray<int> OTodoAccessVCal::sorted( bool, int, int, int ) { | |||
176 | return ar; | 200 | return ar; |
177 | } | 201 | } |
178 | QArray<int> OTodoAccessVCal::allRecords()const { | 202 | QArray<int> OTodoAccessVCal::allRecords()const { |
179 | QArray<int> ar( m_map.count() ); | 203 | QArray<int> ar( m_map.count() ); |
180 | QMap<int, OTodo>::ConstIterator it; | 204 | QMap<int, OTodo>::ConstIterator it; |
181 | int i = 0; | 205 | int i = 0; |
182 | for ( it = m_map.begin(); it != m_map.end(); ++it ) { | 206 | for ( it = m_map.begin(); it != m_map.end(); ++it ) { |
183 | ar[i] = it.key(); | 207 | ar[i] = it.key(); |
184 | i++; | 208 | i++; |
185 | } | 209 | } |
186 | return ar; | 210 | return ar; |
187 | } | 211 | } |
188 | QArray<int> OTodoAccessVCal::matchRegexp(const QRegExp &r)const { | 212 | QArray<int> OTodoAccessVCal::matchRegexp(const QRegExp& /* r */)const { |
189 | QArray<int> ar(0); | 213 | QArray<int> ar(0); |
190 | return ar; | 214 | return ar; |
191 | } | 215 | } |
192 | QArray<int> OTodoAccessVCal::queryByExample( const OTodo&, int, const QDateTime& ) { | 216 | QArray<int> OTodoAccessVCal::queryByExample( const OTodo&, int, const QDateTime& ) { |
193 | QArray<int> ar(0); | 217 | QArray<int> ar(0); |
194 | return ar; | 218 | return ar; |
195 | } | 219 | } |
196 | QArray<int> OTodoAccessVCal::effectiveToDos( const QDate& , | 220 | QArray<int> OTodoAccessVCal::effectiveToDos( const QDate& , |
197 | const QDate& , | 221 | const QDate& , |
198 | bool ) { | 222 | bool ) { |
199 | QArray<int> ar(0); | 223 | QArray<int> ar(0); |
200 | return ar; | 224 | return ar; |
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp index 3d15354..f688735 100644 --- a/libopie2/opiepim/backend/otodoaccessxml.cpp +++ b/libopie2/opiepim/backend/otodoaccessxml.cpp | |||
@@ -78,25 +78,25 @@ OTodoAccessXML::OTodoAccessXML( const QString& appName, | |||
78 | } | 78 | } |
79 | OTodoAccessXML::~OTodoAccessXML() { | 79 | OTodoAccessXML::~OTodoAccessXML() { |
80 | 80 | ||
81 | } | 81 | } |
82 | bool OTodoAccessXML::load() { | 82 | bool OTodoAccessXML::load() { |
83 | rec = 0; | 83 | rec = 0; |
84 | m_opened = true; | 84 | m_opened = true; |
85 | m_changed = false; | 85 | m_changed = false; |
86 | /* initialize dict */ | 86 | /* initialize dict */ |
87 | /* | 87 | /* |
88 | * UPDATE dict if you change anything!!! | 88 | * UPDATE dict if you change anything!!! |
89 | */ | 89 | */ |
90 | QAsciiDict<int> dict(21); | 90 | QAsciiDict<int> dict(26); |
91 | dict.setAutoDelete( TRUE ); | 91 | dict.setAutoDelete( TRUE ); |
92 | dict.insert("Categories" , new int(OTodo::Category) ); | 92 | dict.insert("Categories" , new int(OTodo::Category) ); |
93 | dict.insert("Uid" , new int(OTodo::Uid) ); | 93 | dict.insert("Uid" , new int(OTodo::Uid) ); |
94 | dict.insert("HasDate" , new int(OTodo::HasDate) ); | 94 | dict.insert("HasDate" , new int(OTodo::HasDate) ); |
95 | dict.insert("Completed" , new int(OTodo::Completed) ); | 95 | dict.insert("Completed" , new int(OTodo::Completed) ); |
96 | dict.insert("Description" , new int(OTodo::Description) ); | 96 | dict.insert("Description" , new int(OTodo::Description) ); |
97 | dict.insert("Summary" , new int(OTodo::Summary) ); | 97 | dict.insert("Summary" , new int(OTodo::Summary) ); |
98 | dict.insert("Priority" , new int(OTodo::Priority) ); | 98 | dict.insert("Priority" , new int(OTodo::Priority) ); |
99 | dict.insert("DateDay" , new int(OTodo::DateDay) ); | 99 | dict.insert("DateDay" , new int(OTodo::DateDay) ); |
100 | dict.insert("DateMonth" , new int(OTodo::DateMonth) ); | 100 | dict.insert("DateMonth" , new int(OTodo::DateMonth) ); |
101 | dict.insert("DateYear" , new int(OTodo::DateYear) ); | 101 | dict.insert("DateYear" , new int(OTodo::DateYear) ); |
102 | dict.insert("Progress" , new int(OTodo::Progress) ); | 102 | dict.insert("Progress" , new int(OTodo::Progress) ); |
@@ -827,28 +827,30 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder, | |||
827 | } | 827 | } |
828 | vector.resize( item ); | 828 | vector.resize( item ); |
829 | /* sort it now */ | 829 | /* sort it now */ |
830 | vector.sort(); | 830 | vector.sort(); |
831 | /* now get the uids */ | 831 | /* now get the uids */ |
832 | QArray<int> array( vector.count() ); | 832 | QArray<int> array( vector.count() ); |
833 | for (uint i= 0; i < vector.count(); i++ ) { | 833 | for (uint i= 0; i < vector.count(); i++ ) { |
834 | array[i] = ( vector.at(i) )->todo.uid(); | 834 | array[i] = ( vector.at(i) )->todo.uid(); |
835 | } | 835 | } |
836 | return array; | 836 | return array; |
837 | }; | 837 | }; |
838 | void OTodoAccessXML::removeAllCompleted() { | 838 | void OTodoAccessXML::removeAllCompleted() { |
839 | QMap<int, OTodo> events = m_events; | ||
839 | for ( QMap<int, OTodo>::Iterator it = m_events.begin(); it != m_events.end(); ++it ) { | 840 | for ( QMap<int, OTodo>::Iterator it = m_events.begin(); it != m_events.end(); ++it ) { |
840 | if ( (*it).isCompleted() ) | 841 | if ( (*it).isCompleted() ) |
841 | m_events.remove( it ); | 842 | events.remove( it.key() ); |
842 | } | 843 | } |
844 | m_events = events; | ||
843 | } | 845 | } |
844 | QBitArray OTodoAccessXML::supports()const { | 846 | QBitArray OTodoAccessXML::supports()const { |
845 | static QBitArray ar = sup(); | 847 | static QBitArray ar = sup(); |
846 | return ar; | 848 | return ar; |
847 | } | 849 | } |
848 | QBitArray OTodoAccessXML::sup() { | 850 | QBitArray OTodoAccessXML::sup() { |
849 | QBitArray ar( OTodo::CompletedDate +1 ); | 851 | QBitArray ar( OTodo::CompletedDate +1 ); |
850 | ar.fill( true ); | 852 | ar.fill( true ); |
851 | ar[OTodo::CrossReference] = false; | 853 | ar[OTodo::CrossReference] = false; |
852 | ar[OTodo::State ] = false; | 854 | ar[OTodo::State ] = false; |
853 | ar[OTodo::Reminders] = false; | 855 | ar[OTodo::Reminders] = false; |
854 | ar[OTodo::Notifiers] = false; | 856 | ar[OTodo::Notifiers] = false; |