Diffstat (limited to 'libopie2/opiepim/core/orecur.h') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/orecur.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libopie2/opiepim/core/orecur.h b/libopie2/opiepim/core/orecur.h index b214b3f..47901b0 100644 --- a/libopie2/opiepim/core/orecur.h +++ b/libopie2/opiepim/core/orecur.h | |||
@@ -1,32 +1,35 @@ | |||
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 | 12 | #include <qmap.h> | |
13 | 13 | ||
14 | class ORecur { | 14 | class ORecur { |
15 | public: | 15 | public: |
16 | typedef QValueList<QDate> ExceptionList; | 16 | typedef QValueList<QDate> ExceptionList; |
17 | enum RepeatType{ NoRepeat = -1, Daily, Weekly, MonthlyDay, | 17 | enum RepeatType{ NoRepeat = -1, Daily, Weekly, MonthlyDay, |
18 | MonthlyDate, Yearly }; | 18 | MonthlyDate, Yearly }; |
19 | enum Days { MON = 0x01, TUE = 0x02, WED = 0x04, THU = 0x08, | 19 | enum Days { MON = 0x01, TUE = 0x02, WED = 0x04, THU = 0x08, |
20 | FRI = 0x10, SAT = 0x20, SUN = 0x40 }; | 20 | FRI = 0x10, SAT = 0x20, SUN = 0x40 }; |
21 | enum Fields{ RType = 0, RWeekdays, RPosition, RFreq, RHasEndDate, | ||
22 | EndDate, Created, Exceptions }; | ||
23 | |||
21 | ORecur(); | 24 | ORecur(); |
22 | ORecur( const ORecur& ); | 25 | ORecur( const ORecur& ); |
23 | ~ORecur(); | 26 | ~ORecur(); |
24 | 27 | ||
25 | ORecur &operator=( const ORecur& ); | 28 | ORecur &operator=( const ORecur& ); |
26 | bool operator==(const ORecur& )const; | 29 | bool operator==(const ORecur& )const; |
27 | 30 | ||
28 | bool doesRecur()const; | 31 | bool doesRecur()const; |
29 | /* if it recurrs on that day */ | 32 | /* if it recurrs on that day */ |
30 | bool doesRecur( const QDate& ); | 33 | bool doesRecur( const QDate& ); |
31 | RepeatType type()const; | 34 | RepeatType type()const; |
32 | int frequency()const; | 35 | int frequency()const; |
@@ -65,27 +68,34 @@ public: | |||
65 | void setType( const RepeatType& ); | 68 | void setType( const RepeatType& ); |
66 | void setFrequency( int freq ); | 69 | void setFrequency( int freq ); |
67 | void setPosition( int pos ); | 70 | void setPosition( int pos ); |
68 | void setDays( char c); | 71 | void setDays( char c); |
69 | void setEndDate( const QDate& dt ); | 72 | void setEndDate( const QDate& dt ); |
70 | void setStart( const QDate& dt ); | 73 | void setStart( const QDate& dt ); |
71 | void setCreatedDateTime( const QDateTime& ); | 74 | void setCreatedDateTime( const QDateTime& ); |
72 | void setHasEndDate( bool b ); | 75 | void setHasEndDate( bool b ); |
73 | void setRepitition(int ); | 76 | void setRepitition(int ); |
74 | 77 | ||
75 | void setService( const QString& ser ); | 78 | void setService( const QString& ser ); |
76 | 79 | ||
80 | QMap<int, QString> toMap() const; | ||
81 | void fromMap( const QMap<int, QString>& map ); | ||
82 | |||
77 | /* almost internal */ | 83 | /* almost internal */ |
78 | QString toString()const; | 84 | QString toString()const; |
79 | private: | 85 | private: |
80 | bool p_nextOccurrence( const QDate& from, QDate& next ); | 86 | bool p_nextOccurrence( const QDate& from, QDate& next ); |
81 | void deref(); | 87 | void deref(); |
82 | inline void checkOrModify(); | 88 | inline void checkOrModify(); |
83 | 89 | ||
90 | /* Converts rType to String */ | ||
91 | QString rTypeString() const; | ||
92 | /* Returns a map to convert Stringname for RType to RepeatType */ | ||
93 | QMap<QString, RepeatType> rTypeValueConvertMap() const; | ||
84 | 94 | ||
85 | class Data; | 95 | class Data; |
86 | Data* data; | 96 | Data* data; |
87 | class ORecurPrivate; | 97 | class ORecurPrivate; |
88 | ORecurPrivate *d; | 98 | ORecurPrivate *d; |
89 | }; | 99 | }; |
90 | 100 | ||
91 | #endif | 101 | #endif |