-rw-r--r-- | core/pim/todo/mainwindow.cpp | 2 | ||||
-rw-r--r-- | core/pim/todo/todoentry.ui | 370 | ||||
-rw-r--r-- | core/pim/todo/todoentryimpl.cpp | 7 | ||||
-rw-r--r-- | core/pim/todo/todotable.cpp | 11 | ||||
-rw-r--r-- | core/pim/todo/todotable.h | 3 | ||||
-rw-r--r-- | libopie/tododb.cpp | 12 | ||||
-rw-r--r-- | libopie/todoevent.cpp | 43 | ||||
-rw-r--r-- | libopie/todoevent.h | 67 | ||||
-rw-r--r-- | libopie/todovcalresource.cpp | 23 |
9 files changed, 353 insertions, 185 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index b7b1da0..1358f1c 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -594,7 +594,7 @@ void TodoWindow::slotBeam() | |||
594 | todoDB.save(); | 594 | todoDB.save(); |
595 | Ir *ir = new Ir( this ); | 595 | Ir *ir = new Ir( this ); |
596 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 596 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
597 | QString description = c.description(); | 597 | QString description = c.summary(); |
598 | ir->send( beamfile, description, "text/x-vCalendar" ); | 598 | ir->send( beamfile, description, "text/x-vCalendar" ); |
599 | } | 599 | } |
600 | 600 | ||
diff --git a/core/pim/todo/todoentry.ui b/core/pim/todo/todoentry.ui index c735e76..87ee68c 100644 --- a/core/pim/todo/todoentry.ui +++ b/core/pim/todo/todoentry.ui | |||
@@ -30,7 +30,7 @@ | |||
30 | <rect> | 30 | <rect> |
31 | <x>0</x> | 31 | <x>0</x> |
32 | <y>0</y> | 32 | <y>0</y> |
33 | <width>249</width> | 33 | <width>245</width> |
34 | <height>321</height> | 34 | <height>321</height> |
35 | </rect> | 35 | </rect> |
36 | </property> | 36 | </property> |
@@ -44,192 +44,252 @@ | |||
44 | <property> | 44 | <property> |
45 | <name>layoutSpacing</name> | 45 | <name>layoutSpacing</name> |
46 | </property> | 46 | </property> |
47 | <vbox> | 47 | <widget> |
48 | <class>QLayoutWidget</class> | ||
48 | <property stdset="1"> | 49 | <property stdset="1"> |
49 | <name>margin</name> | 50 | <name>name</name> |
50 | <number>0</number> | 51 | <cstring>Layout3</cstring> |
51 | </property> | 52 | </property> |
52 | <property stdset="1"> | 53 | <property stdset="1"> |
53 | <name>spacing</name> | 54 | <name>geometry</name> |
54 | <number>0</number> | 55 | <rect> |
56 | <x>1</x> | ||
57 | <y>25</y> | ||
58 | <width>243</width> | ||
59 | <height>17</height> | ||
60 | </rect> | ||
55 | </property> | 61 | </property> |
56 | <widget> | 62 | <hbox> |
57 | <class>QLayoutWidget</class> | ||
58 | <property stdset="1"> | 63 | <property stdset="1"> |
59 | <name>name</name> | 64 | <name>margin</name> |
60 | <cstring>Layout4</cstring> | 65 | <number>0</number> |
61 | </property> | 66 | </property> |
62 | <hbox> | 67 | <property stdset="1"> |
68 | <name>spacing</name> | ||
69 | <number>6</number> | ||
70 | </property> | ||
71 | <widget> | ||
72 | <class>QLabel</class> | ||
63 | <property stdset="1"> | 73 | <property stdset="1"> |
64 | <name>margin</name> | 74 | <name>name</name> |
65 | <number>0</number> | 75 | <cstring>TextLabel3</cstring> |
66 | </property> | 76 | </property> |
67 | <property stdset="1"> | 77 | <property stdset="1"> |
68 | <name>spacing</name> | 78 | <name>frameShape</name> |
69 | <number>6</number> | 79 | <enum>NoFrame</enum> |
70 | </property> | 80 | </property> |
71 | <widget> | 81 | <property stdset="1"> |
72 | <class>QLabel</class> | 82 | <name>text</name> |
83 | <string>Category:</string> | ||
84 | </property> | ||
85 | </widget> | ||
86 | <widget> | ||
87 | <class>CategorySelect</class> | ||
88 | <property stdset="1"> | ||
89 | <name>name</name> | ||
90 | <cstring>comboCategory</cstring> | ||
91 | </property> | ||
92 | </widget> | ||
93 | </hbox> | ||
94 | </widget> | ||
95 | <widget> | ||
96 | <class>QLayoutWidget</class> | ||
97 | <property stdset="1"> | ||
98 | <name>name</name> | ||
99 | <cstring>Layout6</cstring> | ||
100 | </property> | ||
101 | <property stdset="1"> | ||
102 | <name>geometry</name> | ||
103 | <rect> | ||
104 | <x>0</x> | ||
105 | <y>0</y> | ||
106 | <width>240</width> | ||
107 | <height>320</height> | ||
108 | </rect> | ||
109 | </property> | ||
110 | <grid> | ||
111 | <property stdset="1"> | ||
112 | <name>margin</name> | ||
113 | <number>0</number> | ||
114 | </property> | ||
115 | <property stdset="1"> | ||
116 | <name>spacing</name> | ||
117 | <number>6</number> | ||
118 | </property> | ||
119 | <widget row="2" column="0" > | ||
120 | <class>QLayoutWidget</class> | ||
121 | <property stdset="1"> | ||
122 | <name>name</name> | ||
123 | <cstring>Layout4</cstring> | ||
124 | </property> | ||
125 | <hbox> | ||
73 | <property stdset="1"> | 126 | <property stdset="1"> |
74 | <name>name</name> | 127 | <name>margin</name> |
75 | <cstring>TextLabel2</cstring> | 128 | <number>0</number> |
76 | </property> | 129 | </property> |
77 | <property stdset="1"> | 130 | <property stdset="1"> |
78 | <name>text</name> | 131 | <name>spacing</name> |
79 | <string>Priority:</string> | 132 | <number>6</number> |
80 | </property> | 133 | </property> |
81 | </widget> | 134 | <widget> |
82 | <widget> | 135 | <class>QLabel</class> |
83 | <class>QComboBox</class> | 136 | <property stdset="1"> |
84 | <item> | 137 | <name>name</name> |
85 | <property> | 138 | <cstring>TextLabel1</cstring> |
86 | <name>text</name> | ||
87 | <string>1 - Very High</string> | ||
88 | </property> | 139 | </property> |
89 | </item> | 140 | <property stdset="1"> |
90 | <item> | ||
91 | <property> | ||
92 | <name>text</name> | 141 | <name>text</name> |
93 | <string>2 - High</string> | 142 | <string>Summary:</string> |
94 | </property> | 143 | </property> |
95 | </item> | 144 | </widget> |
96 | <item> | 145 | <widget> |
97 | <property> | 146 | <class>QLineEdit</class> |
98 | <name>text</name> | 147 | <property stdset="1"> |
99 | <string>3 - Normal</string> | 148 | <name>name</name> |
100 | </property> | 149 | <cstring>lneSum</cstring> |
101 | </item> | ||
102 | <item> | ||
103 | <property> | ||
104 | <name>text</name> | ||
105 | <string>4 - Low</string> | ||
106 | </property> | ||
107 | </item> | ||
108 | <item> | ||
109 | <property> | ||
110 | <name>text</name> | ||
111 | <string>5 - Very Low</string> | ||
112 | </property> | 150 | </property> |
113 | </item> | 151 | </widget> |
114 | <property stdset="1"> | 152 | </hbox> |
115 | <name>name</name> | 153 | </widget> |
116 | <cstring>comboPriority</cstring> | 154 | <widget row="3" column="0" > |
117 | </property> | 155 | <class>QMultiLineEdit</class> |
118 | <property stdset="1"> | ||
119 | <name>sizePolicy</name> | ||
120 | <sizepolicy> | ||
121 | <hsizetype>7</hsizetype> | ||
122 | <vsizetype>0</vsizetype> | ||
123 | </sizepolicy> | ||
124 | </property> | ||
125 | <property stdset="1"> | ||
126 | <name>currentItem</name> | ||
127 | <number>2</number> | ||
128 | </property> | ||
129 | </widget> | ||
130 | </hbox> | ||
131 | </widget> | ||
132 | <widget> | ||
133 | <class>QLayoutWidget</class> | ||
134 | <property stdset="1"> | ||
135 | <name>name</name> | ||
136 | <cstring>Layout3</cstring> | ||
137 | </property> | ||
138 | <hbox> | ||
139 | <property stdset="1"> | 156 | <property stdset="1"> |
140 | <name>margin</name> | 157 | <name>name</name> |
141 | <number>0</number> | 158 | <cstring>txtTodo</cstring> |
142 | </property> | 159 | </property> |
160 | </widget> | ||
161 | <widget row="1" column="0" > | ||
162 | <class>QLayoutWidget</class> | ||
143 | <property stdset="1"> | 163 | <property stdset="1"> |
144 | <name>spacing</name> | 164 | <name>name</name> |
145 | <number>6</number> | 165 | <cstring>Layout4</cstring> |
146 | </property> | 166 | </property> |
147 | <widget> | 167 | <hbox> |
148 | <class>QLabel</class> | ||
149 | <property stdset="1"> | ||
150 | <name>name</name> | ||
151 | <cstring>TextLabel3</cstring> | ||
152 | </property> | ||
153 | <property stdset="1"> | ||
154 | <name>frameShape</name> | ||
155 | <enum>NoFrame</enum> | ||
156 | </property> | ||
157 | <property stdset="1"> | 168 | <property stdset="1"> |
158 | <name>text</name> | 169 | <name>margin</name> |
159 | <string>Category:</string> | 170 | <number>0</number> |
160 | </property> | 171 | </property> |
161 | </widget> | ||
162 | <widget> | ||
163 | <class>CategorySelect</class> | ||
164 | <property stdset="1"> | 172 | <property stdset="1"> |
165 | <name>name</name> | 173 | <name>spacing</name> |
166 | <cstring>comboCategory</cstring> | 174 | <number>6</number> |
167 | </property> | 175 | </property> |
168 | </widget> | 176 | <widget> |
169 | </hbox> | 177 | <class>QCheckBox</class> |
170 | </widget> | 178 | <property stdset="1"> |
171 | <widget> | 179 | <name>name</name> |
172 | <class>QLayoutWidget</class> | 180 | <cstring>checkCompleted</cstring> |
173 | <property stdset="1"> | 181 | </property> |
174 | <name>name</name> | 182 | <property stdset="1"> |
175 | <cstring>Layout4</cstring> | 183 | <name>text</name> |
176 | </property> | 184 | <string>&Completed</string> |
177 | <hbox> | 185 | </property> |
178 | <property stdset="1"> | 186 | </widget> |
179 | <name>margin</name> | 187 | <widget> |
180 | <number>0</number> | 188 | <class>QCheckBox</class> |
181 | </property> | 189 | <property stdset="1"> |
190 | <name>name</name> | ||
191 | <cstring>checkDate</cstring> | ||
192 | </property> | ||
193 | <property stdset="1"> | ||
194 | <name>text</name> | ||
195 | <string>D&ue</string> | ||
196 | </property> | ||
197 | </widget> | ||
198 | <widget> | ||
199 | <class>QPushButton</class> | ||
200 | <property stdset="1"> | ||
201 | <name>name</name> | ||
202 | <cstring>buttonDate</cstring> | ||
203 | </property> | ||
204 | <property stdset="1"> | ||
205 | <name>enabled</name> | ||
206 | <bool>false</bool> | ||
207 | </property> | ||
208 | <property stdset="1"> | ||
209 | <name>text</name> | ||
210 | <string>1 Jan 2001</string> | ||
211 | </property> | ||
212 | </widget> | ||
213 | </hbox> | ||
214 | </widget> | ||
215 | <widget row="0" column="0" > | ||
216 | <class>QLayoutWidget</class> | ||
182 | <property stdset="1"> | 217 | <property stdset="1"> |
183 | <name>spacing</name> | 218 | <name>name</name> |
184 | <number>6</number> | 219 | <cstring>Layout4</cstring> |
185 | </property> | 220 | </property> |
186 | <widget> | 221 | <hbox> |
187 | <class>QCheckBox</class> | ||
188 | <property stdset="1"> | ||
189 | <name>name</name> | ||
190 | <cstring>checkCompleted</cstring> | ||
191 | </property> | ||
192 | <property stdset="1"> | 222 | <property stdset="1"> |
193 | <name>text</name> | 223 | <name>margin</name> |
194 | <string>&Completed</string> | 224 | <number>0</number> |
195 | </property> | 225 | </property> |
196 | </widget> | ||
197 | <widget> | ||
198 | <class>QCheckBox</class> | ||
199 | <property stdset="1"> | 226 | <property stdset="1"> |
200 | <name>name</name> | 227 | <name>spacing</name> |
201 | <cstring>checkDate</cstring> | 228 | <number>6</number> |
202 | </property> | 229 | </property> |
203 | <property stdset="1"> | 230 | <widget> |
204 | <name>text</name> | 231 | <class>QLabel</class> |
205 | <string>D&ue</string> | 232 | <property stdset="1"> |
206 | </property> | 233 | <name>name</name> |
207 | </widget> | 234 | <cstring>TextLabel2</cstring> |
208 | <widget> | 235 | </property> |
209 | <class>QPushButton</class> | 236 | <property stdset="1"> |
210 | <property stdset="1"> | 237 | <name>text</name> |
211 | <name>name</name> | 238 | <string>Priority:</string> |
212 | <cstring>buttonDate</cstring> | 239 | </property> |
213 | </property> | 240 | </widget> |
214 | <property stdset="1"> | 241 | <widget> |
215 | <name>enabled</name> | 242 | <class>QComboBox</class> |
216 | <bool>false</bool> | 243 | <item> |
217 | </property> | 244 | <property> |
218 | <property stdset="1"> | 245 | <name>text</name> |
219 | <name>text</name> | 246 | <string>1 - Very High</string> |
220 | <string>1 Jan 2001</string> | 247 | </property> |
221 | </property> | 248 | </item> |
222 | </widget> | 249 | <item> |
223 | </hbox> | 250 | <property> |
224 | </widget> | 251 | <name>text</name> |
225 | <widget> | 252 | <string>2 - High</string> |
226 | <class>QMultiLineEdit</class> | 253 | </property> |
227 | <property stdset="1"> | 254 | </item> |
228 | <name>name</name> | 255 | <item> |
229 | <cstring>txtTodo</cstring> | 256 | <property> |
230 | </property> | 257 | <name>text</name> |
231 | </widget> | 258 | <string>3 - Normal</string> |
232 | </vbox> | 259 | </property> |
260 | </item> | ||
261 | <item> | ||
262 | <property> | ||
263 | <name>text</name> | ||
264 | <string>4 - Low</string> | ||
265 | </property> | ||
266 | </item> | ||
267 | <item> | ||
268 | <property> | ||
269 | <name>text</name> | ||
270 | <string>5 - Very Low</string> | ||
271 | </property> | ||
272 | </item> | ||
273 | <property stdset="1"> | ||
274 | <name>name</name> | ||
275 | <cstring>comboPriority</cstring> | ||
276 | </property> | ||
277 | <property stdset="1"> | ||
278 | <name>sizePolicy</name> | ||
279 | <sizepolicy> | ||
280 | <hsizetype>7</hsizetype> | ||
281 | <vsizetype>0</vsizetype> | ||
282 | </sizepolicy> | ||
283 | </property> | ||
284 | <property stdset="1"> | ||
285 | <name>currentItem</name> | ||
286 | <number>2</number> | ||
287 | </property> | ||
288 | </widget> | ||
289 | </hbox> | ||
290 | </widget> | ||
291 | </grid> | ||
292 | </widget> | ||
233 | </widget> | 293 | </widget> |
234 | <customwidgets> | 294 | <customwidgets> |
235 | <customwidget> | 295 | <customwidget> |
diff --git a/core/pim/todo/todoentryimpl.cpp b/core/pim/todo/todoentryimpl.cpp index 26a685c..dfaf9b4 100644 --- a/core/pim/todo/todoentryimpl.cpp +++ b/core/pim/todo/todoentryimpl.cpp | |||
@@ -1,5 +1,6 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** Copyright (C) 2002 zecke | ||
3 | ** | 4 | ** |
4 | ** This file is part of Qtopia Environment. | 5 | ** This file is part of Qtopia Environment. |
5 | ** | 6 | ** |
@@ -61,6 +62,7 @@ NewTaskDialog::NewTaskDialog( const ToDoEvent& task, QWidget *parent, | |||
61 | buttonDate->setText( TimeString::longDateString( date ) ); | 62 | buttonDate->setText( TimeString::longDateString( date ) ); |
62 | 63 | ||
63 | txtTodo->setText( task.description() ); | 64 | txtTodo->setText( task.description() ); |
65 | lneSum->setText( task.summary() ); | ||
64 | } | 66 | } |
65 | 67 | ||
66 | /* | 68 | /* |
@@ -130,9 +132,10 @@ ToDoEvent NewTaskDialog::todoEntry() | |||
130 | } | 132 | } |
131 | todo.setPriority( comboPriority->currentItem() + 1 ); | 133 | todo.setPriority( comboPriority->currentItem() + 1 ); |
132 | todo.setCompleted( checkCompleted->isChecked() ); | 134 | todo.setCompleted( checkCompleted->isChecked() ); |
133 | 135 | ||
134 | todo.setDescription( txtTodo->text() ); | 136 | todo.setDescription( txtTodo->text() ); |
135 | 137 | todo.setSummary( lneSum->text() ); | |
138 | |||
136 | return todo; | 139 | return todo; |
137 | } | 140 | } |
138 | 141 | ||
diff --git a/core/pim/todo/todotable.cpp b/core/pim/todo/todotable.cpp index 52a3087..779b28c 100644 --- a/core/pim/todo/todotable.cpp +++ b/core/pim/todo/todotable.cpp | |||
@@ -572,6 +572,7 @@ void TodoTable::updateJournal( const ToDoEvent &todo, journal_action action ) | |||
572 | attr.remove(attr.length()-1, 1 ); | 572 | attr.remove(attr.length()-1, 1 ); |
573 | buf += " Categories=\"" + attr + "\""; | 573 | buf += " Categories=\"" + attr + "\""; |
574 | buf += " Description=\"" + todo.description() + "\""; | 574 | buf += " Description=\"" + todo.description() + "\""; |
575 | buf += " Summary=\"" + todo.summary() + "\""; | ||
575 | if(todo.hasDate() ) { | 576 | if(todo.hasDate() ) { |
576 | buf += " DateYear=\""+QString::number( todo.date().year() ) + "\""; | 577 | buf += " DateYear=\""+QString::number( todo.date().year() ) + "\""; |
577 | buf += " DateMonth=\"" + QString::number( todo.date().month() ) + "\""; | 578 | buf += " DateMonth=\"" + QString::number( todo.date().month() ) + "\""; |
@@ -610,8 +611,11 @@ void TodoTable::loadFile( const QString &/*we use the standard*/ ) | |||
610 | 611 | ||
611 | void TodoTable::journalFreeReplaceEntry( const ToDoEvent &todo, int row ) | 612 | void TodoTable::journalFreeReplaceEntry( const ToDoEvent &todo, int row ) |
612 | { | 613 | { |
613 | QString strTodo; | 614 | QString strTodo = todo.summary(); |
614 | strTodo = todo.description().left(40).simplifyWhiteSpace(); | 615 | if( strTodo.isEmpty() ){ |
616 | strTodo = todo.description().left(40).simplifyWhiteSpace(); | ||
617 | //todo.setSummary(strTodo ); | ||
618 | } | ||
615 | if ( row == -1 ) { | 619 | if ( row == -1 ) { |
616 | QMapIterator<CheckItem*, ToDoEvent *> it; | 620 | QMapIterator<CheckItem*, ToDoEvent *> it; |
617 | for ( it = todoList.begin(); it != todoList.end(); ++it ) { | 621 | for ( it = todoList.begin(); it != todoList.end(); ++it ) { |
@@ -908,6 +912,9 @@ static ToDoEvent xmlToEvent( XMLElement *element ) | |||
908 | //description | 912 | //description |
909 | dummy = element->attribute("Description" ); | 913 | dummy = element->attribute("Description" ); |
910 | event.setDescription( dummy ); | 914 | event.setDescription( dummy ); |
915 | // summary | ||
916 | dummy = element->attribute("Summary" ); | ||
917 | event.setSummary( dummy ); | ||
911 | // category | 918 | // category |
912 | dummy = element->attribute("Categories" ); | 919 | dummy = element->attribute("Categories" ); |
913 | QStringList ids = QStringList::split(";", dummy ); | 920 | QStringList ids = QStringList::split(";", dummy ); |
diff --git a/core/pim/todo/todotable.h b/core/pim/todo/todotable.h index 7672f21..39e00d1 100644 --- a/core/pim/todo/todotable.h +++ b/core/pim/todo/todotable.h | |||
@@ -199,7 +199,8 @@ inline void TodoTable::insertIntoTable( ToDoEvent *todo, int row ) | |||
199 | chk->setChecked( todo->isCompleted() ); | 199 | chk->setChecked( todo->isCompleted() ); |
200 | ComboItem *cmb = new ComboItem( this, QTableItem::WhenCurrent ); | 200 | ComboItem *cmb = new ComboItem( this, QTableItem::WhenCurrent ); |
201 | cmb->setText( QString::number( todo->priority() ) ); | 201 | cmb->setText( QString::number( todo->priority() ) ); |
202 | QTableItem *ti = new TodoTextItem( this, todo->description().left(40).simplifyWhiteSpace() ); | 202 | QString sum = todo->summary(); |
203 | QTableItem *ti = new TodoTextItem( this, sum.isEmpty() ? todo->description().left(40).simplifyWhiteSpace() : sum ); | ||
203 | ti->setReplaceable( false ); | 204 | ti->setReplaceable( false ); |
204 | 205 | ||
205 | DueTextItem *due = new DueTextItem(this, todo ); | 206 | DueTextItem *due = new DueTextItem(this, todo ); |
diff --git a/libopie/tododb.cpp b/libopie/tododb.cpp index fe8b8bf..6b10ec2 100644 --- a/libopie/tododb.cpp +++ b/libopie/tododb.cpp | |||
@@ -13,6 +13,7 @@ namespace { | |||
13 | class FileToDoResource : public ToDoResource { | 13 | class FileToDoResource : public ToDoResource { |
14 | public: | 14 | public: |
15 | FileToDoResource() {}; | 15 | FileToDoResource() {}; |
16 | // FIXME better parsing | ||
16 | bool save(const QString &name, const QValueList<ToDoEvent> &m_todos ){ | 17 | bool save(const QString &name, const QValueList<ToDoEvent> &m_todos ){ |
17 | // prepare the XML | 18 | // prepare the XML |
18 | XMLElement *tasks = new XMLElement( ); | 19 | XMLElement *tasks = new XMLElement( ); |
@@ -23,6 +24,7 @@ public: | |||
23 | map.insert( "Completed", QString::number((int)(*it).isCompleted() ) ); | 24 | map.insert( "Completed", QString::number((int)(*it).isCompleted() ) ); |
24 | map.insert( "HasDate", QString::number((int)(*it).hasDate() ) ); | 25 | map.insert( "HasDate", QString::number((int)(*it).hasDate() ) ); |
25 | map.insert( "Priority", QString::number( (*it).priority() ) ); | 26 | map.insert( "Priority", QString::number( (*it).priority() ) ); |
27 | map.insert( "Summary", (*it).summary() ); | ||
26 | QArray<int> arrat = (*it).categories(); | 28 | QArray<int> arrat = (*it).categories(); |
27 | QString attr; | 29 | QString attr; |
28 | for(uint i=0; i < arrat.count(); i++ ){ | 30 | for(uint i=0; i < arrat.count(); i++ ){ |
@@ -111,11 +113,13 @@ public: | |||
111 | //description | 113 | //description |
112 | dummy = element->attribute("Description" ); | 114 | dummy = element->attribute("Description" ); |
113 | event.setDescription( dummy ); | 115 | event.setDescription( dummy ); |
116 | dummy = element->attribute("Summary" ); | ||
117 | event.setSummary( dummy ); | ||
114 | // category | 118 | // category |
115 | dummy = element->attribute("Categories" ); | 119 | dummy = element->attribute("Categories" ); |
116 | QStringList ids = QStringList::split(";", dummy ); | 120 | QStringList ids = QStringList::split(";", dummy ); |
117 | event.setCategories( ids ); | 121 | event.setCategories( ids ); |
118 | 122 | ||
119 | //uid | 123 | //uid |
120 | dummy = element->attribute("Uid" ); | 124 | dummy = element->attribute("Uid" ); |
121 | dumInt = dummy.toInt(&ok ); | 125 | dumInt = dummy.toInt(&ok ); |
@@ -181,7 +185,7 @@ QValueList<ToDoEvent> ToDoDB::effectiveToDos(const QDate &from, | |||
181 | QValueList<ToDoEvent> ToDoDB::overDue() | 185 | QValueList<ToDoEvent> ToDoDB::overDue() |
182 | { | 186 | { |
183 | QValueList<ToDoEvent> events; | 187 | QValueList<ToDoEvent> events; |
184 | for( QValueList<ToDoEvent>::Iterator it = m_todos.begin(); it!= m_todos.end(); ++it ){ | 188 | for( QValueList<ToDoEvent>::Iterator it = m_todos.begin(); it!= m_todos.end(); ++it ){ |
185 | if( (*it).isOverdue() ) | 189 | if( (*it).isOverdue() ) |
186 | events.append((*it) ); | 190 | events.append((*it) ); |
187 | } | 191 | } |
@@ -238,7 +242,7 @@ QString ToDoDB::fileName()const | |||
238 | } | 242 | } |
239 | void ToDoDB::load() | 243 | void ToDoDB::load() |
240 | { | 244 | { |
241 | m_todos = m_res->load( m_fileName ); | 245 | m_todos = m_res->load( m_fileName ); |
242 | } | 246 | } |
243 | bool ToDoDB::save() | 247 | bool ToDoDB::save() |
244 | { | 248 | { |
diff --git a/libopie/todoevent.cpp b/libopie/todoevent.cpp index aa348a2..fb7073c 100644 --- a/libopie/todoevent.cpp +++ b/libopie/todoevent.cpp | |||
@@ -17,21 +17,25 @@ ToDoEvent::ToDoEvent(const ToDoEvent &event ) | |||
17 | *this = event; | 17 | *this = event; |
18 | } | 18 | } |
19 | 19 | ||
20 | ToDoEvent::ToDoEvent(bool completed, int priority, const QStringList &category, | 20 | ToDoEvent::ToDoEvent(bool completed, int priority, |
21 | const QString &description, bool hasDate, QDate date, int uid ) | 21 | const QStringList &category, |
22 | const QString& summary, | ||
23 | const QString &description, | ||
24 | bool hasDate, QDate date, int uid ) | ||
22 | { | 25 | { |
23 | m_date = date; | 26 | m_date = date; |
24 | m_isCompleted = completed; | 27 | m_isCompleted = completed; |
25 | m_hasDate = hasDate; | 28 | m_hasDate = hasDate; |
26 | m_priority = priority; | 29 | m_priority = priority; |
27 | m_category = category; | 30 | m_category = category; |
31 | m_sum = summary; | ||
28 | m_desc = Qtopia::simplifyMultiLineSpace(description ); | 32 | m_desc = Qtopia::simplifyMultiLineSpace(description ); |
29 | if (uid == -1 ) { | 33 | if (uid == -1 ) { |
30 | Qtopia::UidGen *uidgen = new Qtopia::UidGen(); | 34 | Qtopia::UidGen *uidgen = new Qtopia::UidGen(); |
31 | uid = uidgen->generate(); | 35 | uid = uidgen->generate(); |
32 | delete uidgen; | 36 | delete uidgen; |
33 | }// generate the ids | 37 | }// generate the ids |
34 | m_uid = uid; | 38 | m_uid = uid; |
35 | } | 39 | } |
36 | QArray<int> ToDoEvent::categories()const | 40 | QArray<int> ToDoEvent::categories()const |
37 | { | 41 | { |
@@ -66,6 +70,14 @@ QStringList ToDoEvent::allCategories()const | |||
66 | { | 70 | { |
67 | return m_category; | 71 | return m_category; |
68 | } | 72 | } |
73 | QString ToDoEvent::extra(const QString& )const | ||
74 | { | ||
75 | return QString::null; | ||
76 | } | ||
77 | QString ToDoEvent::summary() const | ||
78 | { | ||
79 | return m_sum; | ||
80 | } | ||
69 | void ToDoEvent::insertCategory(const QString &str ) | 81 | void ToDoEvent::insertCategory(const QString &str ) |
70 | { | 82 | { |
71 | m_category.append( str ); | 83 | m_category.append( str ); |
@@ -99,6 +111,14 @@ void ToDoEvent::setDescription(const QString &desc ) | |||
99 | { | 111 | { |
100 | m_desc = Qtopia::simplifyMultiLineSpace(desc ); | 112 | m_desc = Qtopia::simplifyMultiLineSpace(desc ); |
101 | } | 113 | } |
114 | void ToDoEvent::setExtra( const QString&, const QString& ) | ||
115 | { | ||
116 | |||
117 | } | ||
118 | void ToDoEvent::setSummary( const QString& sum ) | ||
119 | { | ||
120 | m_sum = sum; | ||
121 | } | ||
102 | void ToDoEvent::setCategory( const QString &cat ) | 122 | void ToDoEvent::setCategory( const QString &cat ) |
103 | { | 123 | { |
104 | qWarning("setCategory %s", cat.latin1() ); | 124 | qWarning("setCategory %s", cat.latin1() ); |
@@ -127,9 +147,11 @@ QString ToDoEvent::richText() const | |||
127 | { | 147 | { |
128 | QString text; | 148 | QString text; |
129 | QStringList catlist; | 149 | QStringList catlist; |
130 | 150 | ||
131 | // Description of the todo | 151 | // Description of the todo |
132 | if ( !description().isEmpty() ){ | 152 | if ( !description().isEmpty() ){ |
153 | text += "<b>" + QObject::tr( "Summary:") + "</b><br>"; | ||
154 | text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | ||
133 | text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; | 155 | text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; |
134 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 156 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
135 | } | 157 | } |
@@ -140,7 +162,7 @@ QString ToDoEvent::richText() const | |||
140 | text += date().toString(); | 162 | text += date().toString(); |
141 | text += "<br>"; | 163 | text += "<br>"; |
142 | } | 164 | } |
143 | 165 | ||
144 | // Open database of all categories and get the list of | 166 | // Open database of all categories and get the list of |
145 | // the categories this todoevent belongs to. | 167 | // the categories this todoevent belongs to. |
146 | // Then print them... | 168 | // Then print them... |
@@ -149,7 +171,7 @@ QString ToDoEvent::richText() const | |||
149 | bool firstloop = true; | 171 | bool firstloop = true; |
150 | catdb.load( categoryFileName() ); | 172 | catdb.load( categoryFileName() ); |
151 | catlist = allCategories(); | 173 | catlist = allCategories(); |
152 | 174 | ||
153 | text += "<b>" + QObject::tr( "Category:") + "</b> "; | 175 | text += "<b>" + QObject::tr( "Category:") + "</b> "; |
154 | for ( QStringList::Iterator it = catlist.begin(); it != catlist.end(); ++it ) { | 176 | for ( QStringList::Iterator it = catlist.begin(); it != catlist.end(); ++it ) { |
155 | if (!firstloop){ | 177 | if (!firstloop){ |
@@ -215,7 +237,13 @@ bool ToDoEvent::operator>=(const ToDoEvent &toDoEvent )const | |||
215 | } | 237 | } |
216 | bool ToDoEvent::operator==(const ToDoEvent &toDoEvent )const | 238 | bool ToDoEvent::operator==(const ToDoEvent &toDoEvent )const |
217 | { | 239 | { |
218 | if( m_date == toDoEvent.m_date && m_isCompleted == toDoEvent.m_isCompleted && m_hasDate == toDoEvent.m_hasDate && m_priority == toDoEvent.m_priority && m_category == toDoEvent.m_category && m_desc == toDoEvent.m_desc ) | 240 | if( m_priority == toDoEvent.m_priority && |
241 | m_isCompleted == toDoEvent.m_isCompleted && | ||
242 | m_hasDate == toDoEvent.m_hasDate && | ||
243 | m_date == toDoEvent.m_date && | ||
244 | m_category == toDoEvent.m_category && | ||
245 | m_sum == toDoEvent.m_sum && | ||
246 | m_desc == toDoEvent.m_desc ) | ||
219 | return true; | 247 | return true; |
220 | return false; | 248 | return false; |
221 | } | 249 | } |
@@ -228,6 +256,7 @@ ToDoEvent &ToDoEvent::operator=(const ToDoEvent &item ) | |||
228 | m_category = item.m_category; | 256 | m_category = item.m_category; |
229 | m_desc = item.m_desc; | 257 | m_desc = item.m_desc; |
230 | m_uid = item.m_uid; | 258 | m_uid = item.m_uid; |
259 | m_sum = item.m_sum; | ||
231 | return *this; | 260 | return *this; |
232 | } | 261 | } |
233 | 262 | ||
diff --git a/libopie/todoevent.h b/libopie/todoevent.h index 8a00f99..7454241 100644 --- a/libopie/todoevent.h +++ b/libopie/todoevent.h | |||
@@ -2,6 +2,7 @@ | |||
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> |
@@ -15,14 +16,16 @@ class 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 | ||
@@ -43,27 +46,81 @@ class ToDoEvent { | |||
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; |
@@ -85,6 +142,8 @@ class ToDoEvent { | |||
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 | ||
diff --git a/libopie/todovcalresource.cpp b/libopie/todovcalresource.cpp index 75f2197..80f8c60 100644 --- a/libopie/todovcalresource.cpp +++ b/libopie/todovcalresource.cpp | |||
@@ -2,24 +2,24 @@ | |||
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Holger Freyther <freyther@kde.org> | 3 | .=l. Copyright (c) 2002 Holger Freyther <freyther@kde.org> |
4 | .>+-= the use of vobject was inspired by libkcal | 4 | .>+-= the use of vobject was inspired by libkcal |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
@@ -50,7 +50,7 @@ static VObject *vobjByEvent( const ToDoEvent &event ) | |||
50 | addPropValue( task, VCPriorityProp, string.local8Bit() ); | 50 | addPropValue( task, VCPriorityProp, string.local8Bit() ); |
51 | addPropValue( task, VCCategoriesProp, event.allCategories().join(";").local8Bit() ); | 51 | addPropValue( task, VCCategoriesProp, event.allCategories().join(";").local8Bit() ); |
52 | addPropValue( task, VCDescriptionProp, event.description().local8Bit() ); | 52 | addPropValue( task, VCDescriptionProp, event.description().local8Bit() ); |
53 | addPropValue( task, VCSummaryProp, event.description().left(15).local8Bit() ); | 53 | addPropValue( task, VCSummaryProp, event.summary().left(15).local8Bit() ); |
54 | return task; | 54 | return task; |
55 | }; | 55 | }; |
56 | 56 | ||
@@ -63,7 +63,12 @@ static ToDoEvent eventByVObj( VObject *obj ){ | |||
63 | if( ( ob = isAPropertyOf( obj, VCDescriptionProp )) != 0 ){ | 63 | if( ( ob = isAPropertyOf( obj, VCDescriptionProp )) != 0 ){ |
64 | name = vObjectStringZValue( ob ); | 64 | name = vObjectStringZValue( ob ); |
65 | event.setDescription( name ); | 65 | event.setDescription( name ); |
66 | } | 66 | } |
67 | // summary | ||
68 | if ( ( ob = isAPropertyOf( obj, VCSummaryProp ) ) != 0 ) { | ||
69 | name = vObjectStringZValue( ob ); | ||
70 | event.setSummary( name ); | ||
71 | } | ||
67 | // completed | 72 | // completed |
68 | if( ( ob = isAPropertyOf( obj, VCStatusProp )) != 0 ){ | 73 | if( ( ob = isAPropertyOf( obj, VCStatusProp )) != 0 ){ |
69 | name = vObjectStringZValue( ob ); | 74 | name = vObjectStringZValue( ob ); |
@@ -85,7 +90,7 @@ static ToDoEvent eventByVObj( VObject *obj ){ | |||
85 | event.setHasDate( true ); | 90 | event.setHasDate( true ); |
86 | name = vObjectStringZValue( ob ); | 91 | name = vObjectStringZValue( ob ); |
87 | event.setDate( TimeConversion::fromISO8601( name).date() ); | 92 | event.setDate( TimeConversion::fromISO8601( name).date() ); |
88 | } | 93 | } |
89 | // categories | 94 | // categories |
90 | if((ob = isAPropertyOf( obj, VCCategoriesProp )) != 0 ){ | 95 | if((ob = isAPropertyOf( obj, VCCategoriesProp )) != 0 ){ |
91 | name = vObjectStringZValue( ob ); | 96 | name = vObjectStringZValue( ob ); |
@@ -96,7 +101,7 @@ static ToDoEvent eventByVObj( VObject *obj ){ | |||
96 | }; | 101 | }; |
97 | 102 | ||
98 | 103 | ||
99 | QValueList<ToDoEvent> ToDoVCalResource::load(const QString &file) | 104 | QValueList<ToDoEvent> ToDoVCalResource::load(const QString &file) |
100 | { | 105 | { |
101 | QValueList<ToDoEvent> events; | 106 | QValueList<ToDoEvent> events; |
102 | VObject *vcal = 0l; | 107 | VObject *vcal = 0l; |