summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 257a4dd..035d630 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2553,246 +2553,253 @@ void CalendarView::moveIncidence()
2553 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2553 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2554 if ( incidence ) { 2554 if ( incidence ) {
2555 moveIncidence(incidence); 2555 moveIncidence(incidence);
2556 } 2556 }
2557} 2557}
2558void CalendarView::beamIncidence() 2558void CalendarView::beamIncidence()
2559{ 2559{
2560 Incidence *incidence = currentSelection(); 2560 Incidence *incidence = currentSelection();
2561 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2561 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2562 if ( incidence ) { 2562 if ( incidence ) {
2563 beamIncidence(incidence); 2563 beamIncidence(incidence);
2564 } 2564 }
2565} 2565}
2566void CalendarView::toggleCancelIncidence() 2566void CalendarView::toggleCancelIncidence()
2567{ 2567{
2568 Incidence *incidence = currentSelection(); 2568 Incidence *incidence = currentSelection();
2569 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2569 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2570 if ( incidence ) { 2570 if ( incidence ) {
2571 cancelIncidence(incidence); 2571 cancelIncidence(incidence);
2572 } 2572 }
2573} 2573}
2574 2574
2575 2575
2576void CalendarView::cancelIncidence(Incidence * inc ) 2576void CalendarView::cancelIncidence(Incidence * inc )
2577{ 2577{
2578 inc->setCancelled( ! inc->cancelled() ); 2578 inc->setCancelled( ! inc->cancelled() );
2579 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 2579 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
2580 updateView(); 2580 updateView();
2581} 2581}
2582void CalendarView::cloneIncidence(Incidence * orgInc ) 2582void CalendarView::cloneIncidence(Incidence * orgInc )
2583{ 2583{
2584 Incidence * newInc = orgInc->clone(); 2584 Incidence * newInc = orgInc->clone();
2585 newInc->recreate(); 2585 newInc->recreate();
2586 2586
2587 if ( newInc->type() == "Todo" ) { 2587 if ( newInc->type() == "Todo" ) {
2588 Todo* t = (Todo*) newInc; 2588 Todo* t = (Todo*) newInc;
2589 showTodoEditor(); 2589 showTodoEditor();
2590 mTodoEditor->editTodo( t ); 2590 mTodoEditor->editTodo( t );
2591 if ( mTodoEditor->exec() ) { 2591 if ( mTodoEditor->exec() ) {
2592 mCalendar->addTodo( t ); 2592 mCalendar->addTodo( t );
2593 updateView(); 2593 updateView();
2594 } else { 2594 } else {
2595 delete t; 2595 delete t;
2596 } 2596 }
2597 } 2597 }
2598 else { 2598 else {
2599 Event* e = (Event*) newInc; 2599 Event* e = (Event*) newInc;
2600 showEventEditor(); 2600 showEventEditor();
2601 mEventEditor->editEvent( e ); 2601 mEventEditor->editEvent( e );
2602 if ( mEventEditor->exec() ) { 2602 if ( mEventEditor->exec() ) {
2603 mCalendar->addEvent( e ); 2603 mCalendar->addEvent( e );
2604 updateView(); 2604 updateView();
2605 } else { 2605 } else {
2606 delete e; 2606 delete e;
2607 } 2607 }
2608 } 2608 }
2609} 2609}
2610 2610
2611void CalendarView::newEvent() 2611void CalendarView::newEvent()
2612{ 2612{
2613 // TODO: Replace this code by a common eventDurationHint of KOBaseView. 2613 // TODO: Replace this code by a common eventDurationHint of KOBaseView.
2614 KOAgendaView *aView = mViewManager->agendaView(); 2614 KOAgendaView *aView = mViewManager->agendaView();
2615 if (aView) { 2615 if (aView) {
2616 if (aView->selectionStart().isValid()) { 2616 if (aView->selectionStart().isValid()) {
2617 if (aView->selectedIsAllDay()) { 2617 if (aView->selectedIsAllDay()) {
2618 newEvent(aView->selectionStart(),aView->selectionEnd(),true); 2618 newEvent(aView->selectionStart(),aView->selectionEnd(),true);
2619 } else { 2619 } else {
2620 newEvent(aView->selectionStart(),aView->selectionEnd()); 2620 newEvent(aView->selectionStart(),aView->selectionEnd());
2621 } 2621 }
2622 return; 2622 return;
2623 } 2623 }
2624 } 2624 }
2625 2625
2626 QDate date = mNavigator->selectedDates().first(); 2626 QDate date = mNavigator->selectedDates().first();
2627 QDateTime current = QDateTime::currentDateTime(); 2627 QDateTime current = QDateTime::currentDateTime();
2628 if ( date <= current.date() ) { 2628 if ( date <= current.date() ) {
2629 int hour = current.time().hour() +1; 2629 int hour = current.time().hour() +1;
2630 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), 2630 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
2631 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2631 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2632 } else 2632 } else
2633 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), 2633 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ),
2634 QDateTime( date, QTime( KOPrefs::instance()->mStartTime + 2634 QDateTime( date, QTime( KOPrefs::instance()->mStartTime +
2635 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2635 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2636} 2636}
2637 2637
2638void CalendarView::newEvent(QDateTime fh) 2638void CalendarView::newEvent(QDateTime fh)
2639{ 2639{
2640 newEvent(fh, 2640 newEvent(fh,
2641 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); 2641 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration)));
2642} 2642}
2643 2643
2644void CalendarView::newEvent(QDate dt) 2644void CalendarView::newEvent(QDate dt)
2645{ 2645{
2646 newEvent(QDateTime(dt, QTime(0,0,0)), 2646 newEvent(QDateTime(dt, QTime(0,0,0)),
2647 QDateTime(dt, QTime(0,0,0)), true); 2647 QDateTime(dt, QTime(0,0,0)), true);
2648} 2648}
2649 2649void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint)
2650{
2651 newEvent(fromHint, toHint, false);
2652}
2650void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) 2653void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
2651{ 2654{
2652 2655
2653 showEventEditor(); 2656 showEventEditor();
2654 mEventEditor->newEvent(fromHint,toHint,allDay); 2657 mEventEditor->newEvent(fromHint,toHint,allDay);
2655 if ( mFilterView->filtersEnabled() ) { 2658 if ( mFilterView->filtersEnabled() ) {
2656 CalFilter *filter = mFilterView->selectedFilter(); 2659 CalFilter *filter = mFilterView->selectedFilter();
2657 if (filter && filter->showCategories()) { 2660 if (filter && filter->showCategories()) {
2658 mEventEditor->setCategories(filter->categoryList().join(",") ); 2661 mEventEditor->setCategories(filter->categoryList().join(",") );
2659 } 2662 }
2660 if ( filter ) 2663 if ( filter )
2661 mEventEditor->setSecrecy( filter->getSecrecy() ); 2664 mEventEditor->setSecrecy( filter->getSecrecy() );
2662 } 2665 }
2663} 2666}
2664void CalendarView::todoAdded(Todo * t) 2667void CalendarView::todoAdded(Todo * t)
2665{ 2668{
2666 2669
2667 changeTodoDisplay ( t ,KOGlobals::EVENTADDED); 2670 changeTodoDisplay ( t ,KOGlobals::EVENTADDED);
2668 updateTodoViews(); 2671 updateTodoViews();
2669} 2672}
2670void CalendarView::todoChanged(Todo * t) 2673void CalendarView::todoChanged(Todo * t)
2671{ 2674{
2672 emit todoModified( t, 4 ); 2675 emit todoModified( t, 4 );
2673 // updateTodoViews(); 2676 // updateTodoViews();
2674} 2677}
2675void CalendarView::todoToBeDeleted(Todo *) 2678void CalendarView::todoToBeDeleted(Todo *)
2676{ 2679{
2677 //qDebug("todoToBeDeleted(Todo *) "); 2680 //qDebug("todoToBeDeleted(Todo *) ");
2678 updateTodoViews(); 2681 updateTodoViews();
2679} 2682}
2680void CalendarView::todoDeleted() 2683void CalendarView::todoDeleted()
2681{ 2684{
2682 //qDebug(" todoDeleted()"); 2685 //qDebug(" todoDeleted()");
2683 updateTodoViews(); 2686 updateTodoViews();
2684} 2687}
2685 2688
2686 2689
2687 2690void CalendarView::newTodoDateTime( QDateTime dt, bool allday )
2688void CalendarView::newTodo()
2689{ 2691{
2690 2692 qDebug("datetime ");
2691 showTodoEditor(); 2693 showTodoEditor();
2692 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); 2694 mTodoEditor->newTodo(dt,0,allday);
2693 if ( mFilterView->filtersEnabled() ) { 2695 if ( mFilterView->filtersEnabled() ) {
2694 CalFilter *filter = mFilterView->selectedFilter(); 2696 CalFilter *filter = mFilterView->selectedFilter();
2695 if (filter && filter->showCategories()) { 2697 if (filter && filter->showCategories()) {
2696 mTodoEditor->setCategories(filter->categoryList().join(",") ); 2698 mTodoEditor->setCategories(filter->categoryList().join(",") );
2697 } 2699 }
2698 if ( filter ) 2700 if ( filter )
2699 mTodoEditor->setSecrecy( filter->getSecrecy() ); 2701 mTodoEditor->setSecrecy( filter->getSecrecy() );
2700 } 2702 }
2701} 2703}
2702 2704
2705void CalendarView::newTodo()
2706{
2707 newTodoDateTime( QDateTime(),true );
2708}
2709
2703void CalendarView::newSubTodo() 2710void CalendarView::newSubTodo()
2704{ 2711{
2705 Todo *todo = selectedTodo(); 2712 Todo *todo = selectedTodo();
2706 if ( todo ) newSubTodo( todo ); 2713 if ( todo ) newSubTodo( todo );
2707} 2714}
2708 2715
2709void CalendarView::newSubTodo(Todo *parentEvent) 2716void CalendarView::newSubTodo(Todo *parentEvent)
2710{ 2717{
2711 2718
2712 showTodoEditor(); 2719 showTodoEditor();
2713 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); 2720 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true);
2714} 2721}
2715 2722
2716void CalendarView::newFloatingEvent() 2723void CalendarView::newFloatingEvent()
2717{ 2724{
2718 DateList tmpList = mNavigator->selectedDates(); 2725 DateList tmpList = mNavigator->selectedDates();
2719 QDate date = tmpList.first(); 2726 QDate date = tmpList.first();
2720 2727
2721 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), 2728 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
2722 QDateTime( date, QTime( 12, 0, 0 ) ), true ); 2729 QDateTime( date, QTime( 12, 0, 0 ) ), true );
2723} 2730}
2724 2731
2725 2732
2726void CalendarView::editEvent( Event *event ) 2733void CalendarView::editEvent( Event *event )
2727{ 2734{
2728 2735
2729 if ( !event ) return; 2736 if ( !event ) return;
2730 if ( event->isReadOnly() ) { 2737 if ( event->isReadOnly() ) {
2731 showEvent( event ); 2738 showEvent( event );
2732 return; 2739 return;
2733 } 2740 }
2734 showEventEditor(); 2741 showEventEditor();
2735 mEventEditor->editEvent( event , mFlagEditDescription); 2742 mEventEditor->editEvent( event , mFlagEditDescription);
2736} 2743}
2737void CalendarView::editJournal( Journal *jour ) 2744void CalendarView::editJournal( Journal *jour )
2738{ 2745{
2739 if ( !jour ) return; 2746 if ( !jour ) return;
2740 mDialogManager->hideSearchDialog(); 2747 mDialogManager->hideSearchDialog();
2741 mViewManager->showJournalView(); 2748 mViewManager->showJournalView();
2742 mNavigator->slotDaySelect( jour->dtStart().date() ); 2749 mNavigator->slotDaySelect( jour->dtStart().date() );
2743} 2750}
2744void CalendarView::editTodo( Todo *todo ) 2751void CalendarView::editTodo( Todo *todo )
2745{ 2752{
2746 if ( !todo ) return; 2753 if ( !todo ) return;
2747 2754
2748 if ( todo->isReadOnly() ) { 2755 if ( todo->isReadOnly() ) {
2749 showTodo( todo ); 2756 showTodo( todo );
2750 return; 2757 return;
2751 } 2758 }
2752 showTodoEditor(); 2759 showTodoEditor();
2753 mTodoEditor->editTodo( todo ,mFlagEditDescription); 2760 mTodoEditor->editTodo( todo ,mFlagEditDescription);
2754 2761
2755} 2762}
2756 2763
2757KOEventViewerDialog* CalendarView::getEventViewerDialog() 2764KOEventViewerDialog* CalendarView::getEventViewerDialog()
2758{ 2765{
2759 if ( !mEventViewerDialog ) { 2766 if ( !mEventViewerDialog ) {
2760 mEventViewerDialog = new KOEventViewerDialog(this); 2767 mEventViewerDialog = new KOEventViewerDialog(this);
2761 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); 2768 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
2762 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); 2769 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
2763 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), 2770 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
2764 dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 2771 dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
2765 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), 2772 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
2766 viewManager(), SLOT( showAgendaView( bool ) ) ); 2773 viewManager(), SLOT( showAgendaView( bool ) ) );
2767 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), 2774 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ),
2768 this, SLOT( todoChanged(Todo *) ) ); 2775 this, SLOT( todoChanged(Todo *) ) );
2769 mEventViewerDialog->resize( 640, 480 ); 2776 mEventViewerDialog->resize( 640, 480 );
2770 2777
2771 } 2778 }
2772 return mEventViewerDialog; 2779 return mEventViewerDialog;
2773} 2780}
2774void CalendarView::showEvent(Event *event) 2781void CalendarView::showEvent(Event *event)
2775{ 2782{
2776 getEventViewerDialog()->setEvent(event); 2783 getEventViewerDialog()->setEvent(event);
2777 getEventViewerDialog()->showMe(); 2784 getEventViewerDialog()->showMe();
2778} 2785}
2779 2786
2780void CalendarView::showTodo(Todo *event) 2787void CalendarView::showTodo(Todo *event)
2781{ 2788{
2782 getEventViewerDialog()->setTodo(event); 2789 getEventViewerDialog()->setTodo(event);
2783 getEventViewerDialog()->showMe(); 2790 getEventViewerDialog()->showMe();
2784} 2791}
2785void CalendarView::showJournal( Journal *jour ) 2792void CalendarView::showJournal( Journal *jour )
2786{ 2793{
2787 getEventViewerDialog()->setJournal(jour); 2794 getEventViewerDialog()->setJournal(jour);
2788 getEventViewerDialog()->showMe(); 2795 getEventViewerDialog()->showMe();
2789 2796
2790} 2797}
2791// void CalendarView::todoModified (Todo *event, int changed) 2798// void CalendarView::todoModified (Todo *event, int changed)
2792// { 2799// {
2793// // if (mDialogList.find (event) != mDialogList.end ()) { 2800// // if (mDialogList.find (event) != mDialogList.end ()) {
2794// // kdDebug() << "Todo modified and open" << endl; 2801// // kdDebug() << "Todo modified and open" << endl;
2795// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; 2802// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
2796// // temp->modified (changed); 2803// // temp->modified (changed);
2797 2804
2798// // } 2805// // }