-rw-r--r-- | libopie2/opiepim/core/opimcontact.cpp | 20 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimcontactfields.cpp | 22 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimdateconversion.cpp | 12 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimevent.cpp | 24 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimnotifymanager.cpp | 7 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimrecord.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimtimezone.cpp | 5 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimtodo.cpp | 22 | ||||
-rw-r--r-- | libopie2/opiepim/core/otodoaccess.cpp | 2 |
9 files changed, 65 insertions, 51 deletions
diff --git a/libopie2/opiepim/core/opimcontact.cpp b/libopie2/opiepim/core/opimcontact.cpp index c1e06c8..48a74d0 100644 --- a/libopie2/opiepim/core/opimcontact.cpp +++ b/libopie2/opiepim/core/opimcontact.cpp | |||
@@ -25,24 +25,26 @@ | |||
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #define QTOPIA_INTERNAL_CONTACT_MRE | 30 | #define QTOPIA_INTERNAL_CONTACT_MRE |
31 | 31 | ||
32 | #include "opimcontact.h" | 32 | #include "opimcontact.h" |
33 | 33 | ||
34 | /* OPIE */ | 34 | /* OPIE */ |
35 | #include <opie2/opimresolver.h> | 35 | #include <opie2/opimresolver.h> |
36 | #include <opie2/opimdateconversion.h> | 36 | #include <opie2/opimdateconversion.h> |
37 | #include <opie2/odebug.h> | ||
38 | |||
37 | #include <qpe/stringutil.h> | 39 | #include <qpe/stringutil.h> |
38 | #include <qpe/timestring.h> | 40 | #include <qpe/timestring.h> |
39 | #include <qpe/config.h> | 41 | #include <qpe/config.h> |
40 | 42 | ||
41 | /* QT */ | 43 | /* QT */ |
42 | #include <qstylesheet.h> | 44 | #include <qstylesheet.h> |
43 | 45 | ||
44 | /* STD */ | 46 | /* STD */ |
45 | #include <stdio.h> | 47 | #include <stdio.h> |
46 | 48 | ||
47 | /*! | 49 | /*! |
48 | \class Contact contact.h | 50 | \class Contact contact.h |
@@ -70,32 +72,32 @@ OPimContact::OPimContact():OPimRecord(), mMap(), d( 0 ) | |||
70 | set from \a fromMap. | 72 | set from \a fromMap. |
71 | */ | 73 | */ |
72 | OPimContact::OPimContact( const QMap<int, QString> &fromMap ):OPimRecord(), mMap( fromMap ), d( 0 ) | 74 | OPimContact::OPimContact( const QMap<int, QString> &fromMap ):OPimRecord(), mMap( fromMap ), d( 0 ) |
73 | { | 75 | { |
74 | QString cats = mMap[ Qtopia::AddressCategory ]; | 76 | QString cats = mMap[ Qtopia::AddressCategory ]; |
75 | if ( !cats.isEmpty() ) | 77 | if ( !cats.isEmpty() ) |
76 | setCategories( idsFromString( cats ) ); | 78 | setCategories( idsFromString( cats ) ); |
77 | 79 | ||
78 | QString uidStr = find( Qtopia::AddressUid ); | 80 | QString uidStr = find( Qtopia::AddressUid ); |
79 | 81 | ||
80 | if ( uidStr.isEmpty() || ( uidStr.toInt() == 0 ) ) | 82 | if ( uidStr.isEmpty() || ( uidStr.toInt() == 0 ) ) |
81 | { | 83 | { |
82 | qWarning( "Invalid UID found. Generate new one.." ); | 84 | owarn << "Invalid UID found. Generate new one.." << oendl; |
83 | setUid( uidGen().generate() ); | 85 | setUid( uidGen().generate() ); |
84 | } | 86 | } |
85 | else | 87 | else |
86 | setUid( uidStr.toInt() ); | 88 | setUid( uidStr.toInt() ); |
87 | 89 | ||
88 | // if ( !uidStr.isEmpty() ) | 90 | // if ( !uidStr.isEmpty() ) |
89 | // setUid( uidStr.toInt() ); | 91 | // setUid( uidStr.toInt() ); |
90 | } | 92 | } |
91 | 93 | ||
92 | /*! | 94 | /*! |
93 | Destroys a contact. | 95 | Destroys a contact. |
94 | */ | 96 | */ |
95 | OPimContact::~OPimContact() | 97 | OPimContact::~OPimContact() |
96 | {} | 98 | {} |
97 | 99 | ||
98 | /*! \fn void OPimContact::setTitle( const QString &str ) | 100 | /*! \fn void OPimContact::setTitle( const QString &str ) |
99 | Sets the title of the contact to \a str. | 101 | Sets the title of the contact to \a str. |
100 | */ | 102 | */ |
101 | 103 | ||
@@ -922,25 +924,25 @@ QStringList OPimContact::childrenList() const | |||
922 | 924 | ||
923 | /*! | 925 | /*! |
924 | Returns a list of email addresses belonging to the contact, including | 926 | Returns a list of email addresses belonging to the contact, including |
925 | the default email address. | 927 | the default email address. |
926 | */ | 928 | */ |
927 | QStringList OPimContact::emailList() const | 929 | QStringList OPimContact::emailList() const |
928 | { | 930 | { |
929 | QString emailStr = emails(); | 931 | QString emailStr = emails(); |
930 | 932 | ||
931 | QStringList r; | 933 | QStringList r; |
932 | if ( !emailStr.isEmpty() ) | 934 | if ( !emailStr.isEmpty() ) |
933 | { | 935 | { |
934 | qDebug( " emailstr " ); | 936 | odebug << " emailstr " << oendl; |
935 | QStringList l = QStringList::split( emailSeparator(), emailStr ); | 937 | QStringList l = QStringList::split( emailSeparator(), emailStr ); |
936 | for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) | 938 | for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) |
937 | r += ( *it ).simplifyWhiteSpace(); | 939 | r += ( *it ).simplifyWhiteSpace(); |
938 | } | 940 | } |
939 | 941 | ||
940 | return r; | 942 | return r; |
941 | } | 943 | } |
942 | 944 | ||
943 | /*! | 945 | /*! |
944 | \overload | 946 | \overload |
945 | 947 | ||
946 | Generates the string for the contact to be filed as from the first, | 948 | Generates the string for the contact to be filed as from the first, |
@@ -1127,44 +1129,44 @@ class QString OPimContact::recordField( int pos ) const | |||
1127 | // In future releases, we should store birthday and anniversary | 1129 | // In future releases, we should store birthday and anniversary |
1128 | // internally as QDate instead of QString ! | 1130 | // internally as QDate instead of QString ! |
1129 | // QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) | 1131 | // QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) |
1130 | 1132 | ||
1131 | /*! \fn void OPimContact::setBirthday( const QDate& date ) | 1133 | /*! \fn void OPimContact::setBirthday( const QDate& date ) |
1132 | Sets the birthday for the contact to \a date. If date is null | 1134 | Sets the birthday for the contact to \a date. If date is null |
1133 | the current stored date will be removed. | 1135 | the current stored date will be removed. |
1134 | */ | 1136 | */ |
1135 | void OPimContact::setBirthday( const QDate &v ) | 1137 | void OPimContact::setBirthday( const QDate &v ) |
1136 | { | 1138 | { |
1137 | if ( v.isNull() ) | 1139 | if ( v.isNull() ) |
1138 | { | 1140 | { |
1139 | qWarning( "Remove Birthday" ); | 1141 | owarn << "Remove Birthday" << oendl; |
1140 | replace( Qtopia::Birthday, QString::null ); | 1142 | replace( Qtopia::Birthday, QString::null ); |
1141 | return ; | 1143 | return ; |
1142 | } | 1144 | } |
1143 | 1145 | ||
1144 | if ( v.isValid() ) | 1146 | if ( v.isValid() ) |
1145 | replace( Qtopia::Birthday, OPimDateConversion::dateToString( v ) ); | 1147 | replace( Qtopia::Birthday, OPimDateConversion::dateToString( v ) ); |
1146 | 1148 | ||
1147 | } | 1149 | } |
1148 | 1150 | ||
1149 | 1151 | ||
1150 | /*! \fn void OPimContact::setAnniversary( const QDate &date ) | 1152 | /*! \fn void OPimContact::setAnniversary( const QDate &date ) |
1151 | Sets the anniversary of the contact to \a date. If date is | 1153 | Sets the anniversary of the contact to \a date. If date is |
1152 | null, the current stored date will be removed. | 1154 | null, the current stored date will be removed. |
1153 | */ | 1155 | */ |
1154 | void OPimContact::setAnniversary( const QDate &v ) | 1156 | void OPimContact::setAnniversary( const QDate &v ) |
1155 | { | 1157 | { |
1156 | if ( v.isNull() ) | 1158 | if ( v.isNull() ) |
1157 | { | 1159 | { |
1158 | qWarning( "Remove Anniversary" ); | 1160 | owarn << "Remove Anniversary" << oendl; |
1159 | replace( Qtopia::Anniversary, QString::null ); | 1161 | replace( Qtopia::Anniversary, QString::null ); |
1160 | return ; | 1162 | return ; |
1161 | } | 1163 | } |
1162 | 1164 | ||
1163 | if ( v.isValid() ) | 1165 | if ( v.isValid() ) |
1164 | replace( Qtopia::Anniversary, OPimDateConversion::dateToString( v ) ); | 1166 | replace( Qtopia::Anniversary, OPimDateConversion::dateToString( v ) ); |
1165 | } | 1167 | } |
1166 | 1168 | ||
1167 | 1169 | ||
1168 | /*! \fn QDate OPimContact::birthday() const | 1170 | /*! \fn QDate OPimContact::birthday() const |
1169 | Returns the birthday of the contact. | 1171 | Returns the birthday of the contact. |
1170 | */ | 1172 | */ |
@@ -1187,25 +1189,25 @@ QDate OPimContact::anniversary() const | |||
1187 | QDate empty; | 1189 | QDate empty; |
1188 | QString str = find( Qtopia::Anniversary ); | 1190 | QString str = find( Qtopia::Anniversary ); |
1189 | // qWarning ("Anniversary %s", str.latin1() ); | 1191 | // qWarning ("Anniversary %s", str.latin1() ); |
1190 | if ( !str.isEmpty() ) | 1192 | if ( !str.isEmpty() ) |
1191 | return OPimDateConversion::dateFromString ( str ); | 1193 | return OPimDateConversion::dateFromString ( str ); |
1192 | else | 1194 | else |
1193 | return empty; | 1195 | return empty; |
1194 | } | 1196 | } |
1195 | 1197 | ||
1196 | 1198 | ||
1197 | void OPimContact::insertEmail( const QString &v ) | 1199 | void OPimContact::insertEmail( const QString &v ) |
1198 | { | 1200 | { |
1199 | //qDebug("insertEmail %s", v.latin1()); | 1201 | //odebug << "insertEmail " << v << "" << oendl; |
1200 | QString e = v.simplifyWhiteSpace(); | 1202 | QString e = v.simplifyWhiteSpace(); |
1201 | QString def = defaultEmail(); | 1203 | QString def = defaultEmail(); |
1202 | 1204 | ||
1203 | // if no default, set it as the default email and don't insert | 1205 | // if no default, set it as the default email and don't insert |
1204 | if ( def.isEmpty() ) | 1206 | if ( def.isEmpty() ) |
1205 | { | 1207 | { |
1206 | setDefaultEmail( e ); // will insert into the list for us | 1208 | setDefaultEmail( e ); // will insert into the list for us |
1207 | return ; | 1209 | return ; |
1208 | } | 1210 | } |
1209 | 1211 | ||
1210 | // otherwise, insert assuming doesn't already exist | 1212 | // otherwise, insert assuming doesn't already exist |
1211 | QString emailsStr = find( Qtopia::Emails ); | 1213 | QString emailsStr = find( Qtopia::Emails ); |
@@ -1221,54 +1223,54 @@ void OPimContact::insertEmail( const QString &v ) | |||
1221 | void OPimContact::removeEmail( const QString &v ) | 1223 | void OPimContact::removeEmail( const QString &v ) |
1222 | { | 1224 | { |
1223 | QString e = v.simplifyWhiteSpace(); | 1225 | QString e = v.simplifyWhiteSpace(); |
1224 | QString def = defaultEmail(); | 1226 | QString def = defaultEmail(); |
1225 | QString emailsStr = find( Qtopia::Emails ); | 1227 | QString emailsStr = find( Qtopia::Emails ); |
1226 | QStringList emails = emailList(); | 1228 | QStringList emails = emailList(); |
1227 | 1229 | ||
1228 | // otherwise, must first contain it | 1230 | // otherwise, must first contain it |
1229 | if ( !emailsStr.contains( e ) ) | 1231 | if ( !emailsStr.contains( e ) ) |
1230 | return ; | 1232 | return ; |
1231 | 1233 | ||
1232 | // remove it | 1234 | // remove it |
1233 | //qDebug(" removing email from list %s", e.latin1()); | 1235 | //odebug << " removing email from list " << e << "" << oendl; |
1234 | emails.remove( e ); | 1236 | emails.remove( e ); |
1235 | // reset the string | 1237 | // reset the string |
1236 | emailsStr = emails.join( emailSeparator() ); // Sharp's brain dead separator | 1238 | emailsStr = emails.join( emailSeparator() ); // Sharp's brain dead separator |
1237 | replace( Qtopia::Emails, emailsStr ); | 1239 | replace( Qtopia::Emails, emailsStr ); |
1238 | 1240 | ||
1239 | // if default, then replace the default email with the first one | 1241 | // if default, then replace the default email with the first one |
1240 | if ( def == e ) | 1242 | if ( def == e ) |
1241 | { | 1243 | { |
1242 | //qDebug("removeEmail is default; setting new default"); | 1244 | //odebug << "removeEmail is default; setting new default" << oendl; |
1243 | if ( !emails.count() ) | 1245 | if ( !emails.count() ) |
1244 | clearEmails(); | 1246 | clearEmails(); |
1245 | else // setDefaultEmail will remove e from the list | 1247 | else // setDefaultEmail will remove e from the list |
1246 | setDefaultEmail( emails.first() ); | 1248 | setDefaultEmail( emails.first() ); |
1247 | } | 1249 | } |
1248 | } | 1250 | } |
1249 | 1251 | ||
1250 | 1252 | ||
1251 | void OPimContact::clearEmails() | 1253 | void OPimContact::clearEmails() |
1252 | { | 1254 | { |
1253 | mMap.remove( Qtopia::DefaultEmail ); | 1255 | mMap.remove( Qtopia::DefaultEmail ); |
1254 | mMap.remove( Qtopia::Emails ); | 1256 | mMap.remove( Qtopia::Emails ); |
1255 | } | 1257 | } |
1256 | 1258 | ||
1257 | 1259 | ||
1258 | void OPimContact::setDefaultEmail( const QString &v ) | 1260 | void OPimContact::setDefaultEmail( const QString &v ) |
1259 | { | 1261 | { |
1260 | QString e = v.simplifyWhiteSpace(); | 1262 | QString e = v.simplifyWhiteSpace(); |
1261 | 1263 | ||
1262 | //qDebug("OPimContact::setDefaultEmail %s", e.latin1()); | 1264 | //odebug << "OPimContact::setDefaultEmail " << e << "" << oendl; |
1263 | replace( Qtopia::DefaultEmail, e ); | 1265 | replace( Qtopia::DefaultEmail, e ); |
1264 | 1266 | ||
1265 | if ( !e.isEmpty() ) | 1267 | if ( !e.isEmpty() ) |
1266 | insertEmail( e ); | 1268 | insertEmail( e ); |
1267 | 1269 | ||
1268 | } | 1270 | } |
1269 | 1271 | ||
1270 | 1272 | ||
1271 | void OPimContact::insertEmails( const QStringList &v ) | 1273 | void OPimContact::insertEmails( const QStringList &v ) |
1272 | { | 1274 | { |
1273 | for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it ) | 1275 | for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it ) |
1274 | insertEmail( *it ); | 1276 | insertEmail( *it ); |
diff --git a/libopie2/opiepim/core/opimcontactfields.cpp b/libopie2/opiepim/core/opimcontactfields.cpp index 120beb6..5d45d1f 100644 --- a/libopie2/opiepim/core/opimcontactfields.cpp +++ b/libopie2/opiepim/core/opimcontactfields.cpp | |||
@@ -22,24 +22,26 @@ | |||
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "opimcontactfields.h" | 30 | #include "opimcontactfields.h" |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <opie2/opimcontact.h> | 33 | #include <opie2/opimcontact.h> |
34 | #include <opie2/odebug.h> | ||
35 | |||
34 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
35 | 37 | ||
36 | /* QT */ | 38 | /* QT */ |
37 | #include <qobject.h> | 39 | #include <qobject.h> |
38 | 40 | ||
39 | 41 | ||
40 | namespace Opie | 42 | namespace Opie |
41 | { | 43 | { |
42 | /*! | 44 | /*! |
43 | \internal | 45 | \internal |
44 | Returns a list of personal field names for a contact. | 46 | Returns a list of personal field names for a contact. |
45 | */ | 47 | */ |
@@ -433,84 +435,84 @@ OPimContactFields::~OPimContactFields() | |||
433 | { | 435 | { |
434 | Config cfg ( "AddressBook" ); | 436 | Config cfg ( "AddressBook" ); |
435 | cfg.setGroup( "ContactFieldOrder" ); | 437 | cfg.setGroup( "ContactFieldOrder" ); |
436 | cfg.writeEntry( "General", globalFieldOrder ); | 438 | cfg.writeEntry( "General", globalFieldOrder ); |
437 | } | 439 | } |
438 | } | 440 | } |
439 | 441 | ||
440 | 442 | ||
441 | 443 | ||
442 | void OPimContactFields::saveToRecord( OPimContact &cnt ) | 444 | void OPimContactFields::saveToRecord( OPimContact &cnt ) |
443 | { | 445 | { |
444 | 446 | ||
445 | qDebug( "ocontactfields saveToRecord: >%s<", fieldOrder.latin1() ); | 447 | odebug << "ocontactfields saveToRecord: >" << fieldOrder << "<" << oendl; |
446 | 448 | ||
447 | // Store fieldorder into this contact. | 449 | // Store fieldorder into this contact. |
448 | cnt.setCustomField( CONTACT_FIELD_ORDER_NAME, fieldOrder ); | 450 | cnt.setCustomField( CONTACT_FIELD_ORDER_NAME, fieldOrder ); |
449 | 451 | ||
450 | globalFieldOrder = fieldOrder; | 452 | globalFieldOrder = fieldOrder; |
451 | changedFieldOrder = true; | 453 | changedFieldOrder = true; |
452 | 454 | ||
453 | } | 455 | } |
454 | 456 | ||
455 | void OPimContactFields::loadFromRecord( const OPimContact &cnt ) | 457 | void OPimContactFields::loadFromRecord( const OPimContact &cnt ) |
456 | { | 458 | { |
457 | qDebug( "ocontactfields loadFromRecord" ); | 459 | odebug << "ocontactfields loadFromRecord" << oendl; |
458 | qDebug( "loading >%s<", cnt.fullName().latin1() ); | 460 | odebug << "loading >" << cnt.fullName() << "<" << oendl; |
459 | 461 | ||
460 | // Get fieldorder for this contact. If none is defined, | 462 | // Get fieldorder for this contact. If none is defined, |
461 | // we will use the global one from the config file.. | 463 | // we will use the global one from the config file.. |
462 | 464 | ||
463 | fieldOrder = cnt.customField( CONTACT_FIELD_ORDER_NAME ); | 465 | fieldOrder = cnt.customField( CONTACT_FIELD_ORDER_NAME ); |
464 | 466 | ||
465 | qDebug( "fieldOrder from contact>%s<", fieldOrder.latin1() ); | 467 | odebug << "fieldOrder from contact>" << fieldOrder << "<" << oendl; |
466 | 468 | ||
467 | if ( fieldOrder.isEmpty() ) | 469 | if ( fieldOrder.isEmpty() ) |
468 | { | 470 | { |
469 | fieldOrder = globalFieldOrder; | 471 | fieldOrder = globalFieldOrder; |
470 | } | 472 | } |
471 | 473 | ||
472 | 474 | ||
473 | qDebug( "effective fieldOrder in loadFromRecord >%s<", fieldOrder.latin1() ); | 475 | odebug << "effective fieldOrder in loadFromRecord >" << fieldOrder << "<" << oendl; |
474 | } | 476 | } |
475 | 477 | ||
476 | void OPimContactFields::setFieldOrder( int num, int index ) | 478 | void OPimContactFields::setFieldOrder( int num, int index ) |
477 | { | 479 | { |
478 | qDebug( "qcontactfields setfieldorder pos %i -> %i", num, index ); | 480 | odebug << "qcontactfields setfieldorder pos " << num << " -> " << index << "" << oendl; |
479 | 481 | ||
480 | fieldOrder[ num ] = QString::number( index, 16 ) [ 0 ]; | 482 | fieldOrder[ num ] = QString::number( index, 16 ) [ 0 ]; |
481 | 483 | ||
482 | // We will store this new fieldorder globally to | 484 | // We will store this new fieldorder globally to |
483 | // remember it for contacts which have none | 485 | // remember it for contacts which have none |
484 | globalFieldOrder = fieldOrder; | 486 | globalFieldOrder = fieldOrder; |
485 | changedFieldOrder = true; | 487 | changedFieldOrder = true; |
486 | 488 | ||
487 | qDebug( "fieldOrder >%s<", fieldOrder.latin1() ); | 489 | odebug << "fieldOrder >" << fieldOrder << "<" << oendl; |
488 | } | 490 | } |
489 | 491 | ||
490 | int OPimContactFields::getFieldOrder( int num, int defIndex ) | 492 | int OPimContactFields::getFieldOrder( int num, int defIndex ) |
491 | { | 493 | { |
492 | qDebug( "ocontactfields getFieldOrder" ); | 494 | odebug << "ocontactfields getFieldOrder" << oendl; |
493 | qDebug( "fieldOrder >%s<", fieldOrder.latin1() ); | 495 | odebug << "fieldOrder >" << fieldOrder << "<" << oendl; |
494 | 496 | ||
495 | // Get index of combo as char.. | 497 | // Get index of combo as char.. |
496 | QChar poschar = fieldOrder[ num ]; | 498 | QChar poschar = fieldOrder[ num ]; |
497 | 499 | ||
498 | bool ok; | 500 | bool ok; |
499 | int ret = 0; | 501 | int ret = 0; |
500 | // Convert char to number.. | 502 | // Convert char to number.. |
501 | if ( !( poschar == QChar::null ) ) | 503 | if ( !( poschar == QChar::null ) ) |
502 | ret = QString( poschar ).toInt( &ok, 16 ); | 504 | ret = QString( poschar ).toInt( &ok, 16 ); |
503 | else | 505 | else |
504 | ok = false; | 506 | ok = false; |
505 | 507 | ||
506 | // Return default value if index for | 508 | // Return default value if index for |
507 | // num was not set or if anything else happened.. | 509 | // num was not set or if anything else happened.. |
508 | if ( !ok ) ret = defIndex; | 510 | if ( !ok ) ret = defIndex; |
509 | 511 | ||
510 | qDebug( "returning >%i<", ret ); | 512 | odebug << "returning >" << ret << "<" << oendl; |
511 | 513 | ||
512 | return ret; | 514 | return ret; |
513 | 515 | ||
514 | } | 516 | } |
515 | 517 | ||
516 | } | 518 | } |
diff --git a/libopie2/opiepim/core/opimdateconversion.cpp b/libopie2/opiepim/core/opimdateconversion.cpp index 8bf891b..c93e178 100644 --- a/libopie2/opiepim/core/opimdateconversion.cpp +++ b/libopie2/opiepim/core/opimdateconversion.cpp | |||
@@ -19,43 +19,45 @@ _;:, .> :=|. This program is free software; you can | |||
19 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
20 | : = ...= . :.=- | 20 | : = ...= . :.=- |
21 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
22 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
23 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | /* OPIE */ | 29 | /* OPIE */ |
30 | #include <opie2/opimdateconversion.h> | 30 | #include <opie2/opimdateconversion.h> |
31 | #include <opie2/odebug.h> | ||
32 | |||
31 | #include <qpe/timeconversion.h> | 33 | #include <qpe/timeconversion.h> |
32 | 34 | ||
33 | namespace Opie | 35 | namespace Opie |
34 | { | 36 | { |
35 | 37 | ||
36 | QString OPimDateConversion::dateToString( const QDate &d ) | 38 | QString OPimDateConversion::dateToString( const QDate &d ) |
37 | { | 39 | { |
38 | if ( d.isNull() || !d.isValid() ) | 40 | if ( d.isNull() || !d.isValid() ) |
39 | return QString::null; | 41 | return QString::null; |
40 | 42 | ||
41 | // ISO format in year, month, day (YYYYMMDD); e.g. 20021231 | 43 | // ISO format in year, month, day (YYYYMMDD); e.g. 20021231 |
42 | QString year = QString::number( d.year() ); | 44 | QString year = QString::number( d.year() ); |
43 | QString month = QString::number( d.month() ); | 45 | QString month = QString::number( d.month() ); |
44 | month = month.rightJustify( 2, '0' ); | 46 | month = month.rightJustify( 2, '0' ); |
45 | QString day = QString::number( d.day() ); | 47 | QString day = QString::number( d.day() ); |
46 | day = day.rightJustify( 2, '0' ); | 48 | day = day.rightJustify( 2, '0' ); |
47 | 49 | ||
48 | QString str = year + month + day; | 50 | QString str = year + month + day; |
49 | //qDebug( "\tPimContact dateToStr = %s", str.latin1() ); | 51 | //odebug << "\tPimContact dateToStr = " << str << "" << oendl; |
50 | 52 | ||
51 | return str; | 53 | return str; |
52 | } | 54 | } |
53 | 55 | ||
54 | 56 | ||
55 | QDate OPimDateConversion::dateFromString( const QString& s ) | 57 | QDate OPimDateConversion::dateFromString( const QString& s ) |
56 | { | 58 | { |
57 | QDate date; | 59 | QDate date; |
58 | 60 | ||
59 | if ( s.isEmpty() ) | 61 | if ( s.isEmpty() ) |
60 | return date; | 62 | return date; |
61 | 63 | ||
@@ -65,42 +67,42 @@ QDate OPimDateConversion::dateFromString( const QString& s ) | |||
65 | if ( date.isValid() ) | 67 | if ( date.isValid() ) |
66 | return date; | 68 | return date; |
67 | 69 | ||
68 | // Read ISO-Format (YYYYMMDD) | 70 | // Read ISO-Format (YYYYMMDD) |
69 | int year = s.mid( 0, 4 ).toInt(); | 71 | int year = s.mid( 0, 4 ).toInt(); |
70 | int month = s.mid( 4, 2 ).toInt(); | 72 | int month = s.mid( 4, 2 ).toInt(); |
71 | int day = s.mid( 6, 2 ).toInt(); | 73 | int day = s.mid( 6, 2 ).toInt(); |
72 | 74 | ||
73 | // do some quick sanity checking -eilers | 75 | // do some quick sanity checking -eilers |
74 | // but we isValid() again? -zecke | 76 | // but we isValid() again? -zecke |
75 | if ( year < 1900 || year > 3000 ) | 77 | if ( year < 1900 || year > 3000 ) |
76 | { | 78 | { |
77 | qWarning( "PimContact year is not in range" ); | 79 | owarn << "PimContact year is not in range" << oendl; |
78 | return date; | 80 | return date; |
79 | } | 81 | } |
80 | if ( month < 0 || month > 12 ) | 82 | if ( month < 0 || month > 12 ) |
81 | { | 83 | { |
82 | qWarning( "PimContact month is not in range" ); | 84 | owarn << "PimContact month is not in range" << oendl; |
83 | return date; | 85 | return date; |
84 | } | 86 | } |
85 | if ( day < 0 || day > 31 ) | 87 | if ( day < 0 || day > 31 ) |
86 | { | 88 | { |
87 | qWarning( "PimContact day is not in range" ); | 89 | owarn << "PimContact day is not in range" << oendl; |
88 | return date; | 90 | return date; |
89 | } | 91 | } |
90 | 92 | ||
91 | date.setYMD( year, month, day ); | 93 | date.setYMD( year, month, day ); |
92 | if ( !date.isValid() ) | 94 | if ( !date.isValid() ) |
93 | { | 95 | { |
94 | qWarning( "PimContact date is not valid" ); | 96 | owarn << "PimContact date is not valid" << oendl; |
95 | return date; | 97 | return date; |
96 | } | 98 | } |
97 | 99 | ||
98 | return date; | 100 | return date; |
99 | } | 101 | } |
100 | 102 | ||
101 | 103 | ||
102 | QString OPimDateConversion::dateTimeToString( const QDateTime& dt ) | 104 | QString OPimDateConversion::dateTimeToString( const QDateTime& dt ) |
103 | { | 105 | { |
104 | if ( !dt.isValid() || dt.isNull() ) | 106 | if ( !dt.isValid() || dt.isNull() ) |
105 | return QString::null; | 107 | return QString::null; |
106 | 108 | ||
diff --git a/libopie2/opiepim/core/opimevent.cpp b/libopie2/opiepim/core/opimevent.cpp index 9d46651..8752fce 100644 --- a/libopie2/opiepim/core/opimevent.cpp +++ b/libopie2/opiepim/core/opimevent.cpp | |||
@@ -24,24 +24,26 @@ | |||
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "opimevent.h" | 30 | #include "opimevent.h" |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <opie2/opimrecurrence.h> | 33 | #include <opie2/opimrecurrence.h> |
34 | #include <opie2/opimresolver.h> | 34 | #include <opie2/opimresolver.h> |
35 | #include <opie2/opimnotifymanager.h> | 35 | #include <opie2/opimnotifymanager.h> |
36 | #include <opie2/odebug.h> | ||
37 | |||
36 | #include <qpe/categories.h> | 38 | #include <qpe/categories.h> |
37 | #include <qpe/stringutil.h> | 39 | #include <qpe/stringutil.h> |
38 | 40 | ||
39 | /* QT */ | 41 | /* QT */ |
40 | 42 | ||
41 | namespace Opie | 43 | namespace Opie |
42 | { | 44 | { |
43 | 45 | ||
44 | int OCalendarHelper::week( const QDate& date ) | 46 | int OCalendarHelper::week( const QDate& date ) |
45 | { | 47 | { |
46 | // Calculates the week this date is in within that | 48 | // Calculates the week this date is in within that |
47 | // month. Equals the "row" is is in in the month view | 49 | // month. Equals the "row" is is in in the month view |
@@ -546,29 +548,29 @@ void OPimEvent::deref() | |||
546 | // Thus, we could remove the stuff there and use this | 548 | // Thus, we could remove the stuff there and use this |
547 | // for it and for all other places.. | 549 | // for it and for all other places.. |
548 | // Encoding should happen at one place, only ! (eilers) | 550 | // Encoding should happen at one place, only ! (eilers) |
549 | QMap<int, QString> OPimEvent::toMap() const | 551 | QMap<int, QString> OPimEvent::toMap() const |
550 | { | 552 | { |
551 | QMap<int, QString> retMap; | 553 | QMap<int, QString> retMap; |
552 | 554 | ||
553 | retMap.insert( OPimEvent::FUid, QString::number( uid() ) ); | 555 | retMap.insert( OPimEvent::FUid, QString::number( uid() ) ); |
554 | retMap.insert( OPimEvent::FCategories, Qtopia::escapeString( Qtopia::Record::idsToString( categories() ) ) ); | 556 | retMap.insert( OPimEvent::FCategories, Qtopia::escapeString( Qtopia::Record::idsToString( categories() ) ) ); |
555 | retMap.insert( OPimEvent::FDescription, Qtopia::escapeString( description() ) ); | 557 | retMap.insert( OPimEvent::FDescription, Qtopia::escapeString( description() ) ); |
556 | retMap.insert( OPimEvent::FLocation, Qtopia::escapeString( location() ) ); | 558 | retMap.insert( OPimEvent::FLocation, Qtopia::escapeString( location() ) ); |
557 | retMap.insert( OPimEvent::FType, isAllDay() ? "AllDay" : "" ); | 559 | retMap.insert( OPimEvent::FType, isAllDay() ? "AllDay" : "" ); |
558 | if ( notifiers().alarms().count() ){ | 560 | if ( notifiers().alarms().count() ){ |
559 | // Currently we just support one alarm.. (eilers) | 561 | // Currently we just support one alarm.. (eilers) |
560 | OPimAlarm alarm = notifiers().alarms() [ 0 ]; | 562 | OPimAlarm alarm = notifiers().alarms() [ 0 ]; |
561 | retMap.insert( OPimEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) ); | 563 | retMap.insert( OPimEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) ); |
562 | retMap.insert( OPimEvent::FSound, ( alarm.sound() == OPimAlarm::Loud ) ? "loud" : "silent" ); | 564 | retMap.insert( OPimEvent::FSound, ( alarm.sound() == OPimAlarm::Loud ) ? "loud" : "silent" ); |
563 | } | 565 | } |
564 | 566 | ||
565 | OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() ); | 567 | OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() ); |
566 | retMap.insert( OPimEvent::FStart, QString::number( zone.fromUTCDateTime( zone.toDateTime( startDateTime(), OPimTimeZone::utc() ) ) ) ); | 568 | retMap.insert( OPimEvent::FStart, QString::number( zone.fromUTCDateTime( zone.toDateTime( startDateTime(), OPimTimeZone::utc() ) ) ) ); |
567 | retMap.insert( OPimEvent::FEnd, QString::number( zone.fromUTCDateTime( zone.toDateTime( endDateTime(), OPimTimeZone::utc() ) ) ) ); | 569 | retMap.insert( OPimEvent::FEnd, QString::number( zone.fromUTCDateTime( zone.toDateTime( endDateTime(), OPimTimeZone::utc() ) ) ) ); |
568 | retMap.insert( OPimEvent::FNote, Qtopia::escapeString( note() ) ); | 570 | retMap.insert( OPimEvent::FNote, Qtopia::escapeString( note() ) ); |
569 | retMap.insert( OPimEvent::FTimeZone, timeZone().isEmpty() ? QString( "None" ) : timeZone() ); | 571 | retMap.insert( OPimEvent::FTimeZone, timeZone().isEmpty() ? QString( "None" ) : timeZone() ); |
570 | if ( parent() ) | 572 | if ( parent() ) |
571 | retMap.insert( OPimEvent::FRecParent, QString::number( parent() ) ); | 573 | retMap.insert( OPimEvent::FRecParent, QString::number( parent() ) ); |
572 | if ( children().count() ) | 574 | if ( children().count() ) |
573 | { | 575 | { |
574 | QArray<int> childr = children(); | 576 | QArray<int> childr = children(); |
@@ -632,49 +634,49 @@ void OPimEvent::fromMap( const QMap<int, QString>& map ) | |||
632 | 634 | ||
633 | /* AllDay is always in UTC */ | 635 | /* AllDay is always in UTC */ |
634 | if ( isAllDay() ) | 636 | if ( isAllDay() ) |
635 | { | 637 | { |
636 | OPimTimeZone utc = OPimTimeZone::utc(); | 638 | OPimTimeZone utc = OPimTimeZone::utc(); |
637 | setStartDateTime( utc.fromUTCDateTime( start ) ); | 639 | setStartDateTime( utc.fromUTCDateTime( start ) ); |
638 | setEndDateTime ( utc.fromUTCDateTime( end ) ); | 640 | setEndDateTime ( utc.fromUTCDateTime( end ) ); |
639 | setTimeZone( "UTC" ); // make sure it is really utc | 641 | setTimeZone( "UTC" ); // make sure it is really utc |
640 | } | 642 | } |
641 | else | 643 | else |
642 | { | 644 | { |
643 | /* to current date time */ | 645 | /* to current date time */ |
644 | // qWarning(" Start is %d", start ); | 646 | // owarn << " Start is " << start << "" << oendl; |
645 | OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() ); | 647 | OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() ); |
646 | QDateTime date = zone.toDateTime( start ); | 648 | QDateTime date = zone.toDateTime( start ); |
647 | qWarning( " Start is %s", date.toString().latin1() ); | 649 | owarn << " Start is " << date.toString() << "" << oendl; |
648 | setStartDateTime( zone.toDateTime( date, OPimTimeZone::current() ) ); | 650 | setStartDateTime( zone.toDateTime( date, OPimTimeZone::current() ) ); |
649 | 651 | ||
650 | date = zone.toDateTime( end ); | 652 | date = zone.toDateTime( end ); |
651 | setEndDateTime ( zone.toDateTime( date, OPimTimeZone::current() ) ); | 653 | setEndDateTime ( zone.toDateTime( date, OPimTimeZone::current() ) ); |
652 | } | 654 | } |
653 | 655 | ||
654 | int alarmTime = -1; | 656 | int alarmTime = -1; |
655 | if ( !map[ OPimEvent::FAlarm ].isEmpty() ) | 657 | if ( !map[ OPimEvent::FAlarm ].isEmpty() ) |
656 | alarmTime = map[ OPimEvent::FAlarm ].toInt(); | 658 | alarmTime = map[ OPimEvent::FAlarm ].toInt(); |
657 | 659 | ||
658 | int sound = ( ( map[ OPimEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent ); | 660 | int sound = ( ( map[ OPimEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent ); |
659 | if ( ( alarmTime != -1 ) ) | 661 | if ( ( alarmTime != -1 ) ) |
660 | { | 662 | { |
661 | QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 ); | 663 | QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 ); |
662 | OPimAlarm al( sound , dt ); | 664 | OPimAlarm al( sound , dt ); |
663 | notifiers().add( al ); | 665 | notifiers().add( al ); |
664 | } | 666 | } |
665 | 667 | ||
666 | 668 | ||
667 | if ( !map[ OPimEvent::FNote ].isEmpty() ) | 669 | if ( !map[ OPimEvent::FNote ].isEmpty() ) |
668 | setNote( map[ OPimEvent::FNote ] ); | 670 | setNote( map[ OPimEvent::FNote ] ); |
669 | 671 | ||
670 | if ( !map[ OPimEvent::FRecParent ].isEmpty() ) | 672 | if ( !map[ OPimEvent::FRecParent ].isEmpty() ) |
671 | setParent( map[ OPimEvent::FRecParent ].toInt() ); | 673 | setParent( map[ OPimEvent::FRecParent ].toInt() ); |
672 | 674 | ||
673 | if ( !map[ OPimEvent::FRecChildren ].isEmpty() ) | 675 | if ( !map[ OPimEvent::FRecChildren ].isEmpty() ) |
674 | { | 676 | { |
675 | QStringList list = QStringList::split( ' ', map[ OPimEvent::FRecChildren ] ); | 677 | QStringList list = QStringList::split( ' ', map[ OPimEvent::FRecChildren ] ); |
676 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) | 678 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
677 | { | 679 | { |
678 | addChild( ( *it ).toInt() ); | 680 | addChild( ( *it ).toInt() ); |
679 | } | 681 | } |
680 | } | 682 | } |
diff --git a/libopie2/opiepim/core/opimnotifymanager.cpp b/libopie2/opiepim/core/opimnotifymanager.cpp index 573340a..0f863aa 100644 --- a/libopie2/opiepim/core/opimnotifymanager.cpp +++ b/libopie2/opiepim/core/opimnotifymanager.cpp | |||
@@ -22,24 +22,25 @@ | |||
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "opimnotifymanager.h" | 30 | #include "opimnotifymanager.h" |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <opie2/opimdateconversion.h> | 33 | #include <opie2/opimdateconversion.h> |
34 | #include <opie2/odebug.h> | ||
34 | 35 | ||
35 | /* QT */ | 36 | /* QT */ |
36 | #include <qstringlist.h> | 37 | #include <qstringlist.h> |
37 | 38 | ||
38 | namespace Opie | 39 | namespace Opie |
39 | { | 40 | { |
40 | 41 | ||
41 | OPimNotifyManager::OPimNotifyManager( const Reminders& rem, const Alarms& al ) | 42 | OPimNotifyManager::OPimNotifyManager( const Reminders& rem, const Alarms& al ) |
42 | : m_rem( rem ), m_al( al ) | 43 | : m_rem( rem ), m_al( al ) |
43 | {} | 44 | {} |
44 | 45 | ||
45 | 46 | ||
@@ -154,25 +155,25 @@ void OPimNotifyManager::registerNotify( const OPimNotify& ) | |||
154 | /** | 155 | /** |
155 | * same as above... | 156 | * same as above... |
156 | * Also implement Url model | 157 | * Also implement Url model |
157 | * have a MainWindow.... | 158 | * have a MainWindow.... |
158 | */ | 159 | */ |
159 | void OPimNotifyManager::deregister( const OPimNotify& ) | 160 | void OPimNotifyManager::deregister( const OPimNotify& ) |
160 | { | 161 | { |
161 | } | 162 | } |
162 | 163 | ||
163 | 164 | ||
164 | bool OPimNotifyManager::isEmpty() const | 165 | bool OPimNotifyManager::isEmpty() const |
165 | { | 166 | { |
166 | qWarning( "is Empty called on OPimNotifyManager %d %d", m_rem.count(), m_al.count() ); | 167 | owarn << "is Empty called on OPimNotifyManager " << m_rem.count() << " " << m_al.count() << "" << oendl; |
167 | if ( m_rem.isEmpty() && m_al.isEmpty() ) return true; | 168 | if ( m_rem.isEmpty() && m_al.isEmpty() ) return true; |
168 | else return false; | 169 | else return false; |
169 | } | 170 | } |
170 | 171 | ||
171 | 172 | ||
172 | // Taken from otodoaccessxml.. code duplication bad. any alternative? | 173 | // Taken from otodoaccessxml.. code duplication bad. any alternative? |
173 | QString OPimNotifyManager::alarmsToString() const | 174 | QString OPimNotifyManager::alarmsToString() const |
174 | { | 175 | { |
175 | QString str; | 176 | QString str; |
176 | 177 | ||
177 | OPimNotifyManager::Alarms alarms = m_al; | 178 | OPimNotifyManager::Alarms alarms = m_al; |
178 | if ( !alarms.isEmpty() ) | 179 | if ( !alarms.isEmpty() ) |
@@ -182,25 +183,25 @@ QString OPimNotifyManager::alarmsToString() const | |||
182 | for ( ; it != alarms.end(); ++it ) | 183 | for ( ; it != alarms.end(); ++it ) |
183 | { | 184 | { |
184 | /* only if time is valid */ | 185 | /* only if time is valid */ |
185 | if ( ( *it ).dateTime().isValid() ) | 186 | if ( ( *it ).dateTime().isValid() ) |
186 | { | 187 | { |
187 | als << OPimDateConversion::dateTimeToString( ( *it ).dateTime() ) | 188 | als << OPimDateConversion::dateTimeToString( ( *it ).dateTime() ) |
188 | + ":" + QString::number( ( *it ).duration() ) | 189 | + ":" + QString::number( ( *it ).duration() ) |
189 | + ":" + QString::number( ( *it ).sound() ) | 190 | + ":" + QString::number( ( *it ).sound() ) |
190 | + ":"; | 191 | + ":"; |
191 | } | 192 | } |
192 | } | 193 | } |
193 | // now write the list | 194 | // now write the list |
194 | qWarning( "als: %s", als.join( "____________" ).latin1() ); | 195 | owarn << "als: " << als.join( "____________" ) << "" << oendl; |
195 | str = als.join( ";" ); | 196 | str = als.join( ";" ); |
196 | } | 197 | } |
197 | 198 | ||
198 | return str; | 199 | return str; |
199 | } | 200 | } |
200 | 201 | ||
201 | 202 | ||
202 | QString OPimNotifyManager::remindersToString() const | 203 | QString OPimNotifyManager::remindersToString() const |
203 | { | 204 | { |
204 | QString str; | 205 | QString str; |
205 | 206 | ||
206 | OPimNotifyManager::Reminders reminders = m_rem; | 207 | OPimNotifyManager::Reminders reminders = m_rem; |
@@ -216,25 +217,25 @@ QString OPimNotifyManager::remindersToString() const | |||
216 | } | 217 | } |
217 | 218 | ||
218 | return str; | 219 | return str; |
219 | } | 220 | } |
220 | 221 | ||
221 | 222 | ||
222 | void OPimNotifyManager::alarmsFromString( const QString& str ) | 223 | void OPimNotifyManager::alarmsFromString( const QString& str ) |
223 | { | 224 | { |
224 | QStringList als = QStringList::split( ";", str ); | 225 | QStringList als = QStringList::split( ";", str ); |
225 | for ( QStringList::Iterator it = als.begin(); it != als.end(); ++it ) | 226 | for ( QStringList::Iterator it = als.begin(); it != als.end(); ++it ) |
226 | { | 227 | { |
227 | QStringList alarm = QStringList::split( ":", ( *it ), TRUE ); // allow empty | 228 | QStringList alarm = QStringList::split( ":", ( *it ), TRUE ); // allow empty |
228 | qWarning( "alarm: %s", alarm.join( "___" ).latin1() ); | 229 | owarn << "alarm: " << alarm.join( "___" ) << "" << oendl; |
229 | qWarning( "alarm[0]: %s %s", alarm[ 0 ].latin1(), | 230 | qWarning( "alarm[0]: %s %s", alarm[ 0 ].latin1(), |
230 | OPimDateConversion::dateTimeFromString( alarm[ 0 ] ).toString().latin1() ); | 231 | OPimDateConversion::dateTimeFromString( alarm[ 0 ] ).toString().latin1() ); |
231 | OPimAlarm al( alarm[ 2 ].toInt(), OPimDateConversion::dateTimeFromString( alarm[ 0 ] ), | 232 | OPimAlarm al( alarm[ 2 ].toInt(), OPimDateConversion::dateTimeFromString( alarm[ 0 ] ), |
232 | alarm[ 1 ].toInt() ); | 233 | alarm[ 1 ].toInt() ); |
233 | add( al ); | 234 | add( al ); |
234 | } | 235 | } |
235 | } | 236 | } |
236 | 237 | ||
237 | 238 | ||
238 | void OPimNotifyManager::remindersFromString( const QString& str ) | 239 | void OPimNotifyManager::remindersFromString( const QString& str ) |
239 | { | 240 | { |
240 | 241 | ||
diff --git a/libopie2/opiepim/core/opimrecord.cpp b/libopie2/opiepim/core/opimrecord.cpp index c783092..6546d99 100644 --- a/libopie2/opiepim/core/opimrecord.cpp +++ b/libopie2/opiepim/core/opimrecord.cpp | |||
@@ -112,25 +112,25 @@ bool OPimRecord::isEmpty() const | |||
112 | 112 | ||
113 | 113 | ||
114 | /*QString OPimRecord::crossToString()const { | 114 | /*QString OPimRecord::crossToString()const { |
115 | QString str; | 115 | QString str; |
116 | QMap<QString, QArray<int> >::ConstIterator it; | 116 | QMap<QString, QArray<int> >::ConstIterator it; |
117 | for (it = m_relations.begin(); it != m_relations.end(); ++it ) { | 117 | for (it = m_relations.begin(); it != m_relations.end(); ++it ) { |
118 | QArray<int> id = it.data(); | 118 | QArray<int> id = it.data(); |
119 | for ( uint i = 0; i < id.size(); ++i ) { | 119 | for ( uint i = 0; i < id.size(); ++i ) { |
120 | str += it.key() + "," + QString::number( i ) + ";"; | 120 | str += it.key() + "," + QString::number( i ) + ";"; |
121 | } | 121 | } |
122 | } | 122 | } |
123 | str = str.remove( str.length()-1, 1); // strip the ; | 123 | str = str.remove( str.length()-1, 1); // strip the ; |
124 | //qWarning("IDS " + str ); | 124 | //owarn << "IDS " + str << oendl; |
125 | 125 | ||
126 | return str; | 126 | return str; |
127 | }*/ | 127 | }*/ |
128 | /* if uid = 1 assign a new one */ | 128 | /* if uid = 1 assign a new one */ |
129 | void OPimRecord::setUid( int uid ) | 129 | void OPimRecord::setUid( int uid ) |
130 | { | 130 | { |
131 | if ( uid == 1 ) | 131 | if ( uid == 1 ) |
132 | uid = uidGen().generate(); | 132 | uid = uidGen().generate(); |
133 | 133 | ||
134 | Qtopia::Record::setUid( uid ); | 134 | Qtopia::Record::setUid( uid ); |
135 | }; | 135 | }; |
136 | 136 | ||
diff --git a/libopie2/opiepim/core/opimtimezone.cpp b/libopie2/opiepim/core/opimtimezone.cpp index be21b1b..fefceb5 100644 --- a/libopie2/opiepim/core/opimtimezone.cpp +++ b/libopie2/opiepim/core/opimtimezone.cpp | |||
@@ -20,24 +20,27 @@ | |||
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "opimtimezone.h" | 30 | #include "opimtimezone.h" |
31 | 31 | ||
32 | /* OPIE */ | ||
33 | #include <opie2/odebug.h> | ||
34 | |||
32 | /* STD */ | 35 | /* STD */ |
33 | #include <stdio.h> | 36 | #include <stdio.h> |
34 | #include <stdlib.h> | 37 | #include <stdlib.h> |
35 | #include <sys/types.h> | 38 | #include <sys/types.h> |
36 | 39 | ||
37 | namespace Opie | 40 | namespace Opie |
38 | { | 41 | { |
39 | 42 | ||
40 | QDateTime utcTime( time_t t ) | 43 | QDateTime utcTime( time_t t ) |
41 | { | 44 | { |
42 | tm * broken = ::gmtime( &t ); | 45 | tm * broken = ::gmtime( &t ); |
43 | QDateTime ret; | 46 | QDateTime ret; |
@@ -140,25 +143,25 @@ QDateTime OPimTimeZone::toDateTime( time_t t ) | |||
140 | { | 143 | { |
141 | return utcTime( t, m_name ); | 144 | return utcTime( t, m_name ); |
142 | } | 145 | } |
143 | 146 | ||
144 | 147 | ||
145 | /* | 148 | /* |
146 | * convert dt to utc using zone.m_name | 149 | * convert dt to utc using zone.m_name |
147 | * convert utc -> timeZoneDT using this->m_name | 150 | * convert utc -> timeZoneDT using this->m_name |
148 | */ | 151 | */ |
149 | QDateTime OPimTimeZone::toDateTime( const QDateTime& dt, const OPimTimeZone& zone ) | 152 | QDateTime OPimTimeZone::toDateTime( const QDateTime& dt, const OPimTimeZone& zone ) |
150 | { | 153 | { |
151 | time_t utc = to_Time_t( dt, zone.m_name ); | 154 | time_t utc = to_Time_t( dt, zone.m_name ); |
152 | qWarning( "%d %s", utc, zone.m_name.latin1() ); | 155 | owarn << "" << utc << " " << zone.m_name << "" << oendl; |
153 | return utcTime( utc, m_name ); | 156 | return utcTime( utc, m_name ); |
154 | } | 157 | } |
155 | 158 | ||
156 | 159 | ||
157 | time_t OPimTimeZone::fromDateTime( const QDateTime& time ) | 160 | time_t OPimTimeZone::fromDateTime( const QDateTime& time ) |
158 | { | 161 | { |
159 | return to_Time_t( time, m_name ); | 162 | return to_Time_t( time, m_name ); |
160 | } | 163 | } |
161 | 164 | ||
162 | 165 | ||
163 | time_t OPimTimeZone::fromUTCDateTime( const QDateTime& time ) | 166 | time_t OPimTimeZone::fromUTCDateTime( const QDateTime& time ) |
164 | { | 167 | { |
diff --git a/libopie2/opiepim/core/opimtodo.cpp b/libopie2/opiepim/core/opimtodo.cpp index 47433e0..27b36a6 100644 --- a/libopie2/opiepim/core/opimtodo.cpp +++ b/libopie2/opiepim/core/opimtodo.cpp | |||
@@ -26,24 +26,26 @@ | |||
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "opimtodo.h" | 30 | #include "opimtodo.h" |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <opie2/opimstate.h> | 33 | #include <opie2/opimstate.h> |
34 | #include <opie2/opimrecurrence.h> | 34 | #include <opie2/opimrecurrence.h> |
35 | #include <opie2/opimmaintainer.h> | 35 | #include <opie2/opimmaintainer.h> |
36 | #include <opie2/opimnotifymanager.h> | 36 | #include <opie2/opimnotifymanager.h> |
37 | #include <opie2/opimresolver.h> | 37 | #include <opie2/opimresolver.h> |
38 | #include <opie2/odebug.h> | ||
39 | |||
38 | #include <qpe/palmtopuidgen.h> | 40 | #include <qpe/palmtopuidgen.h> |
39 | #include <qpe/palmtoprecord.h> | 41 | #include <qpe/palmtoprecord.h> |
40 | #include <qpe/categories.h> | 42 | #include <qpe/categories.h> |
41 | #include <qpe/categoryselect.h> | 43 | #include <qpe/categoryselect.h> |
42 | #include <qpe/stringutil.h> | 44 | #include <qpe/stringutil.h> |
43 | 45 | ||
44 | /* QT */ | 46 | /* QT */ |
45 | #include <qobject.h> | 47 | #include <qobject.h> |
46 | #include <qshared.h> | 48 | #include <qshared.h> |
47 | 49 | ||
48 | namespace Opie | 50 | namespace Opie |
49 | { | 51 | { |
@@ -76,73 +78,73 @@ struct OPimTodo::OPimTodoData : public QShared | |||
76 | OPimRecurrence *recur; | 78 | OPimRecurrence *recur; |
77 | OPimMaintainer *maintainer; | 79 | OPimMaintainer *maintainer; |
78 | QDate start; | 80 | QDate start; |
79 | QDate completed; | 81 | QDate completed; |
80 | OPimNotifyManager *notifiers; | 82 | OPimNotifyManager *notifiers; |
81 | }; | 83 | }; |
82 | 84 | ||
83 | 85 | ||
84 | OPimTodo::OPimTodo( const OPimTodo &event ) | 86 | OPimTodo::OPimTodo( const OPimTodo &event ) |
85 | : OPimRecord( event ), data( event.data ) | 87 | : OPimRecord( event ), data( event.data ) |
86 | { | 88 | { |
87 | data->ref(); | 89 | data->ref(); |
88 | // qWarning("ref up"); | 90 | // owarn << "ref up" << oendl; |
89 | } | 91 | } |
90 | 92 | ||
91 | 93 | ||
92 | OPimTodo::~OPimTodo() | 94 | OPimTodo::~OPimTodo() |
93 | { | 95 | { |
94 | 96 | ||
95 | // qWarning("~OPimTodo " ); | 97 | // owarn << "~OPimTodo " << oendl; |
96 | if ( data->deref() ) | 98 | if ( data->deref() ) |
97 | { | 99 | { |
98 | // qWarning("OPimTodo::dereffing"); | 100 | // owarn << "OPimTodo::dereffing" << oendl; |
99 | delete data; | 101 | delete data; |
100 | data = 0l; | 102 | data = 0l; |
101 | } | 103 | } |
102 | } | 104 | } |
103 | 105 | ||
104 | 106 | ||
105 | OPimTodo::OPimTodo( bool completed, int priority, | 107 | OPimTodo::OPimTodo( bool completed, int priority, |
106 | const QArray<int> &category, | 108 | const QArray<int> &category, |
107 | const QString& summary, | 109 | const QString& summary, |
108 | const QString &description, | 110 | const QString &description, |
109 | ushort progress, | 111 | ushort progress, |
110 | bool hasDate, QDate date, int uid ) | 112 | bool hasDate, QDate date, int uid ) |
111 | : OPimRecord( uid ) | 113 | : OPimRecord( uid ) |
112 | { | 114 | { |
113 | // qWarning("OPimTodoData " + summary); | 115 | // owarn << "OPimTodoData " + summary << oendl; |
114 | setCategories( category ); | 116 | setCategories( category ); |
115 | 117 | ||
116 | data = new OPimTodoData; | 118 | data = new OPimTodoData; |
117 | 119 | ||
118 | data->date = date; | 120 | data->date = date; |
119 | data->isCompleted = completed; | 121 | data->isCompleted = completed; |
120 | data->hasDate = hasDate; | 122 | data->hasDate = hasDate; |
121 | data->priority = priority; | 123 | data->priority = priority; |
122 | data->sum = summary; | 124 | data->sum = summary; |
123 | data->prog = progress; | 125 | data->prog = progress; |
124 | data->desc = Qtopia::simplifyMultiLineSpace( description ); | 126 | data->desc = Qtopia::simplifyMultiLineSpace( description ); |
125 | } | 127 | } |
126 | 128 | ||
127 | 129 | ||
128 | OPimTodo::OPimTodo( bool completed, int priority, | 130 | OPimTodo::OPimTodo( bool completed, int priority, |
129 | const QStringList &category, | 131 | const QStringList &category, |
130 | const QString& summary, | 132 | const QString& summary, |
131 | const QString &description, | 133 | const QString &description, |
132 | ushort progress, | 134 | ushort progress, |
133 | bool hasDate, QDate date, int uid ) | 135 | bool hasDate, QDate date, int uid ) |
134 | : OPimRecord( uid ) | 136 | : OPimRecord( uid ) |
135 | { | 137 | { |
136 | // qWarning("OPimTodoData" + summary); | 138 | // owarn << "OPimTodoData" + summary << oendl; |
137 | setCategories( idsFromString( category.join( ";" ) ) ); | 139 | setCategories( idsFromString( category.join( ";" ) ) ); |
138 | 140 | ||
139 | data = new OPimTodoData; | 141 | data = new OPimTodoData; |
140 | 142 | ||
141 | data->date = date; | 143 | data->date = date; |
142 | data->isCompleted = completed; | 144 | data->isCompleted = completed; |
143 | data->hasDate = hasDate; | 145 | data->hasDate = hasDate; |
144 | data->priority = priority; | 146 | data->priority = priority; |
145 | data->sum = summary; | 147 | data->sum = summary; |
146 | data->prog = progress; | 148 | data->prog = progress; |
147 | data->desc = Qtopia::simplifyMultiLineSpace( description ); | 149 | data->desc = Qtopia::simplifyMultiLineSpace( description ); |
148 | } | 150 | } |
@@ -297,25 +299,25 @@ void OPimTodo::setCompleted( bool completed ) | |||
297 | } | 299 | } |
298 | 300 | ||
299 | 301 | ||
300 | void OPimTodo::setHasDueDate( bool hasDate ) | 302 | void OPimTodo::setHasDueDate( bool hasDate ) |
301 | { | 303 | { |
302 | changeOrModify(); | 304 | changeOrModify(); |
303 | data->hasDate = hasDate; | 305 | data->hasDate = hasDate; |
304 | } | 306 | } |
305 | 307 | ||
306 | 308 | ||
307 | void OPimTodo::setDescription( const QString &desc ) | 309 | void OPimTodo::setDescription( const QString &desc ) |
308 | { | 310 | { |
309 | // qWarning( "desc " + desc ); | 311 | // owarn << "desc " + desc << oendl; |
310 | changeOrModify(); | 312 | changeOrModify(); |
311 | data->desc = Qtopia::simplifyMultiLineSpace( desc ); | 313 | data->desc = Qtopia::simplifyMultiLineSpace( desc ); |
312 | } | 314 | } |
313 | 315 | ||
314 | 316 | ||
315 | void OPimTodo::setSummary( const QString& sum ) | 317 | void OPimTodo::setSummary( const QString& sum ) |
316 | { | 318 | { |
317 | changeOrModify(); | 319 | changeOrModify(); |
318 | data->sum = sum; | 320 | data->sum = sum; |
319 | } | 321 | } |
320 | 322 | ||
321 | 323 | ||
@@ -582,40 +584,40 @@ bool OPimTodo::operator==( const OPimTodo &toDoEvent ) const | |||
582 | if ( data->sum != toDoEvent.data->sum ) return false; | 584 | if ( data->sum != toDoEvent.data->sum ) return false; |
583 | if ( data->desc != toDoEvent.data->desc ) return false; | 585 | if ( data->desc != toDoEvent.data->desc ) return false; |
584 | if ( data->maintainer != toDoEvent.data->maintainer ) | 586 | if ( data->maintainer != toDoEvent.data->maintainer ) |
585 | return false; | 587 | return false; |
586 | 588 | ||
587 | return OPimRecord::operator==( toDoEvent ); | 589 | return OPimRecord::operator==( toDoEvent ); |
588 | } | 590 | } |
589 | 591 | ||
590 | 592 | ||
591 | void OPimTodo::deref() | 593 | void OPimTodo::deref() |
592 | { | 594 | { |
593 | 595 | ||
594 | // qWarning("deref in ToDoEvent"); | 596 | // owarn << "deref in ToDoEvent" << oendl; |
595 | if ( data->deref() ) | 597 | if ( data->deref() ) |
596 | { | 598 | { |
597 | // qWarning("deleting"); | 599 | // owarn << "deleting" << oendl; |
598 | delete data; | 600 | delete data; |
599 | data = 0; | 601 | data = 0; |
600 | } | 602 | } |
601 | } | 603 | } |
602 | 604 | ||
603 | 605 | ||
604 | OPimTodo &OPimTodo::operator=( const OPimTodo &item ) | 606 | OPimTodo &OPimTodo::operator=( const OPimTodo &item ) |
605 | { | 607 | { |
606 | if ( this == &item ) return * this; | 608 | if ( this == &item ) return * this; |
607 | 609 | ||
608 | OPimRecord::operator=( item ); | 610 | OPimRecord::operator=( item ); |
609 | //qWarning("operator= ref "); | 611 | //owarn << "operator= ref " << oendl; |
610 | item.data->ref(); | 612 | item.data->ref(); |
611 | deref(); | 613 | deref(); |
612 | data = item.data; | 614 | data = item.data; |
613 | 615 | ||
614 | return *this; | 616 | return *this; |
615 | } | 617 | } |
616 | 618 | ||
617 | 619 | ||
618 | QMap<int, QString> OPimTodo::toMap() const | 620 | QMap<int, QString> OPimTodo::toMap() const |
619 | { | 621 | { |
620 | QMap<int, QString> map; | 622 | QMap<int, QString> map; |
621 | 623 | ||
@@ -640,25 +642,25 @@ QMap<int, QString> OPimTodo::toMap() const | |||
640 | } | 642 | } |
641 | 643 | ||
642 | 644 | ||
643 | /** | 645 | /** |
644 | * change or modify looks at the ref count and either | 646 | * change or modify looks at the ref count and either |
645 | * creates a new QShared Object or it can modify it | 647 | * creates a new QShared Object or it can modify it |
646 | * right in place | 648 | * right in place |
647 | */ | 649 | */ |
648 | void OPimTodo::changeOrModify() | 650 | void OPimTodo::changeOrModify() |
649 | { | 651 | { |
650 | if ( data->count != 1 ) | 652 | if ( data->count != 1 ) |
651 | { | 653 | { |
652 | qWarning( "changeOrModify" ); | 654 | owarn << "changeOrModify" << oendl; |
653 | data->deref(); | 655 | data->deref(); |
654 | OPimTodoData* d2 = new OPimTodoData(); | 656 | OPimTodoData* d2 = new OPimTodoData(); |
655 | copy( data, d2 ); | 657 | copy( data, d2 ); |
656 | data = d2; | 658 | data = d2; |
657 | } | 659 | } |
658 | } | 660 | } |
659 | 661 | ||
660 | 662 | ||
661 | // WATCHOUT | 663 | // WATCHOUT |
662 | /* | 664 | /* |
663 | * if you add something to the Data struct | 665 | * if you add something to the Data struct |
664 | * be sure to copy it here | 666 | * be sure to copy it here |
diff --git a/libopie2/opiepim/core/otodoaccess.cpp b/libopie2/opiepim/core/otodoaccess.cpp index c4adbbd..26a68a0 100644 --- a/libopie2/opiepim/core/otodoaccess.cpp +++ b/libopie2/opiepim/core/otodoaccess.cpp | |||
@@ -41,25 +41,25 @@ OPimTodoAccess::OPimTodoAccess( OPimTodoAccessBackend* end, enum Access ) | |||
41 | : QObject(), OPimAccessTemplate<OPimTodo>( end ), m_todoBackEnd( end ) | 41 | : QObject(), OPimAccessTemplate<OPimTodo>( end ), m_todoBackEnd( end ) |
42 | { | 42 | { |
43 | // if (end == 0l ) | 43 | // if (end == 0l ) |
44 | // m_todoBackEnd = new OPimTodoAccessBackendSQL( QString::null); | 44 | // m_todoBackEnd = new OPimTodoAccessBackendSQL( QString::null); |
45 | 45 | ||
46 | // Zecke: Du musst hier noch fr das XML-Backend einen Appnamen bergeben ! | 46 | // Zecke: Du musst hier noch fr das XML-Backend einen Appnamen bergeben ! |
47 | if (end == 0l ) | 47 | if (end == 0l ) |
48 | m_todoBackEnd = OBackendFactory<OPimTodoAccessBackend>::defaultBackend (OPimGlobal::TODOLIST, QString::null); | 48 | m_todoBackEnd = OBackendFactory<OPimTodoAccessBackend>::defaultBackend (OPimGlobal::TODOLIST, QString::null); |
49 | 49 | ||
50 | setBackEnd( m_todoBackEnd ); | 50 | setBackEnd( m_todoBackEnd ); |
51 | } | 51 | } |
52 | OPimTodoAccess::~OPimTodoAccess() { | 52 | OPimTodoAccess::~OPimTodoAccess() { |
53 | // qWarning("~OPimTodoAccess"); | 53 | // owarn << "~OPimTodoAccess" << oendl; |
54 | } | 54 | } |
55 | void OPimTodoAccess::mergeWith( const QValueList<OPimTodo>& list ) { | 55 | void OPimTodoAccess::mergeWith( const QValueList<OPimTodo>& list ) { |
56 | QValueList<OPimTodo>::ConstIterator it; | 56 | QValueList<OPimTodo>::ConstIterator it; |
57 | for ( it = list.begin(); it != list.end(); ++it ) { | 57 | for ( it = list.begin(); it != list.end(); ++it ) { |
58 | replace( (*it) ); | 58 | replace( (*it) ); |
59 | } | 59 | } |
60 | } | 60 | } |
61 | OPimTodoAccess::List OPimTodoAccess::effectiveToDos( const QDate& start, | 61 | OPimTodoAccess::List OPimTodoAccess::effectiveToDos( const QDate& start, |
62 | const QDate& end, | 62 | const QDate& end, |
63 | bool includeNoDates ) { | 63 | bool includeNoDates ) { |
64 | QArray<int> ints = m_todoBackEnd->effectiveToDos( start, end, includeNoDates ); | 64 | QArray<int> ints = m_todoBackEnd->effectiveToDos( start, end, includeNoDates ); |
65 | 65 | ||