author | zautrix <zautrix> | 2005-08-05 21:04:00 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-05 21:04:00 (UTC) |
commit | 90585d5946407bdb8783bcb369ef7483c869995d (patch) (unidiff) | |
tree | 10b1b1b2580e6f341d83522b13440925a55e108b /korganizer | |
parent | 6bf157dca5ab703c7f1674c117cc62d9675f4bde (diff) | |
download | kdepimpi-90585d5946407bdb8783bcb369ef7483c869995d.zip kdepimpi-90585d5946407bdb8783bcb369ef7483c869995d.tar.gz kdepimpi-90585d5946407bdb8783bcb369ef7483c869995d.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/kolistview.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index e560ce4..b236c2d 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -264,1179 +264,1181 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, | |||
264 | const char *name) | 264 | const char *name) |
265 | : KOEventView(calendar, parent, name) | 265 | : KOEventView(calendar, parent, name) |
266 | { | 266 | { |
267 | 267 | ||
268 | mActiveItem = 0; | 268 | mActiveItem = 0; |
269 | mForceShowCompletedTodos = false; | 269 | mForceShowCompletedTodos = false; |
270 | mListView = new KOListViewListView(this); | 270 | mListView = new KOListViewListView(this); |
271 | mListView->addColumn(i18n("Summary")); | 271 | mListView->addColumn(i18n("Summary")); |
272 | mListView->addColumn(i18n("Start Date")); | 272 | mListView->addColumn(i18n("Start Date")); |
273 | mListView->addColumn(i18n("Start Time")); | 273 | mListView->addColumn(i18n("Start Time")); |
274 | mListView->addColumn(i18n("End/Due Date")); | 274 | mListView->addColumn(i18n("End/Due Date")); |
275 | mListView->addColumn(i18n("End/Due Time")); | 275 | mListView->addColumn(i18n("End/Due Time")); |
276 | mListView->addColumn(i18n("Duration")); | 276 | mListView->addColumn(i18n("Duration")); |
277 | mListView->addColumn(i18n("Alarm")); // alarm set? | 277 | mListView->addColumn(i18n("Alarm")); // alarm set? |
278 | mListView->addColumn(i18n("Recurs")); // recurs? | 278 | mListView->addColumn(i18n("Recurs")); // recurs? |
279 | mListView->addColumn(i18n("Cancelled")); | 279 | mListView->addColumn(i18n("Cancelled")); |
280 | mListView->addColumn(i18n("Categories")); | 280 | mListView->addColumn(i18n("Categories")); |
281 | mListView->addColumn(i18n("Calendar")); | 281 | mListView->addColumn(i18n("Calendar")); |
282 | mListView->addColumn(i18n("Last Modified")); | 282 | mListView->addColumn(i18n("Last Modified")); |
283 | 283 | ||
284 | mListView->setColumnAlignment(0,AlignLeft); | 284 | mListView->setColumnAlignment(0,AlignLeft); |
285 | mListView->setColumnAlignment(1,AlignLeft); | 285 | mListView->setColumnAlignment(1,AlignLeft); |
286 | mListView->setColumnAlignment(2,AlignHCenter); | 286 | mListView->setColumnAlignment(2,AlignHCenter); |
287 | mListView->setColumnAlignment(3,AlignLeft); | 287 | mListView->setColumnAlignment(3,AlignLeft); |
288 | mListView->setColumnAlignment(4,AlignHCenter); | 288 | mListView->setColumnAlignment(4,AlignHCenter); |
289 | mListView->setColumnAlignment(5,AlignLeft); | 289 | mListView->setColumnAlignment(5,AlignLeft); |
290 | mListView->setColumnAlignment(6,AlignLeft); | 290 | mListView->setColumnAlignment(6,AlignLeft); |
291 | mListView->setColumnAlignment(7,AlignLeft); | 291 | mListView->setColumnAlignment(7,AlignLeft); |
292 | mListView->setColumnAlignment(8,AlignLeft); | 292 | mListView->setColumnAlignment(8,AlignLeft); |
293 | mListView->setColumnAlignment(9,AlignLeft); | 293 | mListView->setColumnAlignment(9,AlignLeft); |
294 | mListView->setColumnAlignment(10,AlignLeft); | 294 | mListView->setColumnAlignment(10,AlignLeft); |
295 | mListView->setColumnAlignment(11,AlignLeft); | 295 | mListView->setColumnAlignment(11,AlignLeft); |
296 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); | 296 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); |
297 | 297 | ||
298 | int iii = 0; | 298 | int iii = 0; |
299 | for ( iii = 0; iii< 12 ; ++iii ) | 299 | for ( iii = 0; iii< 12 ; ++iii ) |
300 | mListView->setColumnWidthMode( iii, QListView::Manual ); | 300 | mListView->setColumnWidthMode( iii, QListView::Manual ); |
301 | 301 | ||
302 | QBoxLayout *layoutTop = new QVBoxLayout(this); | 302 | QBoxLayout *layoutTop = new QVBoxLayout(this); |
303 | layoutTop->addWidget(mListView); | 303 | layoutTop->addWidget(mListView); |
304 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 304 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
305 | mPopupMenu = eventPopup(); | 305 | mPopupMenu = eventPopup(); |
306 | QPopupMenu* selPopup = new QPopupMenu ( this ); | 306 | QPopupMenu* selPopup = new QPopupMenu ( this ); |
307 | mPopupMenu->insertSeparator(); | 307 | mPopupMenu->insertSeparator(); |
308 | 308 | ||
309 | selPopup->insertItem(i18n("All"),this, | 309 | selPopup->insertItem(i18n("All"),this, |
310 | SLOT(allSelection())); | 310 | SLOT(allSelection())); |
311 | selPopup->insertItem(i18n("None"),this, | 311 | selPopup->insertItem(i18n("None"),this, |
312 | SLOT(clearSelection())); | 312 | SLOT(clearSelection())); |
313 | selPopup->insertItem(i18n("Delete selected..."),this, | 313 | selPopup->insertItem(i18n("Delete selected..."),this, |
314 | SLOT(deleteAll())); | 314 | SLOT(deleteAll())); |
315 | mPopupMenu->insertItem(i18n("Selection"), selPopup ); | 315 | mPopupMenu->insertItem(i18n("Selection"), selPopup ); |
316 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 316 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
317 | i18n("Hide all selected"),this, | 317 | i18n("Hide all selected"),this, |
318 | SLOT(hideAll()),true); | 318 | SLOT(hideAll()),true); |
319 | 319 | ||
320 | selPopup->insertSeparator(); | 320 | selPopup->insertSeparator(); |
321 | QPopupMenu * exportPO = new QPopupMenu ( this ); | 321 | QPopupMenu * exportPO = new QPopupMenu ( this ); |
322 | selPopup->insertItem( i18n("Export"), exportPO ); | 322 | selPopup->insertItem( i18n("Export"), exportPO ); |
323 | #ifdef DESKTOP_VERSION | 323 | #ifdef DESKTOP_VERSION |
324 | mPopupMenu->insertSeparator(); | 324 | mPopupMenu->insertSeparator(); |
325 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 325 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
326 | i18n("Print complete list..."),this, | 326 | i18n("Print complete list..."),this, |
327 | SLOT(printList()),true); | 327 | SLOT(printList()),true); |
328 | #endif | 328 | #endif |
329 | mCalPopup = new QPopupMenu ( this ); | 329 | mCalPopup = new QPopupMenu ( this ); |
330 | selPopup->insertItem( i18n("Set Calendar"), mCalPopup ); | 330 | selPopup->insertItem( i18n("Set Calendar"), mCalPopup ); |
331 | 331 | ||
332 | selPopup->insertItem(i18n("Set categories")+"...",this, | 332 | selPopup->insertItem(i18n("Set categories")+"...",this, |
333 | SLOT(setCat()) ); | 333 | SLOT(setCat()) ); |
334 | selPopup->insertItem( i18n("Set alarm..."),this, | 334 | selPopup->insertItem( i18n("Set alarm..."),this, |
335 | SLOT(setAlarm())); | 335 | SLOT(setAlarm())); |
336 | #if 0 | 336 | #if 0 |
337 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 337 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
338 | i18n("Set categories")+"...",this, | 338 | i18n("Set categories")+"...",this, |
339 | SLOT(setCat()),true); | 339 | SLOT(setCat()),true); |
340 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 340 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
341 | i18n("Set alarm..."),this, | 341 | i18n("Set alarm..."),this, |
342 | SLOT(setAlarm()),true); | 342 | SLOT(setAlarm()),true); |
343 | #endif | 343 | #endif |
344 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, | 344 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, |
345 | SLOT( populateCalPopup() )); | 345 | SLOT( populateCalPopup() )); |
346 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, | 346 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, |
347 | SLOT( setCalendar( int ) )); | 347 | SLOT( setCalendar( int ) )); |
348 | QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this, | 348 | QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this, |
349 | SLOT( catChanged( Incidence * ) )); | 349 | SLOT( catChanged( Incidence * ) )); |
350 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, | 350 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, |
351 | SLOT(saveToFile())); | 351 | SLOT(saveToFile())); |
352 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, | 352 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, |
353 | SLOT(saveToFileVCS())); | 353 | SLOT(saveToFileVCS())); |
354 | exportPO->insertItem( i18n("Journal/Details..."),this, | 354 | exportPO->insertItem( i18n("Journal/Details..."),this, |
355 | SLOT(saveDescriptionToFile())); | 355 | SLOT(saveDescriptionToFile())); |
356 | // mPopupMenu->insertSeparator(); | 356 | // mPopupMenu->insertSeparator(); |
357 | // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 357 | // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
358 | // i18n("Add Categ. to selected..."),this, | 358 | // i18n("Add Categ. to selected..."),this, |
359 | // SLOT(addCat()),true); | 359 | // SLOT(addCat()),true); |
360 | //mPopupMenu->insertSeparator(); | 360 | //mPopupMenu->insertSeparator(); |
361 | #ifndef DESKTOP_VERSION | 361 | #ifndef DESKTOP_VERSION |
362 | selPopup->insertSeparator(); | 362 | selPopup->insertSeparator(); |
363 | selPopup->insertItem( i18n("Beam via IR..."),this, | 363 | selPopup->insertItem( i18n("Beam via IR..."),this, |
364 | SLOT(beamSelected())); | 364 | SLOT(beamSelected())); |
365 | #if 0 | 365 | #if 0 |
366 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 366 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
367 | i18n("Beam via IR"),this, | 367 | i18n("Beam via IR"),this, |
368 | SLOT(beamSelected()),true); | 368 | SLOT(beamSelected()),true); |
369 | #endif | 369 | #endif |
370 | #endif | 370 | #endif |
371 | /* | 371 | /* |
372 | mPopupMenu = new QPopupMenu; | 372 | mPopupMenu = new QPopupMenu; |
373 | mPopupMenu->insertItem(i18n("Edit Event"), this, | 373 | mPopupMenu->insertItem(i18n("Edit Event"), this, |
374 | SLOT (editEvent())); | 374 | SLOT (editEvent())); |
375 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, | 375 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, |
376 | SLOT (deleteEvent())); | 376 | SLOT (deleteEvent())); |
377 | mPopupMenu->insertSeparator(); | 377 | mPopupMenu->insertSeparator(); |
378 | mPopupMenu->insertItem(i18n("Show Dates"), this, | 378 | mPopupMenu->insertItem(i18n("Show Dates"), this, |
379 | SLOT(showDates())); | 379 | SLOT(showDates())); |
380 | mPopupMenu->insertItem(i18n("Hide Dates"), this, | 380 | mPopupMenu->insertItem(i18n("Hide Dates"), this, |
381 | SLOT(hideDates())); | 381 | SLOT(hideDates())); |
382 | */ | 382 | */ |
383 | QObject::connect(mListView,SIGNAL( newEvent()), | 383 | QObject::connect(mListView,SIGNAL( newEvent()), |
384 | this,SIGNAL(signalNewEvent())); | 384 | this,SIGNAL(signalNewEvent())); |
385 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), | 385 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), |
386 | this,SLOT(defaultItemAction(QListViewItem *))); | 386 | this,SLOT(defaultItemAction(QListViewItem *))); |
387 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, | 387 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, |
388 | const QPoint &, int )), | 388 | const QPoint &, int )), |
389 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); | 389 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); |
390 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), | 390 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), |
391 | SLOT(processSelectionChange(QListViewItem *))); | 391 | SLOT(processSelectionChange(QListViewItem *))); |
392 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), | 392 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), |
393 | SIGNAL(showIncidenceSignal(Incidence *)) ); | 393 | SIGNAL(showIncidenceSignal(Incidence *)) ); |
394 | 394 | ||
395 | readSettings(KOGlobals::config(),"KOListView Layout"); | 395 | readSettings(KOGlobals::config(),"KOListView Layout"); |
396 | } | 396 | } |
397 | 397 | ||
398 | KOListView::~KOListView() | 398 | KOListView::~KOListView() |
399 | { | 399 | { |
400 | delete mPopupMenu; | 400 | delete mPopupMenu; |
401 | #if QT_VERSION >= 0x030000 | 401 | #if QT_VERSION >= 0x030000 |
402 | 402 | ||
403 | #else | 403 | #else |
404 | delete mKOListViewWhatsThis; | 404 | delete mKOListViewWhatsThis; |
405 | #endif | 405 | #endif |
406 | } | 406 | } |
407 | 407 | ||
408 | void KOListView::catChanged( Incidence* inc) | 408 | void KOListView::catChanged( Incidence* inc) |
409 | { | 409 | { |
410 | KOListViewItem* item = getItemForEvent(inc); | 410 | KOListViewItem* item = getItemForEvent(inc); |
411 | if (item) { | 411 | if (item) { |
412 | ListItemVisitor v(item, mStartDate ); | 412 | ListItemVisitor v(item, mStartDate ); |
413 | inc->accept(v); | 413 | inc->accept(v); |
414 | } | 414 | } |
415 | } | 415 | } |
416 | QString KOListView::getWhatsThisText(QPoint p) | 416 | QString KOListView::getWhatsThisText(QPoint p) |
417 | { | 417 | { |
418 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); | 418 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); |
419 | if ( item ) | 419 | if ( item ) |
420 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), | 420 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), |
421 | KOPrefs::instance()->mWTshowDetails, | 421 | KOPrefs::instance()->mWTshowDetails, |
422 | KOPrefs::instance()->mWTshowCreated, | 422 | KOPrefs::instance()->mWTshowCreated, |
423 | KOPrefs::instance()->mWTshowChanged); | 423 | KOPrefs::instance()->mWTshowChanged); |
424 | return i18n("That is the list view" ); | 424 | return i18n("That is the list view" ); |
425 | 425 | ||
426 | } | 426 | } |
427 | 427 | ||
428 | void KOListView::setCalendar( int c ) | 428 | void KOListView::setCalendar( int c ) |
429 | { | 429 | { |
430 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), | 430 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), |
431 | i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), | 431 | i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), |
432 | i18n("Continue"), i18n("Cancel"), 0, | 432 | i18n("Continue"), i18n("Cancel"), 0, |
433 | 0, 1 ); | 433 | 0, 1 ); |
434 | if ( result != 0 ) { | 434 | if ( result != 0 ) { |
435 | return; | 435 | return; |
436 | } | 436 | } |
437 | 437 | ||
438 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 438 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
439 | int icount = delSel.count(); | 439 | int icount = delSel.count(); |
440 | if ( icount ) { | 440 | if ( icount ) { |
441 | Incidence *incidence = delSel.first(); | 441 | Incidence *incidence = delSel.first(); |
442 | while ( incidence ) { | 442 | while ( incidence ) { |
443 | incidence->setCalID( c ); | 443 | incidence->setCalID( c ); |
444 | KOListViewItem * item = getItemForEvent( incidence ); | 444 | KOListViewItem * item = getItemForEvent( incidence ); |
445 | if ( item ) { | 445 | if ( item ) { |
446 | ListItemVisitor v(item, mStartDate ); | 446 | ListItemVisitor v(item, mStartDate ); |
447 | incidence->accept(v); | 447 | incidence->accept(v); |
448 | } | 448 | } |
449 | incidence = delSel.next(); | 449 | incidence = delSel.next(); |
450 | } | 450 | } |
451 | } | 451 | } |
452 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 452 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
453 | KopiCalendarFile * cal = calendars.first(); | 453 | KopiCalendarFile * cal = calendars.first(); |
454 | while ( cal ) { | 454 | while ( cal ) { |
455 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); | 455 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); |
456 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); | 456 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); |
457 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); | 457 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); |
458 | if ( cal->isStandard ) | 458 | if ( cal->isStandard ) |
459 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 459 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
460 | cal = calendars.next(); | 460 | cal = calendars.next(); |
461 | } | 461 | } |
462 | mCalendar->setSyncEventsReadOnly(); | 462 | mCalendar->setSyncEventsReadOnly(); |
463 | mCalendar->reInitAlarmSettings(); | 463 | mCalendar->reInitAlarmSettings(); |
464 | 464 | ||
465 | } | 465 | } |
466 | void KOListView::populateCalPopup() | 466 | void KOListView::populateCalPopup() |
467 | { | 467 | { |
468 | mCalPopup->clear(); | 468 | mCalPopup->clear(); |
469 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 469 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
470 | while ( kkf ) { | 470 | while ( kkf ) { |
471 | int index = mCalPopup->insertItem( kkf->mName+"...", kkf->mCalNumber); | 471 | int index = mCalPopup->insertItem( kkf->mName+"...", kkf->mCalNumber); |
472 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) | 472 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) |
473 | mCalPopup->setItemEnabled( index, false ); | 473 | mCalPopup->setItemEnabled( index, false ); |
474 | kkf = KOPrefs::instance()->mCalendars.next(); | 474 | kkf = KOPrefs::instance()->mCalendars.next(); |
475 | } | 475 | } |
476 | } | 476 | } |
477 | void KOListView::updateList() | 477 | void KOListView::updateList() |
478 | { | 478 | { |
479 | // qDebug(" KOListView::updateList() "); | 479 | // qDebug(" KOListView::updateList() "); |
480 | 480 | ||
481 | } | 481 | } |
482 | 482 | ||
483 | void KOListView::clearList() | 483 | void KOListView::clearList() |
484 | { | 484 | { |
485 | clear (); | 485 | clear (); |
486 | } | 486 | } |
487 | 487 | ||
488 | void KOListView::setCat() | 488 | void KOListView::setCat() |
489 | { | 489 | { |
490 | 490 | ||
491 | bool set = true; | 491 | bool set = true; |
492 | int result = KMessageBox::warningYesNoCancel(this, | 492 | int result = KMessageBox::warningYesNoCancel(this, |
493 | i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"), | 493 | i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"), |
494 | i18n("Set categories"), | 494 | i18n("Set categories"), |
495 | i18n("Add"), | 495 | i18n("Add"), |
496 | i18n("Reset")); | 496 | i18n("Reset")); |
497 | if (result == KMessageBox::Cancel) return; | 497 | if (result == KMessageBox::Cancel) return; |
498 | if (result == KMessageBox::Yes) set = false; | 498 | if (result == KMessageBox::Yes) set = false; |
499 | setCategories( set ); | 499 | setCategories( set ); |
500 | } | 500 | } |
501 | 501 | ||
502 | void KOListView::setAlarm() | 502 | void KOListView::setAlarm() |
503 | { | 503 | { |
504 | KOAlarmPrefs kap( this); | 504 | KOAlarmPrefs kap( this); |
505 | if ( !kap.exec() ) | 505 | if ( !kap.exec() ) |
506 | return; | 506 | return; |
507 | QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos | 507 | QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos |
508 | Incidence* inc = delSel.first(); | 508 | Incidence* inc = delSel.first(); |
509 | int count = 0; | 509 | int count = 0; |
510 | while ( inc ) { | 510 | while ( inc ) { |
511 | ++count; | 511 | ++count; |
512 | if (kap.mAlarmButton->isChecked()) { | 512 | if (kap.mAlarmButton->isChecked()) { |
513 | if (inc->alarms().count() == 0) | 513 | if (inc->alarms().count() == 0) |
514 | inc->newAlarm(); | 514 | inc->newAlarm(); |
515 | Alarm *alarm = inc->alarms().first(); | 515 | Alarm *alarm = inc->alarms().first(); |
516 | alarm->setEnabled(true); | 516 | alarm->setEnabled(true); |
517 | int j = kap.mAlarmTimeEdit->value()* -60; | 517 | int j = kap.mAlarmTimeEdit->value()* -60; |
518 | if (kap.mAlarmIncrCombo->currentItem() == 1) | 518 | if (kap.mAlarmIncrCombo->currentItem() == 1) |
519 | j = j * 60; | 519 | j = j * 60; |
520 | else if (kap.mAlarmIncrCombo->currentItem() == 2) | 520 | else if (kap.mAlarmIncrCombo->currentItem() == 2) |
521 | j = j * (60 * 24); | 521 | j = j * (60 * 24); |
522 | alarm->setStartOffset( j ); | 522 | alarm->setStartOffset( j ); |
523 | 523 | ||
524 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { | 524 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { |
525 | alarm->setProcedureAlarm(kap.mAlarmProgram); | 525 | alarm->setProcedureAlarm(kap.mAlarmProgram); |
526 | } | 526 | } |
527 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) | 527 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) |
528 | alarm->setAudioAlarm(kap.mAlarmSound); | 528 | alarm->setAudioAlarm(kap.mAlarmSound); |
529 | else | 529 | else |
530 | alarm->setType(Alarm::Invalid); | 530 | alarm->setType(Alarm::Invalid); |
531 | } else { | 531 | } else { |
532 | QPtrList<Alarm> alarms = inc->alarms(); | 532 | QPtrList<Alarm> alarms = inc->alarms(); |
533 | Alarm *alarm; | 533 | Alarm *alarm; |
534 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 534 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
535 | alarm->setEnabled(false); | 535 | alarm->setEnabled(false); |
536 | alarm->setType(Alarm::Invalid); | 536 | alarm->setType(Alarm::Invalid); |
537 | } | 537 | } |
538 | } | 538 | } |
539 | KOListViewItem* item = getItemForEvent(inc); | 539 | KOListViewItem* item = getItemForEvent(inc); |
540 | if (item) { | 540 | if (item) { |
541 | ListItemVisitor v(item, mStartDate ); | 541 | ListItemVisitor v(item, mStartDate ); |
542 | inc->accept(v); | 542 | inc->accept(v); |
543 | } | 543 | } |
544 | inc = delSel.next(); | 544 | inc = delSel.next(); |
545 | } | 545 | } |
546 | topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); | 546 | topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); |
547 | qDebug("KO: Set alarm for %d items", count); | 547 | qDebug("KO: Set alarm for %d items", count); |
548 | calendar()->reInitAlarmSettings(); | 548 | calendar()->reInitAlarmSettings(); |
549 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 549 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
550 | } | 550 | } |
551 | void KOListView::setCategories( bool removeOld ) | 551 | void KOListView::setCategories( bool removeOld ) |
552 | { | 552 | { |
553 | 553 | ||
554 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 554 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
555 | csd->setColorEnabled(); | 555 | csd->setColorEnabled(); |
556 | if (! csd->exec()) { | 556 | if (! csd->exec()) { |
557 | delete csd; | 557 | delete csd; |
558 | return; | 558 | return; |
559 | } | 559 | } |
560 | QStringList catList = csd->selectedCategories(); | 560 | QStringList catList = csd->selectedCategories(); |
561 | delete csd; | 561 | delete csd; |
562 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; | 562 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; |
563 | Incidence* inc = delSel.first(); | 563 | Incidence* inc = delSel.first(); |
564 | while ( inc ) { | 564 | while ( inc ) { |
565 | if ( removeOld ) { | 565 | if ( removeOld ) { |
566 | inc->setCategories( catList, false ); | 566 | inc->setCategories( catList, false ); |
567 | } else { | 567 | } else { |
568 | inc->addCategories( catList, false ); | 568 | inc->addCategories( catList, false ); |
569 | } | 569 | } |
570 | KOListViewItem* item = getItemForEvent(inc); | 570 | KOListViewItem* item = getItemForEvent(inc); |
571 | if (item) { | 571 | if (item) { |
572 | ListItemVisitor v(item, mStartDate ); | 572 | ListItemVisitor v(item, mStartDate ); |
573 | inc->accept(v); | 573 | inc->accept(v); |
574 | } | 574 | } |
575 | inc = delSel.next(); | 575 | inc = delSel.next(); |
576 | } | 576 | } |
577 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 577 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
578 | } | 578 | } |
579 | 579 | ||
580 | void KOListView::beamSelected() | 580 | void KOListView::beamSelected() |
581 | { | 581 | { |
582 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 582 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
583 | if ( delSel.count() ) | 583 | if ( delSel.count() ) |
584 | emit beamIncidenceList( delSel ); | 584 | emit beamIncidenceList( delSel ); |
585 | } | 585 | } |
586 | 586 | ||
587 | void KOListView::saveDescriptionToFile() | 587 | void KOListView::saveDescriptionToFile() |
588 | { | 588 | { |
589 | 589 | ||
590 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), | 590 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), |
591 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), | 591 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), |
592 | i18n("Continue"), i18n("Cancel"), 0, | 592 | i18n("Continue"), i18n("Cancel"), 0, |
593 | 0, 1 ); | 593 | 0, 1 ); |
594 | if ( result != 0 ) { | 594 | if ( result != 0 ) { |
595 | return; | 595 | return; |
596 | } | 596 | } |
597 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 597 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
598 | int icount = delSel.count(); | 598 | int icount = delSel.count(); |
599 | if ( icount ) { | 599 | if ( icount ) { |
600 | QString fn = KOPrefs::instance()->mLastSaveFile; | 600 | QString fn = KOPrefs::instance()->mLastSaveFile; |
601 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); | 601 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); |
602 | 602 | ||
603 | if ( fn == "" ) | 603 | if ( fn == "" ) |
604 | return; | 604 | return; |
605 | QFileInfo info; | 605 | QFileInfo info; |
606 | info.setFile( fn ); | 606 | info.setFile( fn ); |
607 | QString mes; | 607 | QString mes; |
608 | bool createbup = true; | 608 | bool createbup = true; |
609 | if ( info. exists() ) { | 609 | if ( info. exists() ) { |
610 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 610 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
611 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 611 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
612 | i18n("Overwrite!"), i18n("Cancel"), 0, | 612 | i18n("Overwrite!"), i18n("Cancel"), 0, |
613 | 0, 1 ); | 613 | 0, 1 ); |
614 | if ( result != 0 ) { | 614 | if ( result != 0 ) { |
615 | createbup = false; | 615 | createbup = false; |
616 | } | 616 | } |
617 | } | 617 | } |
618 | if ( createbup ) { | 618 | if ( createbup ) { |
619 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + | 619 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + |
620 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); | 620 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); |
621 | Incidence *incidence = delSel.first(); | 621 | Incidence *incidence = delSel.first(); |
622 | icount = 0; | 622 | icount = 0; |
623 | while ( incidence ) { | 623 | while ( incidence ) { |
624 | if ( incidence->typeID() == journalID ) { | 624 | if ( incidence->typeID() == journalID ) { |
625 | text += "\n************************************\n"; | 625 | text += "\n************************************\n"; |
626 | if ( !incidence->summary().isEmpty() ) | 626 | if ( !incidence->summary().isEmpty() ) |
627 | text += i18n("Journal: %1 from ").arg( incidence->summary() ) +incidence->dtStartDateStr( false ); | 627 | text += i18n("Journal: %1 from ").arg( incidence->summary() ) +incidence->dtStartDateStr( false ); |
628 | else | 628 | else |
629 | text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); | 629 | text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); |
630 | if ( !incidence->location().isEmpty() ) | 630 | if ( !incidence->location().isEmpty() ) |
631 | text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; | 631 | text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; |
632 | text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); | 632 | text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); |
633 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); | 633 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); |
634 | ++icount; | 634 | ++icount; |
635 | 635 | ||
636 | } else { | 636 | } else { |
637 | if ( !incidence->description().isEmpty() ) { | 637 | if ( !incidence->description().isEmpty() ) { |
638 | text += "\n************************************\n"; | 638 | text += "\n************************************\n"; |
639 | if ( incidence->typeID() == todoID ) | 639 | if ( incidence->typeID() == todoID ) |
640 | text += i18n("To-Do: "); | 640 | text += i18n("To-Do: "); |
641 | text += incidence->summary(); | 641 | text += incidence->summary(); |
642 | if ( !incidence->location().isEmpty() ) | 642 | if ( !incidence->location().isEmpty() ) |
643 | text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; | 643 | text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; |
644 | if ( incidence->hasStartDate() ) | 644 | if ( incidence->hasStartDate() ) |
645 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); | 645 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); |
646 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); | 646 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); |
647 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); | 647 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); |
648 | ++icount; | 648 | ++icount; |
649 | 649 | ||
650 | } | 650 | } |
651 | } | 651 | } |
652 | incidence = delSel.next(); | 652 | incidence = delSel.next(); |
653 | } | 653 | } |
654 | QFile file( fn ); | 654 | QFile file( fn ); |
655 | if (!file.open( IO_WriteOnly ) ) { | 655 | if (!file.open( IO_WriteOnly ) ) { |
656 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); | 656 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); |
657 | return; | 657 | return; |
658 | } | 658 | } |
659 | QTextStream ts( &file ); | 659 | QTextStream ts( &file ); |
660 | ts << text; | 660 | ts << text; |
661 | file.close(); | 661 | file.close(); |
662 | //qDebug("%s ", text.latin1()); | 662 | //qDebug("%s ", text.latin1()); |
663 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); | 663 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); |
664 | KOPrefs::instance()->mLastSaveFile = fn; | 664 | KOPrefs::instance()->mLastSaveFile = fn; |
665 | topLevelWidget()->setCaption(mes); | 665 | topLevelWidget()->setCaption(mes); |
666 | } | 666 | } |
667 | } | 667 | } |
668 | } | 668 | } |
669 | void KOListView::saveToFileVCS() | 669 | void KOListView::saveToFileVCS() |
670 | { | 670 | { |
671 | writeToFile( false ); | 671 | writeToFile( false ); |
672 | } | 672 | } |
673 | void KOListView::saveToFile() | 673 | void KOListView::saveToFile() |
674 | { | 674 | { |
675 | writeToFile( true ); | 675 | writeToFile( true ); |
676 | } | 676 | } |
677 | QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos ) | 677 | QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos ) |
678 | { | 678 | { |
679 | QPtrList<Incidence> delSel ; | 679 | QPtrList<Incidence> delSel ; |
680 | bool addSubTodos = false; | 680 | bool addSubTodos = false; |
681 | bool askSubTodos = true; | 681 | bool askSubTodos = true; |
682 | QListViewItem *item = mListView->firstChild (); | 682 | QListViewItem *item = mListView->firstChild (); |
683 | while ( item ) { | 683 | while ( item ) { |
684 | if ( item->isSelected() ) { | 684 | if ( item->isSelected() ) { |
685 | Incidence* inc = ((KOListViewItem *)item)->data(); | 685 | Incidence* inc = ((KOListViewItem *)item)->data(); |
686 | if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) { | 686 | if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) { |
687 | if ( (inc->typeID() == todoID && includeTodos) || | 687 | if ( (inc->typeID() == todoID && includeTodos) || |
688 | (inc->typeID() == eventID && includeEvents) || | 688 | (inc->typeID() == eventID && includeEvents) || |
689 | (inc->typeID() == journalID && includeJournals) ) { | 689 | (inc->typeID() == journalID && includeJournals) ) { |
690 | if ( inc->typeID() == todoID && onlyDueTodos ) { | 690 | if ( inc->typeID() == todoID && onlyDueTodos ) { |
691 | if ( ((Todo*)inc)->hasDueDate() ) | 691 | if ( ((Todo*)inc)->hasDueDate() ) |
692 | delSel.append( inc ); | 692 | delSel.append( inc ); |
693 | } else | 693 | } else |
694 | delSel.append( inc ); | 694 | delSel.append( inc ); |
695 | 695 | ||
696 | } | 696 | } |
697 | } | 697 | } |
698 | if ( inc->typeID() == todoID ) { | 698 | if ( inc->typeID() == todoID ) { |
699 | Todo * todo = (Todo*) inc; | 699 | Todo * todo = (Todo*) inc; |
700 | if ( todo->relations().count() ) { | 700 | if ( todo->relations().count() ) { |
701 | if ( askSubTodos ) { | 701 | if ( askSubTodos ) { |
702 | int result = KMessageBox::warningYesNoCancel(this, | 702 | int result = KMessageBox::warningYesNoCancel(this, |
703 | i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"), | 703 | i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"), |
704 | i18n("Todo has subtodos"), | 704 | i18n("Todo has subtodos"), |
705 | i18n("Yes"), | 705 | i18n("Yes"), |
706 | i18n("No")); | 706 | i18n("No")); |
707 | if ( result == KMessageBox::Cancel ) { | 707 | if ( result == KMessageBox::Cancel ) { |
708 | delSel.clear(); | 708 | delSel.clear(); |
709 | return delSel; | 709 | return delSel; |
710 | } | 710 | } |
711 | if (result == KMessageBox::Yes) | 711 | if (result == KMessageBox::Yes) |
712 | addSubTodos = true; | 712 | addSubTodos = true; |
713 | askSubTodos = false; | 713 | askSubTodos = false; |
714 | } | 714 | } |
715 | if ( addSubTodos ) { | 715 | if ( addSubTodos ) { |
716 | QPtrList<Incidence> tempSel ; | 716 | QPtrList<Incidence> tempSel ; |
717 | inc->addRelationsToList( &tempSel ); | 717 | inc->addRelationsToList( &tempSel ); |
718 | Incidence* tempinc = tempSel.first(); | 718 | Incidence* tempinc = tempSel.first(); |
719 | while ( tempinc ) { | 719 | while ( tempinc ) { |
720 | if ( delSel.findRef( tempinc ) == -1 ) { | 720 | if ( delSel.findRef( tempinc ) == -1 ) { |
721 | if ( tempinc->typeID() == todoID && onlyDueTodos ) { | 721 | if ( tempinc->typeID() == todoID && onlyDueTodos ) { |
722 | if ( ((Todo*)tempinc)->hasDueDate() ) | 722 | if ( ((Todo*)tempinc)->hasDueDate() ) |
723 | delSel.append( tempinc ); | 723 | delSel.append( tempinc ); |
724 | } else | 724 | } else |
725 | delSel.append( tempinc ); | 725 | delSel.append( tempinc ); |
726 | } | 726 | } |
727 | tempinc = tempSel.next(); | 727 | tempinc = tempSel.next(); |
728 | } | 728 | } |
729 | } | 729 | } |
730 | } | 730 | } |
731 | } | 731 | } |
732 | } | 732 | } |
733 | item = item->nextSibling(); | 733 | item = item->nextSibling(); |
734 | } | 734 | } |
735 | return delSel; | 735 | return delSel; |
736 | } | 736 | } |
737 | 737 | ||
738 | void KOListView::writeToFile( bool iCal ) | 738 | void KOListView::writeToFile( bool iCal ) |
739 | { | 739 | { |
740 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; | 740 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; |
741 | if ( !iCal ) { | 741 | if ( !iCal ) { |
742 | bool journal = false; | 742 | bool journal = false; |
743 | Incidence *incidence = delSel.first(); | 743 | Incidence *incidence = delSel.first(); |
744 | while ( incidence ) { | 744 | while ( incidence ) { |
745 | if ( incidence->typeID() == journalID ) { | 745 | if ( incidence->typeID() == journalID ) { |
746 | journal = true; | 746 | journal = true; |
747 | break; | 747 | break; |
748 | } | 748 | } |
749 | incidence = delSel.next(); | 749 | incidence = delSel.next(); |
750 | } | 750 | } |
751 | if ( journal ) { | 751 | if ( journal ) { |
752 | int result = KMessageBox::warningContinueCancel(this, | 752 | int result = KMessageBox::warningContinueCancel(this, |
753 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 753 | i18n("The journal entries can not be\nexported to a vCalendar file."), |
754 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | 754 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), |
755 | true); | 755 | true); |
756 | if (result != KMessageBox::Continue) return; | 756 | if (result != KMessageBox::Continue) return; |
757 | } | 757 | } |
758 | } | 758 | } |
759 | if ( delSel.count() ) { | 759 | if ( delSel.count() ) { |
760 | QString fn = KOPrefs::instance()->mLastSaveFile; | 760 | QString fn = KOPrefs::instance()->mLastSaveFile; |
761 | QString extension; | 761 | QString extension; |
762 | if ( iCal ) { | 762 | if ( iCal ) { |
763 | if ( fn.right( 4 ).lower() == ".vcs" ) { | 763 | if ( fn.right( 4 ).lower() == ".vcs" ) { |
764 | fn = fn.left( fn.length() -3) + "ics"; | 764 | fn = fn.left( fn.length() -3) + "ics"; |
765 | } | 765 | } |
766 | } else { | 766 | } else { |
767 | if ( fn.right( 4 ).lower() == ".ics" ) { | 767 | if ( fn.right( 4 ).lower() == ".ics" ) { |
768 | fn = fn.left( fn.length() -3) + "vcs"; | 768 | fn = fn.left( fn.length() -3) + "vcs"; |
769 | } | 769 | } |
770 | } | 770 | } |
771 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); | 771 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); |
772 | 772 | ||
773 | if ( fn == "" ) | 773 | if ( fn == "" ) |
774 | return; | 774 | return; |
775 | QFileInfo info; | 775 | QFileInfo info; |
776 | info.setFile( fn ); | 776 | info.setFile( fn ); |
777 | QString mes; | 777 | QString mes; |
778 | bool createbup = true; | 778 | bool createbup = true; |
779 | if ( info. exists() ) { | 779 | if ( info. exists() ) { |
780 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 780 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
781 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 781 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
782 | i18n("Overwrite!"), i18n("Cancel"), 0, | 782 | i18n("Overwrite!"), i18n("Cancel"), 0, |
783 | 0, 1 ); | 783 | 0, 1 ); |
784 | if ( result != 0 ) { | 784 | if ( result != 0 ) { |
785 | createbup = false; | 785 | createbup = false; |
786 | } | 786 | } |
787 | } | 787 | } |
788 | if ( createbup ) { | 788 | if ( createbup ) { |
789 | CalendarLocal cal; | 789 | CalendarLocal cal; |
790 | cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 790 | cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
791 | Incidence *incidence = delSel.first(); | 791 | Incidence *incidence = delSel.first(); |
792 | while ( incidence ) { | 792 | while ( incidence ) { |
793 | cal.addIncidence( incidence->clone() ); | 793 | cal.addIncidence( incidence->clone() ); |
794 | incidence = delSel.next(); | 794 | incidence = delSel.next(); |
795 | } | 795 | } |
796 | if ( iCal ) { | 796 | if ( iCal ) { |
797 | ICalFormat format; | 797 | ICalFormat format; |
798 | format.save( &cal, fn ); | 798 | format.save( &cal, fn ); |
799 | } else { | 799 | } else { |
800 | 800 | ||
801 | VCalFormat format; | 801 | VCalFormat format; |
802 | format.save( &cal, fn ); | 802 | format.save( &cal, fn ); |
803 | } | 803 | } |
804 | mes = i18n("KO/Pi:Saved %1").arg(fn ); | 804 | mes = i18n("KO/Pi:Saved %1").arg(fn ); |
805 | KOPrefs::instance()->mLastSaveFile = fn; | 805 | KOPrefs::instance()->mLastSaveFile = fn; |
806 | topLevelWidget()->setCaption(mes); | 806 | topLevelWidget()->setCaption(mes); |
807 | } | 807 | } |
808 | } | 808 | } |
809 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 809 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
810 | } | 810 | } |
811 | void KOListView::hideAll() | 811 | void KOListView::hideAll() |
812 | { | 812 | { |
813 | QPtrList<QListViewItem> delSel ; | 813 | QPtrList<QListViewItem> delSel ; |
814 | QListViewItem *item = mListView->firstChild (); | 814 | QListViewItem *item = mListView->firstChild (); |
815 | while ( item ) { | 815 | while ( item ) { |
816 | if ( item->isSelected() ) { | 816 | if ( item->isSelected() ) { |
817 | delSel.append(item); | 817 | delSel.append(item); |
818 | } | 818 | } |
819 | item = item->nextSibling(); | 819 | item = item->nextSibling(); |
820 | } | 820 | } |
821 | item = delSel.first() ; | 821 | item = delSel.first() ; |
822 | while ( item ) { | 822 | while ( item ) { |
823 | QListViewItem * del = item; | 823 | QListViewItem * del = item; |
824 | item = delSel.next(); | 824 | item = delSel.next(); |
825 | delete del; | 825 | delete del; |
826 | } | 826 | } |
827 | } | 827 | } |
828 | void KOListView::printList() | 828 | void KOListView::printList() |
829 | { | 829 | { |
830 | mListView->printList(); | 830 | mListView->printList(); |
831 | } | 831 | } |
832 | void KOListView::deleteAll() | 832 | void KOListView::deleteAll() |
833 | { | 833 | { |
834 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;; | 834 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;; |
835 | if ( delSel.count() ) { | 835 | if ( delSel.count() ) { |
836 | int icount = delSel.count(); | 836 | int icount = delSel.count(); |
837 | Incidence *incidence = delSel.first(); | 837 | Incidence *incidence = delSel.first(); |
838 | Incidence *toDelete; | 838 | Incidence *toDelete; |
839 | KOPrefs *p = KOPrefs::instance(); | 839 | KOPrefs *p = KOPrefs::instance(); |
840 | bool confirm = p->mConfirm; | 840 | bool confirm = p->mConfirm; |
841 | QString mess; | 841 | QString mess; |
842 | mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); | 842 | mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); |
843 | 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")) ) { | 843 | 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")) ) { |
844 | p->mConfirm = false; | 844 | p->mConfirm = false; |
845 | int delCounter = 0; | 845 | int delCounter = 0; |
846 | QDialog dia ( this, "p-dialog", true ); | 846 | QDialog dia ( this, "p-dialog", true ); |
847 | QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); | 847 | QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); |
848 | QVBoxLayout lay( &dia ); | 848 | QVBoxLayout lay( &dia ); |
849 | lay.setMargin(7); | 849 | lay.setMargin(7); |
850 | lay.setSpacing(7); | 850 | lay.setSpacing(7); |
851 | lay.addWidget( &lab); | 851 | lay.addWidget( &lab); |
852 | QProgressBar bar( icount, &dia ); | 852 | QProgressBar bar( icount, &dia ); |
853 | lay.addWidget( &bar); | 853 | lay.addWidget( &bar); |
854 | int w = 220; | 854 | int w = 220; |
855 | int h = 50; | 855 | int h = 50; |
856 | int dw = QApplication::desktop()->width(); | 856 | int dw = QApplication::desktop()->width(); |
857 | int dh = QApplication::desktop()->height(); | 857 | int dh = QApplication::desktop()->height(); |
858 | dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 858 | dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
859 | //dia.resize( 240,50 ); | 859 | //dia.resize( 240,50 ); |
860 | dia.show(); | 860 | dia.show(); |
861 | KOPrefs::instance()->mGlobalUpdateDisabled = true; | 861 | KOPrefs::instance()->mGlobalUpdateDisabled = true; |
862 | while ( incidence ) { | 862 | while ( incidence ) { |
863 | bar.setProgress( delCounter ); | 863 | bar.setProgress( delCounter ); |
864 | mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); | 864 | mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); |
865 | dia.setCaption( mess ); | 865 | dia.setCaption( mess ); |
866 | qApp->processEvents(); | 866 | qApp->processEvents(); |
867 | toDelete = (incidence); | 867 | toDelete = (incidence); |
868 | incidence = delSel.next(); | 868 | incidence = delSel.next(); |
869 | emit deleteIncidenceSignal(toDelete ); | 869 | emit deleteIncidenceSignal(toDelete ); |
870 | if ( dia.result() != 0 ) | 870 | if ( dia.result() != 0 ) |
871 | break; | 871 | break; |
872 | 872 | ||
873 | } | 873 | } |
874 | KOPrefs::instance()->mGlobalUpdateDisabled = false; | 874 | KOPrefs::instance()->mGlobalUpdateDisabled = false; |
875 | emit deleteIncidenceSignal( 0 ); | 875 | emit deleteIncidenceSignal( 0 ); |
876 | mess = mess.sprintf( i18n("%d items remaining in list."), count() ); | 876 | mess = mess.sprintf( i18n("%d items remaining in list."), count() ); |
877 | topLevelWidget ()->setCaption( mess ); | 877 | topLevelWidget ()->setCaption( mess ); |
878 | p->mConfirm = confirm; | 878 | p->mConfirm = confirm; |
879 | } | 879 | } |
880 | } | 880 | } |
881 | 881 | ||
882 | 882 | ||
883 | } | 883 | } |
884 | int KOListView::maxDatesHint() | 884 | int KOListView::maxDatesHint() |
885 | { | 885 | { |
886 | return 0; | 886 | return 0; |
887 | } | 887 | } |
888 | 888 | ||
889 | int KOListView::currentDateCount() | 889 | int KOListView::currentDateCount() |
890 | { | 890 | { |
891 | return 0; | 891 | return 0; |
892 | } | 892 | } |
893 | 893 | ||
894 | QPtrList<Incidence> KOListView::selectedIncidences() | 894 | QPtrList<Incidence> KOListView::selectedIncidences() |
895 | { | 895 | { |
896 | QPtrList<Incidence> eventList; | 896 | QPtrList<Incidence> eventList; |
897 | QListViewItem *item = mListView->firstChild (); | 897 | QListViewItem *item = mListView->firstChild (); |
898 | while ( item ) { | 898 | while ( item ) { |
899 | if ( item->isSelected() ) { | 899 | if ( item->isSelected() ) { |
900 | eventList.append(((KOListViewItem *)item)->data()); | 900 | eventList.append(((KOListViewItem *)item)->data()); |
901 | } | 901 | } |
902 | 902 | ||
903 | item = item->nextSibling(); | 903 | item = item->nextSibling(); |
904 | } | 904 | } |
905 | 905 | ||
906 | // // QListViewItem *item = mListView->selectedItem(); | 906 | // // QListViewItem *item = mListView->selectedItem(); |
907 | //if (item) eventList.append(((KOListViewItem *)item)->data()); | 907 | //if (item) eventList.append(((KOListViewItem *)item)->data()); |
908 | 908 | ||
909 | return eventList; | 909 | return eventList; |
910 | } | 910 | } |
911 | 911 | ||
912 | DateList KOListView::selectedDates() | 912 | DateList KOListView::selectedDates() |
913 | { | 913 | { |
914 | DateList eventList; | 914 | DateList eventList; |
915 | return eventList; | 915 | return eventList; |
916 | } | 916 | } |
917 | 917 | ||
918 | void KOListView::showDates(bool show) | 918 | void KOListView::showDates(bool show) |
919 | { | 919 | { |
920 | // Shouldn't we set it to a value greater 0? When showDates is called with | 920 | // Shouldn't we set it to a value greater 0? When showDates is called with |
921 | // show == true at first, then the columnwidths are set to zero. | 921 | // show == true at first, then the columnwidths are set to zero. |
922 | static int oldColWidth1 = 0; | 922 | static int oldColWidth1 = 0; |
923 | static int oldColWidth3 = 0; | 923 | static int oldColWidth3 = 0; |
924 | 924 | ||
925 | if (!show) { | 925 | if (!show) { |
926 | oldColWidth1 = mListView->columnWidth(1); | 926 | oldColWidth1 = mListView->columnWidth(1); |
927 | oldColWidth3 = mListView->columnWidth(3); | 927 | oldColWidth3 = mListView->columnWidth(3); |
928 | mListView->setColumnWidth(1, 0); | 928 | mListView->setColumnWidth(1, 0); |
929 | mListView->setColumnWidth(3, 0); | 929 | mListView->setColumnWidth(3, 0); |
930 | } else { | 930 | } else { |
931 | mListView->setColumnWidth(1, oldColWidth1); | 931 | mListView->setColumnWidth(1, oldColWidth1); |
932 | mListView->setColumnWidth(3, oldColWidth3); | 932 | mListView->setColumnWidth(3, oldColWidth3); |
933 | } | 933 | } |
934 | mListView->repaint(); | 934 | mListView->repaint(); |
935 | } | 935 | } |
936 | 936 | ||
937 | void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 937 | void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
938 | const QDate &td) | 938 | const QDate &td) |
939 | { | 939 | { |
940 | #ifndef KORG_NOPRINTER | 940 | #ifndef KORG_NOPRINTER |
941 | calPrinter->preview(CalPrinter::Day, fd, td); | 941 | calPrinter->preview(CalPrinter::Day, fd, td); |
942 | #endif | 942 | #endif |
943 | } | 943 | } |
944 | 944 | ||
945 | void KOListView::showDates() | 945 | void KOListView::showDates() |
946 | { | 946 | { |
947 | showDates(true); | 947 | showDates(true); |
948 | } | 948 | } |
949 | 949 | ||
950 | void KOListView::hideDates() | 950 | void KOListView::hideDates() |
951 | { | 951 | { |
952 | showDates(false); | 952 | showDates(false); |
953 | } | 953 | } |
954 | 954 | ||
955 | void KOListView::resetFocus() | 955 | void KOListView::resetFocus() |
956 | { | 956 | { |
957 | topLevelWidget()->setActiveWindow(); | 957 | topLevelWidget()->setActiveWindow(); |
958 | topLevelWidget()->raise(); | 958 | topLevelWidget()->raise(); |
959 | mListView->setFocus(); | 959 | mListView->setFocus(); |
960 | } | 960 | } |
961 | void KOListView::updateView() | 961 | void KOListView::updateView() |
962 | { | 962 | { |
963 | mListView->setFocus(); | 963 | mListView->setFocus(); |
964 | if ( mListView->firstChild () ) { | 964 | if ( mListView->firstChild () ) { |
965 | mListView->setCurrentItem( mListView->firstChild () ); | 965 | mListView->setCurrentItem( mListView->firstChild () ); |
966 | } | 966 | } |
967 | processSelectionChange( mListView->firstChild () ); | 967 | processSelectionChange( mListView->firstChild () ); |
968 | } | 968 | } |
969 | void KOListView::updateConfig() | 969 | void KOListView::updateConfig() |
970 | { | 970 | { |
971 | 971 | ||
972 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 972 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
973 | updateView(); | 973 | updateView(); |
974 | 974 | ||
975 | } | 975 | } |
976 | void KOListView::setStartDate(const QDate &start) | 976 | void KOListView::setStartDate(const QDate &start) |
977 | { | 977 | { |
978 | mStartDate = start; | 978 | mStartDate = start; |
979 | } | 979 | } |
980 | 980 | ||
981 | void KOListView::showDates(const QDate &start, const QDate &end) | 981 | void KOListView::showDates(const QDate &start, const QDate &end) |
982 | { | 982 | { |
983 | clear(); | 983 | clear(); |
984 | mStartDate = start; | 984 | mStartDate = start; |
985 | QDate date = start; | 985 | QDate date = start; |
986 | while( date <= end ) { | 986 | while( date <= end ) { |
987 | addEvents(calendar()->events(date)); | 987 | addEvents(calendar()->events(date)); |
988 | addTodos(calendar()->todos(date)); | 988 | addTodos(calendar()->todos(date)); |
989 | addJournals( calendar()->journals4Date(date) ); | 989 | addJournals( calendar()->journals4Date(date) ); |
990 | date = date.addDays( 1 ); | 990 | date = date.addDays( 1 ); |
991 | } | 991 | } |
992 | //emit incidenceSelected( 0 ); | 992 | //emit incidenceSelected( 0 ); |
993 | updateView(); | 993 | updateView(); |
994 | 994 | ||
995 | } | 995 | } |
996 | 996 | ||
997 | void KOListView::addEvents(QPtrList<Event> eventList) | 997 | void KOListView::addEvents(QPtrList<Event> eventList) |
998 | { | 998 | { |
999 | 999 | ||
1000 | Event *ev; | 1000 | Event *ev; |
1001 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 1001 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
1002 | addIncidence(ev); | 1002 | addIncidence(ev); |
1003 | } | 1003 | } |
1004 | if ( !mListView->currentItem() ){ | 1004 | if ( !mListView->currentItem() ){ |
1005 | updateView(); | 1005 | updateView(); |
1006 | } | 1006 | } |
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | void KOListView::addTodos(QPtrList<Todo> eventList) | 1009 | void KOListView::addTodos(QPtrList<Todo> eventList) |
1010 | { | 1010 | { |
1011 | Todo *ev; | 1011 | Todo *ev; |
1012 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 1012 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
1013 | addIncidence(ev); | 1013 | addIncidence(ev); |
1014 | } | 1014 | } |
1015 | if ( !mListView->currentItem() ){ | 1015 | if ( !mListView->currentItem() ){ |
1016 | updateView(); | 1016 | updateView(); |
1017 | } | 1017 | } |
1018 | } | 1018 | } |
1019 | void KOListView::addJournals(QPtrList<Journal> eventList) | 1019 | void KOListView::addJournals(QPtrList<Journal> eventList) |
1020 | { | 1020 | { |
1021 | Journal *ev; | 1021 | Journal *ev; |
1022 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 1022 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
1023 | addIncidence(ev); | 1023 | addIncidence(ev); |
1024 | } | 1024 | } |
1025 | if ( !mListView->currentItem() ){ | 1025 | if ( !mListView->currentItem() ){ |
1026 | updateView(); | 1026 | updateView(); |
1027 | } | 1027 | } |
1028 | } | 1028 | } |
1029 | 1029 | ||
1030 | void KOListView::showCompletedTodos() | 1030 | void KOListView::showCompletedTodos() |
1031 | { | 1031 | { |
1032 | mForceShowCompletedTodos = true; | 1032 | mForceShowCompletedTodos = true; |
1033 | } | 1033 | } |
1034 | void KOListView::addIncidence(Incidence *incidence) | 1034 | void KOListView::addIncidence(Incidence *incidence) |
1035 | { | 1035 | { |
1036 | if ( mUidDict.find( incidence->uid() ) ) return; | 1036 | if ( mUidDict.find( incidence->uid() ) ) return; |
1037 | 1037 | ||
1038 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 1038 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
1039 | if ( incidence->typeID() == todoID ) { | 1039 | if ( incidence->typeID() == todoID ) { |
1040 | if ( ! mForceShowCompletedTodos ) { | 1040 | if ( ! mForceShowCompletedTodos ) { |
1041 | if ( !KOPrefs::instance()->mShowCompletedTodo && ((Todo*)incidence)->isCompleted() ) | 1041 | if ( !KOPrefs::instance()->mShowCompletedTodo && ((Todo*)incidence)->isCompleted() ) |
1042 | return; | 1042 | return; |
1043 | } | 1043 | } |
1044 | } | 1044 | } |
1045 | mUidDict.insert( incidence->uid(), incidence ); | 1045 | mUidDict.insert( incidence->uid(), incidence ); |
1046 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); | 1046 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); |
1047 | ListItemVisitor v(item, mStartDate ); | 1047 | ListItemVisitor v(item, mStartDate ); |
1048 | if (incidence->accept(v)) { | 1048 | if (incidence->accept(v)) { |
1049 | return; | 1049 | return; |
1050 | } | 1050 | } |
1051 | else delete item; | 1051 | else delete item; |
1052 | } | 1052 | } |
1053 | 1053 | ||
1054 | void KOListView::showEvents(QPtrList<Event> eventList) | 1054 | void KOListView::showEvents(QPtrList<Event> eventList) |
1055 | { | 1055 | { |
1056 | clear(); | 1056 | clear(); |
1057 | 1057 | ||
1058 | addEvents(eventList); | 1058 | addEvents(eventList); |
1059 | 1059 | ||
1060 | // After new creation of list view no events are selected. | 1060 | // After new creation of list view no events are selected. |
1061 | emit incidenceSelected( 0 ); | 1061 | emit incidenceSelected( 0 ); |
1062 | } | 1062 | } |
1063 | int KOListView::count() | 1063 | int KOListView::count() |
1064 | { | 1064 | { |
1065 | return mListView->childCount(); | 1065 | return mListView->childCount(); |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | void KOListView::changeEventDisplay(Event *event, int action) | 1068 | void KOListView::changeEventDisplay(Event *event, int action) |
1069 | { | 1069 | { |
1070 | KOListViewItem *item; | 1070 | KOListViewItem *item; |
1071 | 1071 | ||
1072 | switch(action) { | 1072 | switch(action) { |
1073 | case KOGlobals::EVENTADDED: | 1073 | case KOGlobals::EVENTADDED: |
1074 | addIncidence( event ); | 1074 | addIncidence( event ); |
1075 | break; | 1075 | break; |
1076 | case KOGlobals::EVENTEDITED: | 1076 | case KOGlobals::EVENTEDITED: |
1077 | item = getItemForEvent(event); | 1077 | item = getItemForEvent(event); |
1078 | if (item) { | 1078 | if (item) { |
1079 | ListItemVisitor v(item, mStartDate ); | 1079 | ListItemVisitor v(item, mStartDate ); |
1080 | ((Incidence*)event)->accept(v); | 1080 | ((Incidence*)event)->accept(v); |
1081 | } | 1081 | } |
1082 | break; | 1082 | break; |
1083 | case KOGlobals::EVENTDELETED: | 1083 | case KOGlobals::EVENTDELETED: |
1084 | item = getItemForEvent(event); | 1084 | item = getItemForEvent(event); |
1085 | if (item) { | 1085 | if (item) { |
1086 | mUidDict.remove( event->uid() ); | 1086 | mUidDict.remove( event->uid() ); |
1087 | delete item; | 1087 | delete item; |
1088 | } | 1088 | } |
1089 | break; | 1089 | break; |
1090 | default: | 1090 | default: |
1091 | ; | 1091 | ; |
1092 | } | 1092 | } |
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | KOListViewItem *KOListView::getItemForEvent(Incidence *event) | 1095 | KOListViewItem *KOListView::getItemForEvent(Incidence *event) |
1096 | { | 1096 | { |
1097 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); | 1097 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); |
1098 | while (item) { | 1098 | while (item) { |
1099 | if (item->data() == event) return item; | 1099 | if (item->data() == event) return item; |
1100 | item = (KOListViewItem *)item->nextSibling(); | 1100 | item = (KOListViewItem *)item->nextSibling(); |
1101 | } | 1101 | } |
1102 | return 0; | 1102 | return 0; |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | void KOListView::defaultItemAction(QListViewItem *i) | 1105 | void KOListView::defaultItemAction(QListViewItem *i) |
1106 | { | 1106 | { |
1107 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); | 1107 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); |
1108 | if ( item ) defaultAction( item->data() ); | 1108 | if ( item ) defaultAction( item->data() ); |
1109 | 1109 | ||
1110 | } | 1110 | } |
1111 | 1111 | ||
1112 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) | 1112 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) |
1113 | { | 1113 | { |
1114 | mActiveItem = (KOListViewItem *)item; | 1114 | mActiveItem = (KOListViewItem *)item; |
1115 | if (mActiveItem) { | 1115 | if (mActiveItem) { |
1116 | Incidence *incidence = mActiveItem->data(); | 1116 | Incidence *incidence = mActiveItem->data(); |
1117 | mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) ); | 1117 | mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) ); |
1118 | mPopupMenu->showIncidencePopup(incidence); | 1118 | mPopupMenu->showIncidencePopup(incidence); |
1119 | 1119 | ||
1120 | /* | 1120 | /* |
1121 | if ( incidence && incidence->type() == "Event" ) { | 1121 | if ( incidence && incidence->type() == "Event" ) { |
1122 | Event *event = static_cast<Event *>( incidence ); | 1122 | Event *event = static_cast<Event *>( incidence ); |
1123 | mPopupMenu->showEventPopup(event); | 1123 | mPopupMenu->showEventPopup(event); |
1124 | } | 1124 | } |
1125 | */ | 1125 | */ |
1126 | } | 1126 | } |
1127 | } | 1127 | } |
1128 | 1128 | ||
1129 | void KOListView::readSettings(KConfig *config, QString setting) | 1129 | void KOListView::readSettings(KConfig *config, QString setting) |
1130 | { | 1130 | { |
1131 | // qDebug("KOListView::readSettings "); | 1131 | // qDebug("KOListView::readSettings "); |
1132 | mListView->restoreLayout(config,setting); | 1132 | mListView->restoreLayout(config,setting); |
1133 | } | 1133 | } |
1134 | 1134 | ||
1135 | void KOListView::writeSettings(KConfig *config, QString setting) | 1135 | void KOListView::writeSettings(KConfig *config, QString setting) |
1136 | { | 1136 | { |
1137 | // qDebug("KOListView::writeSettings "); | 1137 | // qDebug("KOListView::writeSettings "); |
1138 | mListView->saveLayout(config, setting); | 1138 | mListView->saveLayout(config, setting); |
1139 | } | 1139 | } |
1140 | 1140 | ||
1141 | void KOListView::processSelectionChange(QListViewItem *) | 1141 | void KOListView::processSelectionChange(QListViewItem *) |
1142 | { | 1142 | { |
1143 | 1143 | ||
1144 | KOListViewItem *item = | 1144 | KOListViewItem *item = |
1145 | static_cast<KOListViewItem *>( mListView->currentItem() ); | 1145 | static_cast<KOListViewItem *>( mListView->currentItem() ); |
1146 | 1146 | ||
1147 | if ( !item ) { | 1147 | if ( !item ) { |
1148 | emit incidenceSelected( 0 ); | 1148 | emit incidenceSelected( 0 ); |
1149 | } else { | 1149 | } else { |
1150 | emit incidenceSelected( item->data() ); | 1150 | emit incidenceSelected( item->data() ); |
1151 | } | 1151 | } |
1152 | } | 1152 | } |
1153 | 1153 | ||
1154 | void KOListView::clearSelection() | 1154 | void KOListView::clearSelection() |
1155 | { | 1155 | { |
1156 | mListView->selectAll( false ); | 1156 | mListView->selectAll( false ); |
1157 | } | 1157 | } |
1158 | void KOListView::allSelection() | 1158 | void KOListView::allSelection() |
1159 | { | 1159 | { |
1160 | mListView->selectAll( true ); | 1160 | mListView->selectAll( true ); |
1161 | } | 1161 | } |
1162 | 1162 | ||
1163 | void KOListView::clear() | 1163 | void KOListView::clear() |
1164 | { | 1164 | { |
1165 | mListView->clear(); | 1165 | mListView->clear(); |
1166 | mUidDict.clear(); | 1166 | mUidDict.clear(); |
1167 | } | 1167 | } |
1168 | 1168 | ||
1169 | Incidence* KOListView::currentItem() | 1169 | Incidence* KOListView::currentItem() |
1170 | { | 1170 | { |
1171 | if ( mListView->currentItem() ) | 1171 | if ( mListView->currentItem() ) |
1172 | return ((KOListViewItem*) mListView->currentItem())->data(); | 1172 | return ((KOListViewItem*) mListView->currentItem())->data(); |
1173 | return 0; | 1173 | return 0; |
1174 | } | 1174 | } |
1175 | void KOListView::keyPressEvent ( QKeyEvent *e) | 1175 | void KOListView::keyPressEvent ( QKeyEvent *e) |
1176 | { | 1176 | { |
1177 | 1177 | ||
1178 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { | 1178 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { |
1179 | deleteAll(); | 1179 | deleteAll(); |
1180 | return; | 1180 | return; |
1181 | } | 1181 | } |
1182 | 1182 | ||
1183 | e->ignore(); | 1183 | e->ignore(); |
1184 | } | 1184 | } |
1185 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) | 1185 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) |
1186 | { | 1186 | { |
1187 | 1187 | ||
1188 | switch ( e->key() ) { | 1188 | switch ( e->key() ) { |
1189 | case Qt::Key_Down: | 1189 | case Qt::Key_Down: |
1190 | if ( e->state() == ShiftButton ) { | 1190 | if ( e->state() == ShiftButton ) { |
1191 | QListViewItem* cn = currentItem(); | 1191 | QListViewItem* cn = currentItem(); |
1192 | if ( !cn ) | 1192 | if ( !cn ) |
1193 | cn = firstChild(); | 1193 | cn = firstChild(); |
1194 | if ( !cn ) | 1194 | if ( !cn ) |
1195 | return; | 1195 | return; |
1196 | while ( cn->nextSibling() ) | 1196 | while ( cn->nextSibling() ) |
1197 | cn = cn->nextSibling(); | 1197 | cn = cn->nextSibling(); |
1198 | setCurrentItem ( cn ); | 1198 | setCurrentItem ( cn ); |
1199 | ensureItemVisible ( cn ); | 1199 | ensureItemVisible ( cn ); |
1200 | 1200 | ||
1201 | e->accept(); | 1201 | e->accept(); |
1202 | return; | 1202 | return; |
1203 | } | 1203 | } |
1204 | if ( e->state() == ControlButton ) { | 1204 | if ( e->state() == ControlButton ) { |
1205 | int count = childCount (); | 1205 | int count = childCount (); |
1206 | int jump = count / 5; | 1206 | int jump = count / 5; |
1207 | QListViewItem* cn; | 1207 | QListViewItem* cn; |
1208 | cn = currentItem(); | 1208 | cn = currentItem(); |
1209 | if ( ! cn ) | 1209 | if ( ! cn ) |
1210 | return; | 1210 | return; |
1211 | if ( jump == 0 ) | 1211 | if ( jump == 0 ) |
1212 | jump = 1; | 1212 | jump = 1; |
1213 | while ( jump && cn->nextSibling() ) { | 1213 | while ( jump && cn->nextSibling() ) { |
1214 | cn = cn->nextSibling(); | 1214 | cn = cn->nextSibling(); |
1215 | --jump; | 1215 | --jump; |
1216 | } | 1216 | } |
1217 | setCurrentItem ( cn ); | 1217 | setCurrentItem ( cn ); |
1218 | ensureItemVisible ( cn ); | 1218 | ensureItemVisible ( cn ); |
1219 | 1219 | ||
1220 | } else | 1220 | } else |
1221 | QListView::keyPressEvent ( e ) ; | 1221 | QListView::keyPressEvent ( e ) ; |
1222 | e->accept(); | 1222 | e->accept(); |
1223 | break; | 1223 | break; |
1224 | 1224 | ||
1225 | case Qt::Key_Up: | 1225 | case Qt::Key_Up: |
1226 | if ( e->state() == ShiftButton ) { | 1226 | if ( e->state() == ShiftButton ) { |
1227 | QListViewItem* cn = firstChild(); | 1227 | QListViewItem* cn = firstChild(); |
1228 | if ( cn ) { | 1228 | if ( cn ) { |
1229 | setCurrentItem ( cn ); | 1229 | setCurrentItem ( cn ); |
1230 | ensureItemVisible ( cn ); | 1230 | ensureItemVisible ( cn ); |
1231 | } | 1231 | } |
1232 | e->accept(); | 1232 | e->accept(); |
1233 | return; | 1233 | return; |
1234 | } | 1234 | } |
1235 | if ( e->state() == ControlButton ) { | 1235 | if ( e->state() == ControlButton ) { |
1236 | int count = childCount (); | 1236 | int count = childCount (); |
1237 | int jump = count / 5; | 1237 | int jump = count / 5; |
1238 | QListViewItem* cn; | 1238 | QListViewItem* cn; |
1239 | cn = currentItem(); | 1239 | cn = currentItem(); |
1240 | if ( ! cn ) | 1240 | if ( ! cn ) |
1241 | return; | 1241 | return; |
1242 | if ( jump == 0 ) | 1242 | if ( jump == 0 ) |
1243 | jump = 1; | 1243 | jump = 1; |
1244 | while ( jump && cn->itemAbove ()) { | 1244 | while ( jump && cn->itemAbove ()) { |
1245 | cn = cn->itemAbove (); | 1245 | cn = cn->itemAbove (); |
1246 | --jump; | 1246 | --jump; |
1247 | } | 1247 | } |
1248 | setCurrentItem ( cn ); | 1248 | setCurrentItem ( cn ); |
1249 | ensureItemVisible ( cn ); | 1249 | ensureItemVisible ( cn ); |
1250 | } else | 1250 | } else |
1251 | QListView::keyPressEvent ( e ) ; | 1251 | QListView::keyPressEvent ( e ) ; |
1252 | e->accept(); | 1252 | e->accept(); |
1253 | break; | 1253 | break; |
1254 | case Qt::Key_I: { | 1254 | case Qt::Key_I: { |
1255 | QListViewItem* cn; | 1255 | QListViewItem* cn; |
1256 | cn = currentItem(); | 1256 | cn = currentItem(); |
1257 | if ( cn ) { | 1257 | if ( cn ) { |
1258 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1258 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1259 | if ( ci ){ | 1259 | if ( ci ){ |
1260 | //emit showIncidence( ci->data()); | 1260 | //emit showIncidence( ci->data()); |
1261 | cn = cn->nextSibling(); | 1261 | cn = cn->nextSibling(); |
1262 | if ( cn ) { | 1262 | if ( cn ) { |
1263 | setCurrentItem ( cn ); | 1263 | setCurrentItem ( cn ); |
1264 | ensureItemVisible ( cn ); | 1264 | ensureItemVisible ( cn ); |
1265 | } | 1265 | } |
1266 | emit showIncidence( ci->data()); | 1266 | emit showIncidence( ci->data()); |
1267 | } | 1267 | } |
1268 | } | 1268 | } |
1269 | e->accept(); | 1269 | e->accept(); |
1270 | } | 1270 | } |
1271 | break; | 1271 | break; |
1272 | case Qt::Key_Return: | 1272 | case Qt::Key_Return: |
1273 | case Qt::Key_Enter: | 1273 | case Qt::Key_Enter: |
1274 | { | 1274 | { |
1275 | QListViewItem* cn; | 1275 | QListViewItem* cn; |
1276 | cn = currentItem(); | 1276 | cn = currentItem(); |
1277 | if ( cn ) { | 1277 | if ( cn ) { |
1278 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1278 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1279 | if ( ci ){ | 1279 | if ( ci ){ |
1280 | if ( e->state() == ShiftButton ) | 1280 | if ( e->state() == ShiftButton ) |
1281 | ci->setSelected( false ); | 1281 | ci->setSelected( false ); |
1282 | else | 1282 | else |
1283 | ci->setSelected( true ); | 1283 | ci->setSelected( true ); |
1284 | cn = cn->nextSibling(); | 1284 | cn = cn->nextSibling(); |
1285 | if ( cn ) { | 1285 | if ( cn ) { |
1286 | setCurrentItem ( cn ); | 1286 | setCurrentItem ( cn ); |
1287 | ensureItemVisible ( cn ); | 1287 | ensureItemVisible ( cn ); |
1288 | } else { | ||
1289 | emit currentChanged( ci ); | ||
1288 | } | 1290 | } |
1289 | } | 1291 | } |
1290 | } | 1292 | } |
1291 | e->accept(); | 1293 | e->accept(); |
1292 | } | 1294 | } |
1293 | break; | 1295 | break; |
1294 | default: | 1296 | default: |
1295 | e->ignore(); | 1297 | e->ignore(); |
1296 | } | 1298 | } |
1297 | } | 1299 | } |
1298 | KOListViewListView::KOListViewListView(KOListView * lv ) | 1300 | KOListViewListView::KOListViewListView(KOListView * lv ) |
1299 | : KListView( lv, "kolistlistview", false ) | 1301 | : KListView( lv, "kolistlistview", false ) |
1300 | { | 1302 | { |
1301 | mYMousePos = 0; | 1303 | mYMousePos = 0; |
1302 | mPopupTimer = new QTimer(this); | 1304 | mPopupTimer = new QTimer(this); |
1303 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); | 1305 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); |
1304 | #ifndef DESKTOP_VERSION | 1306 | #ifndef DESKTOP_VERSION |
1305 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 1307 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
1306 | #endif | 1308 | #endif |
1307 | setSelectionMode( QListView::Multi ); | 1309 | setSelectionMode( QListView::Multi ); |
1308 | setMultiSelection( true); | 1310 | setMultiSelection( true); |
1309 | } | 1311 | } |
1310 | bool KOListViewListView::hasMultiSelection(QListViewItem* item) | 1312 | bool KOListViewListView::hasMultiSelection(QListViewItem* item) |
1311 | { | 1313 | { |
1312 | QListViewItem *qitem = firstChild (); | 1314 | QListViewItem *qitem = firstChild (); |
1313 | while ( qitem ) { | 1315 | while ( qitem ) { |
1314 | if ( qitem->isSelected() && item != qitem ) | 1316 | if ( qitem->isSelected() && item != qitem ) |
1315 | return true; | 1317 | return true; |
1316 | qitem = qitem->nextSibling(); | 1318 | qitem = qitem->nextSibling(); |
1317 | } | 1319 | } |
1318 | return false; | 1320 | return false; |
1319 | } | 1321 | } |
1320 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 1322 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
1321 | { | 1323 | { |
1322 | if (!e) return; | 1324 | if (!e) return; |
1323 | QPoint vp = contentsToViewport(e->pos()); | 1325 | QPoint vp = contentsToViewport(e->pos()); |
1324 | QListViewItem *item = itemAt(vp); | 1326 | QListViewItem *item = itemAt(vp); |
1325 | if (!item) { | 1327 | if (!item) { |
1326 | emit newEvent(); | 1328 | emit newEvent(); |
1327 | return; | 1329 | return; |
1328 | } | 1330 | } |
1329 | KListView::contentsMouseDoubleClickEvent(e); | 1331 | KListView::contentsMouseDoubleClickEvent(e); |
1330 | } | 1332 | } |
1331 | #if 0 | 1333 | #if 0 |
1332 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1334 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1333 | { | 1335 | { |
1334 | //qDebug("contentsMousePressEvent++++ "); | 1336 | //qDebug("contentsMousePressEvent++++ "); |
1335 | KListView::contentsMousePressEvent( e ); | 1337 | KListView::contentsMousePressEvent( e ); |
1336 | if ( e->button() == RightButton ) { | 1338 | if ( e->button() == RightButton ) { |
1337 | QListViewItem* ci = currentItem(); | 1339 | QListViewItem* ci = currentItem(); |
1338 | clearSelection () ; | 1340 | clearSelection () ; |
1339 | if ( ci ) | 1341 | if ( ci ) |
1340 | ci->setSelected( true ); | 1342 | ci->setSelected( true ); |
1341 | } | 1343 | } |
1342 | } | 1344 | } |
1343 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1345 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1344 | { | 1346 | { |
1345 | KListView::contentsMouseReleaseEvent(e); | 1347 | KListView::contentsMouseReleaseEvent(e); |
1346 | } | 1348 | } |
1347 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1349 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1348 | { | 1350 | { |
1349 | KListView::contentsMouseMoveEvent(e); | 1351 | KListView::contentsMouseMoveEvent(e); |
1350 | } | 1352 | } |
1351 | #endif | 1353 | #endif |
1352 | void KOListViewListView::popupMenu() | 1354 | void KOListViewListView::popupMenu() |
1353 | { | 1355 | { |
1354 | mPopupTimer->stop(); | 1356 | mPopupTimer->stop(); |
1355 | QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); | 1357 | QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); |
1356 | QApplication::postEvent( this->viewport(), e ); | 1358 | QApplication::postEvent( this->viewport(), e ); |
1357 | 1359 | ||
1358 | } | 1360 | } |
1359 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1361 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1360 | { | 1362 | { |
1361 | //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y()); | 1363 | //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y()); |
1362 | mYMousePos = mapToGlobal( (e->pos())).y(); | 1364 | mYMousePos = mapToGlobal( (e->pos())).y(); |
1363 | if ( e->button() == LeftButton ) { | 1365 | if ( e->button() == LeftButton ) { |
1364 | mPopupTimer->start( 600 ); | 1366 | mPopupTimer->start( 600 ); |
1365 | mEventPos = contentsToViewport(e->pos()); | 1367 | mEventPos = contentsToViewport(e->pos()); |
1366 | mEventGlobalPos = e->globalPos(); | 1368 | mEventGlobalPos = e->globalPos(); |
1367 | } | 1369 | } |
1368 | KListView::contentsMousePressEvent( e ); | 1370 | KListView::contentsMousePressEvent( e ); |
1369 | if ( e->button() == RightButton ) { | 1371 | if ( e->button() == RightButton ) { |
1370 | QListViewItem* ci = currentItem(); | 1372 | QListViewItem* ci = currentItem(); |
1371 | //clearSelection(); | 1373 | //clearSelection(); |
1372 | if ( ci ) | 1374 | if ( ci ) |
1373 | ci->setSelected( true ); | 1375 | ci->setSelected( true ); |
1374 | } | 1376 | } |
1375 | } | 1377 | } |
1376 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1378 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1377 | { | 1379 | { |
1378 | mPopupTimer->stop(); | 1380 | mPopupTimer->stop(); |
1379 | KListView::contentsMouseReleaseEvent(e); | 1381 | KListView::contentsMouseReleaseEvent(e); |
1380 | } | 1382 | } |
1381 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1383 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1382 | { | 1384 | { |
1383 | // qDebug("contentsMouseMoveEv....... "); | 1385 | // qDebug("contentsMouseMoveEv....... "); |
1384 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); | 1386 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); |
1385 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); | 1387 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); |
1386 | if ( diff < 0 ) diff = -diff; | 1388 | if ( diff < 0 ) diff = -diff; |
1387 | if ( diff > 15 ) | 1389 | if ( diff > 15 ) |
1388 | mPopupTimer->stop(); | 1390 | mPopupTimer->stop(); |
1389 | else { | 1391 | else { |
1390 | mEventPos = contentsToViewport(e->pos()); | 1392 | mEventPos = contentsToViewport(e->pos()); |
1391 | mEventGlobalPos = e->globalPos(); | 1393 | mEventGlobalPos = e->globalPos(); |
1392 | } | 1394 | } |
1393 | KListView::contentsMouseMoveEvent(e); | 1395 | KListView::contentsMouseMoveEvent(e); |
1394 | } | 1396 | } |
1395 | 1397 | ||
1396 | #define protected public | 1398 | #define protected public |
1397 | #include <qheader.h> | 1399 | #include <qheader.h> |
1398 | #undef protected | 1400 | #undef protected |
1399 | void KOListViewListView::printList() | 1401 | void KOListViewListView::printList() |
1400 | { | 1402 | { |
1401 | #ifdef DESKTOP_VERSION | 1403 | #ifdef DESKTOP_VERSION |
1402 | KOPrintPrefs pp ( this ); | 1404 | KOPrintPrefs pp ( this ); |
1403 | if (!pp.exec() ) | 1405 | if (!pp.exec() ) |
1404 | return; | 1406 | return; |
1405 | int scaleval = pp.printMode() ; | 1407 | int scaleval = pp.printMode() ; |
1406 | 1408 | ||
1407 | QPrinter printer; | 1409 | QPrinter printer; |
1408 | if (!printer.setup() ) | 1410 | if (!printer.setup() ) |
1409 | return; | 1411 | return; |
1410 | clearSelection (); | 1412 | clearSelection (); |
1411 | QPainter p; | 1413 | QPainter p; |
1412 | p.begin ( &printer ); | 1414 | p.begin ( &printer ); |
1413 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | 1415 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); |
1414 | float dx, dy; | 1416 | float dx, dy; |
1415 | int wid = (m.width() * 9)/10; | 1417 | int wid = (m.width() * 9)/10; |
1416 | dx = (float) wid/(float)contentsWidth (); | 1418 | dx = (float) wid/(float)contentsWidth (); |
1417 | dy = (float)(m.height()) / (float)contentsHeight (); | 1419 | dy = (float)(m.height()) / (float)contentsHeight (); |
1418 | float scale; | 1420 | float scale; |
1419 | // scale to fit the width or height of the paper | 1421 | // scale to fit the width or height of the paper |
1420 | if ( dx < dy ) | 1422 | if ( dx < dy ) |
1421 | scale = dx; | 1423 | scale = dx; |
1422 | else | 1424 | else |
1423 | scale = dy; | 1425 | scale = dy; |
1424 | 1426 | ||
1425 | p.translate( m.width()/10,m.width()/10 ); | 1427 | p.translate( m.width()/10,m.width()/10 ); |
1426 | if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { | 1428 | if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { |
1427 | p.scale( scale, scale ); | 1429 | p.scale( scale, scale ); |
1428 | } | 1430 | } |
1429 | 1431 | ||
1430 | int cou = header()->count(); | 1432 | int cou = header()->count(); |
1431 | int iii; | 1433 | int iii; |
1432 | QRect rect ( 0,0,0, header()->height()); | 1434 | QRect rect ( 0,0,0, header()->height()); |
1433 | for ( iii = 0; iii < cou; ++iii ) { | 1435 | for ( iii = 0; iii < cou; ++iii ) { |
1434 | rect.setLeft ( header()->sectionPos( iii ) ); | 1436 | rect.setLeft ( header()->sectionPos( iii ) ); |
1435 | rect.setRight ( header()->sectionPos( iii ) + header()->sectionSize (iii)); | 1437 | rect.setRight ( header()->sectionPos( iii ) + header()->sectionSize (iii)); |
1436 | header()->paintSection ( & p, header()->mapToIndex (iii), rect ); | 1438 | header()->paintSection ( & p, header()->mapToIndex (iii), rect ); |
1437 | } | 1439 | } |
1438 | p.translate( 0, header()->height()); | 1440 | p.translate( 0, header()->height()); |
1439 | drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () ); | 1441 | drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () ); |
1440 | p.end(); | 1442 | p.end(); |
1441 | #endif | 1443 | #endif |
1442 | } | 1444 | } |