-rw-r--r-- | korganizer/koeventviewer.cpp | 112 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 10 |
2 files changed, 68 insertions, 54 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index f39b5e1..c8c2f28 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -185,457 +185,469 @@ void KOEventViewer::setSource(const QString& n) | |||
185 | //emit showIncidence(n); | 185 | //emit showIncidence(n); |
186 | return; | 186 | return; |
187 | } else if (n.startsWith("uid:")) { | 187 | } else if (n.startsWith("uid:")) { |
188 | DCOPClient *client = KApplication::kApplication()->dcopClient(); | 188 | DCOPClient *client = KApplication::kApplication()->dcopClient(); |
189 | const QByteArray noParamData; | 189 | const QByteArray noParamData; |
190 | const QByteArray paramData; | 190 | const QByteArray paramData; |
191 | QByteArray replyData; | 191 | QByteArray replyData; |
192 | QCString replyTypeStr; | 192 | QCString replyTypeStr; |
193 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) | 193 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) |
194 | bool foundAbbrowser = PING_ABBROWSER; | 194 | bool foundAbbrowser = PING_ABBROWSER; |
195 | 195 | ||
196 | if (foundAbbrowser) { | 196 | if (foundAbbrowser) { |
197 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor | 197 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor |
198 | //client->send("kaddressbook","KAddressBookIface", | 198 | //client->send("kaddressbook","KAddressBookIface", |
199 | QDataStream arg(paramData, IO_WriteOnly); | 199 | QDataStream arg(paramData, IO_WriteOnly); |
200 | arg << n.mid(6); | 200 | arg << n.mid(6); |
201 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); | 201 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); |
202 | return; | 202 | return; |
203 | } else { | 203 | } else { |
204 | /* | 204 | /* |
205 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. | 205 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. |
206 | We start it without its main interface | 206 | We start it without its main interface |
207 | */ | 207 | */ |
208 | KIconLoader* iconLoader = new KIconLoader(); | 208 | KIconLoader* iconLoader = new KIconLoader(); |
209 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); | 209 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); |
210 | ActionManager::setStartedKAddressBook(true); | 210 | ActionManager::setStartedKAddressBook(true); |
211 | tmpStr = "kaddressbook --editor-only --uid "; | 211 | tmpStr = "kaddressbook --editor-only --uid "; |
212 | tmpStr += KProcess::quote(n.mid(6)); | 212 | tmpStr += KProcess::quote(n.mid(6)); |
213 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); | 213 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); |
214 | return; | 214 | return; |
215 | } | 215 | } |
216 | } else { | 216 | } else { |
217 | //QTextBrowser::setSource(n); | 217 | //QTextBrowser::setSource(n); |
218 | } | 218 | } |
219 | #endif | 219 | #endif |
220 | } | 220 | } |
221 | void KOEventViewer::mailToAttendees( bool all ) | 221 | void KOEventViewer::mailToAttendees( bool all ) |
222 | { | 222 | { |
223 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); | 223 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); |
224 | if (attendees.count() == 0) return; | 224 | if (attendees.count() == 0) return; |
225 | QStringList nameList; | 225 | QStringList nameList; |
226 | QStringList emailList; | 226 | QStringList emailList; |
227 | QStringList uidList; | 227 | QStringList uidList; |
228 | Attendee* a; | 228 | Attendee* a; |
229 | for(a=attendees.first();a;a=attendees.next()) { | 229 | for(a=attendees.first();a;a=attendees.next()) { |
230 | if ( !all && !a->RSVP() ) continue; | 230 | if ( !all && !a->RSVP() ) continue; |
231 | if (!a->email().isEmpty()) { | 231 | if (!a->email().isEmpty()) { |
232 | nameList.append (a->name() ); | 232 | nameList.append (a->name() ); |
233 | emailList.append (a->email() ); | 233 | emailList.append (a->email() ); |
234 | uidList.append (a->uid() ); | 234 | uidList.append (a->uid() ); |
235 | } | 235 | } |
236 | } | 236 | } |
237 | QString uid = "ComposeMailUIpick2"+mMailSubject; | 237 | QString uid = "ComposeMailUIpick2"+mMailSubject; |
238 | #ifndef DESKTOP_VERSION | 238 | #ifndef DESKTOP_VERSION |
239 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 239 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
240 | #endif | 240 | #endif |
241 | 241 | ||
242 | } | 242 | } |
243 | void KOEventViewer::addTag(const QString & tag,const QString & text) | 243 | void KOEventViewer::addTag(const QString & tag,const QString & text) |
244 | { | 244 | { |
245 | int number=text.contains("\n"); | 245 | int number=text.contains("\n"); |
246 | QString str = "<" + tag + ">"; | 246 | QString str = "<" + tag + ">"; |
247 | QString tmpText=text; | 247 | QString tmpText=text; |
248 | QString tmpStr=str; | 248 | QString tmpStr=str; |
249 | if(number !=-1) | 249 | if(number !=-1) |
250 | { | 250 | { |
251 | if (number > 0) { | 251 | if (number > 0) { |
252 | int pos=0; | 252 | int pos=0; |
253 | QString tmp; | 253 | QString tmp; |
254 | for(int i=0;i<=number;i++) { | 254 | for(int i=0;i<=number;i++) { |
255 | pos=tmpText.find("\n"); | 255 | pos=tmpText.find("\n"); |
256 | tmp=tmpText.left(pos); | 256 | tmp=tmpText.left(pos); |
257 | tmpText=tmpText.right(tmpText.length()-pos-1); | 257 | tmpText=tmpText.right(tmpText.length()-pos-1); |
258 | tmpStr+=tmp+"<br>"; | 258 | tmpStr+=tmp+"<br>"; |
259 | } | 259 | } |
260 | } | 260 | } |
261 | else tmpStr += tmpText; | 261 | else tmpStr += tmpText; |
262 | tmpStr+="</" + tag + ">"; | 262 | tmpStr+="</" + tag + ">"; |
263 | mText.append(tmpStr); | 263 | mText.append(tmpStr); |
264 | } | 264 | } |
265 | else | 265 | else |
266 | { | 266 | { |
267 | str += text + "</" + tag + ">"; | 267 | str += text + "</" + tag + ">"; |
268 | mText.append(str); | 268 | mText.append(str); |
269 | } | 269 | } |
270 | } | 270 | } |
271 | 271 | ||
272 | void KOEventViewer::setColorMode( int m ) | 272 | void KOEventViewer::setColorMode( int m ) |
273 | { | 273 | { |
274 | mColorMode = m; | 274 | mColorMode = m; |
275 | } | 275 | } |
276 | void KOEventViewer::appendEvent(Event *event, int mode ) | 276 | void KOEventViewer::appendEvent(Event *event, int mode ) |
277 | { | 277 | { |
278 | mMailSubject = ""; | 278 | mMailSubject = ""; |
279 | mCurrentIncidence = event; | 279 | mCurrentIncidence = event; |
280 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 280 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
281 | bool wideScreen = ( QApplication::desktop()->width() >= 640 ); | ||
281 | topLevelWidget()->setCaption(i18n("Event Viewer")); | 282 | topLevelWidget()->setCaption(i18n("Event Viewer")); |
282 | if ( mode == 0 ) { | 283 | if ( mode == 0 ) { |
283 | addTag("h2",deTag(event->summary())); | 284 | addTag("h2",deTag(event->summary())); |
284 | } | 285 | } |
285 | else { | 286 | else { |
286 | if ( mColorMode == 1 ) { | 287 | if ( mColorMode == 1 ) { |
287 | mText +="<font color=\"#00A000\">"; | 288 | mText +="<font color=\"#00A000\">"; |
288 | } | 289 | } |
289 | if ( mColorMode == 2 ) { | 290 | if ( mColorMode == 2 ) { |
290 | mText +="<font color=\"#C00000\">"; | 291 | mText +="<font color=\"#C00000\">"; |
291 | } | 292 | } |
292 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 293 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
293 | if ( mode == 1 ) { | 294 | if ( mode == 1 ) { |
294 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); | 295 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); |
295 | } else { | 296 | } else { |
296 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); | 297 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); |
297 | } | 298 | } |
298 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 299 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
299 | if ( mColorMode ) | 300 | if ( mColorMode ) |
300 | mText += "</font>"; | 301 | mText += "</font>"; |
301 | } | 302 | } |
302 | mMailSubject += i18n( "Meeting " )+ event->summary(); | 303 | mMailSubject += i18n( "Meeting " )+ event->summary(); |
303 | if (event->cancelled ()) { | 304 | if (event->cancelled ()) { |
304 | mText +="<font color=\"#B00000\">"; | 305 | mText +="<font color=\"#B00000\">"; |
305 | addTag("i",i18n("This event has been cancelled!")); | 306 | addTag("i",i18n("This event has been cancelled!")); |
306 | mText.append("<br>"); | 307 | mText.append("<br>"); |
307 | mText += "</font>"; | 308 | mText += "</font>"; |
308 | mMailSubject += i18n("(cancelled)"); | 309 | mMailSubject += i18n("(cancelled)"); |
309 | } | 310 | } |
310 | 311 | ||
311 | if (event->doesFloat()) { | 312 | if (event->doesFloat()) { |
312 | if (event->isMultiDay()) { | 313 | if (event->isMultiDay()) { |
313 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 314 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
314 | .arg(event->dtStartDateStr(shortDate)) | 315 | .arg(event->dtStartDateStr(shortDate)) |
315 | .arg(event->dtEndDateStr(shortDate))); | 316 | .arg(event->dtEndDateStr(shortDate))); |
316 | } else { | 317 | } else { |
317 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 318 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
318 | } | 319 | } |
319 | } else { | 320 | } else { |
320 | if (event->isMultiDay()) { | 321 | if (event->isMultiDay()) { |
321 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 322 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
322 | .arg(event->dtStartStr( shortDate))); | 323 | .arg(event->dtStartStr( shortDate))); |
323 | mText.append(i18n("<p><b>To:</b> %1</p>") | 324 | mText.append(i18n("<p><b>To:</b> %1</p>") |
324 | .arg(event->dtEndStr(shortDate))); | 325 | .arg(event->dtEndStr(shortDate))); |
325 | } else { | 326 | } else { |
326 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 327 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
327 | .arg(event->dtStartTimeStr()) | 328 | .arg(event->dtStartTimeStr()) |
328 | .arg(event->dtEndTimeStr())); | 329 | .arg(event->dtEndTimeStr())); |
329 | mText.append(i18n("<p><b>On:</b> %1</p> ") | 330 | mText.append(i18n("<p><b>On:</b> %1</p> ") |
330 | .arg(event->dtStartDateStr( shortDate ))); | 331 | .arg(event->dtStartDateStr( shortDate ))); |
331 | } | 332 | } |
332 | } | 333 | } |
333 | if (!event->location().isEmpty()) { | 334 | if (!event->location().isEmpty()) { |
334 | addTag("b",i18n("Location: ")); | 335 | addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); |
335 | mText.append(deTag(event->location())+"<br>"); | ||
336 | mMailSubject += i18n(" at ") + event->location(); | 336 | mMailSubject += i18n(" at ") + event->location(); |
337 | } | 337 | } |
338 | if (event->recurrence()->doesRecur()) { | 338 | if (event->recurrence()->doesRecur()) { |
339 | 339 | ||
340 | QString recurText = event->recurrence()->recurrenceText(); | 340 | QString recurText = event->recurrence()->recurrenceText(); |
341 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 341 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
342 | bool ok; | 342 | bool ok; |
343 | QDate start = QDate::currentDate(); | 343 | QDate start = QDate::currentDate(); |
344 | QDateTime next; | 344 | QDateTime next; |
345 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); | 345 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); |
346 | if ( ok ) { | 346 | if ( ok ) { |
347 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 347 | if ( wideScreen ){ |
348 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); | 348 | addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) ); |
349 | } else { | ||
350 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | ||
351 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); | ||
352 | } | ||
349 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); | 353 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); |
350 | 354 | ||
351 | } else { | 355 | } else { |
352 | bool last; | 356 | bool last; |
353 | QDate nextd; | 357 | QDate nextd; |
354 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); | 358 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); |
355 | if ( last ) { | 359 | if ( last ) { |
356 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 360 | if ( wideScreen ){ |
357 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); | 361 | addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate )); |
362 | } else{ | ||
363 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | ||
364 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); | ||
365 | } | ||
358 | } | 366 | } |
359 | } | 367 | } |
360 | } else { | 368 | } else { |
361 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); | 369 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); |
362 | 370 | ||
363 | } | 371 | } |
364 | 372 | ||
365 | 373 | ||
366 | if (event->isAlarmEnabled()) { | 374 | if (event->isAlarmEnabled()) { |
367 | Alarm *alarm =event->alarms().first() ; | 375 | Alarm *alarm =event->alarms().first() ; |
368 | QDateTime t = alarm->time(); | 376 | QDateTime t = alarm->time(); |
369 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); | 377 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); |
370 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 378 | if(wideScreen ){ |
371 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 379 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); |
380 | }else{ | ||
381 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | ||
382 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | ||
383 | } | ||
372 | //addTag("p",s); | 384 | //addTag("p",s); |
373 | } | 385 | } |
374 | 386 | ||
375 | addTag("b",i18n("Access: ")); | 387 | addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); |
376 | mText.append(event->secrecyStr()+"<br>"); | ||
377 | 388 | ||
378 | |||
379 | |||
380 | formatCategories(event); | 389 | formatCategories(event); |
381 | 390 | ||
382 | formatReadOnly(event); | 391 | formatReadOnly(event); |
383 | formatAttendees(event); | 392 | formatAttendees(event); |
384 | 393 | ||
385 | if ( KOPrefs::instance()->mEVshowCreated ) { | 394 | if ( KOPrefs::instance()->mEVshowCreated ) { |
386 | #ifdef DESKTOP_VERSION | 395 | if(wideScreen ){ |
387 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 396 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
388 | #else | 397 | }else{ |
389 | addTag("p",i18n("<b>Created: ") +" </b>"); | 398 | addTag("p",i18n("<b>Created: ") +" </b>"); |
390 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 399 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
391 | #endif | 400 | } |
401 | |||
392 | 402 | ||
393 | } | 403 | } |
394 | if ( KOPrefs::instance()->mEVshowChanged ) { | 404 | if ( KOPrefs::instance()->mEVshowChanged ) { |
395 | #ifdef DESKTOP_VERSION | 405 | if(wideScreen ){ |
396 | addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); | 406 | addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); |
397 | #else | 407 | }else{ |
398 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 408 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
399 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 409 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
400 | #endif | 410 | } |
401 | 411 | ||
402 | } | 412 | } |
403 | if ( KOPrefs::instance()->mEVshowDetails ) { | 413 | if ( KOPrefs::instance()->mEVshowDetails ) { |
404 | if (!event->description().isEmpty()) { | 414 | if (!event->description().isEmpty()) { |
405 | addTag("p",i18n("<b>Details: </b>")); | 415 | addTag("p",i18n("<b>Details: </b>")); |
406 | addTag("p",deTag(event->description())); | 416 | addTag("p",deTag(event->description())); |
407 | } | 417 | } |
408 | } | 418 | } |
409 | setText(mText); | 419 | setText(mText); |
410 | //QWhatsThis::add(this,mText); | 420 | //QWhatsThis::add(this,mText); |
411 | 421 | ||
412 | } | 422 | } |
413 | 423 | ||
414 | void KOEventViewer::appendTodo(Todo *event, int mode ) | 424 | void KOEventViewer::appendTodo(Todo *event, int mode ) |
415 | { | 425 | { |
416 | mMailSubject = ""; | 426 | mMailSubject = ""; |
417 | mCurrentIncidence = event; | 427 | mCurrentIncidence = event; |
418 | topLevelWidget()->setCaption(i18n("Todo Viewer")); | 428 | topLevelWidget()->setCaption(i18n("Todo Viewer")); |
419 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 429 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
430 | bool wideScreen = ( QApplication::desktop()->width() >= 640 ); | ||
420 | if (mode == 0 ) | 431 | if (mode == 0 ) |
421 | addTag("h2",deTag(event->summary())); | 432 | addTag("h2",deTag(event->summary())); |
422 | else { | 433 | else { |
423 | if ( mColorMode == 1 ) { | 434 | if ( mColorMode == 1 ) { |
424 | mText +="<font color=\"#00A000\">"; | 435 | mText +="<font color=\"#00A000\">"; |
425 | } | 436 | } |
426 | if ( mColorMode == 2 ) { | 437 | if ( mColorMode == 2 ) { |
427 | mText +="<font color=\"#B00000\">"; | 438 | mText +="<font color=\"#B00000\">"; |
428 | } | 439 | } |
429 | if ( mode == 1 ) { | 440 | if ( mode == 1 ) { |
430 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); | 441 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); |
431 | } else { | 442 | } else { |
432 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); | 443 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); |
433 | } | 444 | } |
434 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 445 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
435 | if ( mColorMode ) | 446 | if ( mColorMode ) |
436 | mText += "</font>"; | 447 | mText += "</font>"; |
437 | } | 448 | } |
438 | mMailSubject += i18n( "Todo " )+ event->summary(); | 449 | mMailSubject += i18n( "Todo " )+ event->summary(); |
439 | 450 | ||
440 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 451 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
441 | mText +="<font color=\"#B00000\">"; | 452 | mText +="<font color=\"#B00000\">"; |
442 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); | 453 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); |
443 | mText += "</font>"; | 454 | mText += "</font>"; |
444 | } else { | 455 | } else { |
445 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 456 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
446 | .arg(event->percentComplete())); | 457 | .arg(event->percentComplete())); |
447 | } | 458 | } |
448 | 459 | ||
449 | if (event->cancelled ()) { | 460 | if (event->cancelled ()) { |
450 | mText +="<font color=\"#B00000\">"; | 461 | mText +="<font color=\"#B00000\">"; |
451 | addTag("i",i18n("This todo has been cancelled!")); | 462 | addTag("i",i18n("This todo has been cancelled!")); |
452 | mText.append("<br>"); | 463 | mText.append("<br>"); |
453 | mText += "</font>"; | 464 | mText += "</font>"; |
454 | mMailSubject += i18n("(cancelled)"); | 465 | mMailSubject += i18n("(cancelled)"); |
455 | } | 466 | } |
456 | 467 | ||
457 | 468 | ||
458 | 469 | ||
459 | if (event->recurrence()->doesRecur()) { | 470 | if (event->recurrence()->doesRecur()) { |
460 | 471 | ||
461 | QString recurText = event->recurrence()->recurrenceText(); | 472 | QString recurText = event->recurrence()->recurrenceText(); |
462 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | 473 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); |
463 | 474 | ||
464 | } | 475 | } |
465 | if (event->hasStartDate()) { | 476 | if (event->hasStartDate()) { |
466 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); | 477 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); |
467 | } | 478 | } |
468 | if (event->hasDueDate()) { | 479 | if (event->hasDueDate()) { |
469 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 480 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
470 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | 481 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); |
471 | } | 482 | } |
472 | if (!event->location().isEmpty()) { | 483 | if (!event->location().isEmpty()) { |
473 | addTag("b",i18n("Location: ")); | 484 | addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); |
474 | mText.append(deTag(event->location())+"<br>"); | ||
475 | mMailSubject += i18n(" at ") + event->location(); | 485 | mMailSubject += i18n(" at ") + event->location(); |
476 | } | 486 | } |
477 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 487 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
478 | .arg(QString::number(event->priority()))); | 488 | .arg(QString::number(event->priority()))); |
479 | 489 | ||
480 | if (event->isAlarmEnabled()) { | 490 | if (event->isAlarmEnabled()) { |
481 | Alarm *alarm =event->alarms().first() ; | 491 | Alarm *alarm =event->alarms().first() ; |
482 | QDateTime t = alarm->time(); | 492 | QDateTime t = alarm->time(); |
483 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); | 493 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); |
484 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 494 | if ( wideScreen ) { |
485 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 495 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); |
486 | //addTag("p",s); | 496 | } else { |
497 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | ||
498 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | ||
499 | } | ||
487 | } | 500 | } |
488 | 501 | ||
489 | addTag("b",i18n("Access: ")); | 502 | addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); |
490 | mText.append(event->secrecyStr()+"<br>"); | ||
491 | 503 | ||
492 | formatCategories(event); | 504 | formatCategories(event); |
493 | 505 | ||
494 | formatReadOnly(event); | 506 | formatReadOnly(event); |
495 | formatAttendees(event); | 507 | formatAttendees(event); |
496 | 508 | ||
497 | if ( KOPrefs::instance()->mEVshowCreated ) { | 509 | if ( KOPrefs::instance()->mEVshowCreated ) { |
498 | #ifdef DESKTOP_VERSION | 510 | if(wideScreen ){ |
499 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 511 | |
500 | #else | 512 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
501 | addTag("p",i18n("<b>Created: ") +" </b>"); | 513 | |
502 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 514 | } else { |
503 | #endif | 515 | addTag("p",i18n("<b>Created: ") +" </b>"); |
504 | 516 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | |
517 | } | ||
505 | } | 518 | } |
506 | if ( KOPrefs::instance()->mEVshowChanged ) { | 519 | if ( KOPrefs::instance()->mEVshowChanged ) { |
507 | #ifdef DESKTOP_VERSION | 520 | if(wideScreen ){ |
508 | addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); | 521 | addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); |
509 | #else | 522 | |
510 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 523 | } else { |
511 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 524 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
512 | #endif | 525 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
513 | 526 | } | |
514 | } | 527 | } |
515 | if ( event->relatedTo() ) { | 528 | if ( event->relatedTo() ) { |
516 | addTag("b",i18n("Parent todo:<br>")); | 529 | addTag("b",i18n("Parent todo:<br>")); |
517 | mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); | 530 | mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); |
518 | } | 531 | } |
519 | QPtrList<Incidence> Relations = event->relations(); | 532 | QPtrList<Incidence> Relations = event->relations(); |
520 | Incidence *to; | 533 | Incidence *to; |
521 | if ( Relations.first() ) | 534 | if ( Relations.first() ) |
522 | addTag("b",i18n("Sub todos:<br>")); | 535 | addTag("b",i18n("Sub todos:<br>")); |
523 | for (to=Relations.first();to;to=Relations.next()) { | 536 | for (to=Relations.first();to;to=Relations.next()) { |
524 | mText.append( deTag(to->summary())+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); | 537 | mText.append( deTag(to->summary())+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); |
525 | 538 | ||
526 | } | 539 | } |
527 | 540 | ||
528 | if ( KOPrefs::instance()->mEVshowDetails ) { | 541 | if ( KOPrefs::instance()->mEVshowDetails ) { |
529 | if (!event->description().isEmpty()) { | 542 | if (!event->description().isEmpty()) { |
530 | addTag("p",i18n("<b>Details: </b>")); | 543 | addTag("p",i18n("<b>Details: </b>")); |
531 | addTag("p",deTag(event->description())); | 544 | addTag("p",deTag(event->description())); |
532 | } | 545 | } |
533 | } | 546 | } |
534 | setText(mText); | 547 | setText(mText); |
535 | } | 548 | } |
536 | 549 | ||
537 | void KOEventViewer::formatCategories(Incidence *event) | 550 | void KOEventViewer::formatCategories(Incidence *event) |
538 | { | 551 | { |
539 | if (!event->categoriesStr().isEmpty()) { | 552 | if (!event->categoriesStr().isEmpty()) { |
540 | if (event->categories().count() == 1) { | 553 | if (event->categories().count() == 1) { |
541 | addTag("h3",i18n("Category")); | 554 | addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace()); |
542 | } else { | 555 | } else { |
543 | addTag("h3",i18n("Categories")); | 556 | addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ; |
544 | } | 557 | } |
545 | addTag("p",event->categoriesStr()); | ||
546 | } | 558 | } |
547 | } | 559 | } |
548 | void KOEventViewer::formatAttendees(Incidence *event) | 560 | void KOEventViewer::formatAttendees(Incidence *event) |
549 | { | 561 | { |
550 | QPtrList<Attendee> attendees = event->attendees(); | 562 | QPtrList<Attendee> attendees = event->attendees(); |
551 | if (attendees.count()) { | 563 | if (attendees.count()) { |
552 | 564 | ||
553 | 565 | ||
554 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 566 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
555 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); | 567 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); |
556 | addTag("h3",i18n("Organizer")); | 568 | addTag("h3",i18n("Organizer")); |
557 | mText.append("<ul><li>"); | 569 | mText.append("<ul><li>"); |
558 | #ifndef KORG_NOKABC | 570 | #ifndef KORG_NOKABC |
559 | 571 | ||
560 | #ifdef DESKTOP_VERSION | 572 | #ifdef DESKTOP_VERSION |
561 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 573 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
562 | KABC::Addressee::List addressList; | 574 | KABC::Addressee::List addressList; |
563 | addressList = add_book->findByEmail(event->organizer()); | 575 | addressList = add_book->findByEmail(event->organizer()); |
564 | KABC::Addressee o = addressList.first(); | 576 | KABC::Addressee o = addressList.first(); |
565 | if (!o.isEmpty() && addressList.size()<2) { | 577 | if (!o.isEmpty() && addressList.size()<2) { |
566 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 578 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
567 | mText += o.formattedName(); | 579 | mText += o.formattedName(); |
568 | mText += "</a>\n"; | 580 | mText += "</a>\n"; |
569 | } else { | 581 | } else { |
570 | mText.append(event->organizer()); | 582 | mText.append(event->organizer()); |
571 | } | 583 | } |
572 | #else //DESKTOP_VERSION | 584 | #else //DESKTOP_VERSION |
573 | mText += "<a href=\"uid:organizer\">"; | 585 | mText += "<a href=\"uid:organizer\">"; |
574 | mText += event->organizer(); | 586 | mText += event->organizer(); |
575 | mText += "</a>\n"; | 587 | mText += "</a>\n"; |
576 | #endif //DESKTOP_VERSION | 588 | #endif //DESKTOP_VERSION |
577 | 589 | ||
578 | 590 | ||
579 | #else | 591 | #else |
580 | mText.append(event->organizer()); | 592 | mText.append(event->organizer()); |
581 | #endif | 593 | #endif |
582 | 594 | ||
583 | if (iconPath) { | 595 | if (iconPath) { |
584 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 596 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
585 | mText += "<IMG src=\"" + iconPath + "\">"; | 597 | mText += "<IMG src=\"" + iconPath + "\">"; |
586 | mText += "</a>\n"; | 598 | mText += "</a>\n"; |
587 | } | 599 | } |
588 | mText.append("</li></ul>"); | 600 | mText.append("</li></ul>"); |
589 | 601 | ||
590 | addTag("h3",i18n("Attendees")); | 602 | addTag("h3",i18n("Attendees")); |
591 | Attendee *a; | 603 | Attendee *a; |
592 | mText.append("<ul>"); | 604 | mText.append("<ul>"); |
593 | int a_count = 0; | 605 | int a_count = 0; |
594 | int a_count_nr = 0; | 606 | int a_count_nr = 0; |
595 | 607 | ||
596 | for(a=attendees.first();a;a=attendees.next()) { | 608 | for(a=attendees.first();a;a=attendees.next()) { |
597 | #ifndef KORG_NOKABC | 609 | #ifndef KORG_NOKABC |
598 | #ifdef DESKTOP_VERSION | 610 | #ifdef DESKTOP_VERSION |
599 | if (a->name().isEmpty()) { | 611 | if (a->name().isEmpty()) { |
600 | addressList = add_book->findByEmail(a->email()); | 612 | addressList = add_book->findByEmail(a->email()); |
601 | KABC::Addressee o = addressList.first(); | 613 | KABC::Addressee o = addressList.first(); |
602 | if (!o.isEmpty() && addressList.size()<2) { | 614 | if (!o.isEmpty() && addressList.size()<2) { |
603 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 615 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
604 | mText += o.formattedName(); | 616 | mText += o.formattedName(); |
605 | mText += "</a>\n"; | 617 | mText += "</a>\n"; |
606 | } else { | 618 | } else { |
607 | mText += "<li>"; | 619 | mText += "<li>"; |
608 | mText.append(a->email()); | 620 | mText.append(a->email()); |
609 | mText += "\n"; | 621 | mText += "\n"; |
610 | } | 622 | } |
611 | } else { | 623 | } else { |
612 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 624 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
613 | if (!a->name().isEmpty()) mText += a->name(); | 625 | if (!a->name().isEmpty()) mText += a->name(); |
614 | else mText += a->email(); | 626 | else mText += a->email(); |
615 | mText += "</a>\n"; | 627 | mText += "</a>\n"; |
616 | } | 628 | } |
617 | #else //DESKTOP_VERSION | 629 | #else //DESKTOP_VERSION |
618 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 630 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
619 | if (!a->name().isEmpty()) mText += a->name(); | 631 | if (!a->name().isEmpty()) mText += a->name(); |
620 | else mText += a->email(); | 632 | else mText += a->email(); |
621 | mText += "</a>\n"; | 633 | mText += "</a>\n"; |
622 | #endif //DESKTOP_VERSION | 634 | #endif //DESKTOP_VERSION |
623 | #else | 635 | #else |
624 | //qDebug("nokabc "); | 636 | //qDebug("nokabc "); |
625 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 637 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
626 | if (!a->name().isEmpty()) mText += a->name(); | 638 | if (!a->name().isEmpty()) mText += a->name(); |
627 | else mText += a->email(); | 639 | else mText += a->email(); |
628 | mText += "</a>\n"; | 640 | mText += "</a>\n"; |
629 | #endif | 641 | #endif |
630 | 642 | ||
631 | 643 | ||
632 | if (!a->email().isEmpty()) { | 644 | if (!a->email().isEmpty()) { |
633 | if (iconPath) { | 645 | if (iconPath) { |
634 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; | 646 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; |
635 | if ( a->RSVP() ) { | 647 | if ( a->RSVP() ) { |
636 | ++a_count_nr; | 648 | ++a_count_nr; |
637 | mText += "<IMG src=\"" + iconPath + "\">"; | 649 | mText += "<IMG src=\"" + iconPath + "\">"; |
638 | } | 650 | } |
639 | else { | 651 | else { |
640 | ++a_count; | 652 | ++a_count; |
641 | mText += "<IMG src=\"" + NOiconPath + "\">"; | 653 | mText += "<IMG src=\"" + NOiconPath + "\">"; |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 0a608dc..25be63a 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -371,213 +371,215 @@ KOQuickTodo::KOQuickTodo(QWidget *parent) : | |||
371 | setText(i18n("Click to add a new Todo")); | 371 | setText(i18n("Click to add a new Todo")); |
372 | } | 372 | } |
373 | 373 | ||
374 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 374 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
375 | { | 375 | { |
376 | if ( text()==i18n("Click to add a new Todo") ) | 376 | if ( text()==i18n("Click to add a new Todo") ) |
377 | setText(""); | 377 | setText(""); |
378 | QLineEdit::focusInEvent(ev); | 378 | QLineEdit::focusInEvent(ev); |
379 | } | 379 | } |
380 | 380 | ||
381 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 381 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
382 | { | 382 | { |
383 | setText(i18n("Click to add a new Todo")); | 383 | setText(i18n("Click to add a new Todo")); |
384 | QLineEdit::focusOutEvent(ev); | 384 | QLineEdit::focusOutEvent(ev); |
385 | } | 385 | } |
386 | 386 | ||
387 | ///////////////////////////////////////////////////////////////////////////// | 387 | ///////////////////////////////////////////////////////////////////////////// |
388 | 388 | ||
389 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 389 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
390 | KOrg::BaseView(calendar,parent,name) | 390 | KOrg::BaseView(calendar,parent,name) |
391 | { | 391 | { |
392 | mPendingUpdateBeforeRepaint = false; | 392 | mPendingUpdateBeforeRepaint = false; |
393 | isFlatDisplay = false; | 393 | isFlatDisplay = false; |
394 | mNavigator = 0; | 394 | mNavigator = 0; |
395 | QBoxLayout *topLayout = new QVBoxLayout(this); | 395 | QBoxLayout *topLayout = new QVBoxLayout(this); |
396 | mName = QString ( name ); | 396 | mName = QString ( name ); |
397 | mBlockUpdate = false; | 397 | mBlockUpdate = false; |
398 | mQuickAdd = new KOQuickTodo(this); | 398 | mQuickAdd = new KOQuickTodo(this); |
399 | topLayout->addWidget(mQuickAdd); | 399 | topLayout->addWidget(mQuickAdd); |
400 | 400 | ||
401 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); | 401 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); |
402 | 402 | ||
403 | mTodoListView = new KOTodoListView(calendar,this, name ); | 403 | mTodoListView = new KOTodoListView(calendar,this, name ); |
404 | topLayout->addWidget(mTodoListView); | 404 | topLayout->addWidget(mTodoListView); |
405 | //mTodoListView->header()->setMaximumHeight(30); | 405 | //mTodoListView->header()->setMaximumHeight(30); |
406 | mTodoListView->setRootIsDecorated(true); | 406 | mTodoListView->setRootIsDecorated(true); |
407 | mTodoListView->setAllColumnsShowFocus(true); | 407 | mTodoListView->setAllColumnsShowFocus(true); |
408 | 408 | ||
409 | mTodoListView->setShowSortIndicator(true); | 409 | mTodoListView->setShowSortIndicator(true); |
410 | 410 | ||
411 | mTodoListView->addColumn(i18n("Todo")); | 411 | mTodoListView->addColumn(i18n("Todo")); |
412 | mTodoListView->addColumn(i18n("Prio")); | 412 | mTodoListView->addColumn(i18n("Prio")); |
413 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 413 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
414 | mTodoListView->addColumn(i18n("Complete")); | 414 | mTodoListView->addColumn(i18n("Complete")); |
415 | mTodoListView->setColumnAlignment(2,AlignCenter); | 415 | mTodoListView->setColumnAlignment(2,AlignCenter); |
416 | 416 | ||
417 | mTodoListView->addColumn(i18n("Due Date")); | 417 | mTodoListView->addColumn(i18n("Due Date")); |
418 | mTodoListView->setColumnAlignment(3,AlignLeft); | 418 | mTodoListView->setColumnAlignment(3,AlignLeft); |
419 | mTodoListView->addColumn(i18n("Due Time")); | 419 | mTodoListView->addColumn(i18n("Due Time")); |
420 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 420 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
421 | 421 | ||
422 | mTodoListView->addColumn(i18n("Start Date")); | 422 | mTodoListView->addColumn(i18n("Start Date")); |
423 | mTodoListView->setColumnAlignment(5,AlignLeft); | 423 | mTodoListView->setColumnAlignment(5,AlignLeft); |
424 | mTodoListView->addColumn(i18n("Start Time")); | 424 | mTodoListView->addColumn(i18n("Start Time")); |
425 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 425 | mTodoListView->setColumnAlignment(6,AlignHCenter); |
426 | 426 | ||
427 | mTodoListView->addColumn(i18n("Cancelled")); | 427 | mTodoListView->addColumn(i18n("Cancelled")); |
428 | mTodoListView->addColumn(i18n("Categories")); | 428 | mTodoListView->addColumn(i18n("Categories")); |
429 | #if 0 | 429 | #if 0 |
430 | mTodoListView->addColumn(i18n("Sort Id")); | 430 | mTodoListView->addColumn(i18n("Sort Id")); |
431 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 431 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
432 | #endif | 432 | #endif |
433 | 433 | ||
434 | mTodoListView->setMinimumHeight( 60 ); | 434 | mTodoListView->setMinimumHeight( 60 ); |
435 | mTodoListView->setItemsRenameable( true ); | 435 | mTodoListView->setItemsRenameable( true ); |
436 | mTodoListView->setRenameable( 0 ); | 436 | mTodoListView->setRenameable( 0 ); |
437 | mTodoListView->setColumnWidth( 0, 120 ); | 437 | mTodoListView->setColumnWidth( 0, 120 ); |
438 | mTodoListView->setColumnWidthMode(0, QListView::Manual); | 438 | mTodoListView->setColumnWidthMode(0, QListView::Manual); |
439 | mTodoListView->setColumnWidthMode(1, QListView::Manual); | 439 | mTodoListView->setColumnWidthMode(1, QListView::Manual); |
440 | mTodoListView->setColumnWidthMode(2, QListView::Manual); | 440 | mTodoListView->setColumnWidthMode(2, QListView::Manual); |
441 | mTodoListView->setColumnWidthMode(3, QListView::Manual); | 441 | mTodoListView->setColumnWidthMode(3, QListView::Manual); |
442 | mTodoListView->setColumnWidthMode(4, QListView::Manual); | 442 | mTodoListView->setColumnWidthMode(4, QListView::Manual); |
443 | mTodoListView->setColumnWidthMode(5, QListView::Manual); | 443 | mTodoListView->setColumnWidthMode(5, QListView::Manual); |
444 | mTodoListView->setColumnWidthMode(6, QListView::Manual); | 444 | mTodoListView->setColumnWidthMode(6, QListView::Manual); |
445 | mTodoListView->setColumnWidthMode(7, QListView::Manual); | 445 | mTodoListView->setColumnWidthMode(7, QListView::Manual); |
446 | mTodoListView->setColumnWidthMode(8, QListView::Manual); | 446 | mTodoListView->setColumnWidthMode(8, QListView::Manual); |
447 | 447 | ||
448 | 448 | ||
449 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); | 449 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); |
450 | 450 | ||
451 | mPriorityPopupMenu = new QPopupMenu(this); | 451 | mPriorityPopupMenu = new QPopupMenu(this); |
452 | for (int i = 1; i <= 5; i++) { | 452 | for (int i = 1; i <= 5; i++) { |
453 | QString label = QString ("%1").arg (i); | 453 | QString label = QString ("%1").arg (i); |
454 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 454 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
455 | } | 455 | } |
456 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 456 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
457 | 457 | ||
458 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 458 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
459 | for (int i = 0; i <= 100; i+=20) { | 459 | for (int i = 0; i <= 100; i+=20) { |
460 | QString label = QString ("%1 %").arg (i); | 460 | QString label = QString ("%1 %").arg (i); |
461 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 461 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
462 | } | 462 | } |
463 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 463 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
464 | 464 | ||
465 | 465 | ||
466 | 466 | ||
467 | mItemPopupMenu = new QPopupMenu(this); | 467 | mItemPopupMenu = new QPopupMenu(this); |
468 | mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, | ||
469 | SLOT (toggleRunningItem())); | ||
470 | mItemPopupMenu->insertSeparator(); | ||
468 | mItemPopupMenu->insertItem(i18n("Show..."), this, | 471 | mItemPopupMenu->insertItem(i18n("Show..."), this, |
469 | SLOT (showTodo())); | 472 | SLOT (showTodo())); |
470 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 473 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
471 | SLOT (editTodo())); | 474 | SLOT (editTodo())); |
472 | mItemPopupMenu->insertItem( i18n("Delete"), this, | 475 | mItemPopupMenu->insertItem( i18n("Delete"), this, |
473 | SLOT (deleteTodo())); | 476 | SLOT (deleteTodo())); |
474 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 477 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
475 | SLOT (cloneTodo())); | 478 | SLOT (cloneTodo())); |
476 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 479 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
477 | SLOT (moveTodo())); | 480 | SLOT (moveTodo())); |
478 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 481 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
479 | SLOT (beamTodo())); | 482 | SLOT (beamTodo())); |
480 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 483 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
481 | SLOT (cancelTodo())); | 484 | SLOT (cancelTodo())); |
482 | mItemPopupMenu->insertSeparator(); | 485 | mItemPopupMenu->insertSeparator(); |
483 | 486 | /* | |
484 | mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, | ||
485 | SLOT (toggleRunningItem())); | ||
486 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 487 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
487 | SLOT (newTodo())); | 488 | SLOT (newTodo())); |
489 | */ | ||
488 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 490 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
489 | SLOT (newSubTodo())); | 491 | SLOT (newSubTodo())); |
490 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 492 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
491 | SLOT (unparentTodo()),0,21); | 493 | SLOT (unparentTodo()),0,21); |
492 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, | 494 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, |
493 | SLOT (reparentTodo()),0,22); | 495 | SLOT (reparentTodo()),0,22); |
494 | mItemPopupMenu->insertSeparator(); | 496 | mItemPopupMenu->insertSeparator(); |
495 | #if 0 | 497 | #if 0 |
496 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), | 498 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), |
497 | this, SLOT( purgeCompleted() ) ); | 499 | this, SLOT( purgeCompleted() ) ); |
498 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 500 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
499 | this, SLOT( toggleCompleted() ),0, 33 ); | 501 | this, SLOT( toggleCompleted() ),0, 33 ); |
500 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 502 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
501 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 503 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
502 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 504 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
503 | this, SLOT( toggleRunning() ),0, 35 ); | 505 | this, SLOT( toggleRunning() ),0, 35 ); |
504 | 506 | ||
505 | #endif | 507 | #endif |
506 | mPopupMenu = new QPopupMenu(this); | 508 | mPopupMenu = new QPopupMenu(this); |
507 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 509 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
508 | SLOT (newTodo()),0,1); | 510 | SLOT (newTodo()),0,1); |
509 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), | 511 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), |
510 | this, SLOT(purgeCompleted()),0,2); | 512 | this, SLOT(purgeCompleted()),0,2); |
511 | mPopupMenu->insertItem(i18n("Show Completed"), | 513 | mPopupMenu->insertItem(i18n("Show Completed"), |
512 | this, SLOT( toggleCompleted() ),0,3 ); | 514 | this, SLOT( toggleCompleted() ),0,3 ); |
513 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 515 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
514 | this, SLOT( toggleQuickTodo() ),0,4 ); | 516 | this, SLOT( toggleQuickTodo() ),0,4 ); |
515 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 517 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
516 | this, SLOT( toggleRunning() ),0,5 ); | 518 | this, SLOT( toggleRunning() ),0,5 ); |
517 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), | 519 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), |
518 | this, SLOT( setAllOpen() ),0,6 ); | 520 | this, SLOT( setAllOpen() ),0,6 ); |
519 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), | 521 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), |
520 | this, SLOT( setAllClose() ),0,7 ); | 522 | this, SLOT( setAllClose() ),0,7 ); |
521 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), | 523 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), |
522 | this, SLOT( setAllFlat() ),0,8 ); | 524 | this, SLOT( setAllFlat() ),0,8 ); |
523 | mDocPrefs = new DocPrefs( name ); | 525 | mDocPrefs = new DocPrefs( name ); |
524 | 526 | ||
525 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); | 527 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); |
526 | mPopupMenu->setCheckable( true ); | 528 | mPopupMenu->setCheckable( true ); |
527 | mItemPopupMenu->setCheckable( true ); | 529 | mItemPopupMenu->setCheckable( true ); |
528 | 530 | ||
529 | 531 | ||
530 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 532 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
531 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 533 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
532 | 534 | ||
533 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 535 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
534 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 536 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
535 | 537 | ||
536 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 538 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
537 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 539 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
538 | 540 | ||
539 | 541 | ||
540 | // Double clicking conflicts with opening/closing the subtree | 542 | // Double clicking conflicts with opening/closing the subtree |
541 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 543 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), |
542 | SLOT( editItem( QListViewItem *) ) ); | 544 | SLOT( editItem( QListViewItem *) ) ); |
543 | /* | 545 | /* |
544 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 546 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
545 | const QPoint &,int ) ), | 547 | const QPoint &,int ) ), |
546 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 548 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
547 | */ | 549 | */ |
548 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | 550 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, |
549 | const QPoint &,int ) ), | 551 | const QPoint &,int ) ), |
550 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 552 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
551 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 553 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
552 | SLOT( itemClicked( QListViewItem * ) ) ); | 554 | SLOT( itemClicked( QListViewItem * ) ) ); |
553 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 555 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
554 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 556 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
555 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 557 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
556 | SLOT( updateView() ) ); | 558 | SLOT( updateView() ) ); |
557 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 559 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
558 | SLOT( todoModified(Todo *, int) ) ); | 560 | SLOT( todoModified(Todo *, int) ) ); |
559 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 561 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
560 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 562 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
561 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 563 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
562 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 564 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
563 | connect( mTodoListView, SIGNAL( paintNeeded() ), | 565 | connect( mTodoListView, SIGNAL( paintNeeded() ), |
564 | SLOT( paintNeeded()) ); | 566 | SLOT( paintNeeded()) ); |
565 | 567 | ||
566 | #if 0 | 568 | #if 0 |
567 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 569 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
568 | SLOT(selectionChanged(QListViewItem *))); | 570 | SLOT(selectionChanged(QListViewItem *))); |
569 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 571 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
570 | SLOT(selectionChanged(QListViewItem *))); | 572 | SLOT(selectionChanged(QListViewItem *))); |
571 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 573 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
572 | SLOT(selectionChanged(QListViewItem *))); | 574 | SLOT(selectionChanged(QListViewItem *))); |
573 | #endif | 575 | #endif |
574 | 576 | ||
575 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); | 577 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); |
576 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); | 578 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); |
577 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); | 579 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); |
578 | 580 | ||
579 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 581 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
580 | SLOT( processSelectionChange() ) ); | 582 | SLOT( processSelectionChange() ) ); |
581 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 583 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
582 | SLOT( addQuickTodo() ) ); | 584 | SLOT( addQuickTodo() ) ); |
583 | 585 | ||