summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core/orecur.h
Unidiff
Diffstat (limited to 'libopie2/opiepim/core/orecur.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/core/orecur.h12
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,44 +1,47 @@
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
14class ORecur { 14class ORecur {
15public: 15public:
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;
33 int position()const; 36 int position()const;
34 char days()const; 37 char days()const;
35 bool hasEndDate()const; 38 bool hasEndDate()const;
36 QDate start()const; 39 QDate start()const;
37 QDate endDate()const; 40 QDate endDate()const;
38 QDateTime createdDateTime()const; 41 QDateTime createdDateTime()const;
39 /** 42 /**
40 * starting on monday=0, sunday=6 43 * starting on monday=0, sunday=6
41 * for convience 44 * for convience
42 */ 45 */
43 bool repeatOnWeekDay( int day )const; 46 bool repeatOnWeekDay( int day )const;
44 47
@@ -52,40 +55,47 @@ public:
52 */ 55 */
53 QString service()const; 56 QString service()const;
54 57
55 /* 58 /*
56 * reference to the exception list 59 * reference to the exception list
57 */ 60 */
58 ExceptionList &exceptions(); 61 ExceptionList &exceptions();
59 62
60 /** 63 /**
61 * the current repetition 64 * the current repetition
62 */ 65 */
63 int repetition()const; 66 int repetition()const;
64 67
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 );
79
80 QMap<int, QString> toMap() const;
81 void fromMap( const QMap<int, QString>& map );
76 82
77 /* almost internal */ 83 /* almost internal */
78 QString toString()const; 84 QString toString()const;
79private: 85private:
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