-rw-r--r-- | korganizer/kolistview.cpp | 147 |
1 files changed, 43 insertions, 104 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index e5e3704..4c815d8 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -269,102 +269,99 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, | |||
269 | mListView->addColumn(i18n("Calendar")); | 269 | mListView->addColumn(i18n("Calendar")); |
270 | 270 | ||
271 | mListView->setColumnAlignment(0,AlignLeft); | 271 | mListView->setColumnAlignment(0,AlignLeft); |
272 | mListView->setColumnAlignment(1,AlignLeft); | 272 | mListView->setColumnAlignment(1,AlignLeft); |
273 | mListView->setColumnAlignment(2,AlignHCenter); | 273 | mListView->setColumnAlignment(2,AlignHCenter); |
274 | mListView->setColumnAlignment(3,AlignLeft); | 274 | mListView->setColumnAlignment(3,AlignLeft); |
275 | mListView->setColumnAlignment(4,AlignHCenter); | 275 | mListView->setColumnAlignment(4,AlignHCenter); |
276 | mListView->setColumnAlignment(5,AlignLeft); | 276 | mListView->setColumnAlignment(5,AlignLeft); |
277 | mListView->setColumnAlignment(6,AlignLeft); | 277 | mListView->setColumnAlignment(6,AlignLeft); |
278 | mListView->setColumnAlignment(7,AlignLeft); | 278 | mListView->setColumnAlignment(7,AlignLeft); |
279 | mListView->setColumnAlignment(8,AlignLeft); | 279 | mListView->setColumnAlignment(8,AlignLeft); |
280 | mListView->setColumnAlignment(9,AlignLeft); | 280 | mListView->setColumnAlignment(9,AlignLeft); |
281 | mListView->setColumnAlignment(10,AlignLeft); | 281 | mListView->setColumnAlignment(10,AlignLeft); |
282 | mListView->setColumnAlignment(11,AlignLeft); | 282 | mListView->setColumnAlignment(11,AlignLeft); |
283 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); | 283 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); |
284 | 284 | ||
285 | int iii = 0; | 285 | int iii = 0; |
286 | for ( iii = 0; iii< 12 ; ++iii ) | 286 | for ( iii = 0; iii< 12 ; ++iii ) |
287 | mListView->setColumnWidthMode( iii, QListView::Manual ); | 287 | mListView->setColumnWidthMode( iii, QListView::Manual ); |
288 | 288 | ||
289 | QBoxLayout *layoutTop = new QVBoxLayout(this); | 289 | QBoxLayout *layoutTop = new QVBoxLayout(this); |
290 | layoutTop->addWidget(mListView); | 290 | layoutTop->addWidget(mListView); |
291 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 291 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
292 | mPopupMenu = eventPopup(); | 292 | mPopupMenu = eventPopup(); |
293 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 293 | QPopupMenu* selPopup = new QPopupMenu ( this ); |
294 | i18n("Select all"),this, | 294 | mPopupMenu->insertSeparator(); |
295 | SLOT(allSelection()),true); | ||
296 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | ||
297 | i18n("Deselect all"),this, | ||
298 | SLOT(clearSelection()),true); | ||
299 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | ||
300 | i18n("Delete all selected"),this, | ||
301 | SLOT(deleteAll()),true); | ||
302 | 295 | ||
296 | selPopup->insertItem(i18n("All"),this, | ||
297 | SLOT(allSelection())); | ||
298 | selPopup->insertItem(i18n("None"),this, | ||
299 | SLOT(clearSelection())); | ||
300 | selPopup->insertItem(i18n("Delete selected..."),this, | ||
301 | SLOT(deleteAll())); | ||
302 | mPopupMenu->insertItem(i18n("Selection"), selPopup ); | ||
303 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 303 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
304 | i18n("Hide all selected"),this, | 304 | i18n("Hide all selected"),this, |
305 | SLOT(hideAll()),true); | 305 | SLOT(hideAll()),true); |
306 | 306 | ||
307 | mPopupMenu->insertSeparator(); | 307 | mPopupMenu->insertSeparator(); |
308 | #ifdef DESKTOP_VERSION | 308 | #ifdef DESKTOP_VERSION |
309 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 309 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
310 | i18n("Print complete list"),this, | 310 | i18n("Print complete list"),this, |
311 | SLOT(printList()),true); | 311 | SLOT(printList()),true); |
312 | mPopupMenu->insertSeparator(); | 312 | mPopupMenu->insertSeparator(); |
313 | #endif | 313 | #endif |
314 | mCalPopup = new QPopupMenu ( this ); | 314 | mCalPopup = new QPopupMenu ( this ); |
315 | mPopupMenu->insertItem( i18n("Set Calendar"), mCalPopup ); | 315 | mPopupMenu->insertItem( i18n("Set Calendar"), mCalPopup ); |
316 | 316 | ||
317 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | ||
318 | i18n("Set categories")+"...",this, | ||
319 | SLOT(setCat()),true); | ||
320 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | ||
321 | i18n("Set alarm..."),this, | ||
322 | SLOT(setAlarm()),true); | ||
317 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, | 323 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, |
318 | SLOT( populateCalPopup() )); | 324 | SLOT( populateCalPopup() )); |
319 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, | 325 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, |
320 | SLOT( setCalendar( int ) )); | 326 | SLOT( setCalendar( int ) )); |
321 | QPopupMenu * exportPO = new QPopupMenu ( this ); | 327 | QPopupMenu * exportPO = new QPopupMenu ( this ); |
322 | mPopupMenu->insertItem( i18n("Export selected"), exportPO ); | 328 | mPopupMenu->insertItem( i18n("Export"), exportPO ); |
323 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, | 329 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, |
324 | SLOT(saveToFile())); | 330 | SLOT(saveToFile())); |
325 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, | 331 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, |
326 | SLOT(saveToFileVCS())); | 332 | SLOT(saveToFileVCS())); |
327 | exportPO->insertItem( i18n("Journal/Details..."),this, | 333 | exportPO->insertItem( i18n("Journal/Details..."),this, |
328 | SLOT(saveDescriptionToFile())); | 334 | SLOT(saveDescriptionToFile())); |
329 | // mPopupMenu->insertSeparator(); | 335 | // mPopupMenu->insertSeparator(); |
330 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 336 | // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
331 | i18n("Add Categ. to selected..."),this, | 337 | // i18n("Add Categ. to selected..."),this, |
332 | SLOT(addCat()),true); | 338 | // SLOT(addCat()),true); |
333 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | ||
334 | i18n("Set Categ. for selected..."),this, | ||
335 | SLOT(setCat()),true); | ||
336 | //mPopupMenu->insertSeparator(); | 339 | //mPopupMenu->insertSeparator(); |
337 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | ||
338 | i18n("Set alarm for selected..."),this, | ||
339 | SLOT(setAlarm()),true); | ||
340 | |||
341 | |||
342 | |||
343 | #ifndef DESKTOP_VERSION | 340 | #ifndef DESKTOP_VERSION |
344 | mPopupMenu->insertSeparator(); | 341 | mPopupMenu->insertSeparator(); |
345 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 342 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
346 | i18n("Beam selected via IR"),this, | 343 | i18n("Beam via IR"),this, |
347 | SLOT(beamSelected()),true); | 344 | SLOT(beamSelected()),true); |
348 | #endif | 345 | #endif |
349 | /* | 346 | /* |
350 | mPopupMenu = new QPopupMenu; | 347 | mPopupMenu = new QPopupMenu; |
351 | mPopupMenu->insertItem(i18n("Edit Event"), this, | 348 | mPopupMenu->insertItem(i18n("Edit Event"), this, |
352 | SLOT (editEvent())); | 349 | SLOT (editEvent())); |
353 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, | 350 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, |
354 | SLOT (deleteEvent())); | 351 | SLOT (deleteEvent())); |
355 | mPopupMenu->insertSeparator(); | 352 | mPopupMenu->insertSeparator(); |
356 | mPopupMenu->insertItem(i18n("Show Dates"), this, | 353 | mPopupMenu->insertItem(i18n("Show Dates"), this, |
357 | SLOT(showDates())); | 354 | SLOT(showDates())); |
358 | mPopupMenu->insertItem(i18n("Hide Dates"), this, | 355 | mPopupMenu->insertItem(i18n("Hide Dates"), this, |
359 | SLOT(hideDates())); | 356 | SLOT(hideDates())); |
360 | */ | 357 | */ |
361 | QObject::connect(mListView,SIGNAL( newEvent()), | 358 | QObject::connect(mListView,SIGNAL( newEvent()), |
362 | this,SIGNAL(signalNewEvent())); | 359 | this,SIGNAL(signalNewEvent())); |
363 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), | 360 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), |
364 | this,SLOT(defaultItemAction(QListViewItem *))); | 361 | this,SLOT(defaultItemAction(QListViewItem *))); |
365 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, | 362 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, |
366 | const QPoint &, int )), | 363 | const QPoint &, int )), |
367 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); | 364 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); |
368 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), | 365 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), |
369 | SLOT(processSelectionChange(QListViewItem *))); | 366 | SLOT(processSelectionChange(QListViewItem *))); |
370 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), | 367 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), |
@@ -417,79 +414,84 @@ void KOListView::setCalendar( int c ) | |||
417 | incidence->accept(v); | 414 | incidence->accept(v); |
418 | } | 415 | } |
419 | incidence = delSel.next(); | 416 | incidence = delSel.next(); |
420 | } | 417 | } |
421 | } | 418 | } |
422 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 419 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
423 | KopiCalendarFile * cal = calendars.first(); | 420 | KopiCalendarFile * cal = calendars.first(); |
424 | while ( cal ) { | 421 | while ( cal ) { |
425 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); | 422 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); |
426 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); | 423 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); |
427 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); | 424 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); |
428 | if ( cal->isStandard ) | 425 | if ( cal->isStandard ) |
429 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 426 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
430 | cal = calendars.next(); | 427 | cal = calendars.next(); |
431 | } | 428 | } |
432 | mCalendar->setSyncEventsReadOnly(); | 429 | mCalendar->setSyncEventsReadOnly(); |
433 | mCalendar->reInitAlarmSettings(); | 430 | mCalendar->reInitAlarmSettings(); |
434 | 431 | ||
435 | } | 432 | } |
436 | void KOListView::populateCalPopup() | 433 | void KOListView::populateCalPopup() |
437 | { | 434 | { |
438 | mCalPopup->clear(); | 435 | mCalPopup->clear(); |
439 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 436 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
440 | while ( kkf ) { | 437 | while ( kkf ) { |
441 | int index = mCalPopup->insertItem( kkf->mName, kkf->mCalNumber); | 438 | int index = mCalPopup->insertItem( kkf->mName+"...", kkf->mCalNumber); |
442 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) | 439 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) |
443 | mCalPopup->setItemEnabled( index, false ); | 440 | mCalPopup->setItemEnabled( index, false ); |
444 | kkf = KOPrefs::instance()->mCalendars.next(); | 441 | kkf = KOPrefs::instance()->mCalendars.next(); |
445 | } | 442 | } |
446 | } | 443 | } |
447 | void KOListView::updateList() | 444 | void KOListView::updateList() |
448 | { | 445 | { |
449 | // qDebug(" KOListView::updateList() "); | 446 | // qDebug(" KOListView::updateList() "); |
450 | 447 | ||
451 | } | 448 | } |
452 | 449 | ||
453 | void KOListView::clearList() | 450 | void KOListView::clearList() |
454 | { | 451 | { |
455 | clear (); | 452 | clear (); |
456 | } | 453 | } |
457 | void KOListView::addCat( ) | 454 | |
458 | { | ||
459 | setCategories( false ); | ||
460 | } | ||
461 | void KOListView::setCat() | 455 | void KOListView::setCat() |
462 | { | 456 | { |
463 | setCategories( true ); | 457 | |
458 | bool set = true; | ||
459 | int result = KMessageBox::warningYesNoCancel(this, | ||
460 | i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"), | ||
461 | i18n("Set categories"), | ||
462 | i18n("Add"), | ||
463 | i18n("Reset")); | ||
464 | if (result == KMessageBox::Cancel) return; | ||
465 | if (result == KMessageBox::Yes) set = false; | ||
466 | setCategories( set ); | ||
464 | } | 467 | } |
465 | 468 | ||
466 | void KOListView::setAlarm() | 469 | void KOListView::setAlarm() |
467 | { | 470 | { |
468 | KOAlarmPrefs kap( this); | 471 | KOAlarmPrefs kap( this); |
469 | if ( !kap.exec() ) | 472 | if ( !kap.exec() ) |
470 | return; | 473 | return; |
471 | QStringList itemList; | ||
472 | QPtrList<KOListViewItem> sel ; | 474 | QPtrList<KOListViewItem> sel ; |
473 | QListViewItem *qitem = mListView->firstChild (); | 475 | QListViewItem *qitem = mListView->firstChild (); |
474 | while ( qitem ) { | 476 | while ( qitem ) { |
475 | if ( qitem->isSelected() ) { | 477 | if ( qitem->isSelected() ) { |
476 | Incidence* inc = ((KOListViewItem *) qitem)->data(); | 478 | Incidence* inc = ((KOListViewItem *) qitem)->data(); |
477 | if ( inc->typeID() != journalID ) { | 479 | if ( inc->typeID() != journalID ) { |
478 | if ( inc->typeID() == todoID ) { | 480 | if ( inc->typeID() == todoID ) { |
479 | if ( ((Todo*)inc)->hasDueDate() ) | 481 | if ( ((Todo*)inc)->hasDueDate() ) |
480 | sel.append(((KOListViewItem *)qitem)); | 482 | sel.append(((KOListViewItem *)qitem)); |
481 | } else | 483 | } else |
482 | sel.append(((KOListViewItem *)qitem)); | 484 | sel.append(((KOListViewItem *)qitem)); |
483 | } | 485 | } |
484 | } | 486 | } |
485 | qitem = qitem->nextSibling(); | 487 | qitem = qitem->nextSibling(); |
486 | } | 488 | } |
487 | int count = 0; | 489 | int count = 0; |
488 | KOListViewItem * item, *temp; | 490 | KOListViewItem * item, *temp; |
489 | item = sel.first(); | 491 | item = sel.first(); |
490 | Incidence* inc; | 492 | Incidence* inc; |
491 | while ( item ) { | 493 | while ( item ) { |
492 | inc = item->data(); | 494 | inc = item->data(); |
493 | ++count; | 495 | ++count; |
494 | if (kap.mAlarmButton->isChecked()) { | 496 | if (kap.mAlarmButton->isChecked()) { |
495 | if (inc->alarms().count() == 0) | 497 | if (inc->alarms().count() == 0) |
@@ -522,133 +524,71 @@ void KOListView::setAlarm() | |||
522 | alarm->setEnabled(false); | 524 | alarm->setEnabled(false); |
523 | alarm->setType(Alarm::Invalid); | 525 | alarm->setType(Alarm::Invalid); |
524 | } | 526 | } |
525 | } | 527 | } |
526 | ListItemVisitor v(item, mStartDate ); | 528 | ListItemVisitor v(item, mStartDate ); |
527 | inc->accept(v); | 529 | inc->accept(v); |
528 | item = sel.next(); | 530 | item = sel.next(); |
529 | } | 531 | } |
530 | topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); | 532 | topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); |
531 | qDebug("KO: Set alarm for %d items", count); | 533 | qDebug("KO: Set alarm for %d items", count); |
532 | calendar()->reInitAlarmSettings(); | 534 | calendar()->reInitAlarmSettings(); |
533 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 535 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
534 | } | 536 | } |
535 | void KOListView::setCategories( bool removeOld ) | 537 | void KOListView::setCategories( bool removeOld ) |
536 | { | 538 | { |
537 | 539 | ||
538 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 540 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
539 | csd->setColorEnabled(); | 541 | csd->setColorEnabled(); |
540 | if (! csd->exec()) { | 542 | if (! csd->exec()) { |
541 | delete csd; | 543 | delete csd; |
542 | return; | 544 | return; |
543 | } | 545 | } |
544 | QStringList catList = csd->selectedCategories(); | 546 | QStringList catList = csd->selectedCategories(); |
545 | delete csd; | 547 | delete csd; |
546 | // if ( catList.count() == 0 ) | 548 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; |
547 | // return; | 549 | Incidence* inc = delSel.first(); |
548 | //catList.sort(); | 550 | while ( inc ) { |
549 | QString categoriesStr = catList.join(","); | ||
550 | int i; | ||
551 | QStringList itemList; | ||
552 | QPtrList<KOListViewItem> sel ; | ||
553 | QListViewItem *qitem = mListView->firstChild (); | ||
554 | while ( qitem ) { | ||
555 | if ( qitem->isSelected() ) { | ||
556 | sel.append(((KOListViewItem *)qitem)); | ||
557 | } | ||
558 | qitem = qitem->nextSibling(); | ||
559 | } | ||
560 | KOListViewItem * item, *temp; | ||
561 | item = sel.first(); | ||
562 | if( item ) { | ||
563 | Incidence* inc = item->data() ; | ||
564 | bool setSub = false; | ||
565 | if( inc->typeID() == todoID && sel.count() == 1 && inc->relations().count() > 0 ) { | ||
566 | int result = KMessageBox::warningYesNoCancel(this, | ||
567 | i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ), | ||
568 | i18n("Todo has subtodos"), | ||
569 | i18n("Yes"), | ||
570 | i18n("No")); | ||
571 | if (result == KMessageBox::Cancel) item = 0; | ||
572 | if (result == KMessageBox::Yes) setSub = true; | ||
573 | } | ||
574 | while ( item ) { | ||
575 | inc = item->data(); | ||
576 | if ( removeOld ) { | 551 | if ( removeOld ) { |
577 | inc->setCategories( catList, setSub ); | 552 | inc->setCategories( catList, false ); |
578 | } else { | 553 | } else { |
579 | inc->addCategories( catList, setSub ); | 554 | inc->addCategories( catList, false ); |
580 | } | 555 | } |
556 | KOListViewItem* item = getItemForEvent(inc); | ||
557 | if (item) { | ||
581 | ListItemVisitor v(item, mStartDate ); | 558 | ListItemVisitor v(item, mStartDate ); |
582 | inc->accept(v); | 559 | inc->accept(v); |
583 | item = sel.next(); | ||
584 | } | 560 | } |
561 | inc = delSel.next(); | ||
585 | } | 562 | } |
586 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 563 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
587 | } | 564 | } |
588 | 565 | ||
589 | void KOListView::beamSelected() | 566 | void KOListView::beamSelected() |
590 | { | 567 | { |
591 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 568 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
592 | int icount = delSel.count(); | 569 | if ( delSel.count() ) |
593 | if ( icount ) { | ||
594 | emit beamIncidenceList( delSel ); | 570 | emit beamIncidenceList( delSel ); |
595 | return; | ||
596 | QString fn ; | ||
597 | fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; | ||
598 | QString mes; | ||
599 | bool createbup = true; | ||
600 | if ( createbup ) { | ||
601 | QString description = "\n"; | ||
602 | CalendarLocal* cal = new CalendarLocal(); | ||
603 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | ||
604 | Incidence *incidence = delSel.first(); | ||
605 | while ( incidence ) { | ||
606 | Incidence *in = incidence->clone(); | ||
607 | description += in->summary() + "\n"; | ||
608 | cal->addIncidence( in ); | ||
609 | incidence = delSel.next(); | ||
610 | } | ||
611 | FileStorage storage( cal, fn, new VCalFormat ); | ||
612 | storage.save(); | ||
613 | delete cal; | ||
614 | mes = i18n("KO/Pi: Ready for beaming"); | ||
615 | topLevelWidget()->setCaption(mes); | ||
616 | |||
617 | #ifndef DESKTOP_VERSION | ||
618 | Ir *ir = new Ir( this ); | ||
619 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | ||
620 | ir->send( fn, description, "text/x-vCalendar" ); | ||
621 | #endif | ||
622 | } | ||
623 | } | ||
624 | } | ||
625 | void KOListView::beamDone( Ir *ir ) | ||
626 | { | ||
627 | #ifndef DESKTOP_VERSION | ||
628 | delete ir; | ||
629 | #endif | ||
630 | topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); | ||
631 | } | 571 | } |
632 | 572 | ||
633 | void KOListView::saveDescriptionToFile() | 573 | void KOListView::saveDescriptionToFile() |
634 | { | 574 | { |
635 | 575 | ||
636 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), | 576 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), |
637 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), | 577 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), |
638 | i18n("Continue"), i18n("Cancel"), 0, | 578 | i18n("Continue"), i18n("Cancel"), 0, |
639 | 0, 1 ); | 579 | 0, 1 ); |
640 | if ( result != 0 ) { | 580 | if ( result != 0 ) { |
641 | return; | 581 | return; |
642 | } | 582 | } |
643 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 583 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
644 | int icount = delSel.count(); | 584 | int icount = delSel.count(); |
645 | if ( icount ) { | 585 | if ( icount ) { |
646 | QString fn = KOPrefs::instance()->mLastSaveFile; | 586 | QString fn = KOPrefs::instance()->mLastSaveFile; |
647 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); | 587 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); |
648 | 588 | ||
649 | if ( fn == "" ) | 589 | if ( fn == "" ) |
650 | return; | 590 | return; |
651 | QFileInfo info; | 591 | QFileInfo info; |
652 | info.setFile( fn ); | 592 | info.setFile( fn ); |
653 | QString mes; | 593 | QString mes; |
654 | bool createbup = true; | 594 | bool createbup = true; |
@@ -1085,51 +1025,50 @@ void KOListView::showEvents(QPtrList<Event> eventList) | |||
1085 | { | 1025 | { |
1086 | clear(); | 1026 | clear(); |
1087 | 1027 | ||
1088 | addEvents(eventList); | 1028 | addEvents(eventList); |
1089 | 1029 | ||
1090 | // After new creation of list view no events are selected. | 1030 | // After new creation of list view no events are selected. |
1091 | emit incidenceSelected( 0 ); | 1031 | emit incidenceSelected( 0 ); |
1092 | } | 1032 | } |
1093 | int KOListView::count() | 1033 | int KOListView::count() |
1094 | { | 1034 | { |
1095 | return mListView->childCount(); | 1035 | return mListView->childCount(); |
1096 | } | 1036 | } |
1097 | 1037 | ||
1098 | void KOListView::changeEventDisplay(Event *event, int action) | 1038 | void KOListView::changeEventDisplay(Event *event, int action) |
1099 | { | 1039 | { |
1100 | KOListViewItem *item; | 1040 | KOListViewItem *item; |
1101 | 1041 | ||
1102 | switch(action) { | 1042 | switch(action) { |
1103 | case KOGlobals::EVENTADDED: | 1043 | case KOGlobals::EVENTADDED: |
1104 | addIncidence( event ); | 1044 | addIncidence( event ); |
1105 | break; | 1045 | break; |
1106 | case KOGlobals::EVENTEDITED: | 1046 | case KOGlobals::EVENTEDITED: |
1107 | item = getItemForEvent(event); | 1047 | item = getItemForEvent(event); |
1108 | if (item) { | 1048 | if (item) { |
1109 | mUidDict.remove( event->uid() ); | 1049 | ListItemVisitor v(item, mStartDate ); |
1110 | delete item; | 1050 | ((Incidence*)event)->accept(v); |
1111 | addIncidence( event ); | ||
1112 | } | 1051 | } |
1113 | break; | 1052 | break; |
1114 | case KOGlobals::EVENTDELETED: | 1053 | case KOGlobals::EVENTDELETED: |
1115 | item = getItemForEvent(event); | 1054 | item = getItemForEvent(event); |
1116 | if (item) { | 1055 | if (item) { |
1117 | mUidDict.remove( event->uid() ); | 1056 | mUidDict.remove( event->uid() ); |
1118 | delete item; | 1057 | delete item; |
1119 | } | 1058 | } |
1120 | break; | 1059 | break; |
1121 | default: | 1060 | default: |
1122 | ; | 1061 | ; |
1123 | } | 1062 | } |
1124 | } | 1063 | } |
1125 | 1064 | ||
1126 | KOListViewItem *KOListView::getItemForEvent(Incidence *event) | 1065 | KOListViewItem *KOListView::getItemForEvent(Incidence *event) |
1127 | { | 1066 | { |
1128 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); | 1067 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); |
1129 | while (item) { | 1068 | while (item) { |
1130 | if (item->data() == event) return item; | 1069 | if (item->data() == event) return item; |
1131 | item = (KOListViewItem *)item->nextSibling(); | 1070 | item = (KOListViewItem *)item->nextSibling(); |
1132 | } | 1071 | } |
1133 | return 0; | 1072 | return 0; |
1134 | } | 1073 | } |
1135 | 1074 | ||