summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core
authorzecke <zecke>2003-05-07 17:49:07 (UTC)
committer zecke <zecke>2003-05-07 17:49:07 (UTC)
commitc13ada0f5e418b25b177e132ff2e1dfe7821577f (patch) (unidiff)
tree40e8d6cc67a1de638ef3c278fd827ba0cbea5b76 /libopie2/opiepim/core
parentac895871f93dce9734189daf9cb95dbbda605096 (diff)
downloadopie-c13ada0f5e418b25b177e132ff2e1dfe7821577f.zip
opie-c13ada0f5e418b25b177e132ff2e1dfe7821577f.tar.gz
opie-c13ada0f5e418b25b177e132ff2e1dfe7821577f.tar.bz2
implement loading of Recurrence
Diffstat (limited to 'libopie2/opiepim/core') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimnotifymanager.cpp3
-rw-r--r--libopie2/opiepim/core/opimnotifymanager.h3
-rw-r--r--libopie2/opiepim/core/orecur.cpp2
3 files changed, 7 insertions, 1 deletions
diff --git a/libopie2/opiepim/core/opimnotifymanager.cpp b/libopie2/opiepim/core/opimnotifymanager.cpp
index be4a1c2..49af757 100644
--- a/libopie2/opiepim/core/opimnotifymanager.cpp
+++ b/libopie2/opiepim/core/opimnotifymanager.cpp
@@ -22,48 +22,51 @@ void OPimNotifyManager::remove( const OPimNotify& noti) {
22 }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { 22 }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) {
23 const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); 23 const OPimAlarm& al = static_cast<const OPimAlarm&>(noti);
24 m_al.remove( al ); 24 m_al.remove( al );
25 } 25 }
26} 26}
27void OPimNotifyManager::replace( const OPimNotify& noti) { 27void OPimNotifyManager::replace( const OPimNotify& noti) {
28 if ( noti.type() == QString::fromLatin1("OPimReminder") ) { 28 if ( noti.type() == QString::fromLatin1("OPimReminder") ) {
29 const OPimReminder& rem = static_cast<const OPimReminder&>(noti); 29 const OPimReminder& rem = static_cast<const OPimReminder&>(noti);
30 m_rem.remove( rem ); 30 m_rem.remove( rem );
31 m_rem.append( rem ); 31 m_rem.append( rem );
32 }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { 32 }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) {
33 const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); 33 const OPimAlarm& al = static_cast<const OPimAlarm&>(noti);
34 m_al.remove( al ); 34 m_al.remove( al );
35 m_al.append( al ); 35 m_al.append( al );
36 } 36 }
37} 37}
38OPimNotifyManager::Reminders OPimNotifyManager::reminders()const { 38OPimNotifyManager::Reminders OPimNotifyManager::reminders()const {
39 return m_rem; 39 return m_rem;
40} 40}
41OPimNotifyManager::Alarms OPimNotifyManager::alarms()const { 41OPimNotifyManager::Alarms OPimNotifyManager::alarms()const {
42 return m_al; 42 return m_al;
43} 43}
44void OPimNotifyManager::setAlarms( const Alarms& al) { 44void OPimNotifyManager::setAlarms( const Alarms& al) {
45 m_al = al; 45 m_al = al;
46} 46}
47void OPimNotifyManager::setReminders( const Reminders& rem) { 47void OPimNotifyManager::setReminders( const Reminders& rem) {
48 m_rem = rem; 48 m_rem = rem;
49} 49}
50/* FIXME!!! */ 50/* FIXME!!! */
51/** 51/**
52 * The idea is to check if the provider for our service 52 * The idea is to check if the provider for our service
53 * is online 53 * is online
54 * if it is we will use QCOP 54 * if it is we will use QCOP
55 * if not the Factory to get the backend... 55 * if not the Factory to get the backend...
56 * Qtopia1.6 services would be kewl to have here.... 56 * Qtopia1.6 services would be kewl to have here....
57 */ 57 */
58void OPimNotifyManager::registerNotify( const OPimNotify& ) { 58void OPimNotifyManager::registerNotify( const OPimNotify& ) {
59 59
60} 60}
61/* FIXME!!! */ 61/* FIXME!!! */
62/** 62/**
63 * same as above... 63 * same as above...
64 * Also implement Url model 64 * Also implement Url model
65 * have a MainWindow.... 65 * have a MainWindow....
66 */ 66 */
67void OPimNotifyManager::deregister( const OPimNotify& ) { 67void OPimNotifyManager::deregister( const OPimNotify& ) {
68 68
69} 69}
70bool OPimNotifyManager::isEmpty()const {
71 return ( m_rem.isEmpty() && m_al.isEmpty() );
72}
diff --git a/libopie2/opiepim/core/opimnotifymanager.h b/libopie2/opiepim/core/opimnotifymanager.h
index 0eebc9b..0ac30a1 100644
--- a/libopie2/opiepim/core/opimnotifymanager.h
+++ b/libopie2/opiepim/core/opimnotifymanager.h
@@ -1,51 +1,54 @@
1#ifndef OPIE_PIM_NOTIFY_MANAGER_H 1#ifndef OPIE_PIM_NOTIFY_MANAGER_H
2#define OPIE_PIM_NOTIFY_MANAGER_H 2#define OPIE_PIM_NOTIFY_MANAGER_H
3 3
4#include <qvaluelist.h> 4#include <qvaluelist.h>
5 5
6#include <opie/opimnotify.h> 6#include <opie/opimnotify.h>
7 7
8/** 8/**
9 * The notify manager keeps track of the Notifiers.... 9 * The notify manager keeps track of the Notifiers....
10 */ 10 */
11class OPimNotifyManager { 11class OPimNotifyManager {
12public: 12public:
13 typedef QValueList<OPimReminder> Reminders; 13 typedef QValueList<OPimReminder> Reminders;
14 typedef QValueList<OPimAlarm> Alarms; 14 typedef QValueList<OPimAlarm> Alarms;
15 OPimNotifyManager( const Reminders& rems = Reminders(), const Alarms& alarms = Alarms() ); 15 OPimNotifyManager( const Reminders& rems = Reminders(), const Alarms& alarms = Alarms() );
16 ~OPimNotifyManager(); 16 ~OPimNotifyManager();
17 17
18 /* we will cast it for you ;) */ 18 /* we will cast it for you ;) */
19 void add( const OPimNotify& ); 19 void add( const OPimNotify& );
20 void remove( const OPimNotify& ); 20 void remove( const OPimNotify& );
21 /* replaces all with this one! */ 21 /* replaces all with this one! */
22 void replace( const OPimNotify& ); 22 void replace( const OPimNotify& );
23 23
24 Reminders reminders()const; 24 Reminders reminders()const;
25 Alarms alarms()const; 25 Alarms alarms()const;
26 26
27 void setAlarms( const Alarms& ); 27 void setAlarms( const Alarms& );
28 void setReminders( const Reminders& ); 28 void setReminders( const Reminders& );
29 29
30 /* register is a Ansi C keyword... */ 30 /* register is a Ansi C keyword... */
31 /** 31 /**
32 * This function will register the Notify to the Alarm Server 32 * This function will register the Notify to the Alarm Server
33 * or datebook depending on the type of the notify 33 * or datebook depending on the type of the notify
34 */ 34 */
35 void registerNotify( const OPimNotify& ); 35 void registerNotify( const OPimNotify& );
36 36
37 /** 37 /**
38 * this will do the opposite.. 38 * this will do the opposite..
39 */ 39 */
40 void deregister( const OPimNotify& ); 40 void deregister( const OPimNotify& );
41 41
42
43 bool isEmpty()const;
44
42private: 45private:
43 Reminders m_rem; 46 Reminders m_rem;
44 Alarms m_al; 47 Alarms m_al;
45 48
46 class Private; 49 class Private;
47 Private *d; 50 Private *d;
48 51
49}; 52};
50 53
51#endif 54#endif
diff --git a/libopie2/opiepim/core/orecur.cpp b/libopie2/opiepim/core/orecur.cpp
index e3b45b4..eae1fdc 100644
--- a/libopie2/opiepim/core/orecur.cpp
+++ b/libopie2/opiepim/core/orecur.cpp
@@ -459,52 +459,52 @@ QString ORecur::toString()const {
459 459
460 buf += " rtype=\""; 460 buf += " rtype=\"";
461 switch ( data->type ) { 461 switch ( data->type ) {
462 case ORecur::Daily: 462 case ORecur::Daily:
463 buf += "Daily"; 463 buf += "Daily";
464 break; 464 break;
465 case ORecur::Weekly: 465 case ORecur::Weekly:
466 buf += "Weekly"; 466 buf += "Weekly";
467 break; 467 break;
468 case ORecur::MonthlyDay: 468 case ORecur::MonthlyDay:
469 buf += "MonthlyDay"; 469 buf += "MonthlyDay";
470 break; 470 break;
471 case ORecur::MonthlyDate: 471 case ORecur::MonthlyDate:
472 buf += "MonthlyDate"; 472 buf += "MonthlyDate";
473 break; 473 break;
474 case ORecur::Yearly: 474 case ORecur::Yearly:
475 buf += "Yearly"; 475 buf += "Yearly";
476 break; 476 break;
477 default: 477 default:
478 buf += "NoRepeat"; 478 buf += "NoRepeat";
479 break; 479 break;
480 } 480 }
481 buf += "\""; 481 buf += "\"";
482 if (data->days > 0 ) 482 if (data->days > 0 )
483 buf += " rweekdays=\"" + QString::number( static_cast<int>( data->days ) ) + "\""; 483 buf += " rweekdays=\"" + QString::number( static_cast<int>( data->days ) ) + "\"";
484 if ( data->pos != 0 ) 484 if ( data->pos != 0 )
485 buf += " rposition=\"" + QString::number(data->pos ) + "\""; 485 buf += " rposition=\"" + QString::number(data->pos ) + "\"";
486 486
487 buf += " rfreq=\"" + QString::number( data->freq ) + "\""; 487 buf += " rfreq=\"" + QString::number( data->freq ) + "\"";
488 buf += " rhasenddate=\"" + QString::number( static_cast<int>( data->hasEnd ) ) + "\""; 488 buf += " rhasenddate=\"" + QString::number( static_cast<int>( data->hasEnd ) ) + "\"";
489 if ( data->hasEnd ) 489 if ( data->hasEnd )
490 buf += " enddt=\"" 490 buf += " enddt=\""
491 + QString::number( OTimeZone::utc().fromUTCDateTime( QDateTime( data->end, QTime(12,0,0) ) ) ) 491 + QString::number( OTimeZone::utc().fromUTCDateTime( QDateTime( data->end, QTime(12,0,0) ) ) )
492 + "\""; 492 + "\"";
493 buf += " created=\"" + QString::number( OTimeZone::utc().fromUTCDateTime( data->create ) ) + "\""; 493 buf += " created=\"" + QString::number( OTimeZone::utc().fromUTCDateTime( data->create ) ) + "\"";
494 494
495 if ( data->list.isEmpty() ) return buf; 495 if ( data->list.isEmpty() ) return buf;
496 // save exceptions list here!! 496 // save exceptions list here!!
497 ExceptionList::ConstIterator it; 497 ExceptionList::ConstIterator it;
498 ExceptionList list = data->list; 498 ExceptionList list = data->list;
499 buf += " exceptions=\""; 499 buf += " exceptions=\"";
500 QDate date; 500 QDate date;
501 for ( it = list.begin(); it != list.end(); ++it ) { 501 for ( it = list.begin(); it != list.end(); ++it ) {
502 date = (*it); 502 date = (*it);
503 if ( it != list.begin() ) buf += " "; 503 if ( it != list.begin() ) buf += " ";
504 504
505 buf += QCString().sprintf("%04d%02d%02d", date.year(), date.month(), date.day() ); 505 buf += QCString().sprintf("%04d%02d%02d", date.year(), date.month(), date.day() );
506 } 506 }
507 buf += "\""; 507 buf += "\" ";
508 508
509 return buf; 509 return buf;
510} 510}