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