-rw-r--r-- | libopie/pim/opimnotifymanager.cpp | 16 | ||||
-rw-r--r-- | libopie/pim/opimnotifymanager.h | 15 | ||||
-rw-r--r-- | libopie/pim/orecur.h | 5 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimnotifymanager.cpp | 16 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimnotifymanager.h | 15 | ||||
-rw-r--r-- | libopie2/opiepim/core/orecur.h | 5 |
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 | |||
@@ -1,146 +1,162 @@ | |||
1 | #include "opimnotifymanager.h" | 1 | #include "opimnotifymanager.h" |
2 | 2 | ||
3 | #include "oconversion.h" | 3 | #include "oconversion.h" |
4 | 4 | ||
5 | #include <qstringlist.h> | 5 | #include <qstringlist.h> |
6 | 6 | ||
7 | OPimNotifyManager::OPimNotifyManager( const Reminders& rem, const Alarms& al) | 7 | OPimNotifyManager::OPimNotifyManager( const Reminders& rem, const Alarms& al) |
8 | : m_rem( rem ), m_al( al ) | 8 | : m_rem( rem ), m_al( al ) |
9 | {} | 9 | {} |
10 | OPimNotifyManager::~OPimNotifyManager() { | 10 | OPimNotifyManager::~OPimNotifyManager() { |
11 | } | 11 | } |
12 | /* use static_cast and type instead of dynamic... */ | 12 | /* use static_cast and type instead of dynamic... */ |
13 | void OPimNotifyManager::add( const OPimNotify& noti) { | 13 | void OPimNotifyManager::add( const OPimNotify& noti) { |
14 | if ( noti.type() == QString::fromLatin1("OPimReminder") ) { | 14 | if ( noti.type() == QString::fromLatin1("OPimReminder") ) { |
15 | const OPimReminder& rem = static_cast<const OPimReminder&>(noti); | 15 | const OPimReminder& rem = static_cast<const OPimReminder&>(noti); |
16 | m_rem.append( rem ); | 16 | m_rem.append( rem ); |
17 | }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { | 17 | }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { |
18 | const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); | 18 | const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); |
19 | m_al.append( al ); | 19 | m_al.append( al ); |
20 | } | 20 | } |
21 | } | 21 | } |
22 | void OPimNotifyManager::remove( const OPimNotify& noti) { | 22 | void OPimNotifyManager::remove( const OPimNotify& noti) { |
23 | if ( noti.type() == QString::fromLatin1("OPimReminder") ) { | 23 | if ( noti.type() == QString::fromLatin1("OPimReminder") ) { |
24 | const OPimReminder& rem = static_cast<const OPimReminder&>(noti); | 24 | const OPimReminder& rem = static_cast<const OPimReminder&>(noti); |
25 | m_rem.remove( rem ); | 25 | m_rem.remove( rem ); |
26 | }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { | 26 | }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { |
27 | const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); | 27 | const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); |
28 | m_al.remove( al ); | 28 | m_al.remove( al ); |
29 | } | 29 | } |
30 | } | 30 | } |
31 | void OPimNotifyManager::replace( const OPimNotify& noti) { | 31 | 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 | } |
42 | OPimNotifyManager::Reminders OPimNotifyManager::reminders()const { | 42 | OPimNotifyManager::Reminders OPimNotifyManager::reminders()const { |
43 | return m_rem; | 43 | return m_rem; |
44 | } | 44 | } |
45 | OPimNotifyManager::Alarms OPimNotifyManager::alarms()const { | 45 | OPimNotifyManager::Alarms OPimNotifyManager::alarms()const { |
46 | return m_al; | 46 | return m_al; |
47 | } | 47 | } |
48 | OPimAlarm 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 | |||
48 | void OPimNotifyManager::setAlarms( const Alarms& al) { | 64 | void OPimNotifyManager::setAlarms( const Alarms& al) { |
49 | m_al = al; | 65 | m_al = al; |
50 | } | 66 | } |
51 | void OPimNotifyManager::setReminders( const Reminders& rem) { | 67 | void 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 | */ |
62 | void OPimNotifyManager::registerNotify( const OPimNotify& ) { | 78 | void OPimNotifyManager::registerNotify( const OPimNotify& ) { |
63 | 79 | ||
64 | } | 80 | } |
65 | /* FIXME!!! */ | 81 | /* FIXME!!! */ |
66 | /** | 82 | /** |
67 | * same as above... | 83 | * same as above... |
68 | * Also implement Url model | 84 | * Also implement Url model |
69 | * have a MainWindow.... | 85 | * have a MainWindow.... |
70 | */ | 86 | */ |
71 | void OPimNotifyManager::deregister( const OPimNotify& ) { | 87 | void OPimNotifyManager::deregister( const OPimNotify& ) { |
72 | 88 | ||
73 | } | 89 | } |
74 | 90 | ||
75 | bool OPimNotifyManager::isEmpty()const { | 91 | bool OPimNotifyManager::isEmpty()const { |
76 | qWarning("is Empty called on OPimNotifyManager %d %d", m_rem.count(), m_al.count() ); | 92 | qWarning("is Empty called on OPimNotifyManager %d %d", m_rem.count(), m_al.count() ); |
77 | if ( m_rem.isEmpty() && m_al.isEmpty() ) return true; | 93 | if ( m_rem.isEmpty() && m_al.isEmpty() ) return true; |
78 | else return false; | 94 | else return false; |
79 | } | 95 | } |
80 | 96 | ||
81 | // Taken from otodoaccessxml.. | 97 | // Taken from otodoaccessxml.. |
82 | QString OPimNotifyManager::alarmsToString() const | 98 | QString OPimNotifyManager::alarmsToString() const |
83 | { | 99 | { |
84 | QString str; | 100 | QString str; |
85 | 101 | ||
86 | OPimNotifyManager::Alarms alarms = m_al; | 102 | OPimNotifyManager::Alarms alarms = m_al; |
87 | if ( !alarms.isEmpty() ) { | 103 | if ( !alarms.isEmpty() ) { |
88 | QStringList als; | 104 | QStringList als; |
89 | OPimNotifyManager::Alarms::Iterator it = alarms.begin(); | 105 | OPimNotifyManager::Alarms::Iterator it = alarms.begin(); |
90 | for ( ; it != alarms.end(); ++it ) { | 106 | for ( ; it != alarms.end(); ++it ) { |
91 | /* only if time is valid */ | 107 | /* only if time is valid */ |
92 | if ( (*it).dateTime().isValid() ) { | 108 | if ( (*it).dateTime().isValid() ) { |
93 | als << OConversion::dateTimeToString( (*it).dateTime() ) | 109 | als << OConversion::dateTimeToString( (*it).dateTime() ) |
94 | + ":" + QString::number( (*it).duration() ) | 110 | + ":" + QString::number( (*it).duration() ) |
95 | + ":" + QString::number( (*it).sound() ) | 111 | + ":" + QString::number( (*it).sound() ) |
96 | + ":"; | 112 | + ":"; |
97 | } | 113 | } |
98 | } | 114 | } |
99 | // now write the list | 115 | // now write the list |
100 | qWarning("als: %s", als.join("____________").latin1() ); | 116 | qWarning("als: %s", als.join("____________").latin1() ); |
101 | str = als.join(";"); | 117 | str = als.join(";"); |
102 | } | 118 | } |
103 | 119 | ||
104 | return str; | 120 | return str; |
105 | } | 121 | } |
106 | QString OPimNotifyManager::remindersToString() const | 122 | QString OPimNotifyManager::remindersToString() const |
107 | { | 123 | { |
108 | QString str; | 124 | QString str; |
109 | 125 | ||
110 | OPimNotifyManager::Reminders reminders = m_rem; | 126 | OPimNotifyManager::Reminders reminders = m_rem; |
111 | if (!reminders.isEmpty() ) { | 127 | if (!reminders.isEmpty() ) { |
112 | OPimNotifyManager::Reminders::Iterator it = reminders.begin(); | 128 | OPimNotifyManager::Reminders::Iterator it = reminders.begin(); |
113 | QStringList records; | 129 | QStringList records; |
114 | for ( ; it != reminders.end(); ++it ) { | 130 | for ( ; it != reminders.end(); ++it ) { |
115 | records << QString::number( (*it).recordUid() ); | 131 | records << QString::number( (*it).recordUid() ); |
116 | } | 132 | } |
117 | str = records.join(";"); | 133 | str = records.join(";"); |
118 | } | 134 | } |
119 | 135 | ||
120 | return str; | 136 | return str; |
121 | } | 137 | } |
122 | 138 | ||
123 | void OPimNotifyManager::alarmsFromString( const QString& str ) | 139 | void OPimNotifyManager::alarmsFromString( const QString& str ) |
124 | { | 140 | { |
125 | QStringList als = QStringList::split(";", str ); | 141 | QStringList als = QStringList::split(";", str ); |
126 | for (QStringList::Iterator it = als.begin(); it != als.end(); ++it ) { | 142 | for (QStringList::Iterator it = als.begin(); it != als.end(); ++it ) { |
127 | QStringList alarm = QStringList::split(":", (*it), TRUE ); // allow empty | 143 | QStringList alarm = QStringList::split(":", (*it), TRUE ); // allow empty |
128 | qWarning("alarm: %s", alarm.join("___").latin1() ); | 144 | qWarning("alarm: %s", alarm.join("___").latin1() ); |
129 | qWarning("alarm[0]: %s %s", alarm[0].latin1(), | 145 | qWarning("alarm[0]: %s %s", alarm[0].latin1(), |
130 | OConversion::dateTimeFromString( alarm[0] ).toString().latin1() ); | 146 | OConversion::dateTimeFromString( alarm[0] ).toString().latin1() ); |
131 | OPimAlarm al( alarm[2].toInt(), OConversion::dateTimeFromString( alarm[0] ), | 147 | OPimAlarm al( alarm[2].toInt(), OConversion::dateTimeFromString( alarm[0] ), |
132 | alarm[1].toInt() ); | 148 | alarm[1].toInt() ); |
133 | add( al ); | 149 | add( al ); |
134 | } | 150 | } |
135 | } | 151 | } |
136 | 152 | ||
137 | void OPimNotifyManager::remindersFromString( const QString& str ) | 153 | void OPimNotifyManager::remindersFromString( const QString& str ) |
138 | { | 154 | { |
139 | 155 | ||
140 | QStringList rems = QStringList::split(";", str ); | 156 | QStringList rems = QStringList::split(";", str ); |
141 | for (QStringList::Iterator it = rems.begin(); it != rems.end(); ++it ) { | 157 | for (QStringList::Iterator it = rems.begin(); it != rems.end(); ++it ) { |
142 | OPimReminder rem( (*it).toInt() ); | 158 | OPimReminder rem( (*it).toInt() ); |
143 | add( rem ); | 159 | add( rem ); |
144 | } | 160 | } |
145 | 161 | ||
146 | } | 162 | } |
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 | |||
@@ -1,76 +1,91 @@ | |||
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 | */ |
11 | class OPimNotifyManager { | 11 | class OPimNotifyManager { |
12 | public: | 12 | public: |
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; |
43 | 58 | ||
44 | /** | 59 | /** |
45 | * Return all alarms as string | 60 | * Return all alarms as string |
46 | */ | 61 | */ |
47 | QString alarmsToString() const; | 62 | QString alarmsToString() const; |
48 | /** | 63 | /** |
49 | * Return all notifiers as string | 64 | * Return all notifiers as string |
50 | */ | 65 | */ |
51 | QString remindersToString() const; | 66 | QString remindersToString() const; |
52 | 67 | ||
53 | /** | 68 | /** |
54 | * Convert string to alarms | 69 | * Convert string to alarms |
55 | * @param str String created by alarmsToString() | 70 | * @param str String created by alarmsToString() |
56 | */ | 71 | */ |
57 | void alarmsFromString( const QString& str ); | 72 | void alarmsFromString( const QString& str ); |
58 | 73 | ||
59 | /** | 74 | /** |
60 | * Convert string to reminders | 75 | * Convert string to reminders |
61 | * @param str String created by remindersToString() | 76 | * @param str String created by remindersToString() |
62 | */ | 77 | */ |
63 | void remindersFromString( const QString& str ); | 78 | void remindersFromString( const QString& str ); |
64 | 79 | ||
65 | 80 | ||
66 | 81 | ||
67 | private: | 82 | private: |
68 | Reminders m_rem; | 83 | Reminders m_rem; |
69 | Alarms m_al; | 84 | Alarms m_al; |
70 | 85 | ||
71 | class Private; | 86 | class Private; |
72 | Private *d; | 87 | Private *d; |
73 | 88 | ||
74 | }; | 89 | }; |
75 | 90 | ||
76 | #endif | 91 | #endif |
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,102 +1,107 @@ | |||
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 | |||
14 | class ORecur { | 19 | class ORecur { |
15 | public: | 20 | public: |
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& ); |
30 | bool operator==(const ORecur& )const; | 35 | bool operator==(const ORecur& )const; |
31 | 36 | ||
32 | bool doesRecur()const; | 37 | bool doesRecur()const; |
33 | /* if it recurrs on that day */ | 38 | /* if it recurrs on that day */ |
34 | bool doesRecur( const QDate& ); | 39 | bool doesRecur( const QDate& ); |
35 | RepeatType type()const; | 40 | RepeatType type()const; |
36 | int frequency()const; | 41 | int frequency()const; |
37 | int position()const; | 42 | int position()const; |
38 | char days()const; | 43 | char days()const; |
39 | bool hasEndDate()const; | 44 | bool hasEndDate()const; |
40 | QDate start()const; | 45 | QDate start()const; |
41 | QDate endDate()const; | 46 | QDate endDate()const; |
42 | QDateTime createdDateTime()const; | 47 | QDateTime createdDateTime()const; |
43 | /** | 48 | /** |
44 | * starting on monday=0, sunday=6 | 49 | * starting on monday=0, sunday=6 |
45 | * for convience | 50 | * for convience |
46 | */ | 51 | */ |
47 | bool repeatOnWeekDay( int day )const; | 52 | bool repeatOnWeekDay( int day )const; |
48 | 53 | ||
49 | /** | 54 | /** |
50 | * FromWhereToStart is not included!!! | 55 | * FromWhereToStart is not included!!! |
51 | */ | 56 | */ |
52 | bool nextOcurrence( const QDate& FromWhereToStart, QDate &recurDate ); | 57 | bool nextOcurrence( const QDate& FromWhereToStart, QDate &recurDate ); |
53 | 58 | ||
54 | /** | 59 | /** |
55 | * The module this ORecur belongs to | 60 | * The module this ORecur belongs to |
56 | */ | 61 | */ |
57 | QString service()const; | 62 | QString service()const; |
58 | 63 | ||
59 | /* | 64 | /* |
60 | * reference to the exception list | 65 | * reference to the exception list |
61 | */ | 66 | */ |
62 | ExceptionList &exceptions(); | 67 | ExceptionList &exceptions(); |
63 | 68 | ||
64 | /** | 69 | /** |
65 | * the current repetition | 70 | * the current repetition |
66 | */ | 71 | */ |
67 | int repetition()const; | 72 | int repetition()const; |
68 | 73 | ||
69 | void setType( const RepeatType& ); | 74 | void setType( const RepeatType& ); |
70 | void setFrequency( int freq ); | 75 | void setFrequency( int freq ); |
71 | void setPosition( int pos ); | 76 | void setPosition( int pos ); |
72 | void setDays( char c); | 77 | void setDays( char c); |
73 | void setEndDate( const QDate& dt ); | 78 | void setEndDate( const QDate& dt ); |
74 | void setStart( const QDate& dt ); | 79 | void setStart( const QDate& dt ); |
75 | void setCreatedDateTime( const QDateTime& ); | 80 | void setCreatedDateTime( const QDateTime& ); |
76 | void setHasEndDate( bool b ); | 81 | void setHasEndDate( bool b ); |
77 | void setRepitition(int ); | 82 | void setRepitition(int ); |
78 | 83 | ||
79 | void setService( const QString& ser ); | 84 | void setService( const QString& ser ); |
80 | 85 | ||
81 | QMap<int, QString> toMap() const; | 86 | QMap<int, QString> toMap() const; |
82 | void fromMap( const QMap<int, QString>& map ); | 87 | void fromMap( const QMap<int, QString>& map ); |
83 | 88 | ||
84 | /* almost internal */ | 89 | /* almost internal */ |
85 | QString toString()const; | 90 | QString toString()const; |
86 | private: | 91 | private: |
87 | bool p_nextOccurrence( const QDate& from, QDate& next ); | 92 | bool p_nextOccurrence( const QDate& from, QDate& next ); |
88 | void deref(); | 93 | void deref(); |
89 | inline void checkOrModify(); | 94 | inline void checkOrModify(); |
90 | 95 | ||
91 | /* Converts rType to String */ | 96 | /* Converts rType to String */ |
92 | QString rTypeString() const; | 97 | QString rTypeString() const; |
93 | /* Returns a map to convert Stringname for RType to RepeatType */ | 98 | /* Returns a map to convert Stringname for RType to RepeatType */ |
94 | QMap<QString, RepeatType> rTypeValueConvertMap() const; | 99 | QMap<QString, RepeatType> rTypeValueConvertMap() const; |
95 | 100 | ||
96 | class Data; | 101 | class Data; |
97 | Data* data; | 102 | Data* data; |
98 | class ORecurPrivate; | 103 | class ORecurPrivate; |
99 | ORecurPrivate *d; | 104 | ORecurPrivate *d; |
100 | }; | 105 | }; |
101 | 106 | ||
102 | #endif | 107 | #endif |
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 | |||
@@ -1,146 +1,162 @@ | |||
1 | #include "opimnotifymanager.h" | 1 | #include "opimnotifymanager.h" |
2 | 2 | ||
3 | #include "oconversion.h" | 3 | #include "oconversion.h" |
4 | 4 | ||
5 | #include <qstringlist.h> | 5 | #include <qstringlist.h> |
6 | 6 | ||
7 | OPimNotifyManager::OPimNotifyManager( const Reminders& rem, const Alarms& al) | 7 | OPimNotifyManager::OPimNotifyManager( const Reminders& rem, const Alarms& al) |
8 | : m_rem( rem ), m_al( al ) | 8 | : m_rem( rem ), m_al( al ) |
9 | {} | 9 | {} |
10 | OPimNotifyManager::~OPimNotifyManager() { | 10 | OPimNotifyManager::~OPimNotifyManager() { |
11 | } | 11 | } |
12 | /* use static_cast and type instead of dynamic... */ | 12 | /* use static_cast and type instead of dynamic... */ |
13 | void OPimNotifyManager::add( const OPimNotify& noti) { | 13 | void OPimNotifyManager::add( const OPimNotify& noti) { |
14 | if ( noti.type() == QString::fromLatin1("OPimReminder") ) { | 14 | if ( noti.type() == QString::fromLatin1("OPimReminder") ) { |
15 | const OPimReminder& rem = static_cast<const OPimReminder&>(noti); | 15 | const OPimReminder& rem = static_cast<const OPimReminder&>(noti); |
16 | m_rem.append( rem ); | 16 | m_rem.append( rem ); |
17 | }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { | 17 | }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { |
18 | const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); | 18 | const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); |
19 | m_al.append( al ); | 19 | m_al.append( al ); |
20 | } | 20 | } |
21 | } | 21 | } |
22 | void OPimNotifyManager::remove( const OPimNotify& noti) { | 22 | void OPimNotifyManager::remove( const OPimNotify& noti) { |
23 | if ( noti.type() == QString::fromLatin1("OPimReminder") ) { | 23 | if ( noti.type() == QString::fromLatin1("OPimReminder") ) { |
24 | const OPimReminder& rem = static_cast<const OPimReminder&>(noti); | 24 | const OPimReminder& rem = static_cast<const OPimReminder&>(noti); |
25 | m_rem.remove( rem ); | 25 | m_rem.remove( rem ); |
26 | }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { | 26 | }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { |
27 | const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); | 27 | const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); |
28 | m_al.remove( al ); | 28 | m_al.remove( al ); |
29 | } | 29 | } |
30 | } | 30 | } |
31 | void OPimNotifyManager::replace( const OPimNotify& noti) { | 31 | 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 | } |
42 | OPimNotifyManager::Reminders OPimNotifyManager::reminders()const { | 42 | OPimNotifyManager::Reminders OPimNotifyManager::reminders()const { |
43 | return m_rem; | 43 | return m_rem; |
44 | } | 44 | } |
45 | OPimNotifyManager::Alarms OPimNotifyManager::alarms()const { | 45 | OPimNotifyManager::Alarms OPimNotifyManager::alarms()const { |
46 | return m_al; | 46 | return m_al; |
47 | } | 47 | } |
48 | OPimAlarm 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 | |||
48 | void OPimNotifyManager::setAlarms( const Alarms& al) { | 64 | void OPimNotifyManager::setAlarms( const Alarms& al) { |
49 | m_al = al; | 65 | m_al = al; |
50 | } | 66 | } |
51 | void OPimNotifyManager::setReminders( const Reminders& rem) { | 67 | void 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 | */ |
62 | void OPimNotifyManager::registerNotify( const OPimNotify& ) { | 78 | void OPimNotifyManager::registerNotify( const OPimNotify& ) { |
63 | 79 | ||
64 | } | 80 | } |
65 | /* FIXME!!! */ | 81 | /* FIXME!!! */ |
66 | /** | 82 | /** |
67 | * same as above... | 83 | * same as above... |
68 | * Also implement Url model | 84 | * Also implement Url model |
69 | * have a MainWindow.... | 85 | * have a MainWindow.... |
70 | */ | 86 | */ |
71 | void OPimNotifyManager::deregister( const OPimNotify& ) { | 87 | void OPimNotifyManager::deregister( const OPimNotify& ) { |
72 | 88 | ||
73 | } | 89 | } |
74 | 90 | ||
75 | bool OPimNotifyManager::isEmpty()const { | 91 | bool OPimNotifyManager::isEmpty()const { |
76 | qWarning("is Empty called on OPimNotifyManager %d %d", m_rem.count(), m_al.count() ); | 92 | qWarning("is Empty called on OPimNotifyManager %d %d", m_rem.count(), m_al.count() ); |
77 | if ( m_rem.isEmpty() && m_al.isEmpty() ) return true; | 93 | if ( m_rem.isEmpty() && m_al.isEmpty() ) return true; |
78 | else return false; | 94 | else return false; |
79 | } | 95 | } |
80 | 96 | ||
81 | // Taken from otodoaccessxml.. | 97 | // Taken from otodoaccessxml.. |
82 | QString OPimNotifyManager::alarmsToString() const | 98 | QString OPimNotifyManager::alarmsToString() const |
83 | { | 99 | { |
84 | QString str; | 100 | QString str; |
85 | 101 | ||
86 | OPimNotifyManager::Alarms alarms = m_al; | 102 | OPimNotifyManager::Alarms alarms = m_al; |
87 | if ( !alarms.isEmpty() ) { | 103 | if ( !alarms.isEmpty() ) { |
88 | QStringList als; | 104 | QStringList als; |
89 | OPimNotifyManager::Alarms::Iterator it = alarms.begin(); | 105 | OPimNotifyManager::Alarms::Iterator it = alarms.begin(); |
90 | for ( ; it != alarms.end(); ++it ) { | 106 | for ( ; it != alarms.end(); ++it ) { |
91 | /* only if time is valid */ | 107 | /* only if time is valid */ |
92 | if ( (*it).dateTime().isValid() ) { | 108 | if ( (*it).dateTime().isValid() ) { |
93 | als << OConversion::dateTimeToString( (*it).dateTime() ) | 109 | als << OConversion::dateTimeToString( (*it).dateTime() ) |
94 | + ":" + QString::number( (*it).duration() ) | 110 | + ":" + QString::number( (*it).duration() ) |
95 | + ":" + QString::number( (*it).sound() ) | 111 | + ":" + QString::number( (*it).sound() ) |
96 | + ":"; | 112 | + ":"; |
97 | } | 113 | } |
98 | } | 114 | } |
99 | // now write the list | 115 | // now write the list |
100 | qWarning("als: %s", als.join("____________").latin1() ); | 116 | qWarning("als: %s", als.join("____________").latin1() ); |
101 | str = als.join(";"); | 117 | str = als.join(";"); |
102 | } | 118 | } |
103 | 119 | ||
104 | return str; | 120 | return str; |
105 | } | 121 | } |
106 | QString OPimNotifyManager::remindersToString() const | 122 | QString OPimNotifyManager::remindersToString() const |
107 | { | 123 | { |
108 | QString str; | 124 | QString str; |
109 | 125 | ||
110 | OPimNotifyManager::Reminders reminders = m_rem; | 126 | OPimNotifyManager::Reminders reminders = m_rem; |
111 | if (!reminders.isEmpty() ) { | 127 | if (!reminders.isEmpty() ) { |
112 | OPimNotifyManager::Reminders::Iterator it = reminders.begin(); | 128 | OPimNotifyManager::Reminders::Iterator it = reminders.begin(); |
113 | QStringList records; | 129 | QStringList records; |
114 | for ( ; it != reminders.end(); ++it ) { | 130 | for ( ; it != reminders.end(); ++it ) { |
115 | records << QString::number( (*it).recordUid() ); | 131 | records << QString::number( (*it).recordUid() ); |
116 | } | 132 | } |
117 | str = records.join(";"); | 133 | str = records.join(";"); |
118 | } | 134 | } |
119 | 135 | ||
120 | return str; | 136 | return str; |
121 | } | 137 | } |
122 | 138 | ||
123 | void OPimNotifyManager::alarmsFromString( const QString& str ) | 139 | void OPimNotifyManager::alarmsFromString( const QString& str ) |
124 | { | 140 | { |
125 | QStringList als = QStringList::split(";", str ); | 141 | QStringList als = QStringList::split(";", str ); |
126 | for (QStringList::Iterator it = als.begin(); it != als.end(); ++it ) { | 142 | for (QStringList::Iterator it = als.begin(); it != als.end(); ++it ) { |
127 | QStringList alarm = QStringList::split(":", (*it), TRUE ); // allow empty | 143 | QStringList alarm = QStringList::split(":", (*it), TRUE ); // allow empty |
128 | qWarning("alarm: %s", alarm.join("___").latin1() ); | 144 | qWarning("alarm: %s", alarm.join("___").latin1() ); |
129 | qWarning("alarm[0]: %s %s", alarm[0].latin1(), | 145 | qWarning("alarm[0]: %s %s", alarm[0].latin1(), |
130 | OConversion::dateTimeFromString( alarm[0] ).toString().latin1() ); | 146 | OConversion::dateTimeFromString( alarm[0] ).toString().latin1() ); |
131 | OPimAlarm al( alarm[2].toInt(), OConversion::dateTimeFromString( alarm[0] ), | 147 | OPimAlarm al( alarm[2].toInt(), OConversion::dateTimeFromString( alarm[0] ), |
132 | alarm[1].toInt() ); | 148 | alarm[1].toInt() ); |
133 | add( al ); | 149 | add( al ); |
134 | } | 150 | } |
135 | } | 151 | } |
136 | 152 | ||
137 | void OPimNotifyManager::remindersFromString( const QString& str ) | 153 | void OPimNotifyManager::remindersFromString( const QString& str ) |
138 | { | 154 | { |
139 | 155 | ||
140 | QStringList rems = QStringList::split(";", str ); | 156 | QStringList rems = QStringList::split(";", str ); |
141 | for (QStringList::Iterator it = rems.begin(); it != rems.end(); ++it ) { | 157 | for (QStringList::Iterator it = rems.begin(); it != rems.end(); ++it ) { |
142 | OPimReminder rem( (*it).toInt() ); | 158 | OPimReminder rem( (*it).toInt() ); |
143 | add( rem ); | 159 | add( rem ); |
144 | } | 160 | } |
145 | 161 | ||
146 | } | 162 | } |
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 | |||
@@ -1,76 +1,91 @@ | |||
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 | */ |
11 | class OPimNotifyManager { | 11 | class OPimNotifyManager { |
12 | public: | 12 | public: |
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; |
43 | 58 | ||
44 | /** | 59 | /** |
45 | * Return all alarms as string | 60 | * Return all alarms as string |
46 | */ | 61 | */ |
47 | QString alarmsToString() const; | 62 | QString alarmsToString() const; |
48 | /** | 63 | /** |
49 | * Return all notifiers as string | 64 | * Return all notifiers as string |
50 | */ | 65 | */ |
51 | QString remindersToString() const; | 66 | QString remindersToString() const; |
52 | 67 | ||
53 | /** | 68 | /** |
54 | * Convert string to alarms | 69 | * Convert string to alarms |
55 | * @param str String created by alarmsToString() | 70 | * @param str String created by alarmsToString() |
56 | */ | 71 | */ |
57 | void alarmsFromString( const QString& str ); | 72 | void alarmsFromString( const QString& str ); |
58 | 73 | ||
59 | /** | 74 | /** |
60 | * Convert string to reminders | 75 | * Convert string to reminders |
61 | * @param str String created by remindersToString() | 76 | * @param str String created by remindersToString() |
62 | */ | 77 | */ |
63 | void remindersFromString( const QString& str ); | 78 | void remindersFromString( const QString& str ); |
64 | 79 | ||
65 | 80 | ||
66 | 81 | ||
67 | private: | 82 | private: |
68 | Reminders m_rem; | 83 | Reminders m_rem; |
69 | Alarms m_al; | 84 | Alarms m_al; |
70 | 85 | ||
71 | class Private; | 86 | class Private; |
72 | Private *d; | 87 | Private *d; |
73 | 88 | ||
74 | }; | 89 | }; |
75 | 90 | ||
76 | #endif | 91 | #endif |
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,102 +1,107 @@ | |||
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 | |||
14 | class ORecur { | 19 | class ORecur { |
15 | public: | 20 | public: |
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& ); |
30 | bool operator==(const ORecur& )const; | 35 | bool operator==(const ORecur& )const; |
31 | 36 | ||
32 | bool doesRecur()const; | 37 | bool doesRecur()const; |
33 | /* if it recurrs on that day */ | 38 | /* if it recurrs on that day */ |
34 | bool doesRecur( const QDate& ); | 39 | bool doesRecur( const QDate& ); |
35 | RepeatType type()const; | 40 | RepeatType type()const; |
36 | int frequency()const; | 41 | int frequency()const; |
37 | int position()const; | 42 | int position()const; |
38 | char days()const; | 43 | char days()const; |
39 | bool hasEndDate()const; | 44 | bool hasEndDate()const; |
40 | QDate start()const; | 45 | QDate start()const; |
41 | QDate endDate()const; | 46 | QDate endDate()const; |
42 | QDateTime createdDateTime()const; | 47 | QDateTime createdDateTime()const; |
43 | /** | 48 | /** |
44 | * starting on monday=0, sunday=6 | 49 | * starting on monday=0, sunday=6 |
45 | * for convience | 50 | * for convience |
46 | */ | 51 | */ |
47 | bool repeatOnWeekDay( int day )const; | 52 | bool repeatOnWeekDay( int day )const; |
48 | 53 | ||
49 | /** | 54 | /** |
50 | * FromWhereToStart is not included!!! | 55 | * FromWhereToStart is not included!!! |
51 | */ | 56 | */ |
52 | bool nextOcurrence( const QDate& FromWhereToStart, QDate &recurDate ); | 57 | bool nextOcurrence( const QDate& FromWhereToStart, QDate &recurDate ); |
53 | 58 | ||
54 | /** | 59 | /** |
55 | * The module this ORecur belongs to | 60 | * The module this ORecur belongs to |
56 | */ | 61 | */ |
57 | QString service()const; | 62 | QString service()const; |
58 | 63 | ||
59 | /* | 64 | /* |
60 | * reference to the exception list | 65 | * reference to the exception list |
61 | */ | 66 | */ |
62 | ExceptionList &exceptions(); | 67 | ExceptionList &exceptions(); |
63 | 68 | ||
64 | /** | 69 | /** |
65 | * the current repetition | 70 | * the current repetition |
66 | */ | 71 | */ |
67 | int repetition()const; | 72 | int repetition()const; |
68 | 73 | ||
69 | void setType( const RepeatType& ); | 74 | void setType( const RepeatType& ); |
70 | void setFrequency( int freq ); | 75 | void setFrequency( int freq ); |
71 | void setPosition( int pos ); | 76 | void setPosition( int pos ); |
72 | void setDays( char c); | 77 | void setDays( char c); |
73 | void setEndDate( const QDate& dt ); | 78 | void setEndDate( const QDate& dt ); |
74 | void setStart( const QDate& dt ); | 79 | void setStart( const QDate& dt ); |
75 | void setCreatedDateTime( const QDateTime& ); | 80 | void setCreatedDateTime( const QDateTime& ); |
76 | void setHasEndDate( bool b ); | 81 | void setHasEndDate( bool b ); |
77 | void setRepitition(int ); | 82 | void setRepitition(int ); |
78 | 83 | ||
79 | void setService( const QString& ser ); | 84 | void setService( const QString& ser ); |
80 | 85 | ||
81 | QMap<int, QString> toMap() const; | 86 | QMap<int, QString> toMap() const; |
82 | void fromMap( const QMap<int, QString>& map ); | 87 | void fromMap( const QMap<int, QString>& map ); |
83 | 88 | ||
84 | /* almost internal */ | 89 | /* almost internal */ |
85 | QString toString()const; | 90 | QString toString()const; |
86 | private: | 91 | private: |
87 | bool p_nextOccurrence( const QDate& from, QDate& next ); | 92 | bool p_nextOccurrence( const QDate& from, QDate& next ); |
88 | void deref(); | 93 | void deref(); |
89 | inline void checkOrModify(); | 94 | inline void checkOrModify(); |
90 | 95 | ||
91 | /* Converts rType to String */ | 96 | /* Converts rType to String */ |
92 | QString rTypeString() const; | 97 | QString rTypeString() const; |
93 | /* Returns a map to convert Stringname for RType to RepeatType */ | 98 | /* Returns a map to convert Stringname for RType to RepeatType */ |
94 | QMap<QString, RepeatType> rTypeValueConvertMap() const; | 99 | QMap<QString, RepeatType> rTypeValueConvertMap() const; |
95 | 100 | ||
96 | class Data; | 101 | class Data; |
97 | Data* data; | 102 | Data* data; |
98 | class ORecurPrivate; | 103 | class ORecurPrivate; |
99 | ORecurPrivate *d; | 104 | ORecurPrivate *d; |
100 | }; | 105 | }; |
101 | 106 | ||
102 | #endif | 107 | #endif |