summaryrefslogtreecommitdiff
authoreilers <eilers>2004-01-16 13:37:03 (UTC)
committer eilers <eilers>2004-01-16 13:37:03 (UTC)
commit839775ea257f2c9be752a77c41a09416469df591 (patch) (unidiff)
treed856530aad005f66adae3634bd384d3d02bb6c95
parentf7936b488e81f8706c4ea900979f2ea70734cfe9 (diff)
downloadopie-839775ea257f2c9be752a77c41a09416469df591.zip
opie-839775ea257f2c9be752a77c41a09416469df591.tar.gz
opie-839775ea257f2c9be752a77c41a09416469df591.tar.bz2
Some changes to handle alarms for datebook-sql db..
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/opimnotifymanager.cpp16
-rw-r--r--libopie/pim/opimnotifymanager.h15
-rw-r--r--libopie/pim/orecur.h5
-rw-r--r--libopie2/opiepim/core/opimnotifymanager.cpp16
-rw-r--r--libopie2/opiepim/core/opimnotifymanager.h15
-rw-r--r--libopie2/opiepim/core/orecur.h5
6 files changed, 72 insertions, 0 deletions
diff --git a/libopie/pim/opimnotifymanager.cpp b/libopie/pim/opimnotifymanager.cpp
index 53ad4c3..d6f0ead 100644
--- a/libopie/pim/opimnotifymanager.cpp
+++ b/libopie/pim/opimnotifymanager.cpp
@@ -32,32 +32,48 @@ void OPimNotifyManager::replace( const OPimNotify& noti) {
32 if ( noti.type() == QString::fromLatin1("OPimReminder") ) { 32 if ( noti.type() == QString::fromLatin1("OPimReminder") ) {
33 const OPimReminder& rem = static_cast<const OPimReminder&>(noti); 33 const OPimReminder& rem = static_cast<const OPimReminder&>(noti);
34 m_rem.remove( rem ); 34 m_rem.remove( rem );
35 m_rem.append( rem ); 35 m_rem.append( rem );
36 }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { 36 }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) {
37 const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); 37 const OPimAlarm& al = static_cast<const OPimAlarm&>(noti);
38 m_al.remove( al ); 38 m_al.remove( al );
39 m_al.append( al ); 39 m_al.append( al );
40 } 40 }
41} 41}
42OPimNotifyManager::Reminders OPimNotifyManager::reminders()const { 42OPimNotifyManager::Reminders OPimNotifyManager::reminders()const {
43 return m_rem; 43 return m_rem;
44} 44}
45OPimNotifyManager::Alarms OPimNotifyManager::alarms()const { 45OPimNotifyManager::Alarms OPimNotifyManager::alarms()const {
46 return m_al; 46 return m_al;
47} 47}
48OPimAlarm OPimNotifyManager::alarmAtDateTime( const QDateTime& when, bool& found ) const {
49 Alarms::ConstIterator it;
50 found = true;
51
52 for ( it = m_al.begin(); it != m_al.end(); ++it ){
53 if ( (*it).dateTime() == when )
54 return (*it);
55 }
56
57 // Fall through if nothing could be found
58 found = false;
59 OPimAlarm empty;
60 return empty;
61}
62
63
48void OPimNotifyManager::setAlarms( const Alarms& al) { 64void OPimNotifyManager::setAlarms( const Alarms& al) {
49 m_al = al; 65 m_al = al;
50} 66}
51void OPimNotifyManager::setReminders( const Reminders& rem) { 67void OPimNotifyManager::setReminders( const Reminders& rem) {
52 m_rem = rem; 68 m_rem = rem;
53} 69}
54/* FIXME!!! */ 70/* FIXME!!! */
55/** 71/**
56 * The idea is to check if the provider for our service 72 * The idea is to check if the provider for our service
57 * is online 73 * is online
58 * if it is we will use QCOP 74 * if it is we will use QCOP
59 * if not the Factory to get the backend... 75 * if not the Factory to get the backend...
60 * Qtopia1.6 services would be kewl to have here.... 76 * Qtopia1.6 services would be kewl to have here....
61 */ 77 */
62void OPimNotifyManager::registerNotify( const OPimNotify& ) { 78void OPimNotifyManager::registerNotify( const OPimNotify& ) {
63 79
diff --git a/libopie/pim/opimnotifymanager.h b/libopie/pim/opimnotifymanager.h
index 48410e7..f3c22f9 100644
--- a/libopie/pim/opimnotifymanager.h
+++ b/libopie/pim/opimnotifymanager.h
@@ -9,34 +9,49 @@
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
26 /**
27 * Return
28 */
25 Alarms alarms()const; 29 Alarms alarms()const;
26 30
31 /**
32 * Return alarm at DateTime "when". If more than one is registered at this
33 * DateTime, the first one is returned.
34 * If none was found, an empty Alarm is returned.
35 * @param when The date and time of the returned alarm
36 * @param found Returns true if anything was found.
37 * @return Returns the found alarm at given DateTime. It is empty if found is false
38 * (nothing could be found at given date and time)
39 */
40 OPimAlarm alarmAtDateTime( const QDateTime& when, bool& found ) const;
41
27 void setAlarms( const Alarms& ); 42 void setAlarms( const Alarms& );
28 void setReminders( const Reminders& ); 43 void setReminders( const Reminders& );
29 44
30 /* register is a Ansi C keyword... */ 45 /* register is a Ansi C keyword... */
31 /** 46 /**
32 * This function will register the Notify to the Alarm Server 47 * This function will register the Notify to the Alarm Server
33 * or datebook depending on the type of the notify 48 * or datebook depending on the type of the notify
34 */ 49 */
35 void registerNotify( const OPimNotify& ); 50 void registerNotify( const OPimNotify& );
36 51
37 /** 52 /**
38 * this will do the opposite.. 53 * this will do the opposite..
39 */ 54 */
40 void deregister( const OPimNotify& ); 55 void deregister( const OPimNotify& );
41 56
42 bool isEmpty()const; 57 bool isEmpty()const;
diff --git a/libopie/pim/orecur.h b/libopie/pim/orecur.h
index 7750c12..d7ecd90 100644
--- a/libopie/pim/orecur.h
+++ b/libopie/pim/orecur.h
@@ -1,29 +1,34 @@
1/* 1/*
2 * GPL from TT 2 * GPL from TT
3 */ 3 */
4 4
5#ifndef OPIE_RECUR_H 5#ifndef OPIE_RECUR_H
6#define OPIE_RECUR_H 6#define OPIE_RECUR_H
7 7
8#include <sys/types.h> 8#include <sys/types.h>
9 9
10#include <qdatetime.h> 10#include <qdatetime.h>
11#include <qvaluelist.h> 11#include <qvaluelist.h>
12#include <qmap.h> 12#include <qmap.h>
13 13
14
15/**
16 * Class to handle Recurrencies..
17 */
18
14class ORecur { 19class ORecur {
15public: 20public:
16 typedef QValueList<QDate> ExceptionList; 21 typedef QValueList<QDate> ExceptionList;
17 enum RepeatType{ NoRepeat = -1, Daily, Weekly, MonthlyDay, 22 enum RepeatType{ NoRepeat = -1, Daily, Weekly, MonthlyDay,
18 MonthlyDate, Yearly }; 23 MonthlyDate, Yearly };
19 enum Days { MON = 0x01, TUE = 0x02, WED = 0x04, THU = 0x08, 24 enum Days { MON = 0x01, TUE = 0x02, WED = 0x04, THU = 0x08,
20 FRI = 0x10, SAT = 0x20, SUN = 0x40 }; 25 FRI = 0x10, SAT = 0x20, SUN = 0x40 };
21 enum Fields{ RType = 0, RWeekdays, RPosition, RFreq, RHasEndDate, 26 enum Fields{ RType = 0, RWeekdays, RPosition, RFreq, RHasEndDate,
22 EndDate, Created, Exceptions }; 27 EndDate, Created, Exceptions };
23 28
24 ORecur(); 29 ORecur();
25 ORecur( const QMap<int, QString>& map ); 30 ORecur( const QMap<int, QString>& map );
26 ORecur( const ORecur& ); 31 ORecur( const ORecur& );
27 ~ORecur(); 32 ~ORecur();
28 33
29 ORecur &operator=( const ORecur& ); 34 ORecur &operator=( const ORecur& );
diff --git a/libopie2/opiepim/core/opimnotifymanager.cpp b/libopie2/opiepim/core/opimnotifymanager.cpp
index 53ad4c3..d6f0ead 100644
--- a/libopie2/opiepim/core/opimnotifymanager.cpp
+++ b/libopie2/opiepim/core/opimnotifymanager.cpp
@@ -32,32 +32,48 @@ void OPimNotifyManager::replace( const OPimNotify& noti) {
32 if ( noti.type() == QString::fromLatin1("OPimReminder") ) { 32 if ( noti.type() == QString::fromLatin1("OPimReminder") ) {
33 const OPimReminder& rem = static_cast<const OPimReminder&>(noti); 33 const OPimReminder& rem = static_cast<const OPimReminder&>(noti);
34 m_rem.remove( rem ); 34 m_rem.remove( rem );
35 m_rem.append( rem ); 35 m_rem.append( rem );
36 }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { 36 }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) {
37 const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); 37 const OPimAlarm& al = static_cast<const OPimAlarm&>(noti);
38 m_al.remove( al ); 38 m_al.remove( al );
39 m_al.append( al ); 39 m_al.append( al );
40 } 40 }
41} 41}
42OPimNotifyManager::Reminders OPimNotifyManager::reminders()const { 42OPimNotifyManager::Reminders OPimNotifyManager::reminders()const {
43 return m_rem; 43 return m_rem;
44} 44}
45OPimNotifyManager::Alarms OPimNotifyManager::alarms()const { 45OPimNotifyManager::Alarms OPimNotifyManager::alarms()const {
46 return m_al; 46 return m_al;
47} 47}
48OPimAlarm OPimNotifyManager::alarmAtDateTime( const QDateTime& when, bool& found ) const {
49 Alarms::ConstIterator it;
50 found = true;
51
52 for ( it = m_al.begin(); it != m_al.end(); ++it ){
53 if ( (*it).dateTime() == when )
54 return (*it);
55 }
56
57 // Fall through if nothing could be found
58 found = false;
59 OPimAlarm empty;
60 return empty;
61}
62
63
48void OPimNotifyManager::setAlarms( const Alarms& al) { 64void OPimNotifyManager::setAlarms( const Alarms& al) {
49 m_al = al; 65 m_al = al;
50} 66}
51void OPimNotifyManager::setReminders( const Reminders& rem) { 67void OPimNotifyManager::setReminders( const Reminders& rem) {
52 m_rem = rem; 68 m_rem = rem;
53} 69}
54/* FIXME!!! */ 70/* FIXME!!! */
55/** 71/**
56 * The idea is to check if the provider for our service 72 * The idea is to check if the provider for our service
57 * is online 73 * is online
58 * if it is we will use QCOP 74 * if it is we will use QCOP
59 * if not the Factory to get the backend... 75 * if not the Factory to get the backend...
60 * Qtopia1.6 services would be kewl to have here.... 76 * Qtopia1.6 services would be kewl to have here....
61 */ 77 */
62void OPimNotifyManager::registerNotify( const OPimNotify& ) { 78void OPimNotifyManager::registerNotify( const OPimNotify& ) {
63 79
diff --git a/libopie2/opiepim/core/opimnotifymanager.h b/libopie2/opiepim/core/opimnotifymanager.h
index 48410e7..f3c22f9 100644
--- a/libopie2/opiepim/core/opimnotifymanager.h
+++ b/libopie2/opiepim/core/opimnotifymanager.h
@@ -9,34 +9,49 @@
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
26 /**
27 * Return
28 */
25 Alarms alarms()const; 29 Alarms alarms()const;
26 30
31 /**
32 * Return alarm at DateTime "when". If more than one is registered at this
33 * DateTime, the first one is returned.
34 * If none was found, an empty Alarm is returned.
35 * @param when The date and time of the returned alarm
36 * @param found Returns true if anything was found.
37 * @return Returns the found alarm at given DateTime. It is empty if found is false
38 * (nothing could be found at given date and time)
39 */
40 OPimAlarm alarmAtDateTime( const QDateTime& when, bool& found ) const;
41
27 void setAlarms( const Alarms& ); 42 void setAlarms( const Alarms& );
28 void setReminders( const Reminders& ); 43 void setReminders( const Reminders& );
29 44
30 /* register is a Ansi C keyword... */ 45 /* register is a Ansi C keyword... */
31 /** 46 /**
32 * This function will register the Notify to the Alarm Server 47 * This function will register the Notify to the Alarm Server
33 * or datebook depending on the type of the notify 48 * or datebook depending on the type of the notify
34 */ 49 */
35 void registerNotify( const OPimNotify& ); 50 void registerNotify( const OPimNotify& );
36 51
37 /** 52 /**
38 * this will do the opposite.. 53 * this will do the opposite..
39 */ 54 */
40 void deregister( const OPimNotify& ); 55 void deregister( const OPimNotify& );
41 56
42 bool isEmpty()const; 57 bool isEmpty()const;
diff --git a/libopie2/opiepim/core/orecur.h b/libopie2/opiepim/core/orecur.h
index 7750c12..d7ecd90 100644
--- a/libopie2/opiepim/core/orecur.h
+++ b/libopie2/opiepim/core/orecur.h
@@ -1,29 +1,34 @@
1/* 1/*
2 * GPL from TT 2 * GPL from TT
3 */ 3 */
4 4
5#ifndef OPIE_RECUR_H 5#ifndef OPIE_RECUR_H
6#define OPIE_RECUR_H 6#define OPIE_RECUR_H
7 7
8#include <sys/types.h> 8#include <sys/types.h>
9 9
10#include <qdatetime.h> 10#include <qdatetime.h>
11#include <qvaluelist.h> 11#include <qvaluelist.h>
12#include <qmap.h> 12#include <qmap.h>
13 13
14
15/**
16 * Class to handle Recurrencies..
17 */
18
14class ORecur { 19class ORecur {
15public: 20public:
16 typedef QValueList<QDate> ExceptionList; 21 typedef QValueList<QDate> ExceptionList;
17 enum RepeatType{ NoRepeat = -1, Daily, Weekly, MonthlyDay, 22 enum RepeatType{ NoRepeat = -1, Daily, Weekly, MonthlyDay,
18 MonthlyDate, Yearly }; 23 MonthlyDate, Yearly };
19 enum Days { MON = 0x01, TUE = 0x02, WED = 0x04, THU = 0x08, 24 enum Days { MON = 0x01, TUE = 0x02, WED = 0x04, THU = 0x08,
20 FRI = 0x10, SAT = 0x20, SUN = 0x40 }; 25 FRI = 0x10, SAT = 0x20, SUN = 0x40 };
21 enum Fields{ RType = 0, RWeekdays, RPosition, RFreq, RHasEndDate, 26 enum Fields{ RType = 0, RWeekdays, RPosition, RFreq, RHasEndDate,
22 EndDate, Created, Exceptions }; 27 EndDate, Created, Exceptions };
23 28
24 ORecur(); 29 ORecur();
25 ORecur( const QMap<int, QString>& map ); 30 ORecur( const QMap<int, QString>& map );
26 ORecur( const ORecur& ); 31 ORecur( const ORecur& );
27 ~ORecur(); 32 ~ORecur();
28 33
29 ORecur &operator=( const ORecur& ); 34 ORecur &operator=( const ORecur& );