summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 7c7466b..4794414 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2427,213 +2427,215 @@ void CalendarView::updateTodoViews()
2427 mViewManager->currentView()->updateView(); 2427 mViewManager->currentView()->updateView();
2428 2428
2429} 2429}
2430 2430
2431 2431
2432void CalendarView::updateView(const QDate &start, const QDate &end) 2432void CalendarView::updateView(const QDate &start, const QDate &end)
2433{ 2433{
2434 mTodoList->updateView(); 2434 mTodoList->updateView();
2435 mViewManager->updateView(start, end); 2435 mViewManager->updateView(start, end);
2436 //mDateNavigator->updateView(); 2436 //mDateNavigator->updateView();
2437} 2437}
2438 2438
2439void CalendarView::clearAllViews() 2439void CalendarView::clearAllViews()
2440{ 2440{
2441 mTodoList->clearList(); 2441 mTodoList->clearList();
2442 mViewManager->clearAllViews(); 2442 mViewManager->clearAllViews();
2443 SearchDialog * sd = mDialogManager->getSearchDialog(); 2443 SearchDialog * sd = mDialogManager->getSearchDialog();
2444 if ( sd ) { 2444 if ( sd ) {
2445 KOListView* kol = sd->listview(); 2445 KOListView* kol = sd->listview();
2446 if ( kol ) 2446 if ( kol )
2447 kol->clearList(); 2447 kol->clearList();
2448 } 2448 }
2449} 2449}
2450void CalendarView::updateView() 2450void CalendarView::updateView()
2451{ 2451{
2452 DateList tmpList = mNavigator->selectedDates(); 2452 DateList tmpList = mNavigator->selectedDates();
2453 2453
2454 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2454 if ( KOPrefs::instance()->mHideNonStartedTodos )
2455 mTodoList->updateView(); 2455 mTodoList->updateView();
2456 // We assume that the navigator only selects consecutive days. 2456 // We assume that the navigator only selects consecutive days.
2457 updateView( tmpList.first(), tmpList.last() ); 2457 updateView( tmpList.first(), tmpList.last() );
2458} 2458}
2459 2459
2460void CalendarView::updateUnmanagedViews() 2460void CalendarView::updateUnmanagedViews()
2461{ 2461{
2462 mDateNavigator->updateDayMatrix(); 2462 mDateNavigator->updateDayMatrix();
2463} 2463}
2464 2464
2465int CalendarView::msgItemDelete(const QString name) 2465int CalendarView::msgItemDelete(const QString name)
2466{ 2466{
2467 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2467 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2468 i18n("This item will be\npermanently deleted."), 2468 i18n("This item will be\npermanently deleted."),
2469 i18n("KO/Pi Confirmation"),i18n("Delete")); 2469 i18n("KO/Pi Confirmation"),i18n("Delete"));
2470} 2470}
2471 2471
2472 2472
2473void CalendarView::edit_cut() 2473void CalendarView::edit_cut()
2474{ 2474{
2475 Event *anEvent=0; 2475 Event *anEvent=0;
2476 2476
2477 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2477 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2478 2478
2479 if (mViewManager->currentView()->isEventView()) { 2479 if (mViewManager->currentView()->isEventView()) {
2480 if ( incidence && incidence->typeID() == eventID ) { 2480 if ( incidence && incidence->typeID() == eventID ) {
2481 anEvent = static_cast<Event *>(incidence); 2481 anEvent = static_cast<Event *>(incidence);
2482 } 2482 }
2483 } 2483 }
2484 2484
2485 if (!anEvent) { 2485 if (!anEvent) {
2486 KNotifyClient::beep(); 2486 KNotifyClient::beep();
2487 return; 2487 return;
2488 } 2488 }
2489 DndFactory factory( mCalendar ); 2489 DndFactory factory( mCalendar );
2490 factory.cutIncidence(anEvent); 2490 factory.cutIncidence(anEvent);
2491 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2491 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2492} 2492}
2493 2493
2494void CalendarView::edit_copy() 2494void CalendarView::edit_copy()
2495{ 2495{
2496 Event *anEvent=0; 2496 Event *anEvent=0;
2497 2497
2498 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2498 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2499 2499
2500 if (mViewManager->currentView()->isEventView()) { 2500 if (mViewManager->currentView()->isEventView()) {
2501 if ( incidence && incidence->typeID() == eventID ) { 2501 if ( incidence && incidence->typeID() == eventID ) {
2502 anEvent = static_cast<Event *>(incidence); 2502 anEvent = static_cast<Event *>(incidence);
2503 } 2503 }
2504 } 2504 }
2505 2505
2506 if (!anEvent) { 2506 if (!anEvent) {
2507 KNotifyClient::beep(); 2507 KNotifyClient::beep();
2508 return; 2508 return;
2509 } 2509 }
2510 DndFactory factory( mCalendar ); 2510 DndFactory factory( mCalendar );
2511 factory.copyIncidence(anEvent); 2511 factory.copyIncidence(anEvent);
2512} 2512}
2513 2513
2514void CalendarView::edit_paste() 2514void CalendarView::edit_paste()
2515{ 2515{
2516 QDate date = mNavigator->selectedDates().first(); 2516 QDate date = mNavigator->selectedDates().first();
2517 2517
2518 DndFactory factory( mCalendar ); 2518 DndFactory factory( mCalendar );
2519 Event *pastedEvent = (Event *)factory.pasteIncidence( date ); 2519 Event *pastedEvent = (Event *)factory.pasteIncidence( date );
2520 2520
2521 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2521 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2522} 2522}
2523 2523void CalendarView::edit_global_options()
2524void CalendarView::edit_options()
2525{ 2524{
2526 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; 2525 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId;
2527 emit save(); 2526 emit save();
2528 emit saveStopTimer(); 2527 emit saveStopTimer();
2529 mDialogManager->showOptionsDialog(); 2528 mDialogManager->showGlobalOptionsDialog();
2530 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { 2529 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
2531 emit saveStopTimer(); 2530 emit saveStopTimer();
2532 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), 2531 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"),
2533 i18n("Timezone settings"),i18n("Reload"))) { 2532 i18n("Timezone settings"),i18n("Reload"))) {
2534 qDebug("KO: TZ reload cancelled "); 2533 qDebug("KO: TZ reload cancelled ");
2535 return; 2534 return;
2536 } 2535 }
2537 qDebug("KO: Timezone change "); 2536 qDebug("KO: Timezone change ");
2538 openCalendar( MainWindow::defaultFileName() ); 2537 openCalendar( MainWindow::defaultFileName() );
2539 setModified(true); 2538 setModified(true);
2540 } 2539 }
2541 else 2540 else
2542 qDebug("KO: No tz change "); 2541 qDebug("KO: No tz change ");
2543 2542}
2543void CalendarView::edit_options()
2544{
2545 mDialogManager->showOptionsDialog();
2544} 2546}
2545 2547
2546 2548
2547void CalendarView::slotSelectPickerDate( QDate d) 2549void CalendarView::slotSelectPickerDate( QDate d)
2548{ 2550{
2549 mDateFrame->hide(); 2551 mDateFrame->hide();
2550 if ( mDatePickerMode == 1 ) { 2552 if ( mDatePickerMode == 1 ) {
2551 mNavigator->slotDaySelect( d ); 2553 mNavigator->slotDaySelect( d );
2552 } else if ( mDatePickerMode == 2 ) { 2554 } else if ( mDatePickerMode == 2 ) {
2553 if ( mMoveIncidence->typeID() == todoID ) { 2555 if ( mMoveIncidence->typeID() == todoID ) {
2554 Todo * to = (Todo *) mMoveIncidence; 2556 Todo * to = (Todo *) mMoveIncidence;
2555 QTime tim; 2557 QTime tim;
2556 int len = 0; 2558 int len = 0;
2557 if ( to->hasStartDate() && to->hasDueDate() ) 2559 if ( to->hasStartDate() && to->hasDueDate() )
2558 len = to->dtStart().secsTo( to->dtDue()); 2560 len = to->dtStart().secsTo( to->dtDue());
2559 if ( to->hasDueDate() ) 2561 if ( to->hasDueDate() )
2560 tim = to->dtDue().time(); 2562 tim = to->dtDue().time();
2561 else { 2563 else {
2562 tim = QTime ( 0,0,0 ); 2564 tim = QTime ( 0,0,0 );
2563 to->setFloats( true ); 2565 to->setFloats( true );
2564 to->setHasDueDate( true ); 2566 to->setHasDueDate( true );
2565 } 2567 }
2566 QDateTime dt ( d,tim ); 2568 QDateTime dt ( d,tim );
2567 to->setDtDue( dt ); 2569 to->setDtDue( dt );
2568 2570
2569 if ( to->hasStartDate() ) { 2571 if ( to->hasStartDate() ) {
2570 if ( len>0 ) 2572 if ( len>0 )
2571 to->setDtStart(to->dtDue().addSecs( -len )); 2573 to->setDtStart(to->dtDue().addSecs( -len ));
2572 else 2574 else
2573 if (to->dtStart() > to->dtDue() ) 2575 if (to->dtStart() > to->dtDue() )
2574 to->setDtStart(to->dtDue().addDays( -3 )); 2576 to->setDtStart(to->dtDue().addDays( -3 ));
2575 } 2577 }
2576 2578
2577 todoChanged( to ); 2579 todoChanged( to );
2578 } else { 2580 } else {
2579 if ( mMoveIncidence->doesRecur() ) { 2581 if ( mMoveIncidence->doesRecur() ) {
2580#if 0 2582#if 0
2581 // PENDING implement this 2583 // PENDING implement this
2582 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2584 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2583 mCalendar()->addIncidence( newInc ); 2585 mCalendar()->addIncidence( newInc );
2584 if ( mMoveIncidence->typeID() == todoID ) 2586 if ( mMoveIncidence->typeID() == todoID )
2585 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2587 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2586 else 2588 else
2587 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2589 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
2588 mMoveIncidence = newInc; 2590 mMoveIncidence = newInc;
2589 2591
2590#endif 2592#endif
2591 } 2593 }
2592 QTime tim = mMoveIncidence->dtStart().time(); 2594 QTime tim = mMoveIncidence->dtStart().time();
2593 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2595 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2594 QDateTime dt ( d,tim ); 2596 QDateTime dt ( d,tim );
2595 mMoveIncidence->setDtStart( dt ); 2597 mMoveIncidence->setDtStart( dt );
2596 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2598 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2597 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2599 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2598 } 2600 }
2599 2601
2600 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2602 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2601 } 2603 }
2602} 2604}
2603 2605
2604void CalendarView::removeCategories() 2606void CalendarView::removeCategories()
2605{ 2607{
2606 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2608 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2607 QStringList catList = KOPrefs::instance()->mCustomCategories; 2609 QStringList catList = KOPrefs::instance()->mCustomCategories;
2608 QStringList catIncList; 2610 QStringList catIncList;
2609 QStringList newCatList; 2611 QStringList newCatList;
2610 Incidence* inc = incList.first(); 2612 Incidence* inc = incList.first();
2611 int i; 2613 int i;
2612 int count = 0; 2614 int count = 0;
2613 while ( inc ) { 2615 while ( inc ) {
2614 newCatList.clear(); 2616 newCatList.clear();
2615 catIncList = inc->categories() ; 2617 catIncList = inc->categories() ;
2616 for( i = 0; i< catIncList.count(); ++i ) { 2618 for( i = 0; i< catIncList.count(); ++i ) {
2617 if ( catList.contains (catIncList[i])) 2619 if ( catList.contains (catIncList[i]))
2618 newCatList.append( catIncList[i] ); 2620 newCatList.append( catIncList[i] );
2619 } 2621 }
2620 newCatList.sort(); 2622 newCatList.sort();
2621 inc->setCategories( newCatList.join(",") ); 2623 inc->setCategories( newCatList.join(",") );
2622 inc = incList.next(); 2624 inc = incList.next();
2623 } 2625 }
2624} 2626}
2625 2627
2626int CalendarView::addCategories() 2628int CalendarView::addCategories()
2627{ 2629{
2628 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2630 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2629 QStringList catList = KOPrefs::instance()->mCustomCategories; 2631 QStringList catList = KOPrefs::instance()->mCustomCategories;
2630 QStringList catIncList; 2632 QStringList catIncList;
2631 Incidence* inc = incList.first(); 2633 Incidence* inc = incList.first();
2632 int i; 2634 int i;
2633 int count = 0; 2635 int count = 0;
2634 while ( inc ) { 2636 while ( inc ) {
2635 catIncList = inc->categories() ; 2637 catIncList = inc->categories() ;
2636 for( i = 0; i< catIncList.count(); ++i ) { 2638 for( i = 0; i< catIncList.count(); ++i ) {
2637 if ( !catList.contains (catIncList[i])) { 2639 if ( !catList.contains (catIncList[i])) {
2638 catList.append( catIncList[i] ); 2640 catList.append( catIncList[i] );
2639 //qDebug("add cat %s ", catIncList[i].latin1()); 2641 //qDebug("add cat %s ", catIncList[i].latin1());