summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index e4a11f5..1f8ad5b 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -374,96 +374,98 @@ void CalendarView::init()
374 mNavigator, SLOT( selectPrevious() ) ); 374 mNavigator, SLOT( selectPrevious() ) );
375 connect( mDateNavigator, SIGNAL( goNext() ), 375 connect( mDateNavigator, SIGNAL( goNext() ),
376 mNavigator, SLOT( selectNext() ) ); 376 mNavigator, SLOT( selectNext() ) );
377 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 377 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
378 mNavigator, SLOT( slotMonthSelect( int ) ) ); 378 mNavigator, SLOT( slotMonthSelect( int ) ) );
379 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), 379 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ),
380 mNavigator, SLOT( slotMonthSelect( int ) ) ); 380 mNavigator, SLOT( slotMonthSelect( int ) ) );
381 381
382 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 382 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
383 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 383 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
384 384
385 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), 385 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ),
386 SLOT( eventAdded( Event *) ) ); 386 SLOT( eventAdded( Event *) ) );
387 387
388 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 388 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
389 389
390 connect( this, SIGNAL( configChanged() ), 390 connect( this, SIGNAL( configChanged() ),
391 mDateNavigator, SLOT( updateConfig() ) ); 391 mDateNavigator, SLOT( updateConfig() ) );
392 392
393 connect( mTodoList, SIGNAL( newTodoSignal() ), 393 connect( mTodoList, SIGNAL( newTodoSignal() ),
394 SLOT( newTodo() ) ); 394 SLOT( newTodo() ) );
395 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 395 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
396 SLOT( newSubTodo( Todo * ) ) ); 396 SLOT( newSubTodo( Todo * ) ) );
397 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 397 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
398 SLOT( editTodo( Todo * ) ) ); 398 SLOT( editTodo( Todo * ) ) );
399 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 399 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
400 SLOT( showTodo( Todo *) ) ); 400 SLOT( showTodo( Todo *) ) );
401 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 401 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
402 SLOT( deleteTodo( Todo *) ) ); 402 SLOT( deleteTodo( Todo *) ) );
403 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 403 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
404 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 404 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
405 SLOT( purgeCompleted() ) ); 405 SLOT( purgeCompleted() ) );
406 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 406 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
407 SIGNAL( todoModified( Todo *, int ) ) ); 407 SIGNAL( todoModified( Todo *, int ) ) );
408 408
409 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 409 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
410 this, SLOT ( cloneIncidence( Incidence * ) ) ); 410 this, SLOT ( cloneIncidence( Incidence * ) ) );
411 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 411 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
412 this, SLOT (cancelIncidence( Incidence * ) ) ); 412 this, SLOT (cancelIncidence( Incidence * ) ) );
413 413
414 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 414 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
415 this, SLOT ( moveIncidence( Incidence * ) ) ); 415 this, SLOT ( moveIncidence( Incidence * ) ) );
416 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 416 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
417 this, SLOT ( beamIncidence( Incidence * ) ) ); 417 this, SLOT ( beamIncidence( Incidence * ) ) );
418 418
419 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 419 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
420 this, SLOT ( todo_unsub( Todo * ) ) ); 420 this, SLOT ( todo_unsub( Todo * ) ) );
421 421
422 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
423 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
422 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 424 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
423 SLOT( updateTodo( Todo *, int ) ) ); 425 SLOT( updateTodo( Todo *, int ) ) );
424 connect( this, SIGNAL( todoModified( Todo *, int )), this, 426 connect( this, SIGNAL( todoModified( Todo *, int )), this,
425 SLOT( changeTodoDisplay( Todo *, int ) ) ); 427 SLOT( changeTodoDisplay( Todo *, int ) ) );
426 428
427 429
428 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 430 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
429 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 431 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
430 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 432 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
431 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 433 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
432 434
433 435
434 436
435 437
436 438
437 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 439 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
438 SLOT(checkClipboard())); 440 SLOT(checkClipboard()));
439 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 441 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
440 SLOT( processTodoListSelection( Incidence * ) ) ); 442 SLOT( processTodoListSelection( Incidence * ) ) );
441 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 443 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
442 444
443 // kdDebug() << "CalendarView::CalendarView() done" << endl; 445 // kdDebug() << "CalendarView::CalendarView() done" << endl;
444 446
445 mDateFrame = new QVBox(0,0,WType_Popup); 447 mDateFrame = new QVBox(0,0,WType_Popup);
446 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 448 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
447 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 449 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
448 mDateFrame->setLineWidth(3); 450 mDateFrame->setLineWidth(3);
449 mDateFrame->hide(); 451 mDateFrame->hide();
450 mDateFrame->setCaption( i18n( "Pick a date to display")); 452 mDateFrame->setCaption( i18n( "Pick a date to display"));
451 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 453 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
452 454
453 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 455 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
454 456
455 mEventEditor = mDialogManager->getEventEditor(); 457 mEventEditor = mDialogManager->getEventEditor();
456 mTodoEditor = mDialogManager->getTodoEditor(); 458 mTodoEditor = mDialogManager->getTodoEditor();
457 459
458 mFlagEditDescription = false; 460 mFlagEditDescription = false;
459 461
460 mSuspendTimer = new QTimer( this ); 462 mSuspendTimer = new QTimer( this );
461 mAlarmTimer = new QTimer( this ); 463 mAlarmTimer = new QTimer( this );
462 mRecheckAlarmTimer = new QTimer( this ); 464 mRecheckAlarmTimer = new QTimer( this );
463 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 465 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
464 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 466 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
465 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 467 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
466 mAlarmDialog = new AlarmDialog( this ); 468 mAlarmDialog = new AlarmDialog( this );
467 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 469 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
468 mAlarmDialog->setServerNotification( false ); 470 mAlarmDialog->setServerNotification( false );
469 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 471 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
@@ -2701,96 +2703,110 @@ void CalendarView::appointment_show()
2701 if (!anEvent) { 2703 if (!anEvent) {
2702 KNotifyClient::beep(); 2704 KNotifyClient::beep();
2703 return; 2705 return;
2704 } 2706 }
2705 2707
2706 showEvent(anEvent); 2708 showEvent(anEvent);
2707} 2709}
2708 2710
2709void CalendarView::appointment_edit() 2711void CalendarView::appointment_edit()
2710{ 2712{
2711 Event *anEvent = 0; 2713 Event *anEvent = 0;
2712 2714
2713 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2715 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2714 2716
2715 if (mViewManager->currentView()->isEventView()) { 2717 if (mViewManager->currentView()->isEventView()) {
2716 if ( incidence && incidence->type() == "Event" ) { 2718 if ( incidence && incidence->type() == "Event" ) {
2717 anEvent = static_cast<Event *>(incidence); 2719 anEvent = static_cast<Event *>(incidence);
2718 } 2720 }
2719 } 2721 }
2720 2722
2721 if (!anEvent) { 2723 if (!anEvent) {
2722 KNotifyClient::beep(); 2724 KNotifyClient::beep();
2723 return; 2725 return;
2724 } 2726 }
2725 2727
2726 editEvent(anEvent); 2728 editEvent(anEvent);
2727} 2729}
2728 2730
2729void CalendarView::appointment_delete() 2731void CalendarView::appointment_delete()
2730{ 2732{
2731 Event *anEvent = 0; 2733 Event *anEvent = 0;
2732 2734
2733 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2735 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2734 2736
2735 if (mViewManager->currentView()->isEventView()) { 2737 if (mViewManager->currentView()->isEventView()) {
2736 if ( incidence && incidence->type() == "Event" ) { 2738 if ( incidence && incidence->type() == "Event" ) {
2737 anEvent = static_cast<Event *>(incidence); 2739 anEvent = static_cast<Event *>(incidence);
2738 } 2740 }
2739 } 2741 }
2740 2742
2741 if (!anEvent) { 2743 if (!anEvent) {
2742 KNotifyClient::beep(); 2744 KNotifyClient::beep();
2743 return; 2745 return;
2744 } 2746 }
2745 2747
2746 deleteEvent(anEvent); 2748 deleteEvent(anEvent);
2747} 2749}
2748 2750
2751void CalendarView::todo_resub( Todo * parent, Todo * sub )
2752{
2753 if (!sub) return;
2754 if (!parent) return;
2755 if ( sub->relatedTo() )
2756 sub->relatedTo()->removeRelation(sub);
2757 sub->setRelatedTo(parent);
2758 sub->setRelatedToUid(parent->uid());
2759 parent->addRelation(sub);
2760 sub->updated();
2761 parent->updated();
2762 setModified(true);
2763 updateView();
2764}
2749void CalendarView::todo_unsub(Todo *anTodo ) 2765void CalendarView::todo_unsub(Todo *anTodo )
2750{ 2766{
2751 // Todo *anTodo = selectedTodo(); 2767 // Todo *anTodo = selectedTodo();
2752 if (!anTodo) return; 2768 if (!anTodo) return;
2753 if (!anTodo->relatedTo()) return; 2769 if (!anTodo->relatedTo()) return;
2754 anTodo->relatedTo()->removeRelation(anTodo); 2770 anTodo->relatedTo()->removeRelation(anTodo);
2755 anTodo->setRelatedTo(0); 2771 anTodo->setRelatedTo(0);
2756 anTodo->updated(); 2772 anTodo->updated();
2757 anTodo->setRelatedToUid(""); 2773 anTodo->setRelatedToUid("");
2758 setModified(true); 2774 setModified(true);
2759 updateView(); 2775 updateView();
2760} 2776}
2761 2777
2762void CalendarView::deleteTodo(Todo *todo) 2778void CalendarView::deleteTodo(Todo *todo)
2763{ 2779{
2764 if (!todo) { 2780 if (!todo) {
2765 KNotifyClient::beep(); 2781 KNotifyClient::beep();
2766 return; 2782 return;
2767 } 2783 }
2768 if (KOPrefs::instance()->mConfirm) { 2784 if (KOPrefs::instance()->mConfirm) {
2769 switch (msgItemDelete()) { 2785 switch (msgItemDelete()) {
2770 case KMessageBox::Continue: // OK 2786 case KMessageBox::Continue: // OK
2771 if (!todo->relations().isEmpty()) { 2787 if (!todo->relations().isEmpty()) {
2772 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), 2788 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."),
2773 i18n("Delete To-Do")); 2789 i18n("Delete To-Do"));
2774 } else { 2790 } else {
2775 checkExternalId( todo ); 2791 checkExternalId( todo );
2776 calendar()->deleteTodo(todo); 2792 calendar()->deleteTodo(todo);
2777 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2793 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2778 updateView(); 2794 updateView();
2779 } 2795 }
2780 break; 2796 break;
2781 } // switch 2797 } // switch
2782 } else { 2798 } else {
2783 if (!todo->relations().isEmpty()) { 2799 if (!todo->relations().isEmpty()) {
2784 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), 2800 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."),
2785 i18n("Delete To-Do")); 2801 i18n("Delete To-Do"));
2786 } else { 2802 } else {
2787 checkExternalId( todo ); 2803 checkExternalId( todo );
2788 mCalendar->deleteTodo(todo); 2804 mCalendar->deleteTodo(todo);
2789 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2805 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2790 updateView(); 2806 updateView();
2791 } 2807 }
2792 } 2808 }
2793 emit updateSearchDialog(); 2809 emit updateSearchDialog();
2794} 2810}
2795void CalendarView::deleteJournal(Journal *jour) 2811void CalendarView::deleteJournal(Journal *jour)
2796{ 2812{