-rw-r--r-- | libopie/todoevent.h | 67 |
1 files changed, 63 insertions, 4 deletions
diff --git a/libopie/todoevent.h b/libopie/todoevent.h index 8a00f99..7454241 100644 --- a/libopie/todoevent.h +++ b/libopie/todoevent.h | |||
@@ -1,92 +1,151 @@ | |||
1 | 1 | ||
2 | #ifndef todoevent_h | 2 | #ifndef todoevent_h |
3 | #define todoevent_h | 3 | #define todoevent_h |
4 | 4 | ||
5 | #include <qmap.h> | ||
5 | #include <qregexp.h> | 6 | #include <qregexp.h> |
6 | #include <qstringlist.h> | 7 | #include <qstringlist.h> |
7 | #include <qdatetime.h> | 8 | #include <qdatetime.h> |
8 | 9 | ||
9 | class ToDoEvent { | 10 | class ToDoEvent { |
10 | friend class ToDoDB; | 11 | friend class ToDoDB; |
11 | public: | 12 | public: |
12 | // priorities from Very low to very high | 13 | // priorities from Very low to very high |
13 | enum Priority { VERYHIGH=1, HIGH, NORMAL, LOW, VERYLOW }; | 14 | enum Priority { VERYHIGH=1, HIGH, NORMAL, LOW, VERYLOW }; |
14 | /* Constructs a new ToDoEvent | 15 | /* Constructs a new ToDoEvent |
15 | @param completed Is the TodoEvent completed | 16 | @param completed Is the TodoEvent completed |
16 | @param priority What is the priority of this ToDoEvent | 17 | @param priority What is the priority of this ToDoEvent |
17 | @param category Which category does it belong( uid ) | 18 | @param category Which category does it belong( uid ) |
19 | @param summary A small summary of the todo | ||
18 | @param description What is this ToDoEvent about | 20 | @param description What is this ToDoEvent about |
19 | @param hasDate Does this Event got a deadline | 21 | @param hasDate Does this Event got a deadline |
20 | @param date what is the deadline? | 22 | @param date what is the deadline? |
21 | @param uid what is the UUID of this Event | 23 | @param uid what is the UUID of this Event |
22 | **/ | 24 | **/ |
23 | ToDoEvent( bool completed = false, int priority = NORMAL, | 25 | ToDoEvent( bool completed = false, int priority = NORMAL, |
24 | const QStringList &category = QStringList(), | 26 | const QStringList &category = QStringList(), |
25 | const QString &description = QString::null , | 27 | const QString &summary = QString::null , |
28 | const QString &description = QString::null, | ||
26 | bool hasDate = false, QDate date = QDate::currentDate(), int uid = -1 ); | 29 | bool hasDate = false, QDate date = QDate::currentDate(), int uid = -1 ); |
27 | /* Copy c'tor | 30 | /* Copy c'tor |
28 | 31 | ||
29 | **/ | 32 | **/ |
30 | ToDoEvent(const ToDoEvent & ); | 33 | ToDoEvent(const ToDoEvent & ); |
31 | 34 | ||
32 | /* | 35 | /* |
33 | Is this event completed? | 36 | Is this event completed? |
34 | **/ | 37 | **/ |
35 | bool isCompleted() const; | 38 | bool isCompleted() const; |
36 | 39 | ||
37 | /* | 40 | /* |
38 | Does this Event have a deadline | 41 | Does this Event have a deadline |
39 | **/ | 42 | **/ |
40 | bool hasDate() const; | 43 | bool hasDate() const; |
41 | 44 | ||
42 | /* | 45 | /* |
43 | What is the priority? | 46 | What is the priority? |
44 | **/ | 47 | **/ |
45 | int priority()const ; | 48 | int priority()const ; |
49 | |||
50 | /* | ||
51 | All category numbers as QString in a List | ||
52 | **/ | ||
46 | QStringList allCategories()const; | 53 | QStringList allCategories()const; |
54 | |||
55 | /* | ||
56 | * Same as above but with QArray<int> | ||
57 | */ | ||
47 | QArray<int> categories() const; | 58 | QArray<int> categories() const; |
59 | |||
60 | /** | ||
61 | * The end Date | ||
62 | */ | ||
48 | QDate date()const; | 63 | QDate date()const; |
64 | |||
65 | /** | ||
66 | * The description of the todo | ||
67 | */ | ||
49 | QString description()const; | 68 | QString description()const; |
50 | 69 | ||
70 | /** | ||
71 | * A small summary of the todo | ||
72 | */ | ||
73 | QString summary() const; | ||
74 | |||
75 | /** | ||
76 | * Return this todoevent in a RichText formatted QString | ||
77 | */ | ||
51 | QString richText() const; | 78 | QString richText() const; |
52 | 79 | ||
80 | /** | ||
81 | * Returns the UID of the Todo | ||
82 | */ | ||
53 | int uid()const { return m_uid;}; | 83 | int uid()const { return m_uid;}; |
84 | |||
85 | |||
86 | QString extra(const QString& )const; | ||
87 | /** | ||
88 | * Set if this Todo is completed | ||
89 | */ | ||
54 | void setCompleted(bool completed ); | 90 | void setCompleted(bool completed ); |
91 | |||
92 | /** | ||
93 | * set if this todo got an end data | ||
94 | */ | ||
55 | void setHasDate( bool hasDate ); | 95 | void setHasDate( bool hasDate ); |
56 | // if the category doesn't exist we will create it | 96 | // if the category doesn't exist we will create it |
57 | // this sets the the Category after this call category will be the only category | 97 | // this sets the the Category after this call category will be the only category |
58 | void setCategory( const QString &category ); | 98 | void setCategory( const QString &category ); |
59 | // adds a category to the Categories of this event | 99 | // adds a category to the Categories of this event |
60 | void insertCategory(const QString &category ); | 100 | void insertCategory(const QString &category ); |
101 | |||
102 | /** | ||
103 | * Removes this event from all categories | ||
104 | */ | ||
61 | void clearCategories(); | 105 | void clearCategories(); |
106 | |||
107 | /** | ||
108 | * This todo belongs to xxx categories | ||
109 | */ | ||
62 | void setCategories(const QStringList& ); | 110 | void setCategories(const QStringList& ); |
63 | 111 | ||
112 | /** | ||
113 | * Set the priority of the Todo | ||
114 | */ | ||
64 | void setPriority(int priority ); | 115 | void setPriority(int priority ); |
116 | |||
117 | /** | ||
118 | * set the end date | ||
119 | */ | ||
65 | void setDate( QDate date ); | 120 | void setDate( QDate date ); |
66 | void setDescription(const QString& ); | 121 | void setDescription(const QString& ); |
122 | void setSummary(const QString& ); | ||
123 | void setExtra( const QString&, const QString& ); | ||
67 | bool isOverdue(); | 124 | bool isOverdue(); |
68 | 125 | ||
69 | bool match( const QRegExp &r )const; | 126 | bool match( const QRegExp &r )const; |
70 | 127 | ||
71 | void setUid(int id) {m_uid = id; }; | 128 | void setUid(int id) {m_uid = id; }; |
72 | bool operator<(const ToDoEvent &toDoEvent )const; | 129 | bool operator<(const ToDoEvent &toDoEvent )const; |
73 | bool operator<=(const ToDoEvent &toDoEvent )const; | 130 | bool operator<=(const ToDoEvent &toDoEvent )const; |
74 | bool operator!=(const ToDoEvent &toDoEvent )const { return !(*this == toDoEvent); }; | 131 | bool operator!=(const ToDoEvent &toDoEvent )const { return !(*this == toDoEvent); }; |
75 | bool operator>(const ToDoEvent &toDoEvent )const; | 132 | bool operator>(const ToDoEvent &toDoEvent )const; |
76 | bool operator>=(const ToDoEvent &toDoEvent)const; | 133 | bool operator>=(const ToDoEvent &toDoEvent)const; |
77 | bool operator==(const ToDoEvent &toDoEvent )const; | 134 | bool operator==(const ToDoEvent &toDoEvent )const; |
78 | ToDoEvent &operator=(const ToDoEvent &toDoEvent ); | 135 | ToDoEvent &operator=(const ToDoEvent &toDoEvent ); |
79 | private: | 136 | private: |
80 | class ToDoEventPrivate; | 137 | class ToDoEventPrivate; |
81 | ToDoEventPrivate *d; | 138 | ToDoEventPrivate *d; |
82 | QDate m_date; | 139 | QDate m_date; |
83 | bool m_isCompleted:1; | 140 | bool m_isCompleted:1; |
84 | bool m_hasDate:1; | 141 | bool m_hasDate:1; |
85 | int m_priority; | 142 | int m_priority; |
86 | QStringList m_category; | 143 | QStringList m_category; |
87 | QString m_desc; | 144 | QString m_desc; |
145 | QString m_sum; | ||
146 | QMap<QString, QString> m_extra; | ||
88 | int m_uid; | 147 | int m_uid; |
89 | }; | 148 | }; |
90 | 149 | ||
91 | 150 | ||
92 | #endif | 151 | #endif |