-rw-r--r-- | korganizer/koeventviewer.cpp | 5 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 13 | ||||
-rw-r--r-- | korganizer/main.cpp | 2 |
3 files changed, 17 insertions, 3 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index e938e4e..1fcc977 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -114,467 +114,468 @@ void KOEventViewer::setSource(const QString& n) | |||
114 | if ( "uid:"+a->uid() == n ) { | 114 | if ( "uid:"+a->uid() == n ) { |
115 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); | 115 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); |
116 | return; | 116 | return; |
117 | } | 117 | } |
118 | } | 118 | } |
119 | } | 119 | } |
120 | return; | 120 | return; |
121 | } | 121 | } |
122 | //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 122 | //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
123 | // the result should now arrive through method insertAttendees | 123 | // the result should now arrive through method insertAttendees |
124 | //QString uid = "uid:"+(*it).uid(); | 124 | //QString uid = "uid:"+(*it).uid(); |
125 | #endif | 125 | #endif |
126 | if ( n.left(6) == "mailto" ) { | 126 | if ( n.left(6) == "mailto" ) { |
127 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); | 127 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); |
128 | #ifndef DESKTOP_VERSION | 128 | #ifndef DESKTOP_VERSION |
129 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); | 129 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); |
130 | e << n.mid(7); | 130 | e << n.mid(7); |
131 | #endif | 131 | #endif |
132 | 132 | ||
133 | } | 133 | } |
134 | 134 | ||
135 | 135 | ||
136 | #ifndef KORG_NODCOP | 136 | #ifndef KORG_NODCOP |
137 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; | 137 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; |
138 | QString tmpStr; | 138 | QString tmpStr; |
139 | if (n.startsWith("mailto:")) { | 139 | if (n.startsWith("mailto:")) { |
140 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); | 140 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); |
141 | //emit showIncidence(n); | 141 | //emit showIncidence(n); |
142 | return; | 142 | return; |
143 | } else if (n.startsWith("uid:")) { | 143 | } else if (n.startsWith("uid:")) { |
144 | DCOPClient *client = KApplication::kApplication()->dcopClient(); | 144 | DCOPClient *client = KApplication::kApplication()->dcopClient(); |
145 | const QByteArray noParamData; | 145 | const QByteArray noParamData; |
146 | const QByteArray paramData; | 146 | const QByteArray paramData; |
147 | QByteArray replyData; | 147 | QByteArray replyData; |
148 | QCString replyTypeStr; | 148 | QCString replyTypeStr; |
149 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) | 149 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) |
150 | bool foundAbbrowser = PING_ABBROWSER; | 150 | bool foundAbbrowser = PING_ABBROWSER; |
151 | 151 | ||
152 | if (foundAbbrowser) { | 152 | if (foundAbbrowser) { |
153 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor | 153 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor |
154 | //client->send("kaddressbook","KAddressBookIface", | 154 | //client->send("kaddressbook","KAddressBookIface", |
155 | QDataStream arg(paramData, IO_WriteOnly); | 155 | QDataStream arg(paramData, IO_WriteOnly); |
156 | arg << n.mid(6); | 156 | arg << n.mid(6); |
157 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); | 157 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); |
158 | return; | 158 | return; |
159 | } else { | 159 | } else { |
160 | /* | 160 | /* |
161 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. | 161 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. |
162 | We start it without its main interface | 162 | We start it without its main interface |
163 | */ | 163 | */ |
164 | KIconLoader* iconLoader = new KIconLoader(); | 164 | KIconLoader* iconLoader = new KIconLoader(); |
165 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); | 165 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); |
166 | ActionManager::setStartedKAddressBook(true); | 166 | ActionManager::setStartedKAddressBook(true); |
167 | tmpStr = "kaddressbook --editor-only --uid "; | 167 | tmpStr = "kaddressbook --editor-only --uid "; |
168 | tmpStr += KProcess::quote(n.mid(6)); | 168 | tmpStr += KProcess::quote(n.mid(6)); |
169 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); | 169 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); |
170 | return; | 170 | return; |
171 | } | 171 | } |
172 | } else { | 172 | } else { |
173 | //QTextBrowser::setSource(n); | 173 | //QTextBrowser::setSource(n); |
174 | } | 174 | } |
175 | #endif | 175 | #endif |
176 | } | 176 | } |
177 | 177 | ||
178 | void KOEventViewer::addTag(const QString & tag,const QString & text) | 178 | void KOEventViewer::addTag(const QString & tag,const QString & text) |
179 | { | 179 | { |
180 | int number=text.contains("\n"); | 180 | int number=text.contains("\n"); |
181 | QString str = "<" + tag + ">"; | 181 | QString str = "<" + tag + ">"; |
182 | QString tmpText=text; | 182 | QString tmpText=text; |
183 | QString tmpStr=str; | 183 | QString tmpStr=str; |
184 | if(number !=-1) | 184 | if(number !=-1) |
185 | { | 185 | { |
186 | if (number > 0) { | 186 | if (number > 0) { |
187 | int pos=0; | 187 | int pos=0; |
188 | QString tmp; | 188 | QString tmp; |
189 | for(int i=0;i<=number;i++) { | 189 | for(int i=0;i<=number;i++) { |
190 | pos=tmpText.find("\n"); | 190 | pos=tmpText.find("\n"); |
191 | tmp=tmpText.left(pos); | 191 | tmp=tmpText.left(pos); |
192 | tmpText=tmpText.right(tmpText.length()-pos-1); | 192 | tmpText=tmpText.right(tmpText.length()-pos-1); |
193 | tmpStr+=tmp+"<br>"; | 193 | tmpStr+=tmp+"<br>"; |
194 | } | 194 | } |
195 | } | 195 | } |
196 | else tmpStr += tmpText; | 196 | else tmpStr += tmpText; |
197 | tmpStr+="</" + tag + ">"; | 197 | tmpStr+="</" + tag + ">"; |
198 | mText.append(tmpStr); | 198 | mText.append(tmpStr); |
199 | } | 199 | } |
200 | else | 200 | else |
201 | { | 201 | { |
202 | str += text + "</" + tag + ">"; | 202 | str += text + "</" + tag + ">"; |
203 | mText.append(str); | 203 | mText.append(str); |
204 | } | 204 | } |
205 | } | 205 | } |
206 | 206 | ||
207 | void KOEventViewer::setColorMode( int m ) | 207 | void KOEventViewer::setColorMode( int m ) |
208 | { | 208 | { |
209 | mColorMode = m; | 209 | mColorMode = m; |
210 | } | 210 | } |
211 | void KOEventViewer::appendEvent(Event *event, int mode ) | 211 | void KOEventViewer::appendEvent(Event *event, int mode ) |
212 | { | 212 | { |
213 | mMailSubject = ""; | 213 | mMailSubject = ""; |
214 | mCurrentIncidence = event; | 214 | mCurrentIncidence = event; |
215 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 215 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
216 | topLevelWidget()->setCaption(i18n("Event Viewer")); | 216 | topLevelWidget()->setCaption(i18n("Event Viewer")); |
217 | if ( mode == 0 ) { | 217 | if ( mode == 0 ) { |
218 | addTag("h2",event->summary()); | 218 | addTag("h2",event->summary()); |
219 | } | 219 | } |
220 | else { | 220 | else { |
221 | if ( mColorMode == 1 ) { | 221 | if ( mColorMode == 1 ) { |
222 | mText +="<font color=\"#00A000\">"; | 222 | mText +="<font color=\"#00A000\">"; |
223 | } | 223 | } |
224 | if ( mColorMode == 2 ) { | 224 | if ( mColorMode == 2 ) { |
225 | mText +="<font color=\"#C00000\">"; | 225 | mText +="<font color=\"#C00000\">"; |
226 | } | 226 | } |
227 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 227 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
228 | if ( mode == 1 ) { | 228 | if ( mode == 1 ) { |
229 | addTag("h2",i18n( "Local: " ) +event->summary()); | 229 | addTag("h2",i18n( "Local: " ) +event->summary()); |
230 | } else { | 230 | } else { |
231 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 231 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
232 | } | 232 | } |
233 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 233 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
234 | if ( mColorMode ) | 234 | if ( mColorMode ) |
235 | mText += "</font>"; | 235 | mText += "</font>"; |
236 | } | 236 | } |
237 | mMailSubject += i18n( "Meeting " )+ event->summary(); | 237 | mMailSubject += i18n( "Meeting " )+ event->summary(); |
238 | if (event->cancelled ()) { | 238 | if (event->cancelled ()) { |
239 | mText +="<font color=\"#B00000\">"; | 239 | mText +="<font color=\"#B00000\">"; |
240 | addTag("i",i18n("This event has been cancelled!")); | 240 | addTag("i",i18n("This event has been cancelled!")); |
241 | mText.append("<br>"); | 241 | mText.append("<br>"); |
242 | mText += "</font>"; | 242 | mText += "</font>"; |
243 | mMailSubject += i18n("(cancelled)"); | 243 | mMailSubject += i18n("(cancelled)"); |
244 | } | 244 | } |
245 | if (!event->location().isEmpty()) { | 245 | if (!event->location().isEmpty()) { |
246 | addTag("b",i18n("Location: ")); | 246 | addTag("b",i18n("Location: ")); |
247 | mText.append(event->location()+"<br>"); | 247 | mText.append(event->location()+"<br>"); |
248 | mMailSubject += i18n(" at ") + event->location(); | 248 | mMailSubject += i18n(" at ") + event->location(); |
249 | } | 249 | } |
250 | if (event->doesFloat()) { | 250 | if (event->doesFloat()) { |
251 | if (event->isMultiDay()) { | 251 | if (event->isMultiDay()) { |
252 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 252 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
253 | .arg(event->dtStartDateStr(shortDate)) | 253 | .arg(event->dtStartDateStr(shortDate)) |
254 | .arg(event->dtEndDateStr(shortDate))); | 254 | .arg(event->dtEndDateStr(shortDate))); |
255 | } else { | 255 | } else { |
256 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 256 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
257 | } | 257 | } |
258 | } else { | 258 | } else { |
259 | if (event->isMultiDay()) { | 259 | if (event->isMultiDay()) { |
260 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 260 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
261 | .arg(event->dtStartStr( shortDate))); | 261 | .arg(event->dtStartStr( shortDate))); |
262 | mText.append(i18n("<p><b>To:</b> %1</p>") | 262 | mText.append(i18n("<p><b>To:</b> %1</p>") |
263 | .arg(event->dtEndStr(shortDate))); | 263 | .arg(event->dtEndStr(shortDate))); |
264 | } else { | 264 | } else { |
265 | mText.append(i18n("<p><b>On:</b> %1</p> ") | 265 | mText.append(i18n("<p><b>On:</b> %1</p> ") |
266 | .arg(event->dtStartDateStr( shortDate ))); | 266 | .arg(event->dtStartDateStr( shortDate ))); |
267 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 267 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
268 | .arg(event->dtStartTimeStr()) | 268 | .arg(event->dtStartTimeStr()) |
269 | .arg(event->dtEndTimeStr())); | 269 | .arg(event->dtEndTimeStr())); |
270 | } | 270 | } |
271 | } | 271 | } |
272 | 272 | ||
273 | if (event->recurrence()->doesRecur()) { | 273 | if (event->recurrence()->doesRecur()) { |
274 | 274 | ||
275 | QString recurText = event->recurrence()->recurrenceText(); | 275 | QString recurText = event->recurrence()->recurrenceText(); |
276 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 276 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
277 | bool last; | 277 | bool last; |
278 | QDate start = QDate::currentDate(); | 278 | QDate start = QDate::currentDate(); |
279 | QDate next; | 279 | QDate next; |
280 | next = event->recurrence()->getPreviousDate( start , &last ); | 280 | next = event->recurrence()->getPreviousDate( start , &last ); |
281 | if ( !last ) { | 281 | if ( !last ) { |
282 | next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); | 282 | next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); |
283 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 283 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
284 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); | 284 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); |
285 | QDateTime nextdt = QDateTime( next, event->dtStart().time()); | 285 | QDateTime nextdt = QDateTime( next, event->dtStart().time()); |
286 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true ); | 286 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true ); |
287 | 287 | ||
288 | } else { | 288 | } else { |
289 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 289 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); |
290 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); | 290 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); |
291 | } | 291 | } |
292 | } else { | 292 | } else { |
293 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); | 293 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); |
294 | 294 | ||
295 | } | 295 | } |
296 | 296 | ||
297 | 297 | ||
298 | if (event->isAlarmEnabled()) { | 298 | if (event->isAlarmEnabled()) { |
299 | Alarm *alarm =event->alarms().first() ; | 299 | Alarm *alarm =event->alarms().first() ; |
300 | QDateTime t = alarm->time(); | 300 | QDateTime t = alarm->time(); |
301 | int min = t.secsTo( event->dtStart() )/60; | 301 | int min = t.secsTo( event->dtStart() )/60; |
302 | QString s =i18n("( %1 min before )").arg( min ); | 302 | QString s =i18n("( %1 min before )").arg( min ); |
303 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 303 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
304 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 304 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
305 | //addTag("p",s); | 305 | //addTag("p",s); |
306 | } | 306 | } |
307 | 307 | ||
308 | addTag("b",i18n("Access: ")); | 308 | addTag("b",i18n("Access: ")); |
309 | mText.append(event->secrecyStr()+"<br>"); | 309 | mText.append(event->secrecyStr()+"<br>"); |
310 | if (!event->description().isEmpty()) { | 310 | if (!event->description().isEmpty()) { |
311 | addTag("p",i18n("<b>Details: </b>")); | 311 | addTag("p",i18n("<b>Details: </b>")); |
312 | addTag("p",event->description()); | 312 | addTag("p",event->description()); |
313 | } | 313 | } |
314 | 314 | ||
315 | formatCategories(event); | 315 | formatCategories(event); |
316 | 316 | ||
317 | formatReadOnly(event); | 317 | formatReadOnly(event); |
318 | formatAttendees(event); | 318 | formatAttendees(event); |
319 | 319 | ||
320 | setText(mText); | 320 | setText(mText); |
321 | //QWhatsThis::add(this,mText); | 321 | //QWhatsThis::add(this,mText); |
322 | 322 | ||
323 | } | 323 | } |
324 | 324 | ||
325 | void KOEventViewer::appendTodo(Todo *event, int mode ) | 325 | void KOEventViewer::appendTodo(Todo *event, int mode ) |
326 | { | 326 | { |
327 | mMailSubject = ""; | 327 | mMailSubject = ""; |
328 | mCurrentIncidence = event; | 328 | mCurrentIncidence = event; |
329 | topLevelWidget()->setCaption(i18n("Todo Viewer")); | 329 | topLevelWidget()->setCaption(i18n("Todo Viewer")); |
330 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 330 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
331 | if (mode == 0 ) | 331 | if (mode == 0 ) |
332 | addTag("h2",event->summary()); | 332 | addTag("h2",event->summary()); |
333 | else { | 333 | else { |
334 | if ( mColorMode == 1 ) { | 334 | if ( mColorMode == 1 ) { |
335 | mText +="<font color=\"#00A000\">"; | 335 | mText +="<font color=\"#00A000\">"; |
336 | } | 336 | } |
337 | if ( mColorMode == 2 ) { | 337 | if ( mColorMode == 2 ) { |
338 | mText +="<font color=\"#B00000\">"; | 338 | mText +="<font color=\"#B00000\">"; |
339 | } | 339 | } |
340 | if ( mode == 1 ) { | 340 | if ( mode == 1 ) { |
341 | addTag("h2",i18n( "Local: " ) +event->summary()); | 341 | addTag("h2",i18n( "Local: " ) +event->summary()); |
342 | } else { | 342 | } else { |
343 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 343 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
344 | } | 344 | } |
345 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 345 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
346 | if ( mColorMode ) | 346 | if ( mColorMode ) |
347 | mText += "</font>"; | 347 | mText += "</font>"; |
348 | } | 348 | } |
349 | mMailSubject += i18n( "Todo " )+ event->summary(); | 349 | mMailSubject += i18n( "Todo " )+ event->summary(); |
350 | if (event->cancelled ()) { | 350 | if (event->cancelled ()) { |
351 | mText +="<font color=\"#B00000\">"; | 351 | mText +="<font color=\"#B00000\">"; |
352 | addTag("i",i18n("This todo has been cancelled!")); | 352 | addTag("i",i18n("This todo has been cancelled!")); |
353 | mText.append("<br>"); | 353 | mText.append("<br>"); |
354 | mText += "</font>"; | 354 | mText += "</font>"; |
355 | mMailSubject += i18n("(cancelled)"); | 355 | mMailSubject += i18n("(cancelled)"); |
356 | } | 356 | } |
357 | 357 | ||
358 | if (!event->location().isEmpty()) { | 358 | if (!event->location().isEmpty()) { |
359 | addTag("b",i18n("Location: ")); | 359 | addTag("b",i18n("Location: ")); |
360 | mText.append(event->location()+"<br>"); | 360 | mText.append(event->location()+"<br>"); |
361 | mMailSubject += i18n(" at ") + event->location(); | 361 | mMailSubject += i18n(" at ") + event->location(); |
362 | } | 362 | } |
363 | if (event->hasDueDate()) { | 363 | if (event->hasDueDate()) { |
364 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 364 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
365 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | 365 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); |
366 | } | 366 | } |
367 | addTag("b",i18n("Access: ")); | 367 | addTag("b",i18n("Access: ")); |
368 | mText.append(event->secrecyStr()+"<br>"); | 368 | mText.append(event->secrecyStr()+"<br>"); |
369 | if (!event->description().isEmpty()) { | 369 | if (!event->description().isEmpty()) { |
370 | addTag("p",i18n("<b>Details: </b>")); | 370 | addTag("p",i18n("<b>Details: </b>")); |
371 | addTag("p",event->description()); | 371 | addTag("p",event->description()); |
372 | } | 372 | } |
373 | 373 | ||
374 | formatCategories(event); | 374 | formatCategories(event); |
375 | 375 | ||
376 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 376 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
377 | .arg(QString::number(event->priority()))); | 377 | .arg(QString::number(event->priority()))); |
378 | 378 | ||
379 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 379 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
380 | .arg(event->percentComplete())); | 380 | .arg(event->percentComplete())); |
381 | 381 | ||
382 | formatReadOnly(event); | 382 | formatReadOnly(event); |
383 | formatAttendees(event); | 383 | formatAttendees(event); |
384 | 384 | ||
385 | setText(mText); | 385 | setText(mText); |
386 | } | 386 | } |
387 | 387 | ||
388 | void KOEventViewer::formatCategories(Incidence *event) | 388 | void KOEventViewer::formatCategories(Incidence *event) |
389 | { | 389 | { |
390 | if (!event->categoriesStr().isEmpty()) { | 390 | if (!event->categoriesStr().isEmpty()) { |
391 | if (event->categories().count() == 1) { | 391 | if (event->categories().count() == 1) { |
392 | addTag("h3",i18n("Category")); | 392 | addTag("h3",i18n("Category")); |
393 | } else { | 393 | } else { |
394 | addTag("h3",i18n("Categories")); | 394 | addTag("h3",i18n("Categories")); |
395 | } | 395 | } |
396 | addTag("p",event->categoriesStr()); | 396 | addTag("p",event->categoriesStr()); |
397 | } | 397 | } |
398 | } | 398 | } |
399 | void KOEventViewer::formatAttendees(Incidence *event) | 399 | void KOEventViewer::formatAttendees(Incidence *event) |
400 | { | 400 | { |
401 | QPtrList<Attendee> attendees = event->attendees(); | 401 | QPtrList<Attendee> attendees = event->attendees(); |
402 | if (attendees.count()) { | 402 | if (attendees.count()) { |
403 | 403 | ||
404 | 404 | ||
405 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 405 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
406 | addTag("h3",i18n("Organizer")); | 406 | addTag("h3",i18n("Organizer")); |
407 | mText.append("<ul><li>"); | 407 | mText.append("<ul><li>"); |
408 | #ifndef KORG_NOKABC | 408 | #ifndef KORG_NOKABC |
409 | 409 | ||
410 | #ifdef DESKTOP_VERSION | 410 | #ifdef DESKTOP_VERSION |
411 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 411 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
412 | KABC::Addressee::List addressList; | 412 | KABC::Addressee::List addressList; |
413 | addressList = add_book->findByEmail(event->organizer()); | 413 | addressList = add_book->findByEmail(event->organizer()); |
414 | KABC::Addressee o = addressList.first(); | 414 | KABC::Addressee o = addressList.first(); |
415 | if (!o.isEmpty() && addressList.size()<2) { | 415 | if (!o.isEmpty() && addressList.size()<2) { |
416 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 416 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
417 | mText += o.formattedName(); | 417 | mText += o.formattedName(); |
418 | mText += "</a>\n"; | 418 | mText += "</a>\n"; |
419 | } else { | 419 | } else { |
420 | mText.append(event->organizer()); | 420 | mText.append(event->organizer()); |
421 | } | 421 | } |
422 | #else //DESKTOP_VERSION | 422 | #else //DESKTOP_VERSION |
423 | mText += "<a href=\"uid:organizer\">"; | 423 | mText += "<a href=\"uid:organizer\">"; |
424 | mText += event->organizer(); | 424 | mText += event->organizer(); |
425 | mText += "</a>\n"; | 425 | mText += "</a>\n"; |
426 | #endif //DESKTOP_VERSION | 426 | #endif //DESKTOP_VERSION |
427 | 427 | ||
428 | 428 | ||
429 | #else | 429 | #else |
430 | mText.append(event->organizer()); | 430 | mText.append(event->organizer()); |
431 | #endif | 431 | #endif |
432 | 432 | ||
433 | if (iconPath) { | 433 | if (iconPath) { |
434 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 434 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
435 | mText += "<IMG src=\"" + iconPath + "\">"; | 435 | mText += "<IMG src=\"" + iconPath + "\">"; |
436 | mText += "</a>\n"; | 436 | mText += "</a>\n"; |
437 | } | 437 | } |
438 | mText.append("</li></ul>"); | 438 | mText.append("</li></ul>"); |
439 | 439 | ||
440 | addTag("h3",i18n("Attendees")); | 440 | addTag("h3",i18n("Attendees")); |
441 | Attendee *a; | 441 | Attendee *a; |
442 | mText.append("<ul>"); | 442 | mText.append("<ul>"); |
443 | for(a=attendees.first();a;a=attendees.next()) { | 443 | for(a=attendees.first();a;a=attendees.next()) { |
444 | #ifndef KORG_NOKABC | 444 | #ifndef KORG_NOKABC |
445 | #ifdef DESKTOP_VERSION | 445 | #ifdef DESKTOP_VERSION |
446 | if (a->name().isEmpty()) { | 446 | if (a->name().isEmpty()) { |
447 | addressList = add_book->findByEmail(a->email()); | 447 | addressList = add_book->findByEmail(a->email()); |
448 | KABC::Addressee o = addressList.first(); | 448 | KABC::Addressee o = addressList.first(); |
449 | if (!o.isEmpty() && addressList.size()<2) { | 449 | if (!o.isEmpty() && addressList.size()<2) { |
450 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 450 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
451 | mText += o.formattedName(); | 451 | mText += o.formattedName(); |
452 | mText += "</a>\n"; | 452 | mText += "</a>\n"; |
453 | } else { | 453 | } else { |
454 | mText += "<li>"; | 454 | mText += "<li>"; |
455 | mText.append(a->email()); | 455 | mText.append(a->email()); |
456 | mText += "\n"; | 456 | mText += "\n"; |
457 | } | 457 | } |
458 | } else { | 458 | } else { |
459 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 459 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
460 | if (!a->name().isEmpty()) mText += a->name(); | 460 | if (!a->name().isEmpty()) mText += a->name(); |
461 | else mText += a->email(); | 461 | else mText += a->email(); |
462 | mText += "</a>\n"; | 462 | mText += "</a>\n"; |
463 | } | 463 | } |
464 | #else //DESKTOP_VERSION | 464 | #else //DESKTOP_VERSION |
465 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 465 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
466 | if (!a->name().isEmpty()) mText += a->name(); | 466 | if (!a->name().isEmpty()) mText += a->name(); |
467 | else mText += a->email(); | 467 | else mText += a->email(); |
468 | mText += "</a>\n"; | 468 | mText += "</a>\n"; |
469 | #endif //DESKTOP_VERSION | 469 | #endif //DESKTOP_VERSION |
470 | #else | 470 | #else |
471 | //qDebug("nokabc "); | 471 | //qDebug("nokabc "); |
472 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 472 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
473 | if (!a->name().isEmpty()) mText += a->name(); | 473 | if (!a->name().isEmpty()) mText += a->name(); |
474 | else mText += a->email(); | 474 | else mText += a->email(); |
475 | mText += "</a>\n"; | 475 | mText += "</a>\n"; |
476 | #endif | 476 | #endif |
477 | 477 | ||
478 | 478 | ||
479 | if (!a->email().isEmpty()) { | 479 | if (!a->email().isEmpty()) { |
480 | if (iconPath) { | 480 | if (iconPath) { |
481 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; | 481 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; |
482 | mText += "<IMG src=\"" + iconPath + "\">"; | 482 | mText += "<IMG src=\"" + iconPath + "\">"; |
483 | mText += "</a>\n"; | 483 | mText += "</a>\n"; |
484 | } | 484 | } |
485 | } | 485 | } |
486 | if (a->status() != Attendee::NeedsAction ) | 486 | if (a->status() != Attendee::NeedsAction ) |
487 | mText +="[" + a->statusStr() + "] "; | 487 | mText +="[" + a->statusStr() + "] "; |
488 | if (a->role() == Attendee::Chair ) | 488 | if (a->role() == Attendee::Chair ) |
489 | mText +="(" + a->roleStr().left(1) + ".)"; | 489 | mText +="(" + a->roleStr().left(1) + ".)"; |
490 | } | 490 | } |
491 | mText.append("</li></ul>"); | 491 | mText.append("</li></ul>"); |
492 | } | 492 | } |
493 | 493 | ||
494 | } | 494 | } |
495 | void KOEventViewer::appendJournal(Journal *jour, int mode ) | 495 | void KOEventViewer::appendJournal(Journal *jour, int mode ) |
496 | { | 496 | { |
497 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 497 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
498 | if (mode == 0 ) | 498 | if (mode == 0 ) { |
499 | addTag("h2",i18n("Journal from: ")); | 499 | addTag("h2",i18n("Journal from: ")); |
500 | } | ||
500 | else { | 501 | else { |
501 | if ( mode == 1 ) { | 502 | if ( mode == 1 ) { |
502 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); | 503 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); |
503 | } else { | 504 | } else { |
504 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); | 505 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); |
505 | } | 506 | } |
506 | addTag("h3",i18n( "Last modified " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); | ||
507 | } | 507 | } |
508 | topLevelWidget()->setCaption("Journal Viewer"); | 508 | topLevelWidget()->setCaption("Journal Viewer"); |
509 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); | 509 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); |
510 | addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); | ||
510 | if (!jour->description().isEmpty()) { | 511 | if (!jour->description().isEmpty()) { |
511 | addTag("p",jour->description()); | 512 | addTag("p",jour->description()); |
512 | } | 513 | } |
513 | setText(mText); | 514 | setText(mText); |
514 | } | 515 | } |
515 | 516 | ||
516 | void KOEventViewer::formatReadOnly(Incidence *event) | 517 | void KOEventViewer::formatReadOnly(Incidence *event) |
517 | { | 518 | { |
518 | if (event->isReadOnly()) { | 519 | if (event->isReadOnly()) { |
519 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); | 520 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); |
520 | } | 521 | } |
521 | } | 522 | } |
522 | void KOEventViewer::setSyncMode( bool b ) | 523 | void KOEventViewer::setSyncMode( bool b ) |
523 | { | 524 | { |
524 | mSyncMode = b; | 525 | mSyncMode = b; |
525 | } | 526 | } |
526 | 527 | ||
527 | 528 | ||
528 | void KOEventViewer::setTodo(Todo *event, bool clearV ) | 529 | void KOEventViewer::setTodo(Todo *event, bool clearV ) |
529 | { | 530 | { |
530 | if ( clearV ) | 531 | if ( clearV ) |
531 | clearEvents(); | 532 | clearEvents(); |
532 | if ( mSyncMode ) { | 533 | if ( mSyncMode ) { |
533 | if ( clearV ) | 534 | if ( clearV ) |
534 | appendTodo(event,1 ); | 535 | appendTodo(event,1 ); |
535 | else | 536 | else |
536 | appendTodo(event,2); | 537 | appendTodo(event,2); |
537 | } else | 538 | } else |
538 | appendTodo(event); | 539 | appendTodo(event); |
539 | } | 540 | } |
540 | void KOEventViewer::setJournal(Journal *event, bool clearV ) | 541 | void KOEventViewer::setJournal(Journal *event, bool clearV ) |
541 | { | 542 | { |
542 | if ( clearV ) | 543 | if ( clearV ) |
543 | clearEvents(); | 544 | clearEvents(); |
544 | if ( mSyncMode ) { | 545 | if ( mSyncMode ) { |
545 | if ( clearV ) | 546 | if ( clearV ) |
546 | appendJournal(event, 1); | 547 | appendJournal(event, 1); |
547 | else | 548 | else |
548 | appendJournal(event, 2); | 549 | appendJournal(event, 2); |
549 | } else | 550 | } else |
550 | appendJournal(event); | 551 | appendJournal(event); |
551 | } | 552 | } |
552 | 553 | ||
553 | void KOEventViewer::setEvent(Event *event) | 554 | void KOEventViewer::setEvent(Event *event) |
554 | { | 555 | { |
555 | clearEvents(); | 556 | clearEvents(); |
556 | if ( mSyncMode ) | 557 | if ( mSyncMode ) |
557 | appendEvent(event, 1); | 558 | appendEvent(event, 1); |
558 | else | 559 | else |
559 | appendEvent(event); | 560 | appendEvent(event); |
560 | } | 561 | } |
561 | 562 | ||
562 | void KOEventViewer::addEvent(Event *event) | 563 | void KOEventViewer::addEvent(Event *event) |
563 | { | 564 | { |
564 | if ( mSyncMode ) | 565 | if ( mSyncMode ) |
565 | appendEvent(event, 2); | 566 | appendEvent(event, 2); |
566 | else | 567 | else |
567 | appendEvent(event); | 568 | appendEvent(event); |
568 | } | 569 | } |
569 | 570 | ||
570 | void KOEventViewer::clearEvents(bool now) | 571 | void KOEventViewer::clearEvents(bool now) |
571 | { | 572 | { |
572 | mText = ""; | 573 | mText = ""; |
573 | if (now) setText(mText); | 574 | if (now) setText(mText); |
574 | } | 575 | } |
575 | 576 | ||
576 | void KOEventViewer::addText(QString text) | 577 | void KOEventViewer::addText(QString text) |
577 | { | 578 | { |
578 | mText.append(text); | 579 | mText.append(text); |
579 | setText(mText); | 580 | setText(mText); |
580 | } | 581 | } |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 9a3ba73..bafd349 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -1,1061 +1,1072 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1999 Preston Brown | 3 | Copyright (c) 1999 Preston Brown |
4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qlistview.h> | 25 | #include <qlistview.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
29 | #include <qprogressbar.h> | 29 | #include <qprogressbar.h> |
30 | #include <qfileinfo.h> | 30 | #include <qfileinfo.h> |
31 | #include <qmessagebox.h> | 31 | #include <qmessagebox.h> |
32 | #include <qdialog.h> | 32 | #include <qdialog.h> |
33 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
34 | #include <qdir.h> | 34 | #include <qdir.h> |
35 | #include <qregexp.h> | ||
35 | 36 | ||
36 | #include <klocale.h> | 37 | #include <klocale.h> |
37 | #include <kdebug.h> | 38 | #include <kdebug.h> |
38 | #include <kiconloader.h> | 39 | #include <kiconloader.h> |
39 | #include <kglobal.h> | 40 | #include <kglobal.h> |
40 | 41 | ||
41 | #include <libkcal/calendar.h> | 42 | #include <libkcal/calendar.h> |
42 | #include <libkcal/calendarlocal.h> | 43 | #include <libkcal/calendarlocal.h> |
43 | #include <libkcal/icalformat.h> | 44 | #include <libkcal/icalformat.h> |
44 | #include <libkcal/vcalformat.h> | 45 | #include <libkcal/vcalformat.h> |
45 | #include <libkcal/recurrence.h> | 46 | #include <libkcal/recurrence.h> |
46 | #include <libkcal/filestorage.h> | 47 | #include <libkcal/filestorage.h> |
47 | #include <libkdepim/categoryselectdialog.h> | 48 | #include <libkdepim/categoryselectdialog.h> |
48 | #ifndef DESKTOP_VERSION | 49 | #ifndef DESKTOP_VERSION |
49 | #include <qpe/qpeapplication.h> | 50 | #include <qpe/qpeapplication.h> |
50 | #else | 51 | #else |
51 | #include <qapplication.h> | 52 | #include <qapplication.h> |
52 | #endif | 53 | #endif |
53 | 54 | ||
54 | #ifndef KORG_NOPRINTER | 55 | #ifndef KORG_NOPRINTER |
55 | #include "calprinter.h" | 56 | #include "calprinter.h" |
56 | #endif | 57 | #endif |
57 | #include "koglobals.h" | 58 | #include "koglobals.h" |
58 | #include "koprefs.h" | 59 | #include "koprefs.h" |
59 | #include "kfiledialog.h" | 60 | #include "kfiledialog.h" |
60 | 61 | ||
61 | #include "kolistview.h" | 62 | #include "kolistview.h" |
62 | 63 | ||
63 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) | 64 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) |
64 | { | 65 | { |
65 | mItem = item; | 66 | mItem = item; |
66 | mDate = date; | 67 | mDate = date; |
67 | } | 68 | } |
68 | 69 | ||
69 | ListItemVisitor::~ListItemVisitor() | 70 | ListItemVisitor::~ListItemVisitor() |
70 | { | 71 | { |
71 | } | 72 | } |
72 | 73 | ||
73 | bool ListItemVisitor::visit(Event *e) | 74 | bool ListItemVisitor::visit(Event *e) |
74 | { | 75 | { |
75 | 76 | ||
76 | bool ok = false; | 77 | bool ok = false; |
77 | QString start, end; | 78 | QString start, end; |
78 | if ( e->doesRecur() ) { | 79 | if ( e->doesRecur() ) { |
79 | QDate d = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); | 80 | QDate d = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); |
80 | if ( ok ) { | 81 | if ( ok ) { |
81 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); | 82 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); |
82 | start = KGlobal::locale()->formatDate(d,true); | 83 | start = KGlobal::locale()->formatDate(d,true); |
83 | end = KGlobal::locale()->formatDate(d.addDays( days),true); | 84 | end = KGlobal::locale()->formatDate(d.addDays( days),true); |
84 | } | 85 | } |
85 | 86 | ||
86 | } | 87 | } |
87 | if ( ! ok ) { | 88 | if ( ! ok ) { |
88 | start =e->dtStartDateStr(); | 89 | start =e->dtStartDateStr(); |
89 | end = e->dtEndDateStr(); | 90 | end = e->dtEndDateStr(); |
90 | } | 91 | } |
91 | mItem->setText(0,e->summary()); | 92 | mItem->setText(0,e->summary()); |
92 | mItem->setText(1,start); | 93 | mItem->setText(1,start); |
93 | mItem->setText(2,e->dtStartTimeStr()); | 94 | mItem->setText(2,e->dtStartTimeStr()); |
94 | mItem->setText(3,end); | 95 | mItem->setText(3,end); |
95 | mItem->setText(4,e->dtEndTimeStr()); | 96 | mItem->setText(4,e->dtEndTimeStr()); |
96 | mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); | 97 | mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); |
97 | mItem->setText(6, e->recurrence()->recurrenceText()); | 98 | mItem->setText(6, e->recurrence()->recurrenceText()); |
98 | mItem->setText(7,"---"); | 99 | mItem->setText(7,"---"); |
99 | mItem->setText(8,"---"); | 100 | mItem->setText(8,"---"); |
100 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); | 101 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); |
101 | mItem->setText(10,e->categoriesStr()); | 102 | mItem->setText(10,e->categoriesStr()); |
102 | 103 | ||
103 | QString key; | 104 | QString key; |
104 | QDate d = e->dtStart().date(); | 105 | QDate d = e->dtStart().date(); |
105 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); | 106 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); |
106 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute()); | 107 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute()); |
107 | mItem->setSortKey(1,key); | 108 | mItem->setSortKey(1,key); |
108 | 109 | ||
109 | d = e->dtEnd().date(); | 110 | d = e->dtEnd().date(); |
110 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); | 111 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); |
111 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute()); | 112 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute()); |
112 | mItem->setSortKey(3,key); | 113 | mItem->setSortKey(3,key); |
113 | 114 | ||
114 | return true; | 115 | return true; |
115 | } | 116 | } |
116 | 117 | ||
117 | bool ListItemVisitor::visit(Todo *t) | 118 | bool ListItemVisitor::visit(Todo *t) |
118 | { | 119 | { |
119 | mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); | 120 | mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); |
120 | if (t->hasStartDate()) { | 121 | if (t->hasStartDate()) { |
121 | mItem->setText(1,t->dtStartDateStr()); | 122 | mItem->setText(1,t->dtStartDateStr()); |
122 | if (t->doesFloat()) { | 123 | if (t->doesFloat()) { |
123 | mItem->setText(2,"---"); | 124 | mItem->setText(2,"---"); |
124 | } else { | 125 | } else { |
125 | mItem->setText(2,t->dtStartTimeStr()); | 126 | mItem->setText(2,t->dtStartTimeStr()); |
126 | } | 127 | } |
127 | } else { | 128 | } else { |
128 | mItem->setText(1,"---"); | 129 | mItem->setText(1,"---"); |
129 | mItem->setText(2,"---"); | 130 | mItem->setText(2,"---"); |
130 | } | 131 | } |
131 | mItem->setText(3,"---"); | 132 | mItem->setText(3,"---"); |
132 | mItem->setText(4,"---"); | 133 | mItem->setText(4,"---"); |
133 | mItem->setText(5,"---"); | 134 | mItem->setText(5,"---"); |
134 | mItem->setText(6,"---"); | 135 | mItem->setText(6,"---"); |
135 | if (t->hasDueDate()) { | 136 | if (t->hasDueDate()) { |
136 | mItem->setText(7,t->dtDueDateStr()); | 137 | mItem->setText(7,t->dtDueDateStr()); |
137 | if (t->doesFloat()) { | 138 | if (t->doesFloat()) { |
138 | mItem->setText(8,"---"); | 139 | mItem->setText(8,"---"); |
139 | } else { | 140 | } else { |
140 | mItem->setText(8,t->dtDueTimeStr()); | 141 | mItem->setText(8,t->dtDueTimeStr()); |
141 | } | 142 | } |
142 | } else { | 143 | } else { |
143 | mItem->setText(7,"---"); | 144 | mItem->setText(7,"---"); |
144 | mItem->setText(8,"---"); | 145 | mItem->setText(8,"---"); |
145 | } | 146 | } |
146 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); | 147 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); |
147 | mItem->setText(10,t->categoriesStr()); | 148 | mItem->setText(10,t->categoriesStr()); |
148 | 149 | ||
149 | QString key; | 150 | QString key; |
150 | QDate d; | 151 | QDate d; |
151 | if (t->hasDueDate()) { | 152 | if (t->hasDueDate()) { |
152 | d = t->dtDue().date(); | 153 | d = t->dtDue().date(); |
153 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); | 154 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); |
154 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 155 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
155 | mItem->setSortKey(7,key); | 156 | mItem->setSortKey(7,key); |
156 | } | 157 | } |
157 | if ( t->hasStartDate() ) { | 158 | if ( t->hasStartDate() ) { |
158 | d = t->dtStart().date(); | 159 | d = t->dtStart().date(); |
159 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); | 160 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); |
160 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 161 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
161 | mItem->setSortKey(1,key); | 162 | mItem->setSortKey(1,key); |
162 | } | 163 | } |
163 | return true; | 164 | return true; |
164 | } | 165 | } |
165 | 166 | ||
166 | bool ListItemVisitor::visit(Journal * j) | 167 | bool ListItemVisitor::visit(Journal * j) |
167 | { | 168 | { |
168 | mItem->setText(0,i18n("Journal")); | 169 | QString des = j->description().left(50); |
170 | des = des.simplifyWhiteSpace (); | ||
171 | des.replace (QRegExp ("\\n"),"" ); | ||
172 | des.replace (QRegExp ("\\r"),"" ); | ||
173 | mItem->setText(0,i18n("Journal")+": "+des.left(25)); | ||
169 | mItem->setText(1,j->dtStartDateStr()); | 174 | mItem->setText(1,j->dtStartDateStr()); |
170 | mItem->setText(2,"---"); | 175 | mItem->setText(2,"---"); |
171 | mItem->setText(3,"---"); | 176 | mItem->setText(3,"---"); |
172 | mItem->setText(4,"---"); | 177 | mItem->setText(4,"---"); |
173 | mItem->setText(5,"---"); | 178 | mItem->setText(5,"---"); |
174 | mItem->setText(6,"---"); | 179 | mItem->setText(6,"---"); |
175 | mItem->setText(7,j->dtStartDateStr()); | 180 | mItem->setText(7,j->dtStartDateStr()); |
176 | mItem->setText(8,"---"); | 181 | mItem->setText(8,"---"); |
177 | mItem->setText(9,"---"); | 182 | mItem->setText(9,"---"); |
183 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); | ||
178 | 184 | ||
179 | QString key; | 185 | QString key; |
180 | QDate d = j->dtStart().date(); | 186 | QDate d = j->dtStart().date(); |
181 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 187 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
182 | mItem->setSortKey(1,key); | 188 | mItem->setSortKey(1,key); |
183 | mItem->setSortKey(7,key); | 189 | mItem->setSortKey(7,key); |
184 | 190 | ||
185 | return true; | 191 | return true; |
186 | } | 192 | } |
187 | 193 | ||
188 | KOListView::KOListView(Calendar *calendar, QWidget *parent, | 194 | KOListView::KOListView(Calendar *calendar, QWidget *parent, |
189 | const char *name) | 195 | const char *name) |
190 | : KOEventView(calendar, parent, name) | 196 | : KOEventView(calendar, parent, name) |
191 | { | 197 | { |
192 | mActiveItem = 0; | 198 | mActiveItem = 0; |
193 | mListView = new KOListViewListView(this); | 199 | mListView = new KOListViewListView(this); |
194 | mListView->addColumn(i18n("Summary")); | 200 | mListView->addColumn(i18n("Summary")); |
195 | mListView->addColumn(i18n("Start Date")); | 201 | mListView->addColumn(i18n("Start Date")); |
196 | mListView->addColumn(i18n("Start Time")); | 202 | mListView->addColumn(i18n("Start Time")); |
197 | mListView->addColumn(i18n("End Date")); | 203 | mListView->addColumn(i18n("End Date")); |
198 | mListView->addColumn(i18n("End Time")); | 204 | mListView->addColumn(i18n("End Time")); |
199 | mListView->addColumn(i18n("Alarm")); // alarm set? | 205 | mListView->addColumn(i18n("Alarm")); // alarm set? |
200 | mListView->addColumn(i18n("Recurs")); // recurs? | 206 | mListView->addColumn(i18n("Recurs")); // recurs? |
201 | mListView->addColumn(i18n("Due Date")); | 207 | mListView->addColumn(i18n("Due Date")); |
202 | mListView->addColumn(i18n("Due Time")); | 208 | mListView->addColumn(i18n("Due Time")); |
203 | mListView->addColumn(i18n("Cancelled")); | 209 | mListView->addColumn(i18n("Cancelled")); |
204 | mListView->addColumn(i18n("Categories")); | 210 | mListView->addColumn(i18n("Categories")); |
205 | 211 | ||
206 | mListView->setColumnAlignment(0,AlignLeft); | 212 | mListView->setColumnAlignment(0,AlignLeft); |
207 | mListView->setColumnAlignment(1,AlignLeft); | 213 | mListView->setColumnAlignment(1,AlignLeft); |
208 | mListView->setColumnAlignment(2,AlignHCenter); | 214 | mListView->setColumnAlignment(2,AlignHCenter); |
209 | mListView->setColumnAlignment(3,AlignLeft); | 215 | mListView->setColumnAlignment(3,AlignLeft); |
210 | mListView->setColumnAlignment(4,AlignHCenter); | 216 | mListView->setColumnAlignment(4,AlignHCenter); |
211 | mListView->setColumnAlignment(5,AlignLeft); | 217 | mListView->setColumnAlignment(5,AlignLeft); |
212 | mListView->setColumnAlignment(6,AlignLeft); | 218 | mListView->setColumnAlignment(6,AlignLeft); |
213 | mListView->setColumnAlignment(7,AlignLeft); | 219 | mListView->setColumnAlignment(7,AlignLeft); |
214 | mListView->setColumnAlignment(8,AlignLeft); | 220 | mListView->setColumnAlignment(8,AlignLeft); |
215 | mListView->setColumnAlignment(9,AlignLeft); | 221 | mListView->setColumnAlignment(9,AlignLeft); |
216 | mListView->setColumnAlignment(10,AlignLeft); | 222 | mListView->setColumnAlignment(10,AlignLeft); |
217 | 223 | ||
218 | int iii = 0; | 224 | int iii = 0; |
219 | for ( iii = 0; iii< 10 ; ++iii ) | 225 | for ( iii = 0; iii< 10 ; ++iii ) |
220 | mListView->setColumnWidthMode( iii, QListView::Manual ); | 226 | mListView->setColumnWidthMode( iii, QListView::Manual ); |
221 | 227 | ||
222 | QBoxLayout *layoutTop = new QVBoxLayout(this); | 228 | QBoxLayout *layoutTop = new QVBoxLayout(this); |
223 | layoutTop->addWidget(mListView); | 229 | layoutTop->addWidget(mListView); |
224 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 230 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
225 | mPopupMenu = eventPopup(); | 231 | mPopupMenu = eventPopup(); |
226 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 232 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
227 | i18n("Select all"),this, | 233 | i18n("Select all"),this, |
228 | SLOT(allSelection()),true); | 234 | SLOT(allSelection()),true); |
229 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 235 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
230 | i18n("Deselect All"),this, | 236 | i18n("Deselect All"),this, |
231 | SLOT(clearSelection()),true); | 237 | SLOT(clearSelection()),true); |
232 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 238 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
233 | i18n("Delete all selected"),this, | 239 | i18n("Delete all selected"),this, |
234 | SLOT(deleteAll()),true); | 240 | SLOT(deleteAll()),true); |
235 | mPopupMenu->insertSeparator(); | 241 | mPopupMenu->insertSeparator(); |
236 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 242 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
237 | i18n("Save selected to file..."),this, | 243 | i18n("Save selected to file..."),this, |
238 | SLOT(saveToFile()),true); | 244 | SLOT(saveToFile()),true); |
239 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 245 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
240 | i18n("Save Journal/Description..."),this, | 246 | i18n("Save Journal/Description..."),this, |
241 | SLOT(saveDescriptionToFile()),true); | 247 | SLOT(saveDescriptionToFile()),true); |
242 | mPopupMenu->insertSeparator(); | 248 | mPopupMenu->insertSeparator(); |
243 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 249 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
244 | i18n("Add Categ. to selected..."),this, | 250 | i18n("Add Categ. to selected..."),this, |
245 | SLOT(addCat()),true); | 251 | SLOT(addCat()),true); |
246 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 252 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
247 | i18n("Set Categ. for selected..."),this, | 253 | i18n("Set Categ. for selected..."),this, |
248 | SLOT(setCat()),true); | 254 | SLOT(setCat()),true); |
249 | mPopupMenu->insertSeparator(); | 255 | mPopupMenu->insertSeparator(); |
250 | 256 | ||
251 | 257 | ||
252 | #ifndef DESKTOP_VERSION | 258 | #ifndef DESKTOP_VERSION |
253 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 259 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
254 | i18n("Beam selected via IR"),this, | 260 | i18n("Beam selected via IR"),this, |
255 | SLOT(beamSelected()),true); | 261 | SLOT(beamSelected()),true); |
256 | #endif | 262 | #endif |
257 | /* | 263 | /* |
258 | mPopupMenu = new QPopupMenu; | 264 | mPopupMenu = new QPopupMenu; |
259 | mPopupMenu->insertItem(i18n("Edit Event"), this, | 265 | mPopupMenu->insertItem(i18n("Edit Event"), this, |
260 | SLOT (editEvent())); | 266 | SLOT (editEvent())); |
261 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, | 267 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, |
262 | SLOT (deleteEvent())); | 268 | SLOT (deleteEvent())); |
263 | mPopupMenu->insertSeparator(); | 269 | mPopupMenu->insertSeparator(); |
264 | mPopupMenu->insertItem(i18n("Show Dates"), this, | 270 | mPopupMenu->insertItem(i18n("Show Dates"), this, |
265 | SLOT(showDates())); | 271 | SLOT(showDates())); |
266 | mPopupMenu->insertItem(i18n("Hide Dates"), this, | 272 | mPopupMenu->insertItem(i18n("Hide Dates"), this, |
267 | SLOT(hideDates())); | 273 | SLOT(hideDates())); |
268 | */ | 274 | */ |
269 | QObject::connect(mListView,SIGNAL( newEvent()), | 275 | QObject::connect(mListView,SIGNAL( newEvent()), |
270 | this,SIGNAL(signalNewEvent())); | 276 | this,SIGNAL(signalNewEvent())); |
271 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), | 277 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), |
272 | this,SLOT(defaultItemAction(QListViewItem *))); | 278 | this,SLOT(defaultItemAction(QListViewItem *))); |
273 | QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, | 279 | QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, |
274 | const QPoint &, int )), | 280 | const QPoint &, int )), |
275 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); | 281 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); |
276 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), | 282 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), |
277 | SLOT(processSelectionChange(QListViewItem *))); | 283 | SLOT(processSelectionChange(QListViewItem *))); |
278 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), | 284 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), |
279 | SIGNAL(showIncidenceSignal(Incidence *)) ); | 285 | SIGNAL(showIncidenceSignal(Incidence *)) ); |
280 | 286 | ||
281 | readSettings(KOGlobals::config(),"KOListView Layout"); | 287 | readSettings(KOGlobals::config(),"KOListView Layout"); |
282 | } | 288 | } |
283 | 289 | ||
284 | KOListView::~KOListView() | 290 | KOListView::~KOListView() |
285 | { | 291 | { |
286 | delete mPopupMenu; | 292 | delete mPopupMenu; |
287 | } | 293 | } |
288 | 294 | ||
289 | void KOListView::updateList() | 295 | void KOListView::updateList() |
290 | { | 296 | { |
291 | // qDebug(" KOListView::updateList() "); | 297 | // qDebug(" KOListView::updateList() "); |
292 | 298 | ||
293 | } | 299 | } |
294 | 300 | ||
295 | void KOListView::addCat( ) | 301 | void KOListView::addCat( ) |
296 | { | 302 | { |
297 | setCategories( false ); | 303 | setCategories( false ); |
298 | } | 304 | } |
299 | void KOListView::setCat() | 305 | void KOListView::setCat() |
300 | { | 306 | { |
301 | setCategories( true ); | 307 | setCategories( true ); |
302 | } | 308 | } |
303 | void KOListView::setCategories( bool removeOld ) | 309 | void KOListView::setCategories( bool removeOld ) |
304 | { | 310 | { |
305 | 311 | ||
306 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 312 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
307 | if (! csd->exec()) { | 313 | if (! csd->exec()) { |
308 | delete csd; | 314 | delete csd; |
309 | return; | 315 | return; |
310 | } | 316 | } |
311 | QStringList catList = csd->selectedCategories(); | 317 | QStringList catList = csd->selectedCategories(); |
312 | delete csd; | 318 | delete csd; |
313 | // if ( catList.count() == 0 ) | 319 | // if ( catList.count() == 0 ) |
314 | // return; | 320 | // return; |
315 | catList.sort(); | 321 | catList.sort(); |
316 | QString categoriesStr = catList.join(","); | 322 | QString categoriesStr = catList.join(","); |
317 | int i; | 323 | int i; |
318 | QStringList itemList; | 324 | QStringList itemList; |
319 | QPtrList<KOListViewItem> sel ; | 325 | QPtrList<KOListViewItem> sel ; |
320 | QListViewItem *qitem = mListView->firstChild (); | 326 | QListViewItem *qitem = mListView->firstChild (); |
321 | while ( qitem ) { | 327 | while ( qitem ) { |
322 | if ( qitem->isSelected() ) { | 328 | if ( qitem->isSelected() ) { |
323 | sel.append(((KOListViewItem *)qitem)); | 329 | sel.append(((KOListViewItem *)qitem)); |
324 | } | 330 | } |
325 | qitem = qitem->nextSibling(); | 331 | qitem = qitem->nextSibling(); |
326 | } | 332 | } |
327 | KOListViewItem * item, *temp; | 333 | KOListViewItem * item, *temp; |
328 | item = sel.first(); | 334 | item = sel.first(); |
329 | Incidence* inc; | 335 | Incidence* inc; |
330 | while ( item ) { | 336 | while ( item ) { |
331 | inc = item->data(); | 337 | inc = item->data(); |
332 | if ( removeOld ) { | 338 | if ( removeOld ) { |
333 | inc->setCategories( categoriesStr ); | 339 | inc->setCategories( categoriesStr ); |
334 | } else { | 340 | } else { |
335 | itemList = QStringList::split (",", inc->categoriesStr() ); | 341 | itemList = QStringList::split (",", inc->categoriesStr() ); |
336 | for( i = 0; i< catList.count(); ++i ) { | 342 | for( i = 0; i< catList.count(); ++i ) { |
337 | if ( !itemList.contains (catList[i])) | 343 | if ( !itemList.contains (catList[i])) |
338 | itemList.append( catList[i] ); | 344 | itemList.append( catList[i] ); |
339 | } | 345 | } |
340 | itemList.sort(); | 346 | itemList.sort(); |
341 | inc->setCategories( itemList.join(",") ); | 347 | inc->setCategories( itemList.join(",") ); |
342 | } | 348 | } |
343 | temp = item; | 349 | temp = item; |
344 | item = sel.next(); | 350 | item = sel.next(); |
345 | mUidDict.remove( inc->uid() ); | 351 | mUidDict.remove( inc->uid() ); |
346 | delete temp;; | 352 | delete temp;; |
347 | addIncidence( inc ); | 353 | addIncidence( inc ); |
348 | } | 354 | } |
349 | } | 355 | } |
350 | 356 | ||
351 | void KOListView::beamSelected() | 357 | void KOListView::beamSelected() |
352 | { | 358 | { |
353 | int icount = 0; | 359 | int icount = 0; |
354 | QPtrList<Incidence> delSel ; | 360 | QPtrList<Incidence> delSel ; |
355 | QListViewItem *item = mListView->firstChild (); | 361 | QListViewItem *item = mListView->firstChild (); |
356 | while ( item ) { | 362 | while ( item ) { |
357 | if ( item->isSelected() ) { | 363 | if ( item->isSelected() ) { |
358 | delSel.append(((KOListViewItem *)item)->data()); | 364 | delSel.append(((KOListViewItem *)item)->data()); |
359 | ++icount; | 365 | ++icount; |
360 | } | 366 | } |
361 | 367 | ||
362 | item = item->nextSibling(); | 368 | item = item->nextSibling(); |
363 | } | 369 | } |
364 | if ( icount ) { | 370 | if ( icount ) { |
365 | emit beamIncidenceList( delSel ); | 371 | emit beamIncidenceList( delSel ); |
366 | return; | 372 | return; |
367 | QString fn ; | 373 | QString fn ; |
368 | fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; | 374 | fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; |
369 | QString mes; | 375 | QString mes; |
370 | bool createbup = true; | 376 | bool createbup = true; |
371 | if ( createbup ) { | 377 | if ( createbup ) { |
372 | QString description = "\n"; | 378 | QString description = "\n"; |
373 | CalendarLocal* cal = new CalendarLocal(); | 379 | CalendarLocal* cal = new CalendarLocal(); |
374 | cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 380 | cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
375 | Incidence *incidence = delSel.first(); | 381 | Incidence *incidence = delSel.first(); |
376 | while ( incidence ) { | 382 | while ( incidence ) { |
377 | Incidence *in = incidence->clone(); | 383 | Incidence *in = incidence->clone(); |
378 | description += in->summary() + "\n"; | 384 | description += in->summary() + "\n"; |
379 | cal->addIncidence( in ); | 385 | cal->addIncidence( in ); |
380 | incidence = delSel.next(); | 386 | incidence = delSel.next(); |
381 | } | 387 | } |
382 | FileStorage storage( cal, fn, new VCalFormat ); | 388 | FileStorage storage( cal, fn, new VCalFormat ); |
383 | storage.save(); | 389 | storage.save(); |
384 | delete cal; | 390 | delete cal; |
385 | mes = i18n("KO/Pi: Ready for beaming"); | 391 | mes = i18n("KO/Pi: Ready for beaming"); |
386 | topLevelWidget()->setCaption(mes); | 392 | topLevelWidget()->setCaption(mes); |
387 | 393 | ||
388 | #ifndef DESKTOP_VERSION | 394 | #ifndef DESKTOP_VERSION |
389 | Ir *ir = new Ir( this ); | 395 | Ir *ir = new Ir( this ); |
390 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 396 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
391 | ir->send( fn, description, "text/x-vCalendar" ); | 397 | ir->send( fn, description, "text/x-vCalendar" ); |
392 | #endif | 398 | #endif |
393 | } | 399 | } |
394 | } | 400 | } |
395 | } | 401 | } |
396 | void KOListView::beamDone( Ir *ir ) | 402 | void KOListView::beamDone( Ir *ir ) |
397 | { | 403 | { |
398 | #ifndef DESKTOP_VERSION | 404 | #ifndef DESKTOP_VERSION |
399 | delete ir; | 405 | delete ir; |
400 | #endif | 406 | #endif |
401 | topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); | 407 | topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); |
402 | } | 408 | } |
403 | 409 | ||
404 | void KOListView::saveDescriptionToFile() | 410 | void KOListView::saveDescriptionToFile() |
405 | { | 411 | { |
406 | 412 | ||
407 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 413 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
408 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), | 414 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), |
409 | i18n("Continue"), i18n("Cancel"), 0, | 415 | i18n("Continue"), i18n("Cancel"), 0, |
410 | 0, 1 ); | 416 | 0, 1 ); |
411 | if ( result != 0 ) { | 417 | if ( result != 0 ) { |
412 | return; | 418 | return; |
413 | } | 419 | } |
414 | int icount = 0; | 420 | int icount = 0; |
415 | QPtrList<Incidence> delSel ; | 421 | QPtrList<Incidence> delSel ; |
416 | QListViewItem *item = mListView->firstChild (); | 422 | QListViewItem *item = mListView->firstChild (); |
417 | while ( item ) { | 423 | while ( item ) { |
418 | if ( item->isSelected() ) { | 424 | if ( item->isSelected() ) { |
419 | delSel.append(((KOListViewItem *)item)->data()); | 425 | delSel.append(((KOListViewItem *)item)->data()); |
420 | ++icount; | 426 | ++icount; |
421 | } | 427 | } |
422 | 428 | ||
423 | item = item->nextSibling(); | 429 | item = item->nextSibling(); |
424 | } | 430 | } |
425 | if ( icount ) { | 431 | if ( icount ) { |
426 | QString fn = KOPrefs::instance()->mLastSaveFile; | 432 | QString fn = KOPrefs::instance()->mLastSaveFile; |
427 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); | 433 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); |
428 | 434 | ||
429 | if ( fn == "" ) | 435 | if ( fn == "" ) |
430 | return; | 436 | return; |
431 | QFileInfo info; | 437 | QFileInfo info; |
432 | info.setFile( fn ); | 438 | info.setFile( fn ); |
433 | QString mes; | 439 | QString mes; |
434 | bool createbup = true; | 440 | bool createbup = true; |
435 | if ( info. exists() ) { | 441 | if ( info. exists() ) { |
436 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 442 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
437 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 443 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
438 | i18n("Overwrite!"), i18n("Cancel"), 0, | 444 | i18n("Overwrite!"), i18n("Cancel"), 0, |
439 | 0, 1 ); | 445 | 0, 1 ); |
440 | if ( result != 0 ) { | 446 | if ( result != 0 ) { |
441 | createbup = false; | 447 | createbup = false; |
442 | } | 448 | } |
443 | } | 449 | } |
444 | if ( createbup ) { | 450 | if ( createbup ) { |
445 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + | 451 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + |
446 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); | 452 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); |
447 | Incidence *incidence = delSel.first(); | 453 | Incidence *incidence = delSel.first(); |
448 | icount = 0; | 454 | icount = 0; |
449 | while ( incidence ) { | 455 | while ( incidence ) { |
450 | if ( incidence->type() == "Journal" ) { | 456 | if ( incidence->type() == "Journal" ) { |
451 | text += "\n************************************\n"; | 457 | text += "\n************************************\n"; |
452 | text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); | 458 | text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); |
453 | text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); | 459 | text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); |
454 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); | 460 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); |
455 | ++icount; | 461 | ++icount; |
456 | 462 | ||
457 | } else { | 463 | } else { |
458 | if ( !incidence->description().isEmpty() ) { | 464 | if ( !incidence->description().isEmpty() ) { |
459 | text += "\n************************************\n"; | 465 | text += "\n************************************\n"; |
460 | if ( incidence->type() == "Todo" ) | 466 | if ( incidence->type() == "Todo" ) |
461 | text += i18n("To-Do: "); | 467 | text += i18n("To-Do: "); |
462 | text += incidence->summary(); | 468 | text += incidence->summary(); |
463 | if ( incidence->hasStartDate() ) | 469 | if ( incidence->hasStartDate() ) |
464 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); | 470 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); |
465 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); | 471 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); |
466 | if ( !incidence->location().isEmpty() ) | 472 | if ( !incidence->location().isEmpty() ) |
467 | text += "\n" +i18n("Location: ") + incidence->location(); | 473 | text += "\n" +i18n("Location: ") + incidence->location(); |
468 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); | 474 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); |
469 | ++icount; | 475 | ++icount; |
470 | 476 | ||
471 | } | 477 | } |
472 | } | 478 | } |
473 | incidence = delSel.next(); | 479 | incidence = delSel.next(); |
474 | } | 480 | } |
475 | QFile file( fn ); | 481 | QFile file( fn ); |
476 | if (!file.open( IO_WriteOnly ) ) { | 482 | if (!file.open( IO_WriteOnly ) ) { |
477 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); | 483 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); |
478 | return; | 484 | return; |
479 | } | 485 | } |
480 | QTextStream ts( &file ); | 486 | QTextStream ts( &file ); |
481 | ts << text; | 487 | ts << text; |
482 | file.close(); | 488 | file.close(); |
483 | //qDebug("%s ", text.latin1()); | 489 | //qDebug("%s ", text.latin1()); |
484 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); | 490 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); |
485 | KOPrefs::instance()->mLastSaveFile = fn; | 491 | KOPrefs::instance()->mLastSaveFile = fn; |
486 | topLevelWidget()->setCaption(mes); | 492 | topLevelWidget()->setCaption(mes); |
487 | } | 493 | } |
488 | } | 494 | } |
489 | } | 495 | } |
490 | void KOListView::saveToFile() | 496 | void KOListView::saveToFile() |
491 | { | 497 | { |
492 | 498 | ||
493 | int icount = 0; | 499 | int icount = 0; |
494 | QPtrList<Incidence> delSel ; | 500 | QPtrList<Incidence> delSel ; |
495 | QListViewItem *item = mListView->firstChild (); | 501 | QListViewItem *item = mListView->firstChild (); |
496 | while ( item ) { | 502 | while ( item ) { |
497 | if ( item->isSelected() ) { | 503 | if ( item->isSelected() ) { |
498 | delSel.append(((KOListViewItem *)item)->data()); | 504 | delSel.append(((KOListViewItem *)item)->data()); |
499 | ++icount; | 505 | ++icount; |
500 | } | 506 | } |
501 | 507 | ||
502 | item = item->nextSibling(); | 508 | item = item->nextSibling(); |
503 | } | 509 | } |
504 | if ( icount ) { | 510 | if ( icount ) { |
505 | QString fn = KOPrefs::instance()->mLastSaveFile; | 511 | QString fn = KOPrefs::instance()->mLastSaveFile; |
506 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); | 512 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); |
507 | 513 | ||
508 | if ( fn == "" ) | 514 | if ( fn == "" ) |
509 | return; | 515 | return; |
510 | QFileInfo info; | 516 | QFileInfo info; |
511 | info.setFile( fn ); | 517 | info.setFile( fn ); |
512 | QString mes; | 518 | QString mes; |
513 | bool createbup = true; | 519 | bool createbup = true; |
514 | if ( info. exists() ) { | 520 | if ( info. exists() ) { |
515 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 521 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
516 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 522 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
517 | i18n("Overwrite!"), i18n("Cancel"), 0, | 523 | i18n("Overwrite!"), i18n("Cancel"), 0, |
518 | 0, 1 ); | 524 | 0, 1 ); |
519 | if ( result != 0 ) { | 525 | if ( result != 0 ) { |
520 | createbup = false; | 526 | createbup = false; |
521 | } | 527 | } |
522 | } | 528 | } |
523 | if ( createbup ) { | 529 | if ( createbup ) { |
524 | CalendarLocal cal; | 530 | CalendarLocal cal; |
525 | cal.setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 531 | cal.setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
526 | Incidence *incidence = delSel.first(); | 532 | Incidence *incidence = delSel.first(); |
527 | while ( incidence ) { | 533 | while ( incidence ) { |
528 | cal.addIncidence( incidence->clone() ); | 534 | cal.addIncidence( incidence->clone() ); |
529 | incidence = delSel.next(); | 535 | incidence = delSel.next(); |
530 | } | 536 | } |
531 | ICalFormat format; | 537 | ICalFormat format; |
532 | format.save( &cal, fn ); | 538 | format.save( &cal, fn ); |
533 | mes = i18n("KO/Pi:Saved %1").arg(fn ); | 539 | mes = i18n("KO/Pi:Saved %1").arg(fn ); |
534 | KOPrefs::instance()->mLastSaveFile = fn; | 540 | KOPrefs::instance()->mLastSaveFile = fn; |
535 | topLevelWidget()->setCaption(mes); | 541 | topLevelWidget()->setCaption(mes); |
536 | } | 542 | } |
537 | } | 543 | } |
538 | } | 544 | } |
539 | void KOListView::deleteAll() | 545 | void KOListView::deleteAll() |
540 | { | 546 | { |
541 | int icount = 0; | 547 | int icount = 0; |
542 | QPtrList<Incidence> delSel ; | 548 | QPtrList<Incidence> delSel ; |
543 | QListViewItem *item = mListView->firstChild (); | 549 | QListViewItem *item = mListView->firstChild (); |
544 | while ( item ) { | 550 | while ( item ) { |
545 | if ( item->isSelected() ) { | 551 | if ( item->isSelected() ) { |
546 | delSel.append(((KOListViewItem *)item)->data()); | 552 | delSel.append(((KOListViewItem *)item)->data()); |
547 | ++icount; | 553 | ++icount; |
548 | } | 554 | } |
549 | 555 | ||
550 | item = item->nextSibling(); | 556 | item = item->nextSibling(); |
551 | } | 557 | } |
552 | if ( icount ) { | 558 | if ( icount ) { |
553 | Incidence *incidence = delSel.first(); | 559 | Incidence *incidence = delSel.first(); |
554 | Incidence *toDelete; | 560 | Incidence *toDelete; |
555 | KOPrefs *p = KOPrefs::instance(); | 561 | KOPrefs *p = KOPrefs::instance(); |
556 | bool confirm = p->mConfirm; | 562 | bool confirm = p->mConfirm; |
557 | QString mess; | 563 | QString mess; |
558 | mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); | 564 | mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); |
559 | if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { | 565 | if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { |
560 | p->mConfirm = false; | 566 | p->mConfirm = false; |
561 | int delCounter = 0; | 567 | int delCounter = 0; |
562 | QDialog dia ( this, "p-dialog", true ); | 568 | QDialog dia ( this, "p-dialog", true ); |
563 | QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); | 569 | QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); |
564 | QVBoxLayout lay( &dia ); | 570 | QVBoxLayout lay( &dia ); |
565 | lay.setMargin(7); | 571 | lay.setMargin(7); |
566 | lay.setSpacing(7); | 572 | lay.setSpacing(7); |
567 | lay.addWidget( &lab); | 573 | lay.addWidget( &lab); |
568 | QProgressBar bar( icount, &dia ); | 574 | QProgressBar bar( icount, &dia ); |
569 | lay.addWidget( &bar); | 575 | lay.addWidget( &bar); |
570 | int w = 220; | 576 | int w = 220; |
571 | int h = 50; | 577 | int h = 50; |
572 | int dw = QApplication::desktop()->width(); | 578 | int dw = QApplication::desktop()->width(); |
573 | int dh = QApplication::desktop()->height(); | 579 | int dh = QApplication::desktop()->height(); |
574 | dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 580 | dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
575 | //dia.resize( 240,50 ); | 581 | //dia.resize( 240,50 ); |
576 | dia.show(); | 582 | dia.show(); |
577 | 583 | ||
578 | while ( incidence ) { | 584 | while ( incidence ) { |
579 | bar.setProgress( delCounter ); | 585 | bar.setProgress( delCounter ); |
580 | mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); | 586 | mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); |
581 | dia.setCaption( mess ); | 587 | dia.setCaption( mess ); |
582 | qApp->processEvents(); | 588 | qApp->processEvents(); |
583 | toDelete = (incidence); | 589 | toDelete = (incidence); |
584 | incidence = delSel.next(); | 590 | incidence = delSel.next(); |
585 | emit deleteIncidenceSignal(toDelete ); | 591 | emit deleteIncidenceSignal(toDelete ); |
586 | if ( dia.result() != 0 ) | 592 | if ( dia.result() != 0 ) |
587 | break; | 593 | break; |
588 | 594 | ||
589 | } | 595 | } |
590 | mess = mess.sprintf( i18n("%d items remaining in list."), count() ); | 596 | mess = mess.sprintf( i18n("%d items remaining in list."), count() ); |
591 | topLevelWidget ()->setCaption( mess ); | 597 | topLevelWidget ()->setCaption( mess ); |
592 | p->mConfirm = confirm; | 598 | p->mConfirm = confirm; |
593 | } | 599 | } |
594 | } | 600 | } |
595 | 601 | ||
596 | 602 | ||
597 | } | 603 | } |
598 | int KOListView::maxDatesHint() | 604 | int KOListView::maxDatesHint() |
599 | { | 605 | { |
600 | return 0; | 606 | return 0; |
601 | } | 607 | } |
602 | 608 | ||
603 | int KOListView::currentDateCount() | 609 | int KOListView::currentDateCount() |
604 | { | 610 | { |
605 | return 0; | 611 | return 0; |
606 | } | 612 | } |
607 | 613 | ||
608 | QPtrList<Incidence> KOListView::selectedIncidences() | 614 | QPtrList<Incidence> KOListView::selectedIncidences() |
609 | { | 615 | { |
610 | QPtrList<Incidence> eventList; | 616 | QPtrList<Incidence> eventList; |
611 | QListViewItem *item = mListView->firstChild (); | 617 | QListViewItem *item = mListView->firstChild (); |
612 | while ( item ) { | 618 | while ( item ) { |
613 | if ( item->isSelected() ) { | 619 | if ( item->isSelected() ) { |
614 | eventList.append(((KOListViewItem *)item)->data()); | 620 | eventList.append(((KOListViewItem *)item)->data()); |
615 | } | 621 | } |
616 | 622 | ||
617 | item = item->nextSibling(); | 623 | item = item->nextSibling(); |
618 | } | 624 | } |
619 | 625 | ||
620 | // // QListViewItem *item = mListView->selectedItem(); | 626 | // // QListViewItem *item = mListView->selectedItem(); |
621 | //if (item) eventList.append(((KOListViewItem *)item)->data()); | 627 | //if (item) eventList.append(((KOListViewItem *)item)->data()); |
622 | 628 | ||
623 | return eventList; | 629 | return eventList; |
624 | } | 630 | } |
625 | 631 | ||
626 | DateList KOListView::selectedDates() | 632 | DateList KOListView::selectedDates() |
627 | { | 633 | { |
628 | DateList eventList; | 634 | DateList eventList; |
629 | return eventList; | 635 | return eventList; |
630 | } | 636 | } |
631 | 637 | ||
632 | void KOListView::showDates(bool show) | 638 | void KOListView::showDates(bool show) |
633 | { | 639 | { |
634 | // Shouldn't we set it to a value greater 0? When showDates is called with | 640 | // Shouldn't we set it to a value greater 0? When showDates is called with |
635 | // show == true at first, then the columnwidths are set to zero. | 641 | // show == true at first, then the columnwidths are set to zero. |
636 | static int oldColWidth1 = 0; | 642 | static int oldColWidth1 = 0; |
637 | static int oldColWidth3 = 0; | 643 | static int oldColWidth3 = 0; |
638 | 644 | ||
639 | if (!show) { | 645 | if (!show) { |
640 | oldColWidth1 = mListView->columnWidth(1); | 646 | oldColWidth1 = mListView->columnWidth(1); |
641 | oldColWidth3 = mListView->columnWidth(3); | 647 | oldColWidth3 = mListView->columnWidth(3); |
642 | mListView->setColumnWidth(1, 0); | 648 | mListView->setColumnWidth(1, 0); |
643 | mListView->setColumnWidth(3, 0); | 649 | mListView->setColumnWidth(3, 0); |
644 | } else { | 650 | } else { |
645 | mListView->setColumnWidth(1, oldColWidth1); | 651 | mListView->setColumnWidth(1, oldColWidth1); |
646 | mListView->setColumnWidth(3, oldColWidth3); | 652 | mListView->setColumnWidth(3, oldColWidth3); |
647 | } | 653 | } |
648 | mListView->repaint(); | 654 | mListView->repaint(); |
649 | } | 655 | } |
650 | 656 | ||
651 | void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 657 | void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
652 | const QDate &td) | 658 | const QDate &td) |
653 | { | 659 | { |
654 | #ifndef KORG_NOPRINTER | 660 | #ifndef KORG_NOPRINTER |
655 | calPrinter->preview(CalPrinter::Day, fd, td); | 661 | calPrinter->preview(CalPrinter::Day, fd, td); |
656 | #endif | 662 | #endif |
657 | } | 663 | } |
658 | 664 | ||
659 | void KOListView::showDates() | 665 | void KOListView::showDates() |
660 | { | 666 | { |
661 | showDates(true); | 667 | showDates(true); |
662 | } | 668 | } |
663 | 669 | ||
664 | void KOListView::hideDates() | 670 | void KOListView::hideDates() |
665 | { | 671 | { |
666 | showDates(false); | 672 | showDates(false); |
667 | } | 673 | } |
668 | 674 | ||
669 | void KOListView::updateView() | 675 | void KOListView::updateView() |
670 | { | 676 | { |
671 | mListView->setFocus(); | 677 | mListView->setFocus(); |
672 | if ( mListView->firstChild () ) | 678 | if ( mListView->firstChild () ) |
673 | mListView->setCurrentItem( mListView->firstChild () ); | 679 | mListView->setCurrentItem( mListView->firstChild () ); |
674 | } | 680 | } |
675 | void KOListView::updateConfig() | 681 | void KOListView::updateConfig() |
676 | { | 682 | { |
677 | 683 | ||
678 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 684 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
679 | updateView(); | 685 | updateView(); |
680 | 686 | ||
681 | } | 687 | } |
682 | void KOListView::setStartDate(const QDate &start) | 688 | void KOListView::setStartDate(const QDate &start) |
683 | { | 689 | { |
684 | mStartDate = start; | 690 | mStartDate = start; |
685 | } | 691 | } |
686 | 692 | ||
687 | void KOListView::showDates(const QDate &start, const QDate &end) | 693 | void KOListView::showDates(const QDate &start, const QDate &end) |
688 | { | 694 | { |
689 | clear(); | 695 | clear(); |
690 | mStartDate = start; | 696 | mStartDate = start; |
691 | QDate date = start; | 697 | QDate date = start; |
698 | QPtrList<Journal> j_list; | ||
692 | while( date <= end ) { | 699 | while( date <= end ) { |
693 | addEvents(calendar()->events(date)); | 700 | addEvents(calendar()->events(date)); |
694 | addTodos(calendar()->todos(date)); | 701 | addTodos(calendar()->todos(date)); |
702 | Journal* jo = calendar()->journal(date); | ||
703 | if ( jo ) | ||
704 | j_list.append( jo ); | ||
695 | date = date.addDays( 1 ); | 705 | date = date.addDays( 1 ); |
696 | } | 706 | } |
707 | addJournals(j_list); | ||
697 | emit incidenceSelected( 0 ); | 708 | emit incidenceSelected( 0 ); |
698 | updateView(); | 709 | updateView(); |
699 | 710 | ||
700 | } | 711 | } |
701 | 712 | ||
702 | void KOListView::addEvents(QPtrList<Event> eventList) | 713 | void KOListView::addEvents(QPtrList<Event> eventList) |
703 | { | 714 | { |
704 | Event *ev; | 715 | Event *ev; |
705 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 716 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
706 | addIncidence(ev); | 717 | addIncidence(ev); |
707 | } | 718 | } |
708 | if ( !mListView->currentItem() ){ | 719 | if ( !mListView->currentItem() ){ |
709 | updateView(); | 720 | updateView(); |
710 | } | 721 | } |
711 | } | 722 | } |
712 | 723 | ||
713 | void KOListView::addTodos(QPtrList<Todo> eventList) | 724 | void KOListView::addTodos(QPtrList<Todo> eventList) |
714 | { | 725 | { |
715 | Todo *ev; | 726 | Todo *ev; |
716 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 727 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
717 | addIncidence(ev); | 728 | addIncidence(ev); |
718 | } | 729 | } |
719 | if ( !mListView->currentItem() ){ | 730 | if ( !mListView->currentItem() ){ |
720 | updateView(); | 731 | updateView(); |
721 | } | 732 | } |
722 | } | 733 | } |
723 | void KOListView::addJournals(QPtrList<Journal> eventList) | 734 | void KOListView::addJournals(QPtrList<Journal> eventList) |
724 | { | 735 | { |
725 | Journal *ev; | 736 | Journal *ev; |
726 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 737 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
727 | addIncidence(ev); | 738 | addIncidence(ev); |
728 | } | 739 | } |
729 | if ( !mListView->currentItem() ){ | 740 | if ( !mListView->currentItem() ){ |
730 | updateView(); | 741 | updateView(); |
731 | } | 742 | } |
732 | } | 743 | } |
733 | 744 | ||
734 | void KOListView::addIncidence(Incidence *incidence) | 745 | void KOListView::addIncidence(Incidence *incidence) |
735 | { | 746 | { |
736 | if ( mUidDict.find( incidence->uid() ) ) return; | 747 | if ( mUidDict.find( incidence->uid() ) ) return; |
737 | 748 | ||
738 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 749 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
739 | mUidDict.insert( incidence->uid(), incidence ); | 750 | mUidDict.insert( incidence->uid(), incidence ); |
740 | 751 | ||
741 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); | 752 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); |
742 | ListItemVisitor v(item, mStartDate ); | 753 | ListItemVisitor v(item, mStartDate ); |
743 | if (incidence->accept(v)) return; | 754 | if (incidence->accept(v)) return; |
744 | else delete item; | 755 | else delete item; |
745 | //qDebug("delete item "); | 756 | //qDebug("delete item "); |
746 | } | 757 | } |
747 | 758 | ||
748 | void KOListView::showEvents(QPtrList<Event> eventList) | 759 | void KOListView::showEvents(QPtrList<Event> eventList) |
749 | { | 760 | { |
750 | clear(); | 761 | clear(); |
751 | 762 | ||
752 | addEvents(eventList); | 763 | addEvents(eventList); |
753 | 764 | ||
754 | // After new creation of list view no events are selected. | 765 | // After new creation of list view no events are selected. |
755 | emit incidenceSelected( 0 ); | 766 | emit incidenceSelected( 0 ); |
756 | } | 767 | } |
757 | int KOListView::count() | 768 | int KOListView::count() |
758 | { | 769 | { |
759 | return mListView->childCount(); | 770 | return mListView->childCount(); |
760 | } | 771 | } |
761 | 772 | ||
762 | void KOListView::changeEventDisplay(Event *event, int action) | 773 | void KOListView::changeEventDisplay(Event *event, int action) |
763 | { | 774 | { |
764 | KOListViewItem *item; | 775 | KOListViewItem *item; |
765 | 776 | ||
766 | switch(action) { | 777 | switch(action) { |
767 | case KOGlobals::EVENTADDED: | 778 | case KOGlobals::EVENTADDED: |
768 | addIncidence( event ); | 779 | addIncidence( event ); |
769 | break; | 780 | break; |
770 | case KOGlobals::EVENTEDITED: | 781 | case KOGlobals::EVENTEDITED: |
771 | item = getItemForEvent(event); | 782 | item = getItemForEvent(event); |
772 | if (item) { | 783 | if (item) { |
773 | mUidDict.remove( event->uid() ); | 784 | mUidDict.remove( event->uid() ); |
774 | delete item; | 785 | delete item; |
775 | addIncidence( event ); | 786 | addIncidence( event ); |
776 | } | 787 | } |
777 | break; | 788 | break; |
778 | case KOGlobals::EVENTDELETED: | 789 | case KOGlobals::EVENTDELETED: |
779 | item = getItemForEvent(event); | 790 | item = getItemForEvent(event); |
780 | if (item) { | 791 | if (item) { |
781 | mUidDict.remove( event->uid() ); | 792 | mUidDict.remove( event->uid() ); |
782 | delete item; | 793 | delete item; |
783 | } | 794 | } |
784 | break; | 795 | break; |
785 | default: | 796 | default: |
786 | ; | 797 | ; |
787 | } | 798 | } |
788 | } | 799 | } |
789 | 800 | ||
790 | KOListViewItem *KOListView::getItemForEvent(Event *event) | 801 | KOListViewItem *KOListView::getItemForEvent(Event *event) |
791 | { | 802 | { |
792 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); | 803 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); |
793 | while (item) { | 804 | while (item) { |
794 | if (item->data() == event) return item; | 805 | if (item->data() == event) return item; |
795 | item = (KOListViewItem *)item->nextSibling(); | 806 | item = (KOListViewItem *)item->nextSibling(); |
796 | } | 807 | } |
797 | return 0; | 808 | return 0; |
798 | } | 809 | } |
799 | 810 | ||
800 | void KOListView::defaultItemAction(QListViewItem *i) | 811 | void KOListView::defaultItemAction(QListViewItem *i) |
801 | { | 812 | { |
802 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); | 813 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); |
803 | if ( item ) defaultAction( item->data() ); | 814 | if ( item ) defaultAction( item->data() ); |
804 | 815 | ||
805 | } | 816 | } |
806 | 817 | ||
807 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) | 818 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) |
808 | { | 819 | { |
809 | mActiveItem = (KOListViewItem *)item; | 820 | mActiveItem = (KOListViewItem *)item; |
810 | if (mActiveItem) { | 821 | if (mActiveItem) { |
811 | Incidence *incidence = mActiveItem->data(); | 822 | Incidence *incidence = mActiveItem->data(); |
812 | mPopupMenu->showIncidencePopup(incidence); | 823 | mPopupMenu->showIncidencePopup(incidence); |
813 | 824 | ||
814 | /* | 825 | /* |
815 | if ( incidence && incidence->type() == "Event" ) { | 826 | if ( incidence && incidence->type() == "Event" ) { |
816 | Event *event = static_cast<Event *>( incidence ); | 827 | Event *event = static_cast<Event *>( incidence ); |
817 | mPopupMenu->showEventPopup(event); | 828 | mPopupMenu->showEventPopup(event); |
818 | } | 829 | } |
819 | */ | 830 | */ |
820 | } | 831 | } |
821 | } | 832 | } |
822 | 833 | ||
823 | void KOListView::readSettings(KConfig *config, QString setting) | 834 | void KOListView::readSettings(KConfig *config, QString setting) |
824 | { | 835 | { |
825 | // qDebug("KOListView::readSettings "); | 836 | // qDebug("KOListView::readSettings "); |
826 | mListView->restoreLayout(config,setting); | 837 | mListView->restoreLayout(config,setting); |
827 | } | 838 | } |
828 | 839 | ||
829 | void KOListView::writeSettings(KConfig *config, QString setting) | 840 | void KOListView::writeSettings(KConfig *config, QString setting) |
830 | { | 841 | { |
831 | // qDebug("KOListView::writeSettings "); | 842 | // qDebug("KOListView::writeSettings "); |
832 | mListView->saveLayout(config, setting); | 843 | mListView->saveLayout(config, setting); |
833 | } | 844 | } |
834 | 845 | ||
835 | void KOListView::processSelectionChange(QListViewItem *) | 846 | void KOListView::processSelectionChange(QListViewItem *) |
836 | { | 847 | { |
837 | 848 | ||
838 | KOListViewItem *item = | 849 | KOListViewItem *item = |
839 | static_cast<KOListViewItem *>( mListView->currentItem() ); | 850 | static_cast<KOListViewItem *>( mListView->currentItem() ); |
840 | 851 | ||
841 | if ( !item ) { | 852 | if ( !item ) { |
842 | emit incidenceSelected( 0 ); | 853 | emit incidenceSelected( 0 ); |
843 | } else { | 854 | } else { |
844 | emit incidenceSelected( item->data() ); | 855 | emit incidenceSelected( item->data() ); |
845 | } | 856 | } |
846 | } | 857 | } |
847 | 858 | ||
848 | void KOListView::clearSelection() | 859 | void KOListView::clearSelection() |
849 | { | 860 | { |
850 | mListView->selectAll( false ); | 861 | mListView->selectAll( false ); |
851 | } | 862 | } |
852 | void KOListView::allSelection() | 863 | void KOListView::allSelection() |
853 | { | 864 | { |
854 | mListView->selectAll( true ); | 865 | mListView->selectAll( true ); |
855 | } | 866 | } |
856 | 867 | ||
857 | void KOListView::clear() | 868 | void KOListView::clear() |
858 | { | 869 | { |
859 | mListView->clear(); | 870 | mListView->clear(); |
860 | mUidDict.clear(); | 871 | mUidDict.clear(); |
861 | } | 872 | } |
862 | 873 | ||
863 | Incidence* KOListView::currentItem() | 874 | Incidence* KOListView::currentItem() |
864 | { | 875 | { |
865 | if ( mListView->currentItem() ) | 876 | if ( mListView->currentItem() ) |
866 | return ((KOListViewItem*) mListView->currentItem())->data(); | 877 | return ((KOListViewItem*) mListView->currentItem())->data(); |
867 | return 0; | 878 | return 0; |
868 | } | 879 | } |
869 | void KOListView::keyPressEvent ( QKeyEvent *e) | 880 | void KOListView::keyPressEvent ( QKeyEvent *e) |
870 | { | 881 | { |
871 | 882 | ||
872 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { | 883 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { |
873 | deleteAll(); | 884 | deleteAll(); |
874 | return; | 885 | return; |
875 | } | 886 | } |
876 | 887 | ||
877 | e->ignore(); | 888 | e->ignore(); |
878 | } | 889 | } |
879 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) | 890 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) |
880 | { | 891 | { |
881 | 892 | ||
882 | switch ( e->key() ) { | 893 | switch ( e->key() ) { |
883 | case Qt::Key_Down: | 894 | case Qt::Key_Down: |
884 | if ( e->state() == ShiftButton ) { | 895 | if ( e->state() == ShiftButton ) { |
885 | QListViewItem* cn = currentItem(); | 896 | QListViewItem* cn = currentItem(); |
886 | if ( !cn ) | 897 | if ( !cn ) |
887 | cn = firstChild(); | 898 | cn = firstChild(); |
888 | if ( !cn ) | 899 | if ( !cn ) |
889 | return; | 900 | return; |
890 | while ( cn->nextSibling() ) | 901 | while ( cn->nextSibling() ) |
891 | cn = cn->nextSibling(); | 902 | cn = cn->nextSibling(); |
892 | setCurrentItem ( cn ); | 903 | setCurrentItem ( cn ); |
893 | ensureItemVisible ( cn ); | 904 | ensureItemVisible ( cn ); |
894 | 905 | ||
895 | e->accept(); | 906 | e->accept(); |
896 | return; | 907 | return; |
897 | } | 908 | } |
898 | if ( e->state() == ControlButton ) { | 909 | if ( e->state() == ControlButton ) { |
899 | int count = childCount (); | 910 | int count = childCount (); |
900 | int jump = count / 5; | 911 | int jump = count / 5; |
901 | QListViewItem* cn; | 912 | QListViewItem* cn; |
902 | cn = currentItem(); | 913 | cn = currentItem(); |
903 | if ( ! cn ) | 914 | if ( ! cn ) |
904 | return; | 915 | return; |
905 | if ( jump == 0 ) | 916 | if ( jump == 0 ) |
906 | jump = 1; | 917 | jump = 1; |
907 | while ( jump && cn->nextSibling() ) { | 918 | while ( jump && cn->nextSibling() ) { |
908 | cn = cn->nextSibling(); | 919 | cn = cn->nextSibling(); |
909 | --jump; | 920 | --jump; |
910 | } | 921 | } |
911 | setCurrentItem ( cn ); | 922 | setCurrentItem ( cn ); |
912 | ensureItemVisible ( cn ); | 923 | ensureItemVisible ( cn ); |
913 | 924 | ||
914 | } else | 925 | } else |
915 | QListView::keyPressEvent ( e ) ; | 926 | QListView::keyPressEvent ( e ) ; |
916 | e->accept(); | 927 | e->accept(); |
917 | break; | 928 | break; |
918 | 929 | ||
919 | case Qt::Key_Up: | 930 | case Qt::Key_Up: |
920 | if ( e->state() == ShiftButton ) { | 931 | if ( e->state() == ShiftButton ) { |
921 | QListViewItem* cn = firstChild(); | 932 | QListViewItem* cn = firstChild(); |
922 | if ( cn ) { | 933 | if ( cn ) { |
923 | setCurrentItem ( cn ); | 934 | setCurrentItem ( cn ); |
924 | ensureItemVisible ( cn ); | 935 | ensureItemVisible ( cn ); |
925 | } | 936 | } |
926 | e->accept(); | 937 | e->accept(); |
927 | return; | 938 | return; |
928 | } | 939 | } |
929 | if ( e->state() == ControlButton ) { | 940 | if ( e->state() == ControlButton ) { |
930 | int count = childCount (); | 941 | int count = childCount (); |
931 | int jump = count / 5; | 942 | int jump = count / 5; |
932 | QListViewItem* cn; | 943 | QListViewItem* cn; |
933 | cn = currentItem(); | 944 | cn = currentItem(); |
934 | if ( ! cn ) | 945 | if ( ! cn ) |
935 | return; | 946 | return; |
936 | if ( jump == 0 ) | 947 | if ( jump == 0 ) |
937 | jump = 1; | 948 | jump = 1; |
938 | while ( jump && cn->itemAbove ()) { | 949 | while ( jump && cn->itemAbove ()) { |
939 | cn = cn->itemAbove (); | 950 | cn = cn->itemAbove (); |
940 | --jump; | 951 | --jump; |
941 | } | 952 | } |
942 | setCurrentItem ( cn ); | 953 | setCurrentItem ( cn ); |
943 | ensureItemVisible ( cn ); | 954 | ensureItemVisible ( cn ); |
944 | } else | 955 | } else |
945 | QListView::keyPressEvent ( e ) ; | 956 | QListView::keyPressEvent ( e ) ; |
946 | e->accept(); | 957 | e->accept(); |
947 | break; | 958 | break; |
948 | case Qt::Key_I: { | 959 | case Qt::Key_I: { |
949 | QListViewItem* cn; | 960 | QListViewItem* cn; |
950 | cn = currentItem(); | 961 | cn = currentItem(); |
951 | if ( cn ) { | 962 | if ( cn ) { |
952 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 963 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
953 | if ( ci ){ | 964 | if ( ci ){ |
954 | emit showIncidence( ci->data()); | 965 | emit showIncidence( ci->data()); |
955 | cn = cn->nextSibling(); | 966 | cn = cn->nextSibling(); |
956 | if ( cn ) { | 967 | if ( cn ) { |
957 | setCurrentItem ( cn ); | 968 | setCurrentItem ( cn ); |
958 | ensureItemVisible ( cn ); | 969 | ensureItemVisible ( cn ); |
959 | } | 970 | } |
960 | } | 971 | } |
961 | } | 972 | } |
962 | e->accept(); | 973 | e->accept(); |
963 | } | 974 | } |
964 | break; | 975 | break; |
965 | case Qt::Key_Return: | 976 | case Qt::Key_Return: |
966 | case Qt::Key_Enter: | 977 | case Qt::Key_Enter: |
967 | { | 978 | { |
968 | QListViewItem* cn; | 979 | QListViewItem* cn; |
969 | cn = currentItem(); | 980 | cn = currentItem(); |
970 | if ( cn ) { | 981 | if ( cn ) { |
971 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 982 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
972 | if ( ci ){ | 983 | if ( ci ){ |
973 | if ( e->state() == ShiftButton ) | 984 | if ( e->state() == ShiftButton ) |
974 | ci->setSelected( false ); | 985 | ci->setSelected( false ); |
975 | else | 986 | else |
976 | ci->setSelected( true ); | 987 | ci->setSelected( true ); |
977 | cn = cn->nextSibling(); | 988 | cn = cn->nextSibling(); |
978 | if ( cn ) { | 989 | if ( cn ) { |
979 | setCurrentItem ( cn ); | 990 | setCurrentItem ( cn ); |
980 | ensureItemVisible ( cn ); | 991 | ensureItemVisible ( cn ); |
981 | } | 992 | } |
982 | } | 993 | } |
983 | } | 994 | } |
984 | e->accept(); | 995 | e->accept(); |
985 | } | 996 | } |
986 | break; | 997 | break; |
987 | default: | 998 | default: |
988 | e->ignore(); | 999 | e->ignore(); |
989 | } | 1000 | } |
990 | } | 1001 | } |
991 | KOListViewListView::KOListViewListView(KOListView * lv ) | 1002 | KOListViewListView::KOListViewListView(KOListView * lv ) |
992 | : KListView( lv ) | 1003 | : KListView( lv ) |
993 | { | 1004 | { |
994 | #ifndef DESKTOP_VERSION | 1005 | #ifndef DESKTOP_VERSION |
995 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 1006 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
996 | #endif | 1007 | #endif |
997 | setSelectionMode( QListView::Multi ); | 1008 | setSelectionMode( QListView::Multi ); |
998 | setMultiSelection( true); | 1009 | setMultiSelection( true); |
999 | mAllowPopupMenu = true; | 1010 | mAllowPopupMenu = true; |
1000 | mMouseDown = false; | 1011 | mMouseDown = false; |
1001 | 1012 | ||
1002 | } | 1013 | } |
1003 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 1014 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
1004 | { | 1015 | { |
1005 | if (!e) return; | 1016 | if (!e) return; |
1006 | QPoint vp = contentsToViewport(e->pos()); | 1017 | QPoint vp = contentsToViewport(e->pos()); |
1007 | QListViewItem *item = itemAt(vp); | 1018 | QListViewItem *item = itemAt(vp); |
1008 | if (!item) { | 1019 | if (!item) { |
1009 | emit newEvent(); | 1020 | emit newEvent(); |
1010 | return; | 1021 | return; |
1011 | } | 1022 | } |
1012 | KListView::contentsMouseDoubleClickEvent(e); | 1023 | KListView::contentsMouseDoubleClickEvent(e); |
1013 | } | 1024 | } |
1014 | 1025 | ||
1015 | 1026 | ||
1016 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1027 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1017 | { | 1028 | { |
1018 | //qDebug("contentsMousePressEvent++++ "); | 1029 | //qDebug("contentsMousePressEvent++++ "); |
1019 | if (! mMouseDown ) { | 1030 | if (! mMouseDown ) { |
1020 | mAllowPopupMenu = true; | 1031 | mAllowPopupMenu = true; |
1021 | mYMousePos = mapToGlobal( (e->pos())).y(); | 1032 | mYMousePos = mapToGlobal( (e->pos())).y(); |
1022 | } | 1033 | } |
1023 | if ( e->button() == RightButton && mMouseDown ) | 1034 | if ( e->button() == RightButton && mMouseDown ) |
1024 | return; | 1035 | return; |
1025 | if ( e->button() == LeftButton ) | 1036 | if ( e->button() == LeftButton ) |
1026 | mMouseDown = true; | 1037 | mMouseDown = true; |
1027 | KListView::contentsMousePressEvent( e ); | 1038 | KListView::contentsMousePressEvent( e ); |
1028 | } | 1039 | } |
1029 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1040 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1030 | { | 1041 | { |
1031 | //qDebug("contentsMouseReleaseEv---- "); | 1042 | //qDebug("contentsMouseReleaseEv---- "); |
1032 | if ( ! mMouseDown ) { | 1043 | if ( ! mMouseDown ) { |
1033 | if ( e->button() == RightButton && ! mAllowPopupMenu ) | 1044 | if ( e->button() == RightButton && ! mAllowPopupMenu ) |
1034 | return; | 1045 | return; |
1035 | QListViewItem* ci = currentItem(); | 1046 | QListViewItem* ci = currentItem(); |
1036 | if ( ci ) | 1047 | if ( ci ) |
1037 | ci->setSelected( true ); | 1048 | ci->setSelected( true ); |
1038 | KListView::contentsMouseReleaseEvent(e); | 1049 | KListView::contentsMouseReleaseEvent(e); |
1039 | return; | 1050 | return; |
1040 | } | 1051 | } |
1041 | if ( e->button() == LeftButton ) | 1052 | if ( e->button() == LeftButton ) |
1042 | mMouseDown = false; | 1053 | mMouseDown = false; |
1043 | if ( e->button() == RightButton && ! mAllowPopupMenu ) | 1054 | if ( e->button() == RightButton && ! mAllowPopupMenu ) |
1044 | return; | 1055 | return; |
1045 | if ( e->button() == RightButton ) { | 1056 | if ( e->button() == RightButton ) { |
1046 | QListViewItem* ci = currentItem(); | 1057 | QListViewItem* ci = currentItem(); |
1047 | if ( ci ) | 1058 | if ( ci ) |
1048 | ci->setSelected( true ); | 1059 | ci->setSelected( true ); |
1049 | } | 1060 | } |
1050 | KListView::contentsMouseReleaseEvent(e); | 1061 | KListView::contentsMouseReleaseEvent(e); |
1051 | } | 1062 | } |
1052 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1063 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1053 | { | 1064 | { |
1054 | // qDebug("contentsMouseMoveEv....... "); | 1065 | // qDebug("contentsMouseMoveEv....... "); |
1055 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); | 1066 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); |
1056 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); | 1067 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); |
1057 | if ( diff < 0 ) diff = -diff; | 1068 | if ( diff < 0 ) diff = -diff; |
1058 | if ( diff > 20 ) | 1069 | if ( diff > 20 ) |
1059 | mAllowPopupMenu = false; | 1070 | mAllowPopupMenu = false; |
1060 | KListView::contentsMouseMoveEvent(e); | 1071 | KListView::contentsMouseMoveEvent(e); |
1061 | } | 1072 | } |
diff --git a/korganizer/main.cpp b/korganizer/main.cpp index c8a55d2..ca53828 100644 --- a/korganizer/main.cpp +++ b/korganizer/main.cpp | |||
@@ -1,104 +1,106 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #ifndef DESKTOP_VERSION | 3 | #ifndef DESKTOP_VERSION |
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | #include <qcopchannel_qws.h> | 5 | #include <qcopchannel_qws.h> |
6 | #include <qpe/global.h> | 6 | #include <qpe/global.h> |
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #else | 8 | #else |
9 | #include <qapplication.h> | 9 | #include <qapplication.h> |
10 | #include <qstring.h> | 10 | #include <qstring.h> |
11 | #include <qwindowsstyle.h> | 11 | #include <qwindowsstyle.h> |
12 | #include <qplatinumstyle.h> | 12 | #include <qplatinumstyle.h> |
13 | #include <qsgistyle.h> | 13 | #include <qsgistyle.h> |
14 | #endif | 14 | #endif |
15 | #include <qtextcodec.h> | ||
15 | 16 | ||
16 | #include <qdir.h> | 17 | #include <qdir.h> |
17 | #include <kstandarddirs.h> | 18 | #include <kstandarddirs.h> |
18 | #include <kglobal.h> | 19 | #include <kglobal.h> |
19 | #include <stdio.h> | 20 | #include <stdio.h> |
20 | #include "mainwindow.h" | 21 | #include "mainwindow.h" |
21 | 22 | ||
22 | int main( int argc, char **argv ) | 23 | int main( int argc, char **argv ) |
23 | { | 24 | { |
24 | #ifndef DESKTOP_VERSION | 25 | #ifndef DESKTOP_VERSION |
25 | QPEApplication a( argc, argv ); | 26 | QPEApplication a( argc, argv ); |
26 | a.setKeepRunning (); | 27 | a.setKeepRunning (); |
27 | #else | 28 | #else |
28 | QApplication a( argc, argv ); | 29 | QApplication a( argc, argv ); |
29 | QApplication::setStyle( new QPlatinumStyle ()); | 30 | QApplication::setStyle( new QPlatinumStyle ()); |
30 | QString hdir = QDir::homeDirPath(); | 31 | QString hdir = QDir::homeDirPath(); |
31 | // there is a bug when creating dirs for WIN 98 | 32 | // there is a bug when creating dirs for WIN 98 |
32 | // it is difficult to fix, because we have no WIN 98 runnung | 33 | // it is difficult to fix, because we have no WIN 98 runnung |
33 | // such that we try it to create the dirs at startup here | 34 | // such that we try it to create the dirs at startup here |
34 | if ( hdir == "C:\\" ) { // win 98 or ME | 35 | if ( hdir == "C:\\" ) { // win 98 or ME |
35 | QDir app_dir; | 36 | QDir app_dir; |
36 | if ( !app_dir.exists("C:\\kdepim") ) | 37 | if ( !app_dir.exists("C:\\kdepim") ) |
37 | app_dir.mkdir ("C:\\kdepim"); | 38 | app_dir.mkdir ("C:\\kdepim"); |
38 | if ( !app_dir.exists("C:\\kdepim\\apps") ) | 39 | if ( !app_dir.exists("C:\\kdepim\\apps") ) |
39 | app_dir.mkdir ("C:\\kdepim\\apps"); | 40 | app_dir.mkdir ("C:\\kdepim\\apps"); |
40 | if ( !app_dir.exists("C:\\kdepim\\config") ) | 41 | if ( !app_dir.exists("C:\\kdepim\\config") ) |
41 | app_dir.mkdir ("C:\\kdepim\\config"); | 42 | app_dir.mkdir ("C:\\kdepim\\config"); |
42 | if ( !app_dir.exists("C:\\kdepim\\apps\\korganizer") ) | 43 | if ( !app_dir.exists("C:\\kdepim\\apps\\korganizer") ) |
43 | app_dir.mkdir ("C:\\kdepim\\apps\\korganizer"); | 44 | app_dir.mkdir ("C:\\kdepim\\apps\\korganizer"); |
44 | } | 45 | } |
45 | #endif | 46 | #endif |
46 | bool exitHelp = false; | 47 | bool exitHelp = false; |
47 | if ( argc > 1 ) { | 48 | if ( argc > 1 ) { |
48 | QString command = argv[1]; | 49 | QString command = argv[1]; |
49 | if ( command == "-help" ){ | 50 | if ( command == "-help" ){ |
50 | printf("KO/Pi command line commands:\n"); | 51 | printf("KO/Pi command line commands:\n"); |
51 | printf(" no command: Start KO/Pi in usual way\n"); | 52 | printf(" no command: Start KO/Pi in usual way\n"); |
52 | printf(" -help: This output\n"); | 53 | printf(" -help: This output\n"); |
53 | printf("Next Option: Open or Show after start:\n"); | 54 | printf("Next Option: Open or Show after start:\n"); |
54 | printf(" -newTodo: New Todo dialog\n"); | 55 | printf(" -newTodo: New Todo dialog\n"); |
55 | printf(" -newEvent: New Event dialog\n"); | 56 | printf(" -newEvent: New Event dialog\n"); |
56 | printf(" -showList: List view\n"); | 57 | printf(" -showList: List view\n"); |
57 | printf(" -showDay: Day view\n"); | 58 | printf(" -showDay: Day view\n"); |
58 | printf(" -showWWeek: Work Week view\n"); | 59 | printf(" -showWWeek: Work Week view\n"); |
59 | printf(" -showWeek: Week view\n"); | 60 | printf(" -showWeek: Week view\n"); |
60 | printf(" -showTodo: Todo view\n"); | 61 | printf(" -showTodo: Todo view\n"); |
61 | printf(" -showJournal: Journal view\n"); | 62 | printf(" -showJournal: Journal view\n"); |
62 | printf(" -showKO: Next Days view\n"); | 63 | printf(" -showKO: Next Days view\n"); |
63 | printf(" -showWNext: What's Next view\n"); | 64 | printf(" -showWNext: What's Next view\n"); |
64 | printf(" -showNextXView: Next X View\n"); | 65 | printf(" -showNextXView: Next X View\n"); |
65 | printf(" -new[Y] and -show[X] may be used togehther\n"); | 66 | printf(" -new[Y] and -show[X] may be used togehther\n"); |
66 | printf(" KO/Pi is exiting now. Bye!\n"); | 67 | printf(" KO/Pi is exiting now. Bye!\n"); |
67 | exitHelp = true; | 68 | exitHelp = true; |
68 | } | 69 | } |
69 | } | 70 | } |
70 | if ( ! exitHelp ) { | 71 | if ( ! exitHelp ) { |
71 | KGlobal::setAppName( "korganizer" ); | 72 | KGlobal::setAppName( "korganizer" ); |
72 | QString fileName ; | 73 | QString fileName ; |
73 | #ifndef DESKTOP_VERSION | 74 | #ifndef DESKTOP_VERSION |
74 | fileName = getenv("QPEDIR"); | 75 | fileName = getenv("QPEDIR"); |
75 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); | 76 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); |
76 | #else | 77 | #else |
77 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; | 78 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; |
78 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 79 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
79 | #endif | 80 | #endif |
80 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); | 81 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); |
81 | MainWindow m; | 82 | MainWindow m; |
82 | #ifndef DESKTOP_VERSION | 83 | #ifndef DESKTOP_VERSION |
83 | 84 | ||
84 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); | 85 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); |
85 | a.showMainWidget(&m ); | 86 | a.showMainWidget(&m ); |
86 | #else | 87 | #else |
87 | a.setMainWidget(&m ); | 88 | a.setMainWidget(&m ); |
88 | m.show(); | 89 | m.show(); |
89 | //m.resize( 800, 600 ); | 90 | //m.resize( 800, 600 ); |
90 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); | 91 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); |
91 | #endif | 92 | #endif |
92 | if ( argc > 1 ) { | 93 | if ( argc > 1 ) { |
93 | QCString command = argv[1]; | 94 | QCString command = argv[1]; |
94 | if ( argc > 2 ) | 95 | if ( argc > 2 ) |
95 | command += argv[2]; | 96 | command += argv[2]; |
96 | qApp->processEvents(); | 97 | qApp->processEvents(); |
97 | m.recieve(command, QByteArray() ); | 98 | m.recieve(command, QByteArray() ); |
98 | 99 | ||
99 | } | 100 | } |
101 | |||
100 | a.exec(); | 102 | a.exec(); |
101 | 103 | ||
102 | } | 104 | } |
103 | qDebug("KO: Bye! "); | 105 | qDebug("KO: Bye! "); |
104 | } | 106 | } |