summaryrefslogtreecommitdiff
path: root/libopie2
authoreilers <eilers>2003-08-01 12:30:16 (UTC)
committer eilers <eilers>2003-08-01 12:30:16 (UTC)
commit6c715b67a8f0e32a4edca5be91332622834c8d91 (patch) (unidiff)
treeae2d660e1fd9c990c2d725c075ce6c42480b0af8 /libopie2
parentcb45aa10043fdd6fddcab42ef0e07ddafc3d506d (diff)
downloadopie-6c715b67a8f0e32a4edca5be91332622834c8d91.zip
opie-6c715b67a8f0e32a4edca5be91332622834c8d91.tar.gz
opie-6c715b67a8f0e32a4edca5be91332622834c8d91.tar.bz2
Merging changes from BRANCH_1_0 to HEAD
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/obackendfactory.h12
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend.h14
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp22
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp3
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend.h4
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp6
-rw-r--r--libopie2/opiepim/backend/opimaccessbackend.h4
-rw-r--r--libopie2/opiepim/backend/otodoaccessbackend.h4
-rw-r--r--libopie2/opiepim/backend/otodoaccessvcal.cpp26
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp6
-rw-r--r--libopie2/opiepim/core/ocontactaccess.h11
-rw-r--r--libopie2/opiepim/core/oconversion.h5
-rw-r--r--libopie2/opiepim/core/opimaccesstemplate.h4
-rw-r--r--libopie2/opiepim/core/opimcache.h6
-rw-r--r--libopie2/opiepim/core/opimxrefmanager.h2
-rw-r--r--libopie2/opiepim/core/otemplatebase.h7
-rw-r--r--libopie2/opiepim/ocontact.cpp253
-rw-r--r--libopie2/opiepim/ocontact.h9
-rw-r--r--libopie2/opiepim/orecordlist.h12
-rw-r--r--libopie2/opiepim/otodo.cpp16
-rw-r--r--libopie2/opiepim/otodo.h9
-rw-r--r--libopie2/opiepim/ui/opimmainwindow.cpp14
22 files changed, 327 insertions, 122 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
79class 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
115private:
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}
160void OContactAccessBackend_VCard::clear () 176void 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
71private:
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}
447void ODateBookAccessBackend_XML::finalizeRecord( OEvent& ev ) { 447void 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
10class 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 */
18template <class T = OPimRecord> 19template <class T = OPimRecord>
19class OPimAccessBackend { 20class OPimAccessBackend {
20public: 21public:
21 typedef OTemplateBase<T> Frontend; 22 typedef OTemplateBase<T> Frontend;
@@ -98,26 +99,25 @@ public:
98protected: 99protected:
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
109private: 110private:
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
118template <class T> 118template <class T>
119OPimAccessBackend<T>::OPimAccessBackend(int acc) 119OPimAccessBackend<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 @@
9class OTodoAccessBackend : public OPimAccessBackend<OTodo> { 9class OTodoAccessBackend : public OPimAccessBackend<OTodo> {
10public: 10public:
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
22private:
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
9namespace { 9namespace {
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
86OTodoAccessVCal::OTodoAccessVCal( const QString& path ) 110OTodoAccessVCal::OTodoAccessVCal( const QString& path )
87 : m_dirty(false), m_file( path ) 111 : m_dirty(false), m_file( path )
88{ 112{
89} 113}
90OTodoAccessVCal::~OTodoAccessVCal() { 114OTodoAccessVCal::~OTodoAccessVCal() {
91} 115}
92bool OTodoAccessVCal::load() { 116bool 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}
178QArray<int> OTodoAccessVCal::allRecords()const { 202QArray<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}
188QArray<int> OTodoAccessVCal::matchRegexp(const QRegExp &r)const { 212QArray<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}
192QArray<int> OTodoAccessVCal::queryByExample( const OTodo&, int, const QDateTime& ) { 216QArray<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}
196QArray<int> OTodoAccessVCal::effectiveToDos( const QDate& , 220QArray<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}
79OTodoAccessXML::~OTodoAccessXML() { 79OTodoAccessXML::~OTodoAccessXML() {
80 80
81} 81}
82bool OTodoAccessXML::load() { 82bool 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};
838void OTodoAccessXML::removeAllCompleted() { 838void 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}
844QBitArray OTodoAccessXML::supports()const { 846QBitArray OTodoAccessXML::supports()const {
845 static QBitArray ar = sup(); 847 static QBitArray ar = sup();
846 return ar; 848 return ar;
847} 849}
848QBitArray OTodoAccessXML::sup() { 850QBitArray 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;
diff --git a/libopie2/opiepim/core/ocontactaccess.h b/libopie2/opiepim/core/ocontactaccess.h
index e90db32..9b0a719 100644
--- a/libopie2/opiepim/core/ocontactaccess.h
+++ b/libopie2/opiepim/core/ocontactaccess.h
@@ -8,24 +8,32 @@
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; 10 * License as published by the Free Software Foundation;
11 * either version 2 of the License, or (at your option) any later 11 * either version 2 of the License, or (at your option) any later
12 * version. 12 * version.
13 * ===================================================================== 13 * =====================================================================
14 * ToDo: Define enum for query settings 14 * ToDo: Define enum for query settings
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
19 * $Log$ 19 * $Log$
20 * Revision 1.9 2003/08/01 12:30:16 eilers
21 * Merging changes from BRANCH_1_0 to HEAD
22 *
23 * Revision 1.8.2.1 2003/06/30 14:34:19 eilers
24 * Patches from Zecke:
25 * Fixing and cleaning up extraMap handling
26 * Adding d_ptr for binary compatibility in the future
27 *
20 * Revision 1.8 2003/05/08 13:55:09 tille 28 * Revision 1.8 2003/05/08 13:55:09 tille
21 * search stuff 29 * search stuff
22 * and match, toRichText & toShortText in oevent 30 * and match, toRichText & toShortText in oevent
23 * 31 *
24 * Revision 1.7 2003/04/13 18:07:10 zecke 32 * Revision 1.7 2003/04/13 18:07:10 zecke
25 * More API doc 33 * More API doc
26 * QString -> const QString& 34 * QString -> const QString&
27 * QString = 0l -> QString::null 35 * QString = 0l -> QString::null
28 * 36 *
29 * Revision 1.6 2003/01/02 14:27:12 eilers 37 * Revision 1.6 2003/01/02 14:27:12 eilers
30 * Improved query by example: Search by date is possible.. First step 38 * Improved query by example: Search by date is possible.. First step
31 * for a today plugin for birthdays.. 39 * for a today plugin for birthdays..
@@ -156,15 +164,18 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
156 void signalChanged ( const OContactAccess *which ); 164 void signalChanged ( const OContactAccess *which );
157 165
158 166
159 private: 167 private:
160 // class OContactAccessPrivate; 168 // class OContactAccessPrivate;
161 // OContactAccessPrivate* d; 169 // OContactAccessPrivate* d;
162 OContactAccessBackend *m_backEnd; 170 OContactAccessBackend *m_backEnd;
163 bool m_loading:1; 171 bool m_loading:1;
164 172
165 private slots: 173 private slots:
166 void copMessage( const QCString &msg, const QByteArray &data ); 174 void copMessage( const QCString &msg, const QByteArray &data );
167 175
176 private:
177 class Private;
178 Private *d;
168 179
169}; 180};
170#endif 181#endif
diff --git a/libopie2/opiepim/core/oconversion.h b/libopie2/opiepim/core/oconversion.h
index 13367e1..4c0a497 100644
--- a/libopie2/opiepim/core/oconversion.h
+++ b/libopie2/opiepim/core/oconversion.h
@@ -28,16 +28,21 @@ class OConversion
28{ 28{
29public: 29public:
30 static QString dateToString( const QDate &d ); 30 static QString dateToString( const QDate &d );
31 static QDate dateFromString( const QString &datestr ); 31 static QDate dateFromString( const QString &datestr );
32 32
33 /** 33 /**
34 * simple function to store DateTime as string and read from string 34 * simple function to store DateTime as string and read from string
35 * no timezone changing is done 35 * no timezone changing is done
36 * DDMMYYYYHHMMSS is the simple format 36 * DDMMYYYYHHMMSS is the simple format
37 */ 37 */
38 static QString dateTimeToString( const QDateTime& ); 38 static QString dateTimeToString( const QDateTime& );
39 static QDateTime dateTimeFromString( const QString& ); 39 static QDateTime dateTimeFromString( const QString& );
40
41private:
42 class Private;
43 Private* d;
44
40}; 45};
41 46
42#endif // __oconversion_h__ 47#endif // __oconversion_h__
43 48
diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h
index 8ff205c..ecbeb68 100644
--- a/libopie2/opiepim/core/opimaccesstemplate.h
+++ b/libopie2/opiepim/core/opimaccesstemplate.h
@@ -1,24 +1,25 @@
1#ifndef OPIE_PIM_ACCESS_TEMPLATE_H 1#ifndef OPIE_PIM_ACCESS_TEMPLATE_H
2#define OPIE_PIM_ACCESS_TEMPLATE_H 2#define OPIE_PIM_ACCESS_TEMPLATE_H
3 3
4#include <qarray.h> 4#include <qarray.h>
5 5
6#include <opie/opimrecord.h> 6#include <opie/opimrecord.h>
7#include <opie/opimaccessbackend.h> 7#include <opie/opimaccessbackend.h>
8#include <opie/orecordlist.h> 8#include <opie/orecordlist.h>
9 9
10#include "opimcache.h" 10#include "opimcache.h"
11#include "otemplatebase.h" 11#include "otemplatebase.h"
12 12
13class OPimAccessTemplatePrivate;
13/** 14/**
14 * Thats the frontend to our OPIE PIM 15 * Thats the frontend to our OPIE PIM
15 * Library. Either you want to use it's 16 * Library. Either you want to use it's
16 * interface or you want to implement 17 * interface or you want to implement
17 * your own Access lib 18 * your own Access lib
18 * Just create a OPimRecord and inherit from 19 * Just create a OPimRecord and inherit from
19 * the plugins 20 * the plugins
20 */ 21 */
21 22
22template <class T = OPimRecord > 23template <class T = OPimRecord >
23class OPimAccessTemplate : public OTemplateBase<T> { 24class OPimAccessTemplate : public OTemplateBase<T> {
24public: 25public:
@@ -143,24 +144,27 @@ protected:
143 * invalidate the cache 144 * invalidate the cache
144 */ 145 */
145 void invalidateCache(); 146 void invalidateCache();
146 147
147 void setBackEnd( BackEnd* end ); 148 void setBackEnd( BackEnd* end );
148 /** 149 /**
149 * returns the backend 150 * returns the backend
150 */ 151 */
151 BackEnd* backEnd(); 152 BackEnd* backEnd();
152 BackEnd* m_backEnd; 153 BackEnd* m_backEnd;
153 Cache m_cache; 154 Cache m_cache;
154 155
156private:
157 OPimAccessTemplatePrivate *d;
158
155}; 159};
156 160
157template <class T> 161template <class T>
158OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end ) 162OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end )
159 : OTemplateBase<T>(), m_backEnd( end ) 163 : OTemplateBase<T>(), m_backEnd( end )
160{ 164{
161 if (end ) 165 if (end )
162 end->setFrontend( this ); 166 end->setFrontend( this );
163} 167}
164template <class T> 168template <class T>
165OPimAccessTemplate<T>::~OPimAccessTemplate() { 169OPimAccessTemplate<T>::~OPimAccessTemplate() {
166 qWarning("~OPimAccessTemplate<T>"); 170 qWarning("~OPimAccessTemplate<T>");
diff --git a/libopie2/opiepim/core/opimcache.h b/libopie2/opiepim/core/opimcache.h
index 73414e5..7f7cff5 100644
--- a/libopie2/opiepim/core/opimcache.h
+++ b/libopie2/opiepim/core/opimcache.h
@@ -1,34 +1,39 @@
1#ifndef OPIE_PIM_CACHE_H 1#ifndef OPIE_PIM_CACHE_H
2#define OPIE_PIM_CACHE_H 2#define OPIE_PIM_CACHE_H
3 3
4#include <qintcache.h> 4#include <qintcache.h>
5 5
6#include "opimrecord.h" 6#include "opimrecord.h"
7 7
8class OPimCacheItemPrivate;
9
8template <class T = OPimRecord> 10template <class T = OPimRecord>
9class OPimCacheItem { 11class OPimCacheItem {
10public: 12public:
11 OPimCacheItem( const T& t = T() ); 13 OPimCacheItem( const T& t = T() );
12 OPimCacheItem( const OPimCacheItem& ); 14 OPimCacheItem( const OPimCacheItem& );
13 ~OPimCacheItem(); 15 ~OPimCacheItem();
14 16
15 OPimCacheItem &operator=( const OPimCacheItem& ); 17 OPimCacheItem &operator=( const OPimCacheItem& );
16 18
17 T record()const; 19 T record()const;
18 void setRecord( const T& ); 20 void setRecord( const T& );
19private: 21private:
20 T m_t; 22 T m_t;
23 OPimCacheItemPrivate *d;
21}; 24};
22 25
26
27class OPimCachePrivate;
23/** 28/**
24 * OPimCache for caching the items 29 * OPimCache for caching the items
25 * We support adding, removing 30 * We support adding, removing
26 * and finding 31 * and finding
27 */ 32 */
28template <class T = OPimRecord> 33template <class T = OPimRecord>
29class OPimCache { 34class OPimCache {
30public: 35public:
31 typedef OPimCacheItem<T> Item; 36 typedef OPimCacheItem<T> Item;
32 OPimCache(); 37 OPimCache();
33 OPimCache( const OPimCache& ); 38 OPimCache( const OPimCache& );
34 ~OPimCache(); 39 ~OPimCache();
@@ -37,24 +42,25 @@ public:
37 42
38 bool contains(int uid)const; 43 bool contains(int uid)const;
39 void invalidate(); 44 void invalidate();
40 void setSize( int size ); 45 void setSize( int size );
41 46
42 T find(int uid )const; 47 T find(int uid )const;
43 void add( const T& ); 48 void add( const T& );
44 void remove( int uid ); 49 void remove( int uid );
45 void replace( const T& ); 50 void replace( const T& );
46 51
47private: 52private:
48 QIntCache<Item> m_cache; 53 QIntCache<Item> m_cache;
54 OPimCachePrivate* d;
49}; 55};
50 56
51// Implementation 57// Implementation
52template <class T> 58template <class T>
53OPimCacheItem<T>::OPimCacheItem( const T& t ) 59OPimCacheItem<T>::OPimCacheItem( const T& t )
54 : m_t(t) { 60 : m_t(t) {
55} 61}
56template <class T> 62template <class T>
57OPimCacheItem<T>::~OPimCacheItem() { 63OPimCacheItem<T>::~OPimCacheItem() {
58 64
59} 65}
60template <class T> 66template <class T>
diff --git a/libopie2/opiepim/core/opimxrefmanager.h b/libopie2/opiepim/core/opimxrefmanager.h
index 39e5eef..c485e98 100644
--- a/libopie2/opiepim/core/opimxrefmanager.h
+++ b/libopie2/opiepim/core/opimxrefmanager.h
@@ -27,15 +27,17 @@ public:
27 void clear(); 27 void clear();
28 28
29 /** 29 /**
30 * apps participating 30 * apps participating
31 */ 31 */
32 QStringList apps()const; 32 QStringList apps()const;
33 OPimXRef::ValueList list()const; 33 OPimXRef::ValueList list()const;
34 OPimXRef::ValueList list( const QString& service )const; 34 OPimXRef::ValueList list( const QString& service )const;
35 OPimXRef::ValueList list( int uid )const; 35 OPimXRef::ValueList list( int uid )const;
36 36
37private: 37private:
38 OPimXRef::ValueList m_list; 38 OPimXRef::ValueList m_list;
39 class Private;
40 Private *d;
39}; 41};
40 42
41#endif 43#endif
diff --git a/libopie2/opiepim/core/otemplatebase.h b/libopie2/opiepim/core/otemplatebase.h
index 29fb6ec..cadac74 100644
--- a/libopie2/opiepim/core/otemplatebase.h
+++ b/libopie2/opiepim/core/otemplatebase.h
@@ -5,71 +5,78 @@
5 5
6#include <opie/opimrecord.h> 6#include <opie/opimrecord.h>
7 7
8 8
9/** 9/**
10 * Templates do not have a base class, This is why 10 * Templates do not have a base class, This is why
11 * we've this class 11 * we've this class
12 * this is here to give us the possibility 12 * this is here to give us the possibility
13 * to have a common base class 13 * to have a common base class
14 * You may not want to use that interface internaly 14 * You may not want to use that interface internaly
15 * POOR mans interface 15 * POOR mans interface
16 */ 16 */
17class OPimBasePrivate;
17struct OPimBase { 18struct OPimBase {
18 /** 19 /**
19 * return the rtti 20 * return the rtti
20 */ 21 */
21 virtual int rtti()= 0; 22 virtual int rtti()= 0;
22 virtual OPimRecord* record()const = 0; 23 virtual OPimRecord* record()const = 0;
23 virtual OPimRecord* record(int uid)const = 0; 24 virtual OPimRecord* record(int uid)const = 0;
24 virtual bool add( const OPimRecord& ) = 0; 25 virtual bool add( const OPimRecord& ) = 0;
25 virtual bool remove( int uid ) = 0; 26 virtual bool remove( int uid ) = 0;
26 virtual bool remove( const OPimRecord& ) = 0; 27 virtual bool remove( const OPimRecord& ) = 0;
27 virtual void clear() = 0; 28 virtual void clear() = 0;
28 virtual bool load() = 0; 29 virtual bool load() = 0;
29 virtual bool save() = 0; 30 virtual bool save() = 0;
30 virtual QArray<int> records()const = 0; 31 virtual QArray<int> records()const = 0;
31 /* 32 /*
32 * ADD editing here? 33 * ADD editing here?
33 * -zecke 34 * -zecke
34 */ 35 */
36private:
37 OPimBasePrivate* d;
35 38
36}; 39};
37/** 40/**
38 * internal template base 41 * internal template base
39 * T needs to implement the copy c'tor!!! 42 * T needs to implement the copy c'tor!!!
40 */ 43 */
44class OTemplateBasePrivate;
41template <class T = OPimRecord> 45template <class T = OPimRecord>
42class OTemplateBase : public OPimBase { 46class OTemplateBase : public OPimBase {
43public: 47public:
44 enum CacheDirection { Forward=0, Reverse }; 48 enum CacheDirection { Forward=0, Reverse };
45 OTemplateBase() { 49 OTemplateBase() {
46 }; 50 };
47 virtual ~OTemplateBase() { 51 virtual ~OTemplateBase() {
48 } 52 }
49 virtual T find( int uid )const = 0; 53 virtual T find( int uid )const = 0;
50 54
51 /** 55 /**
52 * read ahead find 56 * read ahead find
53 */ 57 */
54 virtual T find( int uid, const QArray<int>& items, 58 virtual T find( int uid, const QArray<int>& items,
55 uint current, CacheDirection dir = Forward )const = 0; 59 uint current, CacheDirection dir = Forward )const = 0;
56 virtual void cache( const T& )const = 0; 60 virtual void cache( const T& )const = 0;
57 virtual void setSaneCacheSize( int ) = 0; 61 virtual void setSaneCacheSize( int ) = 0;
58 62
59 /* reimplement of OPimBase */ 63 /* reimplement of OPimBase */
60 int rtti(); 64 int rtti();
61 OPimRecord* record()const; 65 OPimRecord* record()const;
62 OPimRecord* record(int uid )const; 66 OPimRecord* record(int uid )const;
63 static T* rec(); 67 static T* rec();
68
69private:
70 OTemplateBasePrivate *d;
64}; 71};
65 72
66/* 73/*
67 * implementation 74 * implementation
68 */ 75 */
69template <class T> 76template <class T>
70int 77int
71OTemplateBase<T>::rtti() { 78OTemplateBase<T>::rtti() {
72 return T::rtti(); 79 return T::rtti();
73} 80}
74template <class T> 81template <class T>
75OPimRecord* OTemplateBase<T>::record()const { 82OPimRecord* OTemplateBase<T>::record()const {
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp
index be4ce0a..3473baa 100644
--- a/libopie2/opiepim/ocontact.cpp
+++ b/libopie2/opiepim/ocontact.cpp
@@ -12,28 +12,29 @@
12** 12**
13** See http://www.trolltech.com/gpl/ for GPL licensing information. 13** See http://www.trolltech.com/gpl/ for GPL licensing information.
14** 14**
15** Contact info@trolltech.com if any conditions of this licensing are 15** Contact info@trolltech.com if any conditions of this licensing are
16** not clear to you. 16** not clear to you.
17** 17**
18**********************************************************************/ 18**********************************************************************/
19 19
20#define QTOPIA_INTERNAL_CONTACT_MRE 20#define QTOPIA_INTERNAL_CONTACT_MRE
21 21
22#include "ocontact.h" 22#include "ocontact.h"
23#include "opimresolver.h" 23#include "opimresolver.h"
24#include "oconversion.h"
24 25
25#include <qpe/stringutil.h> 26#include <qpe/stringutil.h>
26#include "oconversion.h"
27#include <qpe/timestring.h> 27#include <qpe/timestring.h>
28#include <qpe/config.h>
28 29
29#include <qobject.h> 30#include <qobject.h>
30#include <qregexp.h> 31#include <qregexp.h>
31#include <qstylesheet.h> 32#include <qstylesheet.h>
32#include <qfileinfo.h> 33#include <qfileinfo.h>
33#include <qmap.h> 34#include <qmap.h>
34 35
35#include <stdio.h> 36#include <stdio.h>
36 37
37/*! 38/*!
38 \class Contact contact.h 39 \class Contact contact.h
39 \brief The Contact class holds the data of an address book entry. 40 \brief The Contact class holds the data of an address book entry.
@@ -429,220 +430,292 @@ QMap<int, QString> OContact::toMap() const
429} 430}
430 431
431/*! 432/*!
432 Returns a rich text formatted QString representing the contents the contact. 433 Returns a rich text formatted QString representing the contents the contact.
433*/ 434*/
434QString OContact::toRichText() const 435QString OContact::toRichText() const
435{ 436{
436 QString text; 437 QString text;
437 QString value, comp, state; 438 QString value, comp, state;
438 QString str; 439 QString str;
439 bool marker = false; 440 bool marker = false;
440 441
442 Config cfg("qpe");
443 cfg.setGroup("Appearance");
444 int addressformat = cfg.readNumEntry( "AddressFormat", Zip_City_State );
445
441 // name, jobtitle and company 446 // name, jobtitle and company
442 if ( !(value = fullName()).isEmpty() ) 447 if ( !(value = fullName()).isEmpty() )
443 text += "<b><h3><img src=\"addressbook/AddressBook\">" + Qtopia::escapeString(value) + "</h3></b>"; 448 text += "<b><h3><img src=\"addressbook/AddressBook\"> " + Qtopia::escapeString(value) + "</h3></b>";
444 449
445 if ( !(value = jobTitle()).isEmpty() ) 450 if ( !(value = jobTitle()).isEmpty() )
446 text += Qtopia::escapeString(value) + "<br>"; 451 text += Qtopia::escapeString(value);
447 452
448 comp = company(); 453 comp = company();
449 if ( !(value = department()).isEmpty() ) { 454 if ( !(value = department()).isEmpty() ) {
450 text += Qtopia::escapeString(value); 455 text += Qtopia::escapeString(value);
451 if ( comp ) 456 if ( comp )
452 text += ", "; 457 text += ", ";
453 else 458 else
454 text += "<br>"; 459 text += "<br>";
455 } 460 }
456 if ( !comp.isEmpty() ) 461 if ( !comp.isEmpty() )
457 text += Qtopia::escapeString(comp) + "<br>"; 462 text += Qtopia::escapeString(comp);
458 463
459 text += "<hr><br>"; 464 text += "<br><hr>";
460 465
461 // defailt email 466 // defailt email
462 QString defEmail = defaultEmail(); 467 QString defEmail = defaultEmail();
463 if ( !defEmail.isEmpty() ) 468 if ( !defEmail.isEmpty() ){
464 text += "<b><img src=\"addressbook/email\">" + QObject::tr("Default Email: ") + "</b>" 469 text += "<b><img src=\"addressbook/email\"> " + QObject::tr("Default Email: ") + "</b>"
465 + Qtopia::escapeString(defEmail) + "<br>"; 470 + Qtopia::escapeString(defEmail);
466 471 marker = true;
467 text += "<br>"; 472 }
468 473
469 // business address 474 // business address
470 if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || 475 if ( !businessStreet().isEmpty() || !businessCity().isEmpty() ||
471 !businessZip().isEmpty() || !businessCountry().isEmpty() ) { 476 !businessZip().isEmpty() || !businessCountry().isEmpty() ) {
472 text += QObject::tr( "<b>Work Address:</b>" ); 477 text += QObject::tr( "<br><br><b>Work Address:</b>" );
473 text += "<br>";
474 marker = true; 478 marker = true;
475 } 479 }
476 480
477 if ( !(value = businessStreet()).isEmpty() ) 481 if ( !(value = businessStreet()).isEmpty() ){
478 text += Qtopia::escapeString(value) + "<br>"; 482 text += "<br>" + Qtopia::escapeString(value);
479 state = businessState(); 483 marker = true;
480 if ( !(value = businessZip()).isEmpty() ) 484 }
481 text += Qtopia::escapeString(value) + " "; 485
482 if ( !(value = businessCity()).isEmpty() ) { 486 switch( addressformat ){
483 text += Qtopia::escapeString(value); 487 case Zip_City_State:{ // Zip_Code City, State
484 if ( state ) 488 state = businessState();
485 text += ", " + Qtopia::escapeString(state); 489 if ( !(value = businessZip()).isEmpty() ){
486 text += "<br>"; 490 text += "<br>" + Qtopia::escapeString(value) + " ";
487 } else if ( !state.isEmpty() ) 491 marker = true;
488 text += Qtopia::escapeString(state) + "<br>"; 492
493 } else
494 text += "<br>";
495
496 if ( !(value = businessCity()).isEmpty() ) {
497 marker = true;
498 text += Qtopia::escapeString(value);
499 if ( state )
500 text += ", " + Qtopia::escapeString(state);
501 } else if ( !state.isEmpty() ){
502 text += "<br>" + Qtopia::escapeString(state);
503 marker = true;
504 }
505 break;
506 }
507 case City_State_Zip:{ // City, State Zip_Code
508 state = businessState();
509 if ( !(value = businessCity()).isEmpty() ) {
510 marker = true;
511 text += "<br>" + Qtopia::escapeString(value);
512 if ( state )
513 text += ", " + Qtopia::escapeString(state);
514 } else if ( !state.isEmpty() ){
515 text += "<br>" + Qtopia::escapeString(state);
516 marker = true;
517 }
518 if ( !(value = businessZip()).isEmpty() ){
519 text += " " + Qtopia::escapeString(value);
520 marker = true;
521 }
522 break;
523 }
524 }
489 525
490 if ( !(value = businessCountry()).isEmpty() ) 526 if ( !(value = businessCountry()).isEmpty() ){
491 text += Qtopia::escapeString(value) + "<br>"; 527 text += "<br>" + Qtopia::escapeString(value);
528 marker = true;
529 }
492 530
493 // rest of Business data 531 // rest of Business data
494 str = office(); 532 str = office();
495 if ( !str.isEmpty() ){ 533 if ( !str.isEmpty() ){
496 text += "<b>" + QObject::tr("Office: ") + "</b>" 534 text += "<br><b>" + QObject::tr("Office: ") + "</b>"
497 + Qtopia::escapeString(str) + "<br>"; 535 + Qtopia::escapeString(str);
498 marker = true; 536 marker = true;
499 } 537 }
500 str = businessWebpage(); 538 str = businessWebpage();
501 if ( !str.isEmpty() ){ 539 if ( !str.isEmpty() ){
502 text += "<b><img src=\"addressbook/webpagework\">" + QObject::tr("Business Web Page: ") + "</b>" 540 text += "<br><b><img src=\"addressbook/webpagework\"> " + QObject::tr("Business Web Page: ") + "</b>"
503 + Qtopia::escapeString(str) + "<br>"; 541 + Qtopia::escapeString(str);
504 marker = true; 542 marker = true;
505 } 543 }
506 str = businessPhone(); 544 str = businessPhone();
507 if ( !str.isEmpty() ){ 545 if ( !str.isEmpty() ){
508 text += "<b><img src=\"addressbook/phonework\">" + QObject::tr("Business Phone: ") + "</b>" 546 text += "<br><b><img src=\"addressbook/phonework\"> " + QObject::tr("Business Phone: ") + "</b>"
509 + Qtopia::escapeString(str) + "<br>"; 547 + Qtopia::escapeString(str);
510 marker = true; 548 marker = true;
511 } 549 }
512 str = businessFax(); 550 str = businessFax();
513 if ( !str.isEmpty() ){ 551 if ( !str.isEmpty() ){
514 text += "<b><img src=\"addressbook/faxwork\">" + QObject::tr("Business Fax: ") + "</b>" 552 text += "<br><b><img src=\"addressbook/faxwork\"> " + QObject::tr("Business Fax: ") + "</b>"
515 + Qtopia::escapeString(str) + "<br>"; 553 + Qtopia::escapeString(str);
516 marker = true; 554 marker = true;
517 } 555 }
518 str = businessMobile(); 556 str = businessMobile();
519 if ( !str.isEmpty() ){ 557 if ( !str.isEmpty() ){
520 text += "<b><img src=\"addressbook/mobilework\">" + QObject::tr("Business Mobile: ") + "</b>" 558 text += "<br><b><img src=\"addressbook/mobilework\"> " + QObject::tr("Business Mobile: ") + "</b>"
521 + Qtopia::escapeString(str) + "<br>"; 559 + Qtopia::escapeString(str);
522 marker = true; 560 marker = true;
523 } 561 }
524 str = businessPager(); 562 str = businessPager();
525 if ( !str.isEmpty() ){ 563 if ( !str.isEmpty() ){
526 text += "<b>" + QObject::tr("Business Pager: ") + "</b>" 564 text += "<br><b>" + QObject::tr("Business Pager: ") + "</b>"
527 + Qtopia::escapeString(str) + "<br>"; 565 + Qtopia::escapeString(str);
528 marker = true; 566 marker = true;
529 } 567 }
530 568
531 text += "<br>"; 569 text += "<br>";
532 570
533 // home address 571 // home address
534 if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || 572 if ( !homeStreet().isEmpty() || !homeCity().isEmpty() ||
535 !homeZip().isEmpty() || !homeCountry().isEmpty() ) { 573 !homeZip().isEmpty() || !homeCountry().isEmpty() ) {
536 text += QObject::tr( "<b>Home Address:</b>" ); 574 text += QObject::tr( "<br><br><b>Home Address:</b>" );
537 text += "<br>"; 575 marker = true;
538 } 576 }
539 577
540 if ( !(value = homeStreet()).isEmpty() ) 578 if ( !(value = homeStreet()).isEmpty() ){
541 text += Qtopia::escapeString(value) + "<br>"; 579 text += "<br>" + Qtopia::escapeString(value);
542 state = homeState(); 580 marker = true;
543 if ( !(value = homeZip()).isEmpty() ) 581 }
544 text += Qtopia::escapeString(value) + " "; 582
545 if ( !(value = homeCity()).isEmpty() ) { 583 switch( addressformat ){
546 text += Qtopia::escapeString(value); 584 case Zip_City_State:{ // Zip_Code City, State
547 if ( !state.isEmpty() ) 585 state = homeState();
548 text += ", " + Qtopia::escapeString(state); 586 if ( !(value = homeZip()).isEmpty() ){
549 text += "<br>"; 587 text += "<br>" + Qtopia::escapeString(value) + " ";
550 } else if (!state.isEmpty()) 588 marker = true;
551 text += Qtopia::escapeString(state) + "<br>"; 589 } else
552 if ( !(value = homeCountry()).isEmpty() ) 590 text += "<br>";
553 text += Qtopia::escapeString(value) + "<br>"; 591
592 if ( !(value = homeCity()).isEmpty() ) {
593 marker = true;
594 text += Qtopia::escapeString(value);
595 if ( !state.isEmpty() )
596 text += ", " + Qtopia::escapeString(state);
597 } else if (!state.isEmpty()) {
598 text += "<br>" + Qtopia::escapeString(state);
599 marker = true;
600 }
601 break;
602 }
603 case City_State_Zip:{ // City, State Zip_Code
604 state = homeState();
605 if ( !(value = homeCity()).isEmpty() ) {
606 marker = true;
607 text += "<br>" + Qtopia::escapeString(value);
608 if ( state )
609 text += ", " + Qtopia::escapeString(state);
610 } else if ( !state.isEmpty() ){
611 text += "<br>" + Qtopia::escapeString(state);
612 marker = true;
613 }
614 if ( !(value = homeZip()).isEmpty() ){
615 text += " " + Qtopia::escapeString(value);
616 marker = true;
617 }
618 break;
619 }
620 }
621
622 if ( !(value = homeCountry()).isEmpty() ){
623 text += "<br>" + Qtopia::escapeString(value);
624 marker = true;
625 }
554 626
555 // rest of Home data 627 // rest of Home data
556 str = homeWebpage(); 628 str = homeWebpage();
557 if ( !str.isEmpty() ){ 629 if ( !str.isEmpty() ){
558 text += "<b><img src=\"addressbook/webpagehome\">" + QObject::tr("Home Web Page: ") + "</b>" 630 text += "<br><b><img src=\"addressbook/webpagehome\"> " + QObject::tr("Home Web Page: ") + "</b>"
559 + Qtopia::escapeString(str) + "<br>"; 631 + Qtopia::escapeString(str);
560 marker = true; 632 marker = true;
561 } 633 }
562 str = homePhone(); 634 str = homePhone();
563 if ( !str.isEmpty() ){ 635 if ( !str.isEmpty() ){
564 text += "<b><img src=\"addressbook/phonehome\">" + QObject::tr("Home Phone: ") + "</b>" 636 text += "<br><b><img src=\"addressbook/phonehome\"> " + QObject::tr("Home Phone: ") + "</b>"
565 + Qtopia::escapeString(str) + "<br>"; 637 + Qtopia::escapeString(str);
566 marker = true; 638 marker = true;
567 } 639 }
568 str = homeFax(); 640 str = homeFax();
569 if ( !str.isEmpty() ){ 641 if ( !str.isEmpty() ){
570 text += "<b><img src=\"addressbook/faxhome\">" + QObject::tr("Home Fax: ") + "</b>" 642 text += "<br><b><img src=\"addressbook/faxhome\"> " + QObject::tr("Home Fax: ") + "</b>"
571 + Qtopia::escapeString(str) + "<br>"; 643 + Qtopia::escapeString(str);
572 marker = true; 644 marker = true;
573 } 645 }
574 str = homeMobile(); 646 str = homeMobile();
575 if ( !str.isEmpty() ){ 647 if ( !str.isEmpty() ){
576 text += "<b><img src=\"addressbook/mobilehome\">" + QObject::tr("Home Mobile: ") + "</b>" 648 text += "<br><b><img src=\"addressbook/mobilehome\"> " + QObject::tr("Home Mobile: ") + "</b>"
577 + Qtopia::escapeString(str) + "<br>"; 649 + Qtopia::escapeString(str);
578 marker = true; 650 marker = true;
579 } 651 }
580 652
581 if ( marker ) 653 if ( marker )
582 text += "<br><hr><br>"; 654 text += "<br><hr>";
583 // the others... 655
656 // the rest...
584 str = emails(); 657 str = emails();
585 if ( !str.isEmpty() && ( str != defEmail ) ) 658 if ( !str.isEmpty() && ( str != defEmail ) )
586 text += "<b>" + QObject::tr("All Emails: ") + "</b>" 659 text += "<br><b>" + QObject::tr("All Emails: ") + "</b>"
587 + Qtopia::escapeString(str) + "<br>"; 660 + Qtopia::escapeString(str);
588 str = profession(); 661 str = profession();
589 if ( !str.isEmpty() ) 662 if ( !str.isEmpty() )
590 text += "<b>" + QObject::tr("Profession: ") + "</b>" 663 text += "<br><b>" + QObject::tr("Profession: ") + "</b>"
591 + Qtopia::escapeString(str) + "<br>"; 664 + Qtopia::escapeString(str);
592 str = assistant(); 665 str = assistant();
593 if ( !str.isEmpty() ) 666 if ( !str.isEmpty() )
594 text += "<b>" + QObject::tr("Assistant: ") + "</b>" 667 text += "<br><b>" + QObject::tr("Assistant: ") + "</b>"
595 + Qtopia::escapeString(str) + "<br>"; 668 + Qtopia::escapeString(str);
596 str = manager(); 669 str = manager();
597 if ( !str.isEmpty() ) 670 if ( !str.isEmpty() )
598 text += "<b>" + QObject::tr("Manager: ") + "</b>" 671 text += "<br><b>" + QObject::tr("Manager: ") + "</b>"
599 + Qtopia::escapeString(str) + "<br>"; 672 + Qtopia::escapeString(str);
600 str = gender(); 673 str = gender();
601 if ( !str.isEmpty() && str.toInt() != 0 ) { 674 if ( !str.isEmpty() && str.toInt() != 0 ) {
602 if ( str.toInt() == 1 ) 675 text += "<br>";
603 str = QObject::tr( "Male" ); 676 if ( str.toInt() == 1 )
604 else if ( str.toInt() == 2 ) 677 str = QObject::tr( "Male" );
605 str = QObject::tr( "Female" ); 678 else if ( str.toInt() == 2 )
606 text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; 679 str = QObject::tr( "Female" );
680 text += "<b>" + QObject::tr("Gender: ") + "</b>" + str;
607 } 681 }
608 str = spouse(); 682 str = spouse();
609 if ( !str.isEmpty() ) 683 if ( !str.isEmpty() )
610 text += "<b>" + QObject::tr("Spouse: ") + "</b>" 684 text += "<br><b>" + QObject::tr("Spouse: ") + "</b>"
611 + Qtopia::escapeString(str) + "<br>"; 685 + Qtopia::escapeString(str);
612 if ( birthday().isValid() ){ 686 if ( birthday().isValid() ){
613 str = TimeString::numberDateString( birthday() ); 687 str = TimeString::numberDateString( birthday() );
614 text += "<b>" + QObject::tr("Birthday: ") + "</b>" 688 text += "<br><b>" + QObject::tr("Birthday: ") + "</b>"
615 + Qtopia::escapeString(str) + "<br>"; 689 + Qtopia::escapeString(str);
616 } 690 }
617 if ( anniversary().isValid() ){ 691 if ( anniversary().isValid() ){
618 str = TimeString::numberDateString( anniversary() ); 692 str = TimeString::numberDateString( anniversary() );
619 text += "<b>" + QObject::tr("Anniversary: ") + "</b>" 693 text += "<br><b>" + QObject::tr("Anniversary: ") + "</b>"
620 + Qtopia::escapeString(str) + "<br>"; 694 + Qtopia::escapeString(str);
621 } 695 }
622 str = children(); 696 str = children();
623 if ( !str.isEmpty() ) 697 if ( !str.isEmpty() )
624 text += "<b>" + QObject::tr("Children: ") + "</b>" 698 text += "<br><b>" + QObject::tr("Children: ") + "</b>"
625 + Qtopia::escapeString(str) + "<br>"; 699 + Qtopia::escapeString(str);
626 700
627 str = nickname(); 701 str = nickname();
628 if ( !str.isEmpty() ) 702 if ( !str.isEmpty() )
629 text += "<b>" + QObject::tr("Nickname: ") + "</b>" 703 text += "<br><b>" + QObject::tr("Nickname: ") + "</b>"
630 + Qtopia::escapeString(str) + "<br>"; 704 + Qtopia::escapeString(str);
631 705
632 // categories 706 // categories
633 if ( categoryNames("Contacts").count() ){ 707 if ( categoryNames("Contacts").count() ){
634 text += "<b>" + QObject::tr( "Category:") + "</b> "; 708 text += "<br><b>" + QObject::tr( "Category:") + "</b> ";
635 text += categoryNames("Contacts").join(", "); 709 text += categoryNames("Contacts").join(", ");
636 text += "<br>";
637 } 710 }
638 711
639 // notes last 712 // notes last
640 if ( !(value = notes()).isEmpty() ) { 713 if ( !(value = notes()).isEmpty() ) {
641 text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> "; 714 text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> ";
642 QRegExp reg("\n"); 715 QRegExp reg("\n");
643 716
644 //QString tmp = Qtopia::escapeString(value); 717 //QString tmp = Qtopia::escapeString(value);
645 QString tmp = QStyleSheet::convertFromPlainText(value); 718 QString tmp = QStyleSheet::convertFromPlainText(value);
646 //tmp.replace( reg, "<br>" ); 719 //tmp.replace( reg, "<br>" );
647 text += "<br>" + tmp + "<br>"; 720 text += "<br>" + tmp + "<br>";
648 } 721 }
diff --git a/libopie2/opiepim/ocontact.h b/libopie2/opiepim/ocontact.h
index dd2de17..9a1a8dc 100644
--- a/libopie2/opiepim/ocontact.h
+++ b/libopie2/opiepim/ocontact.h
@@ -23,41 +23,46 @@
23#include <opie/opimrecord.h> 23#include <opie/opimrecord.h>
24#include <qpe/recordfields.h> 24#include <qpe/recordfields.h>
25 25
26#include <qdatetime.h> 26#include <qdatetime.h>
27#include <qstringlist.h> 27#include <qstringlist.h>
28 28
29#if defined(QPC_TEMPLATEDLL) 29#if defined(QPC_TEMPLATEDLL)
30// MOC_SKIP_BEGIN 30// MOC_SKIP_BEGIN
31QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>; 31QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>;
32// MOC_SKIP_END 32// MOC_SKIP_END
33#endif 33#endif
34 34
35class ContactPrivate; 35class OContactPrivate;
36 36
37/** 37/**
38 * OContact class represents a specialised PIM Record for contacts. 38 * OContact class represents a specialised PIM Record for contacts.
39 * It does store all kind of persopn related information. 39 * It does store all kind of persopn related information.
40 * 40 *
41 * @short Contact Container 41 * @short Contact Container
42 * @author TT, Stefan Eiler, Holger Freyther 42 * @author TT, Stefan Eiler, Holger Freyther
43 */ 43 */
44class QPC_EXPORT OContact : public OPimRecord 44class QPC_EXPORT OContact : public OPimRecord
45{ 45{
46 friend class DataSet; 46 friend class DataSet;
47public: 47public:
48 OContact(); 48 OContact();
49 OContact( const QMap<int, QString> &fromMap ); 49 OContact( const QMap<int, QString> &fromMap );
50 virtual ~OContact(); 50 virtual ~OContact();
51 51
52 enum DateFormat{
53 Zip_City_State = 0,
54 City_State_Zip
55 };
56
52 /* 57 /*
53 * do we need to inline them 58 * do we need to inline them
54 * if yes do we need to inline them this way? 59 * if yes do we need to inline them this way?
55 * -zecke 60 * -zecke
56 */ 61 */
57 void setTitle( const QString &v ) { replace( Qtopia::Title, v ); } 62 void setTitle( const QString &v ) { replace( Qtopia::Title, v ); }
58 void setFirstName( const QString &v ) { replace( Qtopia::FirstName, v ); } 63 void setFirstName( const QString &v ) { replace( Qtopia::FirstName, v ); }
59 void setMiddleName( const QString &v ) { replace( Qtopia::MiddleName, v ); } 64 void setMiddleName( const QString &v ) { replace( Qtopia::MiddleName, v ); }
60 void setLastName( const QString &v ) { replace( Qtopia::LastName, v ); } 65 void setLastName( const QString &v ) { replace( Qtopia::LastName, v ); }
61 void setSuffix( const QString &v ) { replace( Qtopia::Suffix, v ); } 66 void setSuffix( const QString &v ) { replace( Qtopia::Suffix, v ); }
62 void setFileAs( const QString &v ) { replace( Qtopia::FileAs, v ); } 67 void setFileAs( const QString &v ) { replace( Qtopia::FileAs, v ); }
63 void setFileAs(); 68 void setFileAs();
@@ -224,17 +229,17 @@ private:
224 QString find( int key ) const; 229 QString find( int key ) const;
225 static QStringList fields(); 230 static QStringList fields();
226 231
227 void save( QString &buf ) const; 232 void save( QString &buf ) const;
228 233
229 QString displayAddress( const QString &street, 234 QString displayAddress( const QString &street,
230 const QString &city, 235 const QString &city,
231 const QString &state, 236 const QString &state,
232 const QString &zip, 237 const QString &zip,
233 const QString &country ) const; 238 const QString &country ) const;
234 239
235 QMap<int, QString> mMap; 240 QMap<int, QString> mMap;
236 ContactPrivate *d; 241 OContactPrivate *d;
237}; 242};
238 243
239 244
240#endif 245#endif
diff --git a/libopie2/opiepim/orecordlist.h b/libopie2/opiepim/orecordlist.h
index edcd729..5211f57 100644
--- a/libopie2/opiepim/orecordlist.h
+++ b/libopie2/opiepim/orecordlist.h
@@ -1,21 +1,22 @@
1 1
2#ifndef OPIE_RECORD_LIST_H 2#ifndef OPIE_RECORD_LIST_H
3#define OPIE_RECORD_LIST_H 3#define OPIE_RECORD_LIST_H
4 4
5#include <qarray.h> 5#include <qarray.h>
6 6
7#include "otemplatebase.h" 7#include "otemplatebase.h"
8#include "opimrecord.h" 8#include "opimrecord.h"
9 9
10class ORecordListIteratorPrivate;
10/** 11/**
11 * Our List Iterator 12 * Our List Iterator
12 * it behaves like STL or Qt 13 * it behaves like STL or Qt
13 * 14 *
14 * for(it = list.begin(); it != list.end(); ++it ) 15 * for(it = list.begin(); it != list.end(); ++it )
15 * doSomeCoolStuff( (*it) ); 16 * doSomeCoolStuff( (*it) );
16 */ 17 */
17template <class T> class ORecordList; 18template <class T> class ORecordList;
18template <class T = OPimRecord> 19template <class T = OPimRecord>
19class ORecordListIterator { 20class ORecordListIterator {
20 friend class ORecordList<T>; 21 friend class ORecordList<T>;
21public: 22public:
@@ -62,27 +63,28 @@ public:
62 */ 63 */
63 void setCurrent( uint cur ); 64 void setCurrent( uint cur );
64 65
65private: 66private:
66 QArray<int> m_uids; 67 QArray<int> m_uids;
67 uint m_current; 68 uint m_current;
68 const Base* m_temp; 69 const Base* m_temp;
69 bool m_end : 1; 70 bool m_end : 1;
70 T m_record; 71 T m_record;
71 bool m_direction :1; 72 bool m_direction :1;
72 73
73 /* d pointer for future versions */ 74 /* d pointer for future versions */
74 class IteratorPrivate; 75 ORecordListIteratorPrivate *d;
75 IteratorPrivate *d;
76}; 76};
77
78class ORecordListPrivate;
77/** 79/**
78 * The recordlist used as a return type 80 * The recordlist used as a return type
79 * from OPimAccessTemplate 81 * from OPimAccessTemplate
80 */ 82 */
81template <class T = OPimRecord > 83template <class T = OPimRecord >
82class ORecordList { 84class ORecordList {
83public: 85public:
84 typedef OTemplateBase<T> Base; 86 typedef OTemplateBase<T> Base;
85 typedef ORecordListIterator<T> Iterator; 87 typedef ORecordListIterator<T> Iterator;
86 88
87 /** 89 /**
88 * c'tor 90 * c'tor
@@ -102,36 +104,37 @@ ORecordList( const QArray<int>& ids,
102 * the end 104 * the end
103 */ 105 */
104 Iterator end(); 106 Iterator end();
105 107
106 /** 108 /**
107 * the number of items in the list 109 * the number of items in the list
108 */ 110 */
109 uint count()const; 111 uint count()const;
110 112
111 T operator[]( uint i ); 113 T operator[]( uint i );
112 int uidAt(uint i ); 114 int uidAt(uint i );
113 115
114 /** 116 /**
115 * Remove the contact with given uid 117 * Remove the contact with given uid
116 */ 118 */
117 bool remove( int uid ); 119 bool remove( int uid );
118 120
119 /* 121 /*
120 ConstIterator begin()const; 122 ConstIterator begin()const;
121 ConstIterator end()const; 123 ConstIterator end()const;
122 */ 124 */
123private: 125private:
124 QArray<int> m_ids; 126 QArray<int> m_ids;
125 const Base* m_acc; 127 const Base* m_acc;
128 ORecordListPrivate *d;
126}; 129};
127 130
128/* ok now implement it */ 131/* ok now implement it */
129template <class T> 132template <class T>
130ORecordListIterator<T>::ORecordListIterator() { 133ORecordListIterator<T>::ORecordListIterator() {
131 m_current = 0; 134 m_current = 0;
132 m_temp = 0l; 135 m_temp = 0l;
133 m_end = true; 136 m_end = true;
134 m_record = T(); 137 m_record = T();
135 /* forward */ 138 /* forward */
136 m_direction = TRUE; 139 m_direction = TRUE;
137} 140}
@@ -211,24 +214,27 @@ bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) {
211 return true; 214 return true;
212} 215}
213template <class T> 216template <class T>
214bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) { 217bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) {
215 return !(*this == it ); 218 return !(*this == it );
216} 219}
217template <class T> 220template <class T>
218ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids, 221ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids,
219 const Base* t ) 222 const Base* t )
220 : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ), 223 : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ),
221 m_direction( false ) 224 m_direction( false )
222{ 225{
226 /* if the list is empty we're already at the end of the list */
227 if (uids.count() == 0 )
228 m_end = true;
223} 229}
224template <class T> 230template <class T>
225uint ORecordListIterator<T>::current()const { 231uint ORecordListIterator<T>::current()const {
226 return m_current; 232 return m_current;
227} 233}
228template <class T> 234template <class T>
229void ORecordListIterator<T>::setCurrent( uint cur ) { 235void ORecordListIterator<T>::setCurrent( uint cur ) {
230 if( cur < m_uids.count() ) { 236 if( cur < m_uids.count() ) {
231 m_end = false; 237 m_end = false;
232 m_current= cur; 238 m_current= cur;
233 } 239 }
234} 240}
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp
index 38b93f7..5a18c37 100644
--- a/libopie2/opiepim/otodo.cpp
+++ b/libopie2/opiepim/otodo.cpp
@@ -19,24 +19,29 @@
19#include "opimresolver.h" 19#include "opimresolver.h"
20 20
21#include "otodo.h" 21#include "otodo.h"
22 22
23 23
24struct OTodo::OTodoData : public QShared { 24struct OTodo::OTodoData : public QShared {
25 OTodoData() : QShared() { 25 OTodoData() : QShared() {
26 recur = 0; 26 recur = 0;
27 state = 0; 27 state = 0;
28 maintainer = 0; 28 maintainer = 0;
29 notifiers = 0; 29 notifiers = 0;
30 }; 30 };
31 ~OTodoData() {
32 delete recur;
33 delete maintainer;
34 delete notifiers;
35 }
31 36
32 QDate date; 37 QDate date;
33 bool isCompleted:1; 38 bool isCompleted:1;
34 bool hasDate:1; 39 bool hasDate:1;
35 int priority; 40 int priority;
36 QString desc; 41 QString desc;
37 QString sum; 42 QString sum;
38 QMap<QString, QString> extra; 43 QMap<QString, QString> extra;
39 ushort prog; 44 ushort prog;
40 OPimState *state; 45 OPimState *state;
41 ORecur *recur; 46 ORecur *recur;
42 OPimMaintainer *maintainer; 47 OPimMaintainer *maintainer;
@@ -265,42 +270,41 @@ void OTodo::setProgress(ushort progress )
265QString OTodo::toShortText() const { 270QString OTodo::toShortText() const {
266 return summary(); 271 return summary();
267} 272}
268/*! 273/*!
269 Returns a richt text string 274 Returns a richt text string
270*/ 275*/
271QString OTodo::toRichText() const 276QString OTodo::toRichText() const
272{ 277{
273 QString text; 278 QString text;
274 QStringList catlist; 279 QStringList catlist;
275 280
276 // summary 281 // summary
277 text += "<b><h3><img src=\"todo/TodoList\">"; 282 text += "<b><h3><img src=\"todo/TodoList\"> ";
278 if ( !summary().isEmpty() ) { 283 if ( !summary().isEmpty() ) {
279 text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" ); 284 text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" );
280 } 285 }
281 text += "</h3></b><br><hr><br>"; 286 text += "</h3></b><br><hr><br>";
282 287
283 // description 288 // description
284 if( !description().isEmpty() ){ 289 if( !description().isEmpty() ){
285 text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; 290 text += "<b>" + QObject::tr( "Notes:" ) + "</b><br>";
286 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; 291 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
287 } 292 }
288 293
289 // priority 294 // priority
290 int priorityval = priority(); 295 int priorityval = priority();
291 text += "<b>" + QObject::tr( "Priority:") +" </b><img src=\"todo/priority" + 296 text += "<b>" + QObject::tr( "Priority:") +" </b><img src=\"todo/priority" +
292 QString::number( priorityval ) + "\">"; 297 QString::number( priorityval ) + "\"> ";
293// text += "<b>" + QObject::tr( "Priority:") +"</b><img src=\"todo/priority" + 298
294// QString::number( priority() ) + "\"><br>";
295 switch ( priorityval ) 299 switch ( priorityval )
296 { 300 {
297 case 1 : text += QObject::tr( "Very high" ); 301 case 1 : text += QObject::tr( "Very high" );
298 break; 302 break;
299 case 2 : text += QObject::tr( "High" ); 303 case 2 : text += QObject::tr( "High" );
300 break; 304 break;
301 case 3 : text += QObject::tr( "Normal" ); 305 case 3 : text += QObject::tr( "Normal" );
302 break; 306 break;
303 case 4 : text += QObject::tr( "Low" ); 307 case 4 : text += QObject::tr( "Low" );
304 break; 308 break;
305 case 5 : text += QObject::tr( "Very low" ); 309 case 5 : text += QObject::tr( "Very low" );
306 break; 310 break;
diff --git a/libopie2/opiepim/otodo.h b/libopie2/opiepim/otodo.h
index f9a345a..6df98b9 100644
--- a/libopie2/opiepim/otodo.h
+++ b/libopie2/opiepim/otodo.h
@@ -89,29 +89,24 @@ public:
89 * Is this event completed? 89 * Is this event completed?
90 */ 90 */
91 bool isCompleted() const; 91 bool isCompleted() const;
92 92
93 /** 93 /**
94 * Does this Event have a deadline 94 * Does this Event have a deadline
95 */ 95 */
96 bool hasDueDate() const; 96 bool hasDueDate() const;
97 bool hasStartDate()const; 97 bool hasStartDate()const;
98 bool hasCompletedDate()const; 98 bool hasCompletedDate()const;
99 99
100 /** 100 /**
101 * Does this Event has an alarm time ?
102 */
103 bool hasAlarmDateTime() const;
104
105 /**
106 * What is the priority? 101 * What is the priority?
107 */ 102 */
108 int priority()const ; 103 int priority()const ;
109 104
110 /** 105 /**
111 * progress as ushort 0, 20, 40, 60, 80 or 100% 106 * progress as ushort 0, 20, 40, 60, 80 or 100%
112 */ 107 */
113 ushort progress() const; 108 ushort progress() const;
114 109
115 /** 110 /**
116 * The due Date 111 * The due Date
117 */ 112 */
@@ -232,28 +227,24 @@ public:
232 227
233 /** 228 /**
234 * set the start date 229 * set the start date
235 */ 230 */
236 void setStartDate( const QDate& date ); 231 void setStartDate( const QDate& date );
237 232
238 /** 233 /**
239 * set the completed date 234 * set the completed date
240 */ 235 */
241 void setCompletedDate( const QDate& date ); 236 void setCompletedDate( const QDate& date );
242 237
243 void setRecurrence( const ORecur& ); 238 void setRecurrence( const ORecur& );
244 /**
245 * set the alarm time
246 */
247 void setAlarmDateTime ( const QDateTime& alarm );
248 239
249 void setDescription(const QString& ); 240 void setDescription(const QString& );
250 void setSummary(const QString& ); 241 void setSummary(const QString& );
251 242
252 /** 243 /**
253 * set the state of a Todo 244 * set the state of a Todo
254 * @param state State what the todo should take 245 * @param state State what the todo should take
255 */ 246 */
256 void setState( const OPimState& state); 247 void setState( const OPimState& state);
257 248
258 /** 249 /**
259 * set the Maintainer Mode 250 * set the Maintainer Mode
diff --git a/libopie2/opiepim/ui/opimmainwindow.cpp b/libopie2/opiepim/ui/opimmainwindow.cpp
index 4044bc1..2739e26 100644
--- a/libopie2/opiepim/ui/opimmainwindow.cpp
+++ b/libopie2/opiepim/ui/opimmainwindow.cpp
@@ -1,18 +1,19 @@
1#include <qapplication.h> 1#include <qapplication.h>
2#include <qdatetime.h> 2#include <qdatetime.h>
3#include <qcopchannel_qws.h> 3#include <qcopchannel_qws.h>
4 4
5#include <qpe/sound.h> 5#include <qpe/sound.h>
6#include <qpe/qcopenvelope_qws.h> 6#include <qpe/qcopenvelope_qws.h>
7#include <qpe/qpeapplication.h>
7 8
8#include "opimresolver.h" 9#include "opimresolver.h"
9#include "opimmainwindow.h" 10#include "opimmainwindow.h"
10 11
11OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent, 12OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent,
12 const char* name, WFlags flag ) 13 const char* name, WFlags flag )
13 : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) { 14 : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) {
14 15
15 /* 16 /*
16 * let's generate our QCopChannel 17 * let's generate our QCopChannel
17 */ 18 */
18 m_str = QString("QPE/"+m_service).local8Bit(); 19 m_str = QString("QPE/"+m_service).local8Bit();
@@ -29,71 +30,82 @@ OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent,
29 this, SLOT(reload() ) ); 30 this, SLOT(reload() ) );
30} 31}
31OPimMainWindow::~OPimMainWindow() { 32OPimMainWindow::~OPimMainWindow() {
32 delete m_channel; 33 delete m_channel;
33} 34}
34QCopChannel* OPimMainWindow::channel() { 35QCopChannel* OPimMainWindow::channel() {
35 return m_channel; 36 return m_channel;
36} 37}
37void OPimMainWindow::doSetDocument( const QString& ) { 38void OPimMainWindow::doSetDocument( const QString& ) {
38 39
39} 40}
40void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) { 41void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) {
42 bool needShow = false;
41 /* 43 /*
42 * create demands to create 44 * create demands to create
43 * a new record... 45 * a new record...
44 */ 46 */
45 QDataStream stream(array, IO_ReadOnly); 47 QDataStream stream(array, IO_ReadOnly);
46 if ( cmd == "create()" ) { 48 if ( cmd == "create()" ) {
49 raise();
47 int uid = create(); 50 int uid = create();
48 QCopEnvelope e(m_str, "created(int)" ); 51 QCopEnvelope e(m_str, "created(int)" );
49 e << uid; 52 e << uid;
53 needShow = true;
50 }else if ( cmd == "remove(int)" ) { 54 }else if ( cmd == "remove(int)" ) {
51 int uid; 55 int uid;
52 stream >> uid; 56 stream >> uid;
53 bool rem = remove( uid ); 57 bool rem = remove( uid );
54 QCopEnvelope e(m_str, "removed(bool)" ); 58 QCopEnvelope e(m_str, "removed(bool)" );
55 e << rem; 59 e << rem;
60 needShow = true;
56 }else if ( cmd == "beam(int)" ) { 61 }else if ( cmd == "beam(int)" ) {
57 int uid; 62 int uid;
58 stream >> uid; 63 stream >> uid;
59 beam( uid); 64 beam( uid);
60 }else if ( cmd == "show(int)" ) { 65 }else if ( cmd == "show(int)" ) {
66 raise();
61 int uid; 67 int uid;
62 stream >> uid; 68 stream >> uid;
63 show( uid ); 69 show( uid );
70 needShow = true;
64 }else if ( cmd == "edit(int)" ) { 71 }else if ( cmd == "edit(int)" ) {
72 raise();
65 int uid; 73 int uid;
66 stream >> uid; 74 stream >> uid;
67 edit( uid ); 75 edit( uid );
68 }else if ( cmd == "add(int,QByteArray)" ) { 76 }else if ( cmd == "add(int,QByteArray)" ) {
69 int rtti; 77 int rtti;
70 QByteArray array; 78 QByteArray array;
71 stream >> rtti; 79 stream >> rtti;
72 stream >> array; 80 stream >> array;
73 m_fallBack = record(rtti, array ); 81 m_fallBack = record(rtti, array );
74 if (!m_fallBack) return; 82 if (!m_fallBack) return;
75 add( *m_fallBack ); 83 add( *m_fallBack );
76 delete m_fallBack; 84 delete m_fallBack;
77 }else if ( cmd == "alarm(QDateTime,int)" ) { 85 }else if ( cmd == "alarm(QDateTime,int)" ) {
86 raise();
78 QDateTime dt; int uid; 87 QDateTime dt; int uid;
79 stream >> dt; 88 stream >> dt;
80 stream >> uid; 89 stream >> uid;
81 qWarning(" Date: %s Uid: %d", dt.toString().latin1(), uid ); 90 qWarning(" Date: %s Uid: %d", dt.toString().latin1(), uid );
82 QDateTime current = QDateTime::currentDateTime(); 91 QDateTime current = QDateTime::currentDateTime();
83 if ( current.time().hour() != dt.time().hour() && current.time().minute() != dt.time().minute() ) 92 if ( current.time().hour() != dt.time().hour() && current.time().minute() != dt.time().minute() )
84 return; 93 return;
85 doAlarm( dt, uid ); 94 doAlarm( dt, uid );
86 95 needShow = true;
87 } 96 }
97
98 if (needShow )
99 QPEApplication::setKeepRunning();
88} 100}
89/* implement the url scripting here */ 101/* implement the url scripting here */
90void OPimMainWindow::setDocument( const QString& str) { 102void OPimMainWindow::setDocument( const QString& str) {
91 doSetDocument( str ); 103 doSetDocument( str );
92} 104}
93/* 105/*
94 * we now try to get the array demarshalled 106 * we now try to get the array demarshalled
95 * check if the rtti matches this one 107 * check if the rtti matches this one
96 */ 108 */
97OPimRecord* OPimMainWindow::record( int rtti, const QByteArray& array ) { 109OPimRecord* OPimMainWindow::record( int rtti, const QByteArray& array ) {
98 if ( service() != rtti ) 110 if ( service() != rtti )
99 return 0l; 111 return 0l;