author | zautrix <zautrix> | 2005-07-30 16:36:00 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-30 16:36:00 (UTC) |
commit | bd2ab556e1a5066524d797856e6a13358155e24b (patch) (unidiff) | |
tree | 334d20a72ff2912d1a49d04671aa73bb424ca539 | |
parent | 6a32c95e5f0a36cd9a681a3f3302bec6e83acce5 (diff) | |
download | kdepimpi-bd2ab556e1a5066524d797856e6a13358155e24b.zip kdepimpi-bd2ab556e1a5066524d797856e6a13358155e24b.tar.gz kdepimpi-bd2ab556e1a5066524d797856e6a13358155e24b.tar.bz2 |
bugfix
-rw-r--r-- | korganizer/calendarview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 28649d9..a1b1d71 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2373,2049 +2373,2049 @@ void CalendarView::readSettings() | |||
2373 | globalFlagBlockAgenda = 1; | 2373 | globalFlagBlockAgenda = 1; |
2374 | mViewManager->showAgendaView(); | 2374 | mViewManager->showAgendaView(); |
2375 | //mViewManager->readSettings( config ); | 2375 | //mViewManager->readSettings( config ); |
2376 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 2376 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
2377 | readFilterSettings(config); | 2377 | readFilterSettings(config); |
2378 | 2378 | ||
2379 | #ifdef DESKTOP_VERSION | 2379 | #ifdef DESKTOP_VERSION |
2380 | config->setGroup("WidgetLayout"); | 2380 | config->setGroup("WidgetLayout"); |
2381 | QStringList list; | 2381 | QStringList list; |
2382 | list = config->readListEntry("MainLayout"); | 2382 | list = config->readListEntry("MainLayout"); |
2383 | int x,y,w,h; | 2383 | int x,y,w,h; |
2384 | if ( ! list.isEmpty() ) { | 2384 | if ( ! list.isEmpty() ) { |
2385 | x = list[0].toInt(); | 2385 | x = list[0].toInt(); |
2386 | y = list[1].toInt(); | 2386 | y = list[1].toInt(); |
2387 | w = list[2].toInt(); | 2387 | w = list[2].toInt(); |
2388 | h = list[3].toInt(); | 2388 | h = list[3].toInt(); |
2389 | KApplication::testCoords( &x,&y,&w,&h ); | 2389 | KApplication::testCoords( &x,&y,&w,&h ); |
2390 | topLevelWidget()->setGeometry(x,y,w,h); | 2390 | topLevelWidget()->setGeometry(x,y,w,h); |
2391 | 2391 | ||
2392 | } else { | 2392 | } else { |
2393 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 2393 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
2394 | } | 2394 | } |
2395 | list = config->readListEntry("EditEventLayout"); | 2395 | list = config->readListEntry("EditEventLayout"); |
2396 | if ( ! list.isEmpty() ) { | 2396 | if ( ! list.isEmpty() ) { |
2397 | x = list[0].toInt(); | 2397 | x = list[0].toInt(); |
2398 | y = list[1].toInt(); | 2398 | y = list[1].toInt(); |
2399 | w = list[2].toInt(); | 2399 | w = list[2].toInt(); |
2400 | h = list[3].toInt(); | 2400 | h = list[3].toInt(); |
2401 | KApplication::testCoords( &x,&y,&w,&h ); | 2401 | KApplication::testCoords( &x,&y,&w,&h ); |
2402 | mEventEditor->setGeometry(x,y,w,h); | 2402 | mEventEditor->setGeometry(x,y,w,h); |
2403 | 2403 | ||
2404 | } | 2404 | } |
2405 | list = config->readListEntry("EditTodoLayout"); | 2405 | list = config->readListEntry("EditTodoLayout"); |
2406 | if ( ! list.isEmpty() ) { | 2406 | if ( ! list.isEmpty() ) { |
2407 | x = list[0].toInt(); | 2407 | x = list[0].toInt(); |
2408 | y = list[1].toInt(); | 2408 | y = list[1].toInt(); |
2409 | w = list[2].toInt(); | 2409 | w = list[2].toInt(); |
2410 | h = list[3].toInt(); | 2410 | h = list[3].toInt(); |
2411 | KApplication::testCoords( &x,&y,&w,&h ); | 2411 | KApplication::testCoords( &x,&y,&w,&h ); |
2412 | mTodoEditor->setGeometry(x,y,w,h); | 2412 | mTodoEditor->setGeometry(x,y,w,h); |
2413 | 2413 | ||
2414 | } | 2414 | } |
2415 | list = config->readListEntry("ViewerLayout"); | 2415 | list = config->readListEntry("ViewerLayout"); |
2416 | if ( ! list.isEmpty() ) { | 2416 | if ( ! list.isEmpty() ) { |
2417 | x = list[0].toInt(); | 2417 | x = list[0].toInt(); |
2418 | y = list[1].toInt(); | 2418 | y = list[1].toInt(); |
2419 | w = list[2].toInt(); | 2419 | w = list[2].toInt(); |
2420 | h = list[3].toInt(); | 2420 | h = list[3].toInt(); |
2421 | KApplication::testCoords( &x,&y,&w,&h ); | 2421 | KApplication::testCoords( &x,&y,&w,&h ); |
2422 | getEventViewerDialog()->setGeometry(x,y,w,h); | 2422 | getEventViewerDialog()->setGeometry(x,y,w,h); |
2423 | } | 2423 | } |
2424 | #endif | 2424 | #endif |
2425 | config->setGroup( "Views" ); | 2425 | config->setGroup( "Views" ); |
2426 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 2426 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
2427 | 2427 | ||
2428 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | 2428 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); |
2429 | 2429 | ||
2430 | int resetval = 0; | 2430 | int resetval = 0; |
2431 | int maxVal = 0; | 2431 | int maxVal = 0; |
2432 | if (sizes.count() != 3) { | 2432 | if (sizes.count() != 3) { |
2433 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2433 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2434 | resetval = mDateNavigator->sizeHint().width()+2; | 2434 | resetval = mDateNavigator->sizeHint().width()+2; |
2435 | } else { | 2435 | } else { |
2436 | resetval = mDateNavigator->sizeHint().height()+2; | 2436 | resetval = mDateNavigator->sizeHint().height()+2; |
2437 | } | 2437 | } |
2438 | } | 2438 | } |
2439 | if ( resetval ) { | 2439 | if ( resetval ) { |
2440 | sizes.clear(); | 2440 | sizes.clear(); |
2441 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2441 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2442 | maxVal = QApplication::desktop()->width() -10; | 2442 | maxVal = QApplication::desktop()->width() -10; |
2443 | } else { | 2443 | } else { |
2444 | maxVal = QApplication::desktop()->height()-10; | 2444 | maxVal = QApplication::desktop()->height()-10; |
2445 | } | 2445 | } |
2446 | sizes << resetval; | 2446 | sizes << resetval; |
2447 | if ( maxVal < resetval + resetval) | 2447 | if ( maxVal < resetval + resetval) |
2448 | resetval = maxVal - resetval; | 2448 | resetval = maxVal - resetval; |
2449 | sizes << resetval; | 2449 | sizes << resetval; |
2450 | sizes << 100; | 2450 | sizes << 100; |
2451 | } | 2451 | } |
2452 | mLeftFrame->setSizes(sizes); | 2452 | mLeftFrame->setSizes(sizes); |
2453 | sizes = config->readIntListEntry("Main Splitter Frame"); | 2453 | sizes = config->readIntListEntry("Main Splitter Frame"); |
2454 | resetval = 0; | 2454 | resetval = 0; |
2455 | maxVal = 0; | 2455 | maxVal = 0; |
2456 | if (sizes.count() != 2) { | 2456 | if (sizes.count() != 2) { |
2457 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2457 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2458 | resetval = mDateNavigator->sizeHint().width()+2; | 2458 | resetval = mDateNavigator->sizeHint().width()+2; |
2459 | } else { | 2459 | } else { |
2460 | resetval = mDateNavigator->sizeHint().height()+2; | 2460 | resetval = mDateNavigator->sizeHint().height()+2; |
2461 | } | 2461 | } |
2462 | } | 2462 | } |
2463 | if ( resetval ) { | 2463 | if ( resetval ) { |
2464 | sizes.clear(); | 2464 | sizes.clear(); |
2465 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2465 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2466 | maxVal = QApplication::desktop()->width() -10; | 2466 | maxVal = QApplication::desktop()->width() -10; |
2467 | } else { | 2467 | } else { |
2468 | maxVal = QApplication::desktop()->height()-10; | 2468 | maxVal = QApplication::desktop()->height()-10; |
2469 | } | 2469 | } |
2470 | sizes << resetval; | 2470 | sizes << resetval; |
2471 | if ( maxVal < resetval + resetval) | 2471 | if ( maxVal < resetval + resetval) |
2472 | resetval = maxVal - resetval; | 2472 | resetval = maxVal - resetval; |
2473 | sizes << resetval; | 2473 | sizes << resetval; |
2474 | } | 2474 | } |
2475 | mMainFrame->setSizes(sizes); | 2475 | mMainFrame->setSizes(sizes); |
2476 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 2476 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
2477 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 2477 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
2478 | else mNavigator->selectDates( dateCount ); | 2478 | else mNavigator->selectDates( dateCount ); |
2479 | // mViewManager->readSettings( config ); | 2479 | // mViewManager->readSettings( config ); |
2480 | updateConfig(); | 2480 | updateConfig(); |
2481 | globalFlagBlockAgenda = 2; | 2481 | globalFlagBlockAgenda = 2; |
2482 | mViewManager->readSettings( config ); | 2482 | mViewManager->readSettings( config ); |
2483 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); | 2483 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); |
2484 | } | 2484 | } |
2485 | 2485 | ||
2486 | void CalendarView::checkSuspendAlarm() | 2486 | void CalendarView::checkSuspendAlarm() |
2487 | { | 2487 | { |
2488 | if ( mSuspendTimer->isActive() ) { | 2488 | if ( mSuspendTimer->isActive() ) { |
2489 | KMessageBox::information( this, i18n("<b>WARNING:</b> There is a pending suspended alarm!"), i18n("Pending Suspend Alarm")); | 2489 | KMessageBox::information( this, i18n("<b>WARNING:</b> There is a pending suspended alarm!"), i18n("Pending Suspend Alarm")); |
2490 | } | 2490 | } |
2491 | } | 2491 | } |
2492 | void CalendarView::writeSettings() | 2492 | void CalendarView::writeSettings() |
2493 | { | 2493 | { |
2494 | // kdDebug() << "CalendarView::writeSettings" << endl; | 2494 | // kdDebug() << "CalendarView::writeSettings" << endl; |
2495 | 2495 | ||
2496 | KConfig *config = KOGlobals::config(); | 2496 | KConfig *config = KOGlobals::config(); |
2497 | 2497 | ||
2498 | mViewManager->writeSettings( config ); | 2498 | mViewManager->writeSettings( config ); |
2499 | mTodoList->saveLayout(config,QString("Todo Layout")); | 2499 | mTodoList->saveLayout(config,QString("Todo Layout")); |
2500 | mDialogManager->writeSettings( config ); | 2500 | mDialogManager->writeSettings( config ); |
2501 | //KOPrefs::instance()->usrWriteConfig(); | 2501 | //KOPrefs::instance()->usrWriteConfig(); |
2502 | KOPrefs::instance()->writeConfig(); | 2502 | KOPrefs::instance()->writeConfig(); |
2503 | 2503 | ||
2504 | writeFilterSettings(config); | 2504 | writeFilterSettings(config); |
2505 | config->setGroup( "AppRun" ); | 2505 | config->setGroup( "AppRun" ); |
2506 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 2506 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
2507 | int days = dt.daysTo( QDate::currentDate() ); | 2507 | int days = dt.daysTo( QDate::currentDate() ); |
2508 | dt = dt.addDays( days ); | 2508 | dt = dt.addDays( days ); |
2509 | int secs = dt.secsTo( QDateTime::currentDateTime() ); | 2509 | int secs = dt.secsTo( QDateTime::currentDateTime() ); |
2510 | config->writeEntry( "LatestProgramStopDays", days ); | 2510 | config->writeEntry( "LatestProgramStopDays", days ); |
2511 | config->writeEntry( "LatestProgramStopSecs", secs ); | 2511 | config->writeEntry( "LatestProgramStopSecs", secs ); |
2512 | //qDebug("KO: Writing stop time: %d ", secs); | 2512 | //qDebug("KO: Writing stop time: %d ", secs); |
2513 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 2513 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
2514 | //QDateTime latest = dt.addSecs ( secs ); | 2514 | //QDateTime latest = dt.addSecs ( secs ); |
2515 | //qDebug("KO: Termination on %s ", latest.toString().latin1()); | 2515 | //qDebug("KO: Termination on %s ", latest.toString().latin1()); |
2516 | config->setGroup( "Views" ); | 2516 | config->setGroup( "Views" ); |
2517 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 2517 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
2518 | 2518 | ||
2519 | #if 0 | 2519 | #if 0 |
2520 | qDebug("********************* "); | 2520 | qDebug("********************* "); |
2521 | qDebug("Testcode secsto "); | 2521 | qDebug("Testcode secsto "); |
2522 | QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); | 2522 | QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); |
2523 | QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); | 2523 | QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); |
2524 | int secsto = dt_nodaylight.secsTo( dt_daylight ); | 2524 | int secsto = dt_nodaylight.secsTo( dt_daylight ); |
2525 | QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); | 2525 | QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); |
2526 | qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); | 2526 | qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); |
2527 | qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); | 2527 | qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); |
2528 | qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); | 2528 | qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); |
2529 | qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); | 2529 | qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); |
2530 | qDebug("********************* testcode end"); | 2530 | qDebug("********************* testcode end"); |
2531 | 2531 | ||
2532 | #endif | 2532 | #endif |
2533 | 2533 | ||
2534 | QValueList<int> listINT = mLeftFrame->sizes(); | 2534 | QValueList<int> listINT = mLeftFrame->sizes(); |
2535 | config->writeEntry("Left Splitter Frame",listINT); | 2535 | config->writeEntry("Left Splitter Frame",listINT); |
2536 | QValueList<int> listINT2 = mMainFrame->sizes(); | 2536 | QValueList<int> listINT2 = mMainFrame->sizes(); |
2537 | config->writeEntry("Main Splitter Frame",listINT2); | 2537 | config->writeEntry("Main Splitter Frame",listINT2); |
2538 | #ifdef DESKTOP_VERSION | 2538 | #ifdef DESKTOP_VERSION |
2539 | config->setGroup("WidgetLayout"); | 2539 | config->setGroup("WidgetLayout"); |
2540 | QStringList list ;//= config->readListEntry("MainLayout"); | 2540 | QStringList list ;//= config->readListEntry("MainLayout"); |
2541 | int x,y,w,h; | 2541 | int x,y,w,h; |
2542 | QWidget* wid; | 2542 | QWidget* wid; |
2543 | wid = topLevelWidget(); | 2543 | wid = topLevelWidget(); |
2544 | x = wid->geometry().x(); | 2544 | x = wid->geometry().x(); |
2545 | y = wid->geometry().y(); | 2545 | y = wid->geometry().y(); |
2546 | w = wid->width(); | 2546 | w = wid->width(); |
2547 | h = wid->height(); | 2547 | h = wid->height(); |
2548 | list.clear(); | 2548 | list.clear(); |
2549 | list << QString::number( x ); | 2549 | list << QString::number( x ); |
2550 | list << QString::number( y ); | 2550 | list << QString::number( y ); |
2551 | list << QString::number( w ); | 2551 | list << QString::number( w ); |
2552 | list << QString::number( h ); | 2552 | list << QString::number( h ); |
2553 | config->writeEntry("MainLayout",list ); | 2553 | config->writeEntry("MainLayout",list ); |
2554 | 2554 | ||
2555 | wid = mEventEditor; | 2555 | wid = mEventEditor; |
2556 | x = wid->geometry().x(); | 2556 | x = wid->geometry().x(); |
2557 | y = wid->geometry().y(); | 2557 | y = wid->geometry().y(); |
2558 | w = wid->width(); | 2558 | w = wid->width(); |
2559 | h = wid->height(); | 2559 | h = wid->height(); |
2560 | list.clear(); | 2560 | list.clear(); |
2561 | list << QString::number( x ); | 2561 | list << QString::number( x ); |
2562 | list << QString::number( y ); | 2562 | list << QString::number( y ); |
2563 | list << QString::number( w ); | 2563 | list << QString::number( w ); |
2564 | list << QString::number( h ); | 2564 | list << QString::number( h ); |
2565 | config->writeEntry("EditEventLayout",list ); | 2565 | config->writeEntry("EditEventLayout",list ); |
2566 | 2566 | ||
2567 | wid = mTodoEditor; | 2567 | wid = mTodoEditor; |
2568 | x = wid->geometry().x(); | 2568 | x = wid->geometry().x(); |
2569 | y = wid->geometry().y(); | 2569 | y = wid->geometry().y(); |
2570 | w = wid->width(); | 2570 | w = wid->width(); |
2571 | h = wid->height(); | 2571 | h = wid->height(); |
2572 | list.clear(); | 2572 | list.clear(); |
2573 | list << QString::number( x ); | 2573 | list << QString::number( x ); |
2574 | list << QString::number( y ); | 2574 | list << QString::number( y ); |
2575 | list << QString::number( w ); | 2575 | list << QString::number( w ); |
2576 | list << QString::number( h ); | 2576 | list << QString::number( h ); |
2577 | config->writeEntry("EditTodoLayout",list ); | 2577 | config->writeEntry("EditTodoLayout",list ); |
2578 | wid = getEventViewerDialog(); | 2578 | wid = getEventViewerDialog(); |
2579 | x = wid->geometry().x(); | 2579 | x = wid->geometry().x(); |
2580 | y = wid->geometry().y(); | 2580 | y = wid->geometry().y(); |
2581 | w = wid->width(); | 2581 | w = wid->width(); |
2582 | h = wid->height(); | 2582 | h = wid->height(); |
2583 | list.clear(); | 2583 | list.clear(); |
2584 | list << QString::number( x ); | 2584 | list << QString::number( x ); |
2585 | list << QString::number( y ); | 2585 | list << QString::number( y ); |
2586 | list << QString::number( w ); | 2586 | list << QString::number( w ); |
2587 | list << QString::number( h ); | 2587 | list << QString::number( h ); |
2588 | config->writeEntry("ViewerLayout",list ); | 2588 | config->writeEntry("ViewerLayout",list ); |
2589 | wid = mDialogManager->getSearchDialog(); | 2589 | wid = mDialogManager->getSearchDialog(); |
2590 | if ( wid ) { | 2590 | if ( wid ) { |
2591 | x = wid->geometry().x(); | 2591 | x = wid->geometry().x(); |
2592 | y = wid->geometry().y(); | 2592 | y = wid->geometry().y(); |
2593 | w = wid->width(); | 2593 | w = wid->width(); |
2594 | h = wid->height(); | 2594 | h = wid->height(); |
2595 | list.clear(); | 2595 | list.clear(); |
2596 | list << QString::number( x ); | 2596 | list << QString::number( x ); |
2597 | list << QString::number( y ); | 2597 | list << QString::number( y ); |
2598 | list << QString::number( w ); | 2598 | list << QString::number( w ); |
2599 | list << QString::number( h ); | 2599 | list << QString::number( h ); |
2600 | config->writeEntry("SearchLayout",list ); | 2600 | config->writeEntry("SearchLayout",list ); |
2601 | } | 2601 | } |
2602 | #endif | 2602 | #endif |
2603 | 2603 | ||
2604 | 2604 | ||
2605 | config->sync(); | 2605 | config->sync(); |
2606 | } | 2606 | } |
2607 | 2607 | ||
2608 | void CalendarView::readFilterSettings(KConfig *config) | 2608 | void CalendarView::readFilterSettings(KConfig *config) |
2609 | { | 2609 | { |
2610 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2610 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2611 | 2611 | ||
2612 | mFilters.clear(); | 2612 | mFilters.clear(); |
2613 | 2613 | ||
2614 | config->setGroup("General"); | 2614 | config->setGroup("General"); |
2615 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2615 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2616 | 2616 | ||
2617 | QStringList::ConstIterator it = filterList.begin(); | 2617 | QStringList::ConstIterator it = filterList.begin(); |
2618 | QStringList::ConstIterator end = filterList.end(); | 2618 | QStringList::ConstIterator end = filterList.end(); |
2619 | while(it != end) { | 2619 | while(it != end) { |
2620 | // kdDebug() << " filter: " << (*it) << endl; | 2620 | // kdDebug() << " filter: " << (*it) << endl; |
2621 | 2621 | ||
2622 | CalFilter *filter; | 2622 | CalFilter *filter; |
2623 | filter = new CalFilter(*it); | 2623 | filter = new CalFilter(*it); |
2624 | config->setGroup("Filter_" + (*it).utf8()); | 2624 | config->setGroup("Filter_" + (*it).utf8()); |
2625 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2625 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2626 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2626 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2627 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2627 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2628 | mFilters.append(filter); | 2628 | mFilters.append(filter); |
2629 | 2629 | ||
2630 | ++it; | 2630 | ++it; |
2631 | } | 2631 | } |
2632 | 2632 | ||
2633 | if (mFilters.count() == 0) { | 2633 | if (mFilters.count() == 0) { |
2634 | CalFilter *filter = new CalFilter(i18n("Default")); | 2634 | CalFilter *filter = new CalFilter(i18n("Default")); |
2635 | mFilters.append(filter); | 2635 | mFilters.append(filter); |
2636 | } | 2636 | } |
2637 | mFilterView->updateFilters(); | 2637 | mFilterView->updateFilters(); |
2638 | config->setGroup("FilterView"); | 2638 | config->setGroup("FilterView"); |
2639 | 2639 | ||
2640 | mFilterView->blockSignals(true); | 2640 | mFilterView->blockSignals(true); |
2641 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2641 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2642 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2642 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2643 | mFilterView->blockSignals(false); | 2643 | mFilterView->blockSignals(false); |
2644 | // We do it manually to avoid it being done twice by the above calls | 2644 | // We do it manually to avoid it being done twice by the above calls |
2645 | updateFilter(); | 2645 | updateFilter(); |
2646 | } | 2646 | } |
2647 | 2647 | ||
2648 | void CalendarView::writeFilterSettings(KConfig *config) | 2648 | void CalendarView::writeFilterSettings(KConfig *config) |
2649 | { | 2649 | { |
2650 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2650 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2651 | 2651 | ||
2652 | QStringList filterList; | 2652 | QStringList filterList; |
2653 | 2653 | ||
2654 | CalFilter *filter = mFilters.first(); | 2654 | CalFilter *filter = mFilters.first(); |
2655 | while(filter) { | 2655 | while(filter) { |
2656 | // kdDebug() << " fn: " << filter->name() << endl; | 2656 | // kdDebug() << " fn: " << filter->name() << endl; |
2657 | filterList << filter->name(); | 2657 | filterList << filter->name(); |
2658 | config->setGroup("Filter_" + filter->name().utf8()); | 2658 | config->setGroup("Filter_" + filter->name().utf8()); |
2659 | config->writeEntry("Criteria",filter->criteria()); | 2659 | config->writeEntry("Criteria",filter->criteria()); |
2660 | config->writeEntry("CategoryList",filter->categoryList()); | 2660 | config->writeEntry("CategoryList",filter->categoryList()); |
2661 | filter = mFilters.next(); | 2661 | filter = mFilters.next(); |
2662 | } | 2662 | } |
2663 | config->setGroup("General"); | 2663 | config->setGroup("General"); |
2664 | config->writeEntry("CalendarFilters",filterList); | 2664 | config->writeEntry("CalendarFilters",filterList); |
2665 | 2665 | ||
2666 | config->setGroup("FilterView"); | 2666 | config->setGroup("FilterView"); |
2667 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2667 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2668 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2668 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2669 | } | 2669 | } |
2670 | 2670 | ||
2671 | 2671 | ||
2672 | void CalendarView::goToday() | 2672 | void CalendarView::goToday() |
2673 | { | 2673 | { |
2674 | if ( mViewManager->currentView()->isMonthView() ) | 2674 | if ( mViewManager->currentView()->isMonthView() ) |
2675 | mNavigator->selectTodayMonth(); | 2675 | mNavigator->selectTodayMonth(); |
2676 | else | 2676 | else |
2677 | mNavigator->selectToday(); | 2677 | mNavigator->selectToday(); |
2678 | } | 2678 | } |
2679 | 2679 | ||
2680 | void CalendarView::goNext() | 2680 | void CalendarView::goNext() |
2681 | { | 2681 | { |
2682 | mNavigator->selectNext(); | 2682 | mNavigator->selectNext(); |
2683 | } | 2683 | } |
2684 | 2684 | ||
2685 | void CalendarView::goPrevious() | 2685 | void CalendarView::goPrevious() |
2686 | { | 2686 | { |
2687 | mNavigator->selectPrevious(); | 2687 | mNavigator->selectPrevious(); |
2688 | } | 2688 | } |
2689 | void CalendarView::goNextMonth() | 2689 | void CalendarView::goNextMonth() |
2690 | { | 2690 | { |
2691 | mNavigator->selectNextMonth(); | 2691 | mNavigator->selectNextMonth(); |
2692 | } | 2692 | } |
2693 | 2693 | ||
2694 | void CalendarView::goPreviousMonth() | 2694 | void CalendarView::goPreviousMonth() |
2695 | { | 2695 | { |
2696 | mNavigator->selectPreviousMonth(); | 2696 | mNavigator->selectPreviousMonth(); |
2697 | } | 2697 | } |
2698 | 2698 | ||
2699 | void CalendarView::updateConfig() | 2699 | void CalendarView::updateConfig() |
2700 | { | 2700 | { |
2701 | if ( KOPrefs::instance()->mUseAppColors ) | 2701 | if ( KOPrefs::instance()->mUseAppColors ) |
2702 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2702 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2703 | emit configChanged(); | 2703 | emit configChanged(); |
2704 | mTodoList->updateConfig(); | 2704 | mTodoList->updateConfig(); |
2705 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2705 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2706 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2706 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2707 | // To make the "fill window" configurations work | 2707 | // To make the "fill window" configurations work |
2708 | //mViewManager->raiseCurrentView(); | 2708 | //mViewManager->raiseCurrentView(); |
2709 | } | 2709 | } |
2710 | 2710 | ||
2711 | 2711 | ||
2712 | void CalendarView::eventChanged(Event *event) | 2712 | void CalendarView::eventChanged(Event *event) |
2713 | { | 2713 | { |
2714 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2714 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2715 | //updateUnmanagedViews(); | 2715 | //updateUnmanagedViews(); |
2716 | } | 2716 | } |
2717 | 2717 | ||
2718 | void CalendarView::eventAdded(Event *event) | 2718 | void CalendarView::eventAdded(Event *event) |
2719 | { | 2719 | { |
2720 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2720 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2721 | } | 2721 | } |
2722 | 2722 | ||
2723 | void CalendarView::eventToBeDeleted(Event *) | 2723 | void CalendarView::eventToBeDeleted(Event *) |
2724 | { | 2724 | { |
2725 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2725 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2726 | } | 2726 | } |
2727 | 2727 | ||
2728 | void CalendarView::eventDeleted() | 2728 | void CalendarView::eventDeleted() |
2729 | { | 2729 | { |
2730 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2730 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2731 | } | 2731 | } |
2732 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2732 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2733 | { | 2733 | { |
2734 | changeIncidenceDisplay((Incidence *)which, action); | 2734 | changeIncidenceDisplay((Incidence *)which, action); |
2735 | mDateNavigator->updateView(); //LR | 2735 | mDateNavigator->updateView(); //LR |
2736 | //mDialogManager->updateSearchDialog(); | 2736 | //mDialogManager->updateSearchDialog(); |
2737 | 2737 | ||
2738 | if (which) { | 2738 | if (which) { |
2739 | mViewManager->updateWNview(); | 2739 | mViewManager->updateWNview(); |
2740 | //mTodoList->updateView(); | 2740 | //mTodoList->updateView(); |
2741 | } | 2741 | } |
2742 | 2742 | ||
2743 | } | 2743 | } |
2744 | 2744 | ||
2745 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2745 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2746 | { | 2746 | { |
2747 | updateUnmanagedViews(); | 2747 | updateUnmanagedViews(); |
2748 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2748 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2749 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2749 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2750 | mCalendar->checkAlarmForIncidence( 0, true ); | 2750 | mCalendar->checkAlarmForIncidence( 0, true ); |
2751 | if ( mEventViewerDialog ) | 2751 | if ( mEventViewerDialog ) |
2752 | mEventViewerDialog->hide(); | 2752 | mEventViewerDialog->hide(); |
2753 | } | 2753 | } |
2754 | else | 2754 | else |
2755 | mCalendar->checkAlarmForIncidence( which , false ); | 2755 | mCalendar->checkAlarmForIncidence( which , false ); |
2756 | } | 2756 | } |
2757 | 2757 | ||
2758 | // most of the changeEventDisplays() right now just call the view's | 2758 | // most of the changeEventDisplays() right now just call the view's |
2759 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2759 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2760 | void CalendarView::changeEventDisplay(Event *which, int action) | 2760 | void CalendarView::changeEventDisplay(Event *which, int action) |
2761 | { | 2761 | { |
2762 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2762 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2763 | changeIncidenceDisplay((Incidence *)which, action); | 2763 | changeIncidenceDisplay((Incidence *)which, action); |
2764 | static bool clearallviews = false; | 2764 | static bool clearallviews = false; |
2765 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 2765 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
2766 | if ( clearallviews ) { | 2766 | if ( clearallviews ) { |
2767 | clearAllViews(); | 2767 | clearAllViews(); |
2768 | clearallviews = false; | 2768 | clearallviews = false; |
2769 | } | 2769 | } |
2770 | return; | 2770 | return; |
2771 | } | 2771 | } |
2772 | clearallviews = true; | 2772 | clearallviews = true; |
2773 | mDateNavigator->updateView(); | 2773 | mDateNavigator->updateView(); |
2774 | //mDialogManager->updateSearchDialog(); | 2774 | //mDialogManager->updateSearchDialog(); |
2775 | if (which) { | 2775 | if (which) { |
2776 | // If there is an event view visible update the display | 2776 | // If there is an event view visible update the display |
2777 | mViewManager->currentView()->changeEventDisplay(which,action); | 2777 | mViewManager->currentView()->changeEventDisplay(which,action); |
2778 | // TODO: check, if update needed | 2778 | // TODO: check, if update needed |
2779 | // if (which->getTodoStatus()) { | 2779 | // if (which->getTodoStatus()) { |
2780 | mTodoList->updateView(); | 2780 | mTodoList->updateView(); |
2781 | if ( action != KOGlobals::EVENTDELETED ) { | 2781 | if ( action != KOGlobals::EVENTDELETED ) { |
2782 | mConflictingEvent = which ; | 2782 | mConflictingEvent = which ; |
2783 | int time = 1000; | 2783 | int time = 1000; |
2784 | #ifdef DESKTOP_VERSION | 2784 | #ifdef DESKTOP_VERSION |
2785 | time = 500; | 2785 | time = 500; |
2786 | #endif | 2786 | #endif |
2787 | QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); | 2787 | QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); |
2788 | } | 2788 | } |
2789 | // } | 2789 | // } |
2790 | } else { | 2790 | } else { |
2791 | mViewManager->currentView()->updateView(); | 2791 | mViewManager->currentView()->updateView(); |
2792 | } | 2792 | } |
2793 | } | 2793 | } |
2794 | void CalendarView::checkConflictForEvent() | 2794 | void CalendarView::checkConflictForEvent() |
2795 | { | 2795 | { |
2796 | 2796 | ||
2797 | if (!KOPrefs::instance()->mConfirm) | 2797 | if (!KOPrefs::instance()->mConfirm) |
2798 | return; | 2798 | return; |
2799 | if ( ! mConflictingEvent ) return; | 2799 | if ( ! mConflictingEvent ) return; |
2800 | Event * conflictingEvent = mConflictingEvent; | 2800 | Event * conflictingEvent = mConflictingEvent; |
2801 | mConflictingEvent = 0; | 2801 | mConflictingEvent = 0; |
2802 | QDateTime current = QDateTime::currentDateTime(); | 2802 | QDateTime current = QDateTime::currentDateTime(); |
2803 | if ( ! conflictingEvent->matchTime( ¤t, 0 ) ) { | 2803 | if ( ! conflictingEvent->matchTime( ¤t, 0 ) ) { |
2804 | return; | 2804 | return; |
2805 | } | 2805 | } |
2806 | QPtrList<Event> testlist = mCalendar->events(); | 2806 | QPtrList<Event> testlist = mCalendar->events(); |
2807 | Event * test = testlist.first(); | 2807 | Event * test = testlist.first(); |
2808 | QDateTime conflict; | 2808 | QDateTime conflict; |
2809 | QDateTime retVal; | 2809 | QDateTime retVal; |
2810 | bool found = false; | 2810 | bool found = false; |
2811 | Event * cE = 0; | 2811 | Event * cE = 0; |
2812 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); | 2812 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); |
2813 | while ( test ) { | 2813 | while ( test ) { |
2814 | qApp->processEvents(); | 2814 | qApp->processEvents(); |
2815 | bool skip = false; | 2815 | bool skip = false; |
2816 | if ( found ) | 2816 | if ( found ) |
2817 | skip = !test->matchTime( ¤t, &conflict ); | 2817 | skip = !test->matchTime( ¤t, &conflict ); |
2818 | else | 2818 | else |
2819 | skip = !test->matchTime( ¤t, 0 ); | 2819 | skip = !test->matchTime( ¤t, 0 ); |
2820 | if ( !skip && !test->doesFloat() ) { | 2820 | if ( !skip && !test->doesFloat() ) { |
2821 | if ( conflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { | 2821 | if ( conflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { |
2822 | if ( ! found ) { | 2822 | if ( ! found ) { |
2823 | conflict = retVal; | 2823 | conflict = retVal; |
2824 | cE = test; | 2824 | cE = test; |
2825 | } else { | 2825 | } else { |
2826 | if ( retVal < conflict ) { | 2826 | if ( retVal < conflict ) { |
2827 | conflict = retVal; | 2827 | conflict = retVal; |
2828 | cE = test; | 2828 | cE = test; |
2829 | } | 2829 | } |
2830 | } | 2830 | } |
2831 | found = true; | 2831 | found = true; |
2832 | } | 2832 | } |
2833 | } | 2833 | } |
2834 | test = testlist.next(); | 2834 | test = testlist.next(); |
2835 | } | 2835 | } |
2836 | topLevelWidget()->setCaption( i18n("KO/Pi") ); | 2836 | topLevelWidget()->setCaption( i18n("KO/Pi") ); |
2837 | if ( found ) { | 2837 | if ( found ) { |
2838 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( conflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; | 2838 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( conflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; |
2839 | qApp->processEvents(); | 2839 | qApp->processEvents(); |
2840 | int km = KMessageBox::warningContinueCancel(this,mess, | 2840 | int km = KMessageBox::warningContinueCancel(this,mess, |
2841 | i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); | 2841 | i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); |
2842 | if ( km != KMessageBox::Continue ) { | 2842 | if ( km != KMessageBox::Continue ) { |
2843 | return; | 2843 | return; |
2844 | } | 2844 | } |
2845 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 2845 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
2846 | mViewManager->showDayView(); | 2846 | mViewManager->showDayView(); |
2847 | mNavigator->slotDaySelect( conflict.date() ); | 2847 | mNavigator->slotDaySelect( conflict.date() ); |
2848 | int hour = conflict.time().hour(); | 2848 | int hour = conflict.time().hour(); |
2849 | mViewManager->agendaView()->setStartHour( hour ); | 2849 | mViewManager->agendaView()->setStartHour( hour ); |
2850 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( conflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); | 2850 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( conflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); |
2851 | } else | 2851 | } else |
2852 | topLevelWidget()->setCaption( i18n("No conflict found") ); | 2852 | topLevelWidget()->setCaption( i18n("No conflict found") ); |
2853 | return; | 2853 | return; |
2854 | 2854 | ||
2855 | } | 2855 | } |
2856 | 2856 | ||
2857 | void CalendarView::updateTodoViews() | 2857 | void CalendarView::updateTodoViews() |
2858 | { | 2858 | { |
2859 | mTodoList->updateView(); | 2859 | mTodoList->updateView(); |
2860 | mViewManager->currentView()->updateView(); | 2860 | mViewManager->currentView()->updateView(); |
2861 | 2861 | ||
2862 | } | 2862 | } |
2863 | 2863 | ||
2864 | 2864 | ||
2865 | 2865 | ||
2866 | void CalendarView::clearAllViews() | 2866 | void CalendarView::clearAllViews() |
2867 | { | 2867 | { |
2868 | mTodoList->clearList(); | 2868 | mTodoList->clearList(); |
2869 | mViewManager->clearAllViews(); | 2869 | mViewManager->clearAllViews(); |
2870 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 2870 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
2871 | if ( sd ) { | 2871 | if ( sd ) { |
2872 | KOListView* kol = sd->listview(); | 2872 | KOListView* kol = sd->listview(); |
2873 | if ( kol ) | 2873 | if ( kol ) |
2874 | kol->clearList(); | 2874 | kol->clearList(); |
2875 | } | 2875 | } |
2876 | } | 2876 | } |
2877 | void CalendarView::updateView() | 2877 | void CalendarView::updateView() |
2878 | { | 2878 | { |
2879 | static bool clearallviews = false; | 2879 | static bool clearallviews = false; |
2880 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 2880 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
2881 | if ( clearallviews ) { | 2881 | if ( clearallviews ) { |
2882 | clearAllViews(); | 2882 | clearAllViews(); |
2883 | clearallviews = false; | 2883 | clearallviews = false; |
2884 | } | 2884 | } |
2885 | return; | 2885 | return; |
2886 | } | 2886 | } |
2887 | clearallviews = true; | 2887 | clearallviews = true; |
2888 | DateList tmpList = mNavigator->selectedDates(); | 2888 | DateList tmpList = mNavigator->selectedDates(); |
2889 | 2889 | ||
2890 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2890 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2891 | mTodoList->updateView(); | 2891 | mTodoList->updateView(); |
2892 | // We assume that the navigator only selects consecutive days. | 2892 | // We assume that the navigator only selects consecutive days. |
2893 | updateView( tmpList.first(), tmpList.last() ); | 2893 | updateView( tmpList.first(), tmpList.last() ); |
2894 | } | 2894 | } |
2895 | 2895 | ||
2896 | void CalendarView::updateUnmanagedViews() | 2896 | void CalendarView::updateUnmanagedViews() |
2897 | { | 2897 | { |
2898 | mDateNavigator->updateDayMatrix(); | 2898 | mDateNavigator->updateDayMatrix(); |
2899 | } | 2899 | } |
2900 | 2900 | ||
2901 | int CalendarView::msgItemDelete(const QString name) | 2901 | int CalendarView::msgItemDelete(const QString name) |
2902 | { | 2902 | { |
2903 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2903 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2904 | i18n("This item will be\npermanently deleted."), | 2904 | i18n("This item will be\npermanently deleted."), |
2905 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2905 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2906 | } | 2906 | } |
2907 | 2907 | ||
2908 | 2908 | ||
2909 | void CalendarView::edit_cut() | 2909 | void CalendarView::edit_cut() |
2910 | { | 2910 | { |
2911 | Event *anEvent=0; | 2911 | Event *anEvent=0; |
2912 | 2912 | ||
2913 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2913 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2914 | 2914 | ||
2915 | if (mViewManager->currentView()->isEventView()) { | 2915 | if (mViewManager->currentView()->isEventView()) { |
2916 | if ( incidence && incidence->typeID() == eventID ) { | 2916 | if ( incidence && incidence->typeID() == eventID ) { |
2917 | anEvent = static_cast<Event *>(incidence); | 2917 | anEvent = static_cast<Event *>(incidence); |
2918 | } | 2918 | } |
2919 | } | 2919 | } |
2920 | 2920 | ||
2921 | if (!anEvent) { | 2921 | if (!anEvent) { |
2922 | KNotifyClient::beep(); | 2922 | KNotifyClient::beep(); |
2923 | return; | 2923 | return; |
2924 | } | 2924 | } |
2925 | DndFactory factory( mCalendar ); | 2925 | DndFactory factory( mCalendar ); |
2926 | factory.cutIncidence(anEvent); | 2926 | factory.cutIncidence(anEvent); |
2927 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2927 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2928 | } | 2928 | } |
2929 | 2929 | ||
2930 | void CalendarView::edit_copy() | 2930 | void CalendarView::edit_copy() |
2931 | { | 2931 | { |
2932 | Event *anEvent=0; | 2932 | Event *anEvent=0; |
2933 | 2933 | ||
2934 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2934 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2935 | 2935 | ||
2936 | if (mViewManager->currentView()->isEventView()) { | 2936 | if (mViewManager->currentView()->isEventView()) { |
2937 | if ( incidence && incidence->typeID() == eventID ) { | 2937 | if ( incidence && incidence->typeID() == eventID ) { |
2938 | anEvent = static_cast<Event *>(incidence); | 2938 | anEvent = static_cast<Event *>(incidence); |
2939 | } | 2939 | } |
2940 | } | 2940 | } |
2941 | 2941 | ||
2942 | if (!anEvent) { | 2942 | if (!anEvent) { |
2943 | KNotifyClient::beep(); | 2943 | KNotifyClient::beep(); |
2944 | return; | 2944 | return; |
2945 | } | 2945 | } |
2946 | DndFactory factory( mCalendar ); | 2946 | DndFactory factory( mCalendar ); |
2947 | factory.copyIncidence(anEvent); | 2947 | factory.copyIncidence(anEvent); |
2948 | } | 2948 | } |
2949 | 2949 | ||
2950 | void CalendarView::edit_paste() | 2950 | void CalendarView::edit_paste() |
2951 | { | 2951 | { |
2952 | QDate date = mNavigator->selectedDates().first(); | 2952 | QDate date = mNavigator->selectedDates().first(); |
2953 | 2953 | ||
2954 | DndFactory factory( mCalendar ); | 2954 | DndFactory factory( mCalendar ); |
2955 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2955 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2956 | 2956 | ||
2957 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2957 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2958 | } | 2958 | } |
2959 | void CalendarView::edit_global_options() | 2959 | void CalendarView::edit_global_options() |
2960 | { | 2960 | { |
2961 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | 2961 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; |
2962 | emit save(); | 2962 | emit save(); |
2963 | emit saveStopTimer(); | 2963 | emit saveStopTimer(); |
2964 | mDialogManager->showGlobalOptionsDialog(); | 2964 | mDialogManager->showGlobalOptionsDialog(); |
2965 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { | 2965 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
2966 | emit saveStopTimer(); | 2966 | emit saveStopTimer(); |
2967 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), | 2967 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), |
2968 | i18n("Timezone settings"),i18n("Reload"))) { | 2968 | i18n("Timezone settings"),i18n("Reload"))) { |
2969 | qDebug("KO: TZ reload cancelled "); | 2969 | qDebug("KO: TZ reload cancelled "); |
2970 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2970 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2971 | return; | 2971 | return; |
2972 | } | 2972 | } |
2973 | qDebug("KO: Timezone change "); | 2973 | qDebug("KO: Timezone change "); |
2974 | loadCalendars(); | 2974 | loadCalendars(); |
2975 | setModified(true); | 2975 | setModified(true); |
2976 | } | 2976 | } |
2977 | else | 2977 | else |
2978 | qDebug("KO: No tz change "); | 2978 | qDebug("KO: No tz change "); |
2979 | } | 2979 | } |
2980 | void CalendarView::edit_options() | 2980 | void CalendarView::edit_options() |
2981 | { | 2981 | { |
2982 | mDialogManager->showOptionsDialog(); | 2982 | mDialogManager->showOptionsDialog(); |
2983 | } | 2983 | } |
2984 | 2984 | ||
2985 | 2985 | ||
2986 | void CalendarView::slotSelectPickerDate( QDate d) | 2986 | void CalendarView::slotSelectPickerDate( QDate d) |
2987 | { | 2987 | { |
2988 | mDateFrame->hide(); | 2988 | mDateFrame->hide(); |
2989 | if ( mDatePickerMode == 1 ) { | 2989 | if ( mDatePickerMode == 1 ) { |
2990 | mNavigator->slotDaySelect( d ); | 2990 | mNavigator->slotDaySelect( d ); |
2991 | } else if ( mDatePickerMode == 2 ) { | 2991 | } else if ( mDatePickerMode == 2 ) { |
2992 | if ( mMoveIncidence->typeID() == todoID ) { | 2992 | if ( mMoveIncidence->typeID() == todoID ) { |
2993 | Todo * to = (Todo *) mMoveIncidence; | 2993 | Todo * to = (Todo *) mMoveIncidence; |
2994 | QTime tim; | 2994 | QTime tim; |
2995 | int len = 0; | 2995 | int len = 0; |
2996 | if ( to->hasStartDate() && to->hasDueDate() ) | 2996 | if ( to->hasStartDate() && to->hasDueDate() ) |
2997 | len = to->dtStart().secsTo( to->dtDue()); | 2997 | len = to->dtStart().secsTo( to->dtDue()); |
2998 | if ( to->hasDueDate() ) | 2998 | if ( to->hasDueDate() ) |
2999 | tim = to->dtDue().time(); | 2999 | tim = to->dtDue().time(); |
3000 | else { | 3000 | else { |
3001 | tim = QTime ( 0,0,0 ); | 3001 | tim = QTime ( 0,0,0 ); |
3002 | to->setFloats( true ); | 3002 | to->setFloats( true ); |
3003 | to->setHasDueDate( true ); | 3003 | to->setHasDueDate( true ); |
3004 | } | 3004 | } |
3005 | QDateTime dt ( d,tim ); | 3005 | QDateTime dt ( d,tim ); |
3006 | to->setDtDue( dt ); | 3006 | to->setDtDue( dt ); |
3007 | 3007 | ||
3008 | if ( to->hasStartDate() ) { | 3008 | if ( to->hasStartDate() ) { |
3009 | if ( len>0 ) | 3009 | if ( len>0 ) |
3010 | to->setDtStart(to->dtDue().addSecs( -len )); | 3010 | to->setDtStart(to->dtDue().addSecs( -len )); |
3011 | else | 3011 | else |
3012 | if (to->dtStart() > to->dtDue() ) | 3012 | if (to->dtStart() > to->dtDue() ) |
3013 | to->setDtStart(to->dtDue().addDays( -3 )); | 3013 | to->setDtStart(to->dtDue().addDays( -3 )); |
3014 | } | 3014 | } |
3015 | 3015 | ||
3016 | todoChanged( to ); | 3016 | todoChanged( to ); |
3017 | } else if ( mMoveIncidence->typeID() == eventID ) { | 3017 | } else if ( mMoveIncidence->typeID() == eventID ) { |
3018 | if ( mMoveIncidence->doesRecur() ) { | 3018 | if ( mMoveIncidence->doesRecur() ) { |
3019 | #if 0 | 3019 | #if 0 |
3020 | // PENDING implement this | 3020 | // PENDING implement this |
3021 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); | 3021 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); |
3022 | mCalendar()->addIncidence( newInc ); | 3022 | mCalendar()->addIncidence( newInc ); |
3023 | if ( mMoveIncidence->typeID() == todoID ) | 3023 | if ( mMoveIncidence->typeID() == todoID ) |
3024 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); | 3024 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); |
3025 | else | 3025 | else |
3026 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); | 3026 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); |
3027 | mMoveIncidence = newInc; | 3027 | mMoveIncidence = newInc; |
3028 | 3028 | ||
3029 | #endif | 3029 | #endif |
3030 | } | 3030 | } |
3031 | QTime tim = mMoveIncidence->dtStart().time(); | 3031 | QTime tim = mMoveIncidence->dtStart().time(); |
3032 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 3032 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
3033 | QDateTime dt ( d,tim ); | 3033 | QDateTime dt ( d,tim ); |
3034 | mMoveIncidence->setDtStart( dt ); | 3034 | mMoveIncidence->setDtStart( dt ); |
3035 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 3035 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
3036 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 3036 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
3037 | } else if ( mMoveIncidence->typeID() == journalID ) { | 3037 | } else if ( mMoveIncidence->typeID() == journalID ) { |
3038 | QTime tim = mMoveIncidence->dtStart().time(); | 3038 | QTime tim = mMoveIncidence->dtStart().time(); |
3039 | QDateTime dt ( d,tim ); | 3039 | QDateTime dt ( d,tim ); |
3040 | mMoveIncidence->setDtStart( dt ); | 3040 | mMoveIncidence->setDtStart( dt ); |
3041 | updateView(); | 3041 | updateView(); |
3042 | } | 3042 | } |
3043 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 3043 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
3044 | } | 3044 | } |
3045 | } | 3045 | } |
3046 | 3046 | ||
3047 | void CalendarView::removeCategories() | 3047 | void CalendarView::removeCategories() |
3048 | { | 3048 | { |
3049 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 3049 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
3050 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 3050 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
3051 | QStringList catIncList; | 3051 | QStringList catIncList; |
3052 | QStringList newCatList; | 3052 | QStringList newCatList; |
3053 | Incidence* inc = incList.first(); | 3053 | Incidence* inc = incList.first(); |
3054 | uint i; | 3054 | uint i; |
3055 | while ( inc ) { | 3055 | while ( inc ) { |
3056 | newCatList.clear(); | 3056 | newCatList.clear(); |
3057 | catIncList = inc->categories() ; | 3057 | catIncList = inc->categories() ; |
3058 | for( i = 0; i< catIncList.count(); ++i ) { | 3058 | for( i = 0; i< catIncList.count(); ++i ) { |
3059 | if ( catList.contains (catIncList[i])) | 3059 | if ( catList.contains (catIncList[i])) |
3060 | newCatList.append( catIncList[i] ); | 3060 | newCatList.append( catIncList[i] ); |
3061 | } | 3061 | } |
3062 | newCatList.sort(); | 3062 | newCatList.sort(); |
3063 | inc->setCategories( newCatList.join(",") ); | 3063 | inc->setCategories( newCatList.join(",") ); |
3064 | inc = incList.next(); | 3064 | inc = incList.next(); |
3065 | } | 3065 | } |
3066 | } | 3066 | } |
3067 | 3067 | ||
3068 | int CalendarView::addCategories() | 3068 | int CalendarView::addCategories() |
3069 | { | 3069 | { |
3070 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 3070 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
3071 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 3071 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
3072 | QStringList catIncList; | 3072 | QStringList catIncList; |
3073 | Incidence* inc = incList.first(); | 3073 | Incidence* inc = incList.first(); |
3074 | uint i; | 3074 | uint i; |
3075 | int count = 0; | 3075 | int count = 0; |
3076 | while ( inc ) { | 3076 | while ( inc ) { |
3077 | catIncList = inc->categories() ; | 3077 | catIncList = inc->categories() ; |
3078 | for( i = 0; i< catIncList.count(); ++i ) { | 3078 | for( i = 0; i< catIncList.count(); ++i ) { |
3079 | if ( !catList.contains (catIncList[i])) { | 3079 | if ( !catList.contains (catIncList[i])) { |
3080 | catList.append( catIncList[i] ); | 3080 | catList.append( catIncList[i] ); |
3081 | //qDebug("add cat %s ", catIncList[i].latin1()); | 3081 | //qDebug("add cat %s ", catIncList[i].latin1()); |
3082 | ++count; | 3082 | ++count; |
3083 | } | 3083 | } |
3084 | } | 3084 | } |
3085 | inc = incList.next(); | 3085 | inc = incList.next(); |
3086 | } | 3086 | } |
3087 | catList.sort(); | 3087 | catList.sort(); |
3088 | KOPrefs::instance()->mCustomCategories = catList; | 3088 | KOPrefs::instance()->mCustomCategories = catList; |
3089 | return count; | 3089 | return count; |
3090 | } | 3090 | } |
3091 | 3091 | ||
3092 | void CalendarView::editCategories() | 3092 | void CalendarView::editCategories() |
3093 | { | 3093 | { |
3094 | qDebug("CalendarView::editCategories() "); | 3094 | qDebug("CalendarView::editCategories() "); |
3095 | KPIM::CategoryEditDialog ced (KOPrefs::instance(),this ); | 3095 | KPIM::CategoryEditDialog ced (KOPrefs::instance(),this ); |
3096 | ced.exec(); | 3096 | ced.exec(); |
3097 | } | 3097 | } |
3098 | void CalendarView::manageCategories() | 3098 | void CalendarView::manageCategories() |
3099 | { | 3099 | { |
3100 | KOCatPrefs* cp = new KOCatPrefs(); | 3100 | KOCatPrefs* cp = new KOCatPrefs(); |
3101 | cp->show(); | 3101 | cp->show(); |
3102 | int w =cp->sizeHint().width() ; | 3102 | int w =cp->sizeHint().width() ; |
3103 | int h = cp->sizeHint().height() ; | 3103 | int h = cp->sizeHint().height() ; |
3104 | int dw = QApplication::desktop()->width(); | 3104 | int dw = QApplication::desktop()->width(); |
3105 | int dh = QApplication::desktop()->height(); | 3105 | int dh = QApplication::desktop()->height(); |
3106 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 3106 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
3107 | if ( !cp->exec() ) { | 3107 | if ( !cp->exec() ) { |
3108 | delete cp; | 3108 | delete cp; |
3109 | return; | 3109 | return; |
3110 | } | 3110 | } |
3111 | int count = 0; | 3111 | int count = 0; |
3112 | if ( cp->addCat() ) { | 3112 | if ( cp->addCat() ) { |
3113 | count = addCategories(); | 3113 | count = addCategories(); |
3114 | if ( count ) { | 3114 | if ( count ) { |
3115 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); | 3115 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); |
3116 | writeSettings(); | 3116 | writeSettings(); |
3117 | } else | 3117 | } else |
3118 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); | 3118 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); |
3119 | } else { | 3119 | } else { |
3120 | removeCategories(); | 3120 | removeCategories(); |
3121 | updateView(); | 3121 | updateView(); |
3122 | } | 3122 | } |
3123 | delete cp; | 3123 | delete cp; |
3124 | } | 3124 | } |
3125 | 3125 | ||
3126 | void CalendarView::beamIncidence(Incidence * Inc) | 3126 | void CalendarView::beamIncidence(Incidence * Inc) |
3127 | { | 3127 | { |
3128 | QPtrList<Incidence> delSel ; | 3128 | QPtrList<Incidence> delSel ; |
3129 | delSel.append(Inc); | 3129 | delSel.append(Inc); |
3130 | beamIncidenceList( delSel ); | 3130 | beamIncidenceList( delSel ); |
3131 | } | 3131 | } |
3132 | void CalendarView::beamCalendar() | 3132 | void CalendarView::beamCalendar() |
3133 | { | 3133 | { |
3134 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); | 3134 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); |
3135 | //qDebug("beamCalendar() "); | 3135 | //qDebug("beamCalendar() "); |
3136 | beamIncidenceList( delSel ); | 3136 | beamIncidenceList( delSel ); |
3137 | } | 3137 | } |
3138 | void CalendarView::beamFilteredCalendar() | 3138 | void CalendarView::beamFilteredCalendar() |
3139 | { | 3139 | { |
3140 | QPtrList<Incidence> delSel = mCalendar->incidences(); | 3140 | QPtrList<Incidence> delSel = mCalendar->incidences(); |
3141 | //qDebug("beamFilteredCalendar() "); | 3141 | //qDebug("beamFilteredCalendar() "); |
3142 | beamIncidenceList( delSel ); | 3142 | beamIncidenceList( delSel ); |
3143 | } | 3143 | } |
3144 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | 3144 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) |
3145 | { | 3145 | { |
3146 | 3146 | ||
3147 | KOBeamPrefs beamDialog; | 3147 | KOBeamPrefs beamDialog; |
3148 | if ( beamDialog.exec () == QDialog::Rejected ) | 3148 | if ( beamDialog.exec () == QDialog::Rejected ) |
3149 | return; | 3149 | return; |
3150 | #ifdef DESKTOP_VERSION | 3150 | #ifdef DESKTOP_VERSION |
3151 | QString fn = locateLocal( "tmp", "kopibeamfile" ); | 3151 | QString fn = locateLocal( "tmp", "kopibeamfile" ); |
3152 | #else | 3152 | #else |
3153 | QString fn = "/tmp/kopibeamfile"; | 3153 | QString fn = "/tmp/kopibeamfile"; |
3154 | #endif | 3154 | #endif |
3155 | QString mes; | 3155 | QString mes; |
3156 | bool createbup = true; | 3156 | bool createbup = true; |
3157 | if ( createbup ) { | 3157 | if ( createbup ) { |
3158 | QString description = "\n"; | 3158 | QString description = "\n"; |
3159 | CalendarLocal* cal = new CalendarLocal(); | 3159 | CalendarLocal* cal = new CalendarLocal(); |
3160 | if ( beamDialog.beamLocal() ) | 3160 | if ( beamDialog.beamLocal() ) |
3161 | cal->setLocalTime(); | 3161 | cal->setLocalTime(); |
3162 | else | 3162 | else |
3163 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 3163 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
3164 | Incidence *incidence = delSel.first(); | 3164 | Incidence *incidence = delSel.first(); |
3165 | bool addText = false; | 3165 | bool addText = false; |
3166 | if ( delSel.count() < 10 ) | 3166 | if ( delSel.count() < 10 ) |
3167 | addText = true; | 3167 | addText = true; |
3168 | else { | 3168 | else { |
3169 | description.sprintf(i18n(" %d items?"),delSel.count() ); | 3169 | description.sprintf(i18n(" %d items?"),delSel.count() ); |
3170 | } | 3170 | } |
3171 | while ( incidence ) { | 3171 | while ( incidence ) { |
3172 | Incidence *in = incidence->clone(); | 3172 | Incidence *in = incidence->clone(); |
3173 | if ( ! in->summary().isEmpty() ) { | 3173 | if ( ! in->summary().isEmpty() ) { |
3174 | in->setDescription(""); | 3174 | in->setDescription(""); |
3175 | } else { | 3175 | } else { |
3176 | in->setSummary( in->description().left(20)); | 3176 | in->setSummary( in->description().left(20)); |
3177 | in->setDescription(""); | 3177 | in->setDescription(""); |
3178 | } | 3178 | } |
3179 | if ( addText ) | 3179 | if ( addText ) |
3180 | description += in->summary() + "\n"; | 3180 | description += in->summary() + "\n"; |
3181 | cal->addIncidence( in ); | 3181 | cal->addIncidence( in ); |
3182 | incidence = delSel.next(); | 3182 | incidence = delSel.next(); |
3183 | } | 3183 | } |
3184 | if ( beamDialog.beamVcal() ) { | 3184 | if ( beamDialog.beamVcal() ) { |
3185 | fn += ".vcs"; | 3185 | fn += ".vcs"; |
3186 | FileStorage storage( cal, fn, new VCalFormat ); | 3186 | FileStorage storage( cal, fn, new VCalFormat ); |
3187 | storage.save(); | 3187 | storage.save(); |
3188 | } else { | 3188 | } else { |
3189 | fn += ".ics"; | 3189 | fn += ".ics"; |
3190 | FileStorage storage( cal, fn, new ICalFormat( ) ); | 3190 | FileStorage storage( cal, fn, new ICalFormat( ) ); |
3191 | storage.save(); | 3191 | storage.save(); |
3192 | } | 3192 | } |
3193 | delete cal; | 3193 | delete cal; |
3194 | mes = i18n("KO/Pi: Ready for beaming"); | 3194 | mes = i18n("KO/Pi: Ready for beaming"); |
3195 | topLevelWidget()->setCaption(mes); | 3195 | topLevelWidget()->setCaption(mes); |
3196 | KApplication::convert2latin1( fn ); | 3196 | KApplication::convert2latin1( fn ); |
3197 | #ifndef DESKTOP_VERSION | 3197 | #ifndef DESKTOP_VERSION |
3198 | Ir *ir = new Ir( this ); | 3198 | Ir *ir = new Ir( this ); |
3199 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 3199 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
3200 | ir->send( fn, description, "text/x-vCalendar" ); | 3200 | ir->send( fn, description, "text/x-vCalendar" ); |
3201 | #endif | 3201 | #endif |
3202 | } | 3202 | } |
3203 | } | 3203 | } |
3204 | 3204 | ||
3205 | #ifndef DESKTOP_VERSION | 3205 | #ifndef DESKTOP_VERSION |
3206 | void CalendarView::beamDone( Ir *ir ) | 3206 | void CalendarView::beamDone( Ir *ir ) |
3207 | { | 3207 | { |
3208 | delete ir; | 3208 | delete ir; |
3209 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); | 3209 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); |
3210 | topLevelWidget()->raise(); | 3210 | topLevelWidget()->raise(); |
3211 | } | 3211 | } |
3212 | #else | 3212 | #else |
3213 | void CalendarView::beamDone( Ir *){;} | 3213 | void CalendarView::beamDone( Ir *){;} |
3214 | #endif | 3214 | #endif |
3215 | void CalendarView::moveIncidence(Incidence * inc ) | 3215 | void CalendarView::moveIncidence(Incidence * inc ) |
3216 | { | 3216 | { |
3217 | if ( !inc ) return; | 3217 | if ( !inc ) return; |
3218 | showDatePickerPopup(); | 3218 | showDatePickerPopup(); |
3219 | mDatePickerMode = 2; | 3219 | mDatePickerMode = 2; |
3220 | mMoveIncidence = inc ; | 3220 | mMoveIncidence = inc ; |
3221 | QDate da; | 3221 | QDate da; |
3222 | if ( mMoveIncidence->typeID() == todoID ) { | 3222 | if ( mMoveIncidence->typeID() == todoID ) { |
3223 | Todo * to = (Todo *) mMoveIncidence; | 3223 | Todo * to = (Todo *) mMoveIncidence; |
3224 | if ( to->hasDueDate() ) | 3224 | if ( to->hasDueDate() ) |
3225 | da = to->dtDue().date(); | 3225 | da = to->dtDue().date(); |
3226 | else | 3226 | else |
3227 | da = QDate::currentDate(); | 3227 | da = QDate::currentDate(); |
3228 | } else { | 3228 | } else { |
3229 | da = mMoveIncidence->dtStart().date(); | 3229 | da = mMoveIncidence->dtStart().date(); |
3230 | } | 3230 | } |
3231 | //PENDING set date for recurring incidence to date of recurrence | 3231 | //PENDING set date for recurring incidence to date of recurrence |
3232 | //mMoveIncidenceOldDate; | 3232 | //mMoveIncidenceOldDate; |
3233 | mDatePicker->setDate( da ); | 3233 | mDatePicker->setDate( da ); |
3234 | } | 3234 | } |
3235 | void CalendarView::showDatePickerPopup() | 3235 | void CalendarView::showDatePickerPopup() |
3236 | { | 3236 | { |
3237 | if ( mDateFrame->isVisible() ) | 3237 | if ( mDateFrame->isVisible() ) |
3238 | mDateFrame->hide(); | 3238 | mDateFrame->hide(); |
3239 | else { | 3239 | else { |
3240 | int offX = 0, offY = 0; | 3240 | int offX = 0, offY = 0; |
3241 | #ifdef DESKTOP_VERSION | 3241 | #ifdef DESKTOP_VERSION |
3242 | int w =mDatePicker->sizeHint().width() ; | 3242 | int w =mDatePicker->sizeHint().width() ; |
3243 | int h = mDatePicker->sizeHint().height() ; | 3243 | int h = mDatePicker->sizeHint().height() ; |
3244 | int dw = topLevelWidget()->width(); | 3244 | int dw = topLevelWidget()->width(); |
3245 | int dh = topLevelWidget()->height(); | 3245 | int dh = topLevelWidget()->height(); |
3246 | offX = topLevelWidget()->x(); | 3246 | offX = topLevelWidget()->x(); |
3247 | offY = topLevelWidget()->y(); | 3247 | offY = topLevelWidget()->y(); |
3248 | #else | 3248 | #else |
3249 | int w =mDatePicker->sizeHint().width() ; | 3249 | int w =mDatePicker->sizeHint().width() ; |
3250 | int h = mDatePicker->sizeHint().height() ; | 3250 | int h = mDatePicker->sizeHint().height() ; |
3251 | int dw = QApplication::desktop()->width(); | 3251 | int dw = QApplication::desktop()->width(); |
3252 | int dh = QApplication::desktop()->height(); | 3252 | int dh = QApplication::desktop()->height(); |
3253 | #endif | 3253 | #endif |
3254 | mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); | 3254 | mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); |
3255 | mDateFrame->show(); | 3255 | mDateFrame->show(); |
3256 | } | 3256 | } |
3257 | } | 3257 | } |
3258 | void CalendarView::showDatePicker( ) | 3258 | void CalendarView::showDatePicker( ) |
3259 | { | 3259 | { |
3260 | showDatePickerPopup(); | 3260 | showDatePickerPopup(); |
3261 | mDatePickerMode = 1; | 3261 | mDatePickerMode = 1; |
3262 | mDatePicker->setDate( mNavigator->selectedDates().first() ); | 3262 | mDatePicker->setDate( mNavigator->selectedDates().first() ); |
3263 | } | 3263 | } |
3264 | 3264 | ||
3265 | void CalendarView::showEventEditor() | 3265 | void CalendarView::showEventEditor() |
3266 | { | 3266 | { |
3267 | #ifdef DESKTOP_VERSION | 3267 | #ifdef DESKTOP_VERSION |
3268 | int x,y,w,h; | 3268 | int x,y,w,h; |
3269 | x = mEventEditor->geometry().x(); | 3269 | x = mEventEditor->geometry().x(); |
3270 | y = mEventEditor->geometry().y(); | 3270 | y = mEventEditor->geometry().y(); |
3271 | w = mEventEditor->width(); | 3271 | w = mEventEditor->width(); |
3272 | h = mEventEditor->height(); | 3272 | h = mEventEditor->height(); |
3273 | mEventEditor->show(); | 3273 | mEventEditor->show(); |
3274 | mEventEditor->setGeometry(x,y,w,h); | 3274 | mEventEditor->setGeometry(x,y,w,h); |
3275 | #else | 3275 | #else |
3276 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { | 3276 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { |
3277 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 3277 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
3278 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); | 3278 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); |
3279 | qApp->processEvents(); | 3279 | qApp->processEvents(); |
3280 | delete mEventEditor; | 3280 | delete mEventEditor; |
3281 | mEventEditor = mDialogManager->getEventEditor(); | 3281 | mEventEditor = mDialogManager->getEventEditor(); |
3282 | topLevelWidget()->setCaption( i18n("") ); | 3282 | topLevelWidget()->setCaption( i18n("") ); |
3283 | } | 3283 | } |
3284 | mEventEditor->showMaximized(); | 3284 | mEventEditor->showMaximized(); |
3285 | #endif | 3285 | #endif |
3286 | } | 3286 | } |
3287 | void CalendarView::showTodoEditor() | 3287 | void CalendarView::showTodoEditor() |
3288 | { | 3288 | { |
3289 | #ifdef DESKTOP_VERSION | 3289 | #ifdef DESKTOP_VERSION |
3290 | int x,y,w,h; | 3290 | int x,y,w,h; |
3291 | x = mTodoEditor->geometry().x(); | 3291 | x = mTodoEditor->geometry().x(); |
3292 | y = mTodoEditor->geometry().y(); | 3292 | y = mTodoEditor->geometry().y(); |
3293 | w = mTodoEditor->width(); | 3293 | w = mTodoEditor->width(); |
3294 | h = mTodoEditor->height(); | 3294 | h = mTodoEditor->height(); |
3295 | mTodoEditor->show(); | 3295 | mTodoEditor->show(); |
3296 | mTodoEditor->setGeometry(x,y,w,h); | 3296 | mTodoEditor->setGeometry(x,y,w,h); |
3297 | #else | 3297 | #else |
3298 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { | 3298 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { |
3299 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 3299 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
3300 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); | 3300 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); |
3301 | qApp->processEvents(); | 3301 | qApp->processEvents(); |
3302 | delete mTodoEditor; | 3302 | delete mTodoEditor; |
3303 | mTodoEditor = mDialogManager->getTodoEditor(); | 3303 | mTodoEditor = mDialogManager->getTodoEditor(); |
3304 | topLevelWidget()->setCaption( i18n("") ); | 3304 | topLevelWidget()->setCaption( i18n("") ); |
3305 | } | 3305 | } |
3306 | mTodoEditor->showMaximized(); | 3306 | mTodoEditor->showMaximized(); |
3307 | #endif | 3307 | #endif |
3308 | } | 3308 | } |
3309 | 3309 | ||
3310 | void CalendarView::cloneIncidence() | 3310 | void CalendarView::cloneIncidence() |
3311 | { | 3311 | { |
3312 | Incidence *incidence = currentSelection(); | 3312 | Incidence *incidence = currentSelection(); |
3313 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3313 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3314 | if ( incidence ) { | 3314 | if ( incidence ) { |
3315 | cloneIncidence(incidence); | 3315 | cloneIncidence(incidence); |
3316 | } | 3316 | } |
3317 | } | 3317 | } |
3318 | void CalendarView::moveIncidence() | 3318 | void CalendarView::moveIncidence() |
3319 | { | 3319 | { |
3320 | Incidence *incidence = currentSelection(); | 3320 | Incidence *incidence = currentSelection(); |
3321 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3321 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3322 | if ( incidence ) { | 3322 | if ( incidence ) { |
3323 | moveIncidence(incidence); | 3323 | moveIncidence(incidence); |
3324 | } | 3324 | } |
3325 | } | 3325 | } |
3326 | void CalendarView::beamIncidence() | 3326 | void CalendarView::beamIncidence() |
3327 | { | 3327 | { |
3328 | Incidence *incidence = currentSelection(); | 3328 | Incidence *incidence = currentSelection(); |
3329 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3329 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3330 | if ( incidence ) { | 3330 | if ( incidence ) { |
3331 | beamIncidence(incidence); | 3331 | beamIncidence(incidence); |
3332 | } | 3332 | } |
3333 | } | 3333 | } |
3334 | void CalendarView::toggleCancelIncidence() | 3334 | void CalendarView::toggleCancelIncidence() |
3335 | { | 3335 | { |
3336 | Incidence *incidence = currentSelection(); | 3336 | Incidence *incidence = currentSelection(); |
3337 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3337 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3338 | if ( incidence ) { | 3338 | if ( incidence ) { |
3339 | cancelIncidence(incidence); | 3339 | cancelIncidence(incidence); |
3340 | } | 3340 | } |
3341 | } | 3341 | } |
3342 | 3342 | ||
3343 | 3343 | ||
3344 | void CalendarView::cancelIncidence(Incidence * inc ) | 3344 | void CalendarView::cancelIncidence(Incidence * inc ) |
3345 | { | 3345 | { |
3346 | inc->setCancelled( ! inc->cancelled() ); | 3346 | inc->setCancelled( ! inc->cancelled() ); |
3347 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); | 3347 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); |
3348 | updateView(); | 3348 | updateView(); |
3349 | } | 3349 | } |
3350 | void CalendarView::cloneIncidence(Incidence * orgInc ) | 3350 | void CalendarView::cloneIncidence(Incidence * orgInc ) |
3351 | { | 3351 | { |
3352 | Incidence * newInc = orgInc->clone(); | 3352 | Incidence * newInc = orgInc->clone(); |
3353 | newInc->recreate(); | 3353 | newInc->recreate(); |
3354 | 3354 | ||
3355 | if ( newInc->typeID() == todoID ) { | 3355 | if ( newInc->typeID() == todoID ) { |
3356 | Todo* t = (Todo*) newInc; | 3356 | Todo* t = (Todo*) newInc; |
3357 | bool cloneSub = false; | 3357 | bool cloneSub = false; |
3358 | if ( orgInc->relations().count() ) { | 3358 | if ( orgInc->relations().count() ) { |
3359 | int result = KMessageBox::warningYesNoCancel(this, | 3359 | int result = KMessageBox::warningYesNoCancel(this, |
3360 | i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( KGlobal::formatMessage ( newInc->summary(),0 ) ), | 3360 | i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( KGlobal::formatMessage ( newInc->summary(),0 ) ), |
3361 | i18n("Todo has subtodos"), | 3361 | i18n("Todo has subtodos"), |
3362 | i18n("Yes"), | 3362 | i18n("Yes"), |
3363 | i18n("No")); | 3363 | i18n("No")); |
3364 | 3364 | ||
3365 | if ( result == KMessageBox::Cancel ) { | 3365 | if ( result == KMessageBox::Cancel ) { |
3366 | delete t; | 3366 | delete t; |
3367 | return; | 3367 | return; |
3368 | } | 3368 | } |
3369 | if (result == KMessageBox::Yes) cloneSub = true; | 3369 | if (result == KMessageBox::Yes) cloneSub = true; |
3370 | } | 3370 | } |
3371 | showTodoEditor(); | 3371 | showTodoEditor(); |
3372 | mTodoEditor->editTodo( t ); | 3372 | mTodoEditor->editTodo( t ); |
3373 | if ( mTodoEditor->exec() ) { | 3373 | if ( mTodoEditor->exec() ) { |
3374 | if ( cloneSub ) { | 3374 | if ( cloneSub ) { |
3375 | orgInc->cloneRelations( t ); | 3375 | orgInc->cloneRelations( t ); |
3376 | mCalendar->addIncidenceBranch( t ); | 3376 | mCalendar->addIncidenceBranch( t ); |
3377 | updateView(); | 3377 | updateView(); |
3378 | 3378 | ||
3379 | } else { | 3379 | } else { |
3380 | mCalendar->addTodo( t ); | 3380 | mCalendar->addTodo( t ); |
3381 | updateView(); | 3381 | updateView(); |
3382 | } | 3382 | } |
3383 | } else { | 3383 | } else { |
3384 | delete t; | 3384 | delete t; |
3385 | } | 3385 | } |
3386 | } | 3386 | } |
3387 | else if ( newInc->typeID() == eventID ) { | 3387 | else if ( newInc->typeID() == eventID ) { |
3388 | Event* e = (Event*) newInc; | 3388 | Event* e = (Event*) newInc; |
3389 | showEventEditor(); | 3389 | showEventEditor(); |
3390 | mEventEditor->editEvent( e ); | 3390 | mEventEditor->editEvent( e ); |
3391 | if ( mEventEditor->exec() ) { | 3391 | if ( mEventEditor->exec() ) { |
3392 | mCalendar->addEvent( e ); | 3392 | mCalendar->addEvent( e ); |
3393 | updateView(); | 3393 | updateView(); |
3394 | } else { | 3394 | } else { |
3395 | delete e; | 3395 | delete e; |
3396 | } | 3396 | } |
3397 | } if ( newInc->typeID() == journalID ) { | 3397 | } else if ( newInc->typeID() == journalID ) { |
3398 | mCalendar->addJournal( (Journal*) newInc ); | 3398 | mCalendar->addJournal( (Journal*) newInc ); |
3399 | editJournal( (Journal*) newInc ); | 3399 | editJournal( (Journal*) newInc ); |
3400 | } | 3400 | } |
3401 | setActiveWindow(); | 3401 | setActiveWindow(); |
3402 | } | 3402 | } |
3403 | 3403 | ||
3404 | void CalendarView::newEvent() | 3404 | void CalendarView::newEvent() |
3405 | { | 3405 | { |
3406 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. | 3406 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. |
3407 | KOAgendaView *aView = mViewManager->agendaView(); | 3407 | KOAgendaView *aView = mViewManager->agendaView(); |
3408 | if (aView) { | 3408 | if (aView) { |
3409 | if (aView->selectionStart().isValid()) { | 3409 | if (aView->selectionStart().isValid()) { |
3410 | if (aView->selectedIsAllDay()) { | 3410 | if (aView->selectedIsAllDay()) { |
3411 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); | 3411 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); |
3412 | } else { | 3412 | } else { |
3413 | newEvent(aView->selectionStart(),aView->selectionEnd()); | 3413 | newEvent(aView->selectionStart(),aView->selectionEnd()); |
3414 | } | 3414 | } |
3415 | return; | 3415 | return; |
3416 | } | 3416 | } |
3417 | } | 3417 | } |
3418 | 3418 | ||
3419 | QDate date = mNavigator->selectedDates().first(); | 3419 | QDate date = mNavigator->selectedDates().first(); |
3420 | #if 0 | 3420 | #if 0 |
3421 | QDateTime current = QDateTime::currentDateTime(); | 3421 | QDateTime current = QDateTime::currentDateTime(); |
3422 | if ( date <= current.date() ) { | 3422 | if ( date <= current.date() ) { |
3423 | int hour = current.time().hour() +1; | 3423 | int hour = current.time().hour() +1; |
3424 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), | 3424 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), |
3425 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 3425 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
3426 | } else | 3426 | } else |
3427 | #endif | 3427 | #endif |
3428 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), | 3428 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), |
3429 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + | 3429 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + |
3430 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 3430 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
3431 | } | 3431 | } |
3432 | 3432 | ||
3433 | void CalendarView::newEvent(QDateTime fh) | 3433 | void CalendarView::newEvent(QDateTime fh) |
3434 | { | 3434 | { |
3435 | newEvent(fh, | 3435 | newEvent(fh, |
3436 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); | 3436 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); |
3437 | } | 3437 | } |
3438 | 3438 | ||
3439 | void CalendarView::newEvent(QDate dt) | 3439 | void CalendarView::newEvent(QDate dt) |
3440 | { | 3440 | { |
3441 | newEvent(QDateTime(dt, QTime(0,0,0)), | 3441 | newEvent(QDateTime(dt, QTime(0,0,0)), |
3442 | QDateTime(dt, QTime(0,0,0)), true); | 3442 | QDateTime(dt, QTime(0,0,0)), true); |
3443 | } | 3443 | } |
3444 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) | 3444 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) |
3445 | { | 3445 | { |
3446 | newEvent(fromHint, toHint, false); | 3446 | newEvent(fromHint, toHint, false); |
3447 | } | 3447 | } |
3448 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) | 3448 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) |
3449 | { | 3449 | { |
3450 | 3450 | ||
3451 | showEventEditor(); | 3451 | showEventEditor(); |
3452 | mEventEditor->newEvent(fromHint,toHint,allDay); | 3452 | mEventEditor->newEvent(fromHint,toHint,allDay); |
3453 | if ( mFilterView->filtersEnabled() ) { | 3453 | if ( mFilterView->filtersEnabled() ) { |
3454 | CalFilter *filter = mFilterView->selectedFilter(); | 3454 | CalFilter *filter = mFilterView->selectedFilter(); |
3455 | if (filter && filter->showCategories()) { | 3455 | if (filter && filter->showCategories()) { |
3456 | mEventEditor->setCategories(filter->categoryList().join(",") ); | 3456 | mEventEditor->setCategories(filter->categoryList().join(",") ); |
3457 | } | 3457 | } |
3458 | if ( filter ) | 3458 | if ( filter ) |
3459 | mEventEditor->setSecrecy( filter->getSecrecy() ); | 3459 | mEventEditor->setSecrecy( filter->getSecrecy() ); |
3460 | } | 3460 | } |
3461 | mEventEditor->exec(); | 3461 | mEventEditor->exec(); |
3462 | setActiveWindow(); | 3462 | setActiveWindow(); |
3463 | } | 3463 | } |
3464 | void CalendarView::todoAdded(Todo * t) | 3464 | void CalendarView::todoAdded(Todo * t) |
3465 | { | 3465 | { |
3466 | 3466 | ||
3467 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); | 3467 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); |
3468 | updateTodoViews(); | 3468 | updateTodoViews(); |
3469 | } | 3469 | } |
3470 | void CalendarView::todoChanged(Todo * t) | 3470 | void CalendarView::todoChanged(Todo * t) |
3471 | { | 3471 | { |
3472 | emit todoModified( t, 4 ); | 3472 | emit todoModified( t, 4 ); |
3473 | // updateTodoViews(); | 3473 | // updateTodoViews(); |
3474 | } | 3474 | } |
3475 | void CalendarView::todoToBeDeleted(Todo *) | 3475 | void CalendarView::todoToBeDeleted(Todo *) |
3476 | { | 3476 | { |
3477 | //qDebug("todoToBeDeleted(Todo *) "); | 3477 | //qDebug("todoToBeDeleted(Todo *) "); |
3478 | updateTodoViews(); | 3478 | updateTodoViews(); |
3479 | } | 3479 | } |
3480 | void CalendarView::todoDeleted() | 3480 | void CalendarView::todoDeleted() |
3481 | { | 3481 | { |
3482 | //qDebug(" todoDeleted()"); | 3482 | //qDebug(" todoDeleted()"); |
3483 | updateTodoViews(); | 3483 | updateTodoViews(); |
3484 | } | 3484 | } |
3485 | 3485 | ||
3486 | 3486 | ||
3487 | void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) | 3487 | void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) |
3488 | { | 3488 | { |
3489 | showTodoEditor(); | 3489 | showTodoEditor(); |
3490 | mTodoEditor->newTodo(dt,0,allday); | 3490 | mTodoEditor->newTodo(dt,0,allday); |
3491 | if ( mFilterView->filtersEnabled() ) { | 3491 | if ( mFilterView->filtersEnabled() ) { |
3492 | CalFilter *filter = mFilterView->selectedFilter(); | 3492 | CalFilter *filter = mFilterView->selectedFilter(); |
3493 | if (filter && filter->showCategories()) { | 3493 | if (filter && filter->showCategories()) { |
3494 | mTodoEditor->setCategories(filter->categoryList().join(",") ); | 3494 | mTodoEditor->setCategories(filter->categoryList().join(",") ); |
3495 | } | 3495 | } |
3496 | if ( filter ) | 3496 | if ( filter ) |
3497 | mTodoEditor->setSecrecy( filter->getSecrecy() ); | 3497 | mTodoEditor->setSecrecy( filter->getSecrecy() ); |
3498 | } | 3498 | } |
3499 | mTodoEditor->exec(); | 3499 | mTodoEditor->exec(); |
3500 | setActiveWindow(); | 3500 | setActiveWindow(); |
3501 | } | 3501 | } |
3502 | 3502 | ||
3503 | void CalendarView::newTodo() | 3503 | void CalendarView::newTodo() |
3504 | { | 3504 | { |
3505 | newTodoDateTime( QDateTime(),true ); | 3505 | newTodoDateTime( QDateTime(),true ); |
3506 | } | 3506 | } |
3507 | 3507 | ||
3508 | void CalendarView::newSubTodo() | 3508 | void CalendarView::newSubTodo() |
3509 | { | 3509 | { |
3510 | Todo *todo = selectedTodo(); | 3510 | Todo *todo = selectedTodo(); |
3511 | if ( todo ) newSubTodo( todo ); | 3511 | if ( todo ) newSubTodo( todo ); |
3512 | } | 3512 | } |
3513 | 3513 | ||
3514 | void CalendarView::newSubTodo(Todo *parentEvent) | 3514 | void CalendarView::newSubTodo(Todo *parentEvent) |
3515 | { | 3515 | { |
3516 | 3516 | ||
3517 | showTodoEditor(); | 3517 | showTodoEditor(); |
3518 | mTodoEditor->newTodo(QDateTime(),parentEvent,true); | 3518 | mTodoEditor->newTodo(QDateTime(),parentEvent,true); |
3519 | mTodoEditor->exec(); | 3519 | mTodoEditor->exec(); |
3520 | setActiveWindow(); | 3520 | setActiveWindow(); |
3521 | } | 3521 | } |
3522 | 3522 | ||
3523 | void CalendarView::newFloatingEvent() | 3523 | void CalendarView::newFloatingEvent() |
3524 | { | 3524 | { |
3525 | DateList tmpList = mNavigator->selectedDates(); | 3525 | DateList tmpList = mNavigator->selectedDates(); |
3526 | QDate date = tmpList.first(); | 3526 | QDate date = tmpList.first(); |
3527 | 3527 | ||
3528 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), | 3528 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), |
3529 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); | 3529 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); |
3530 | } | 3530 | } |
3531 | 3531 | ||
3532 | 3532 | ||
3533 | void CalendarView::editEvent( Event *event ) | 3533 | void CalendarView::editEvent( Event *event ) |
3534 | { | 3534 | { |
3535 | 3535 | ||
3536 | if ( !event ) return; | 3536 | if ( !event ) return; |
3537 | if ( event->isReadOnly() ) { | 3537 | if ( event->isReadOnly() ) { |
3538 | showEvent( event ); | 3538 | showEvent( event ); |
3539 | return; | 3539 | return; |
3540 | } | 3540 | } |
3541 | showEventEditor(); | 3541 | showEventEditor(); |
3542 | mEventEditor->editEvent( event , mFlagEditDescription); | 3542 | mEventEditor->editEvent( event , mFlagEditDescription); |
3543 | mEventEditor->exec(); | 3543 | mEventEditor->exec(); |
3544 | setActiveWindow(); | 3544 | setActiveWindow(); |
3545 | 3545 | ||
3546 | } | 3546 | } |
3547 | void CalendarView::editJournal( Journal *jour ) | 3547 | void CalendarView::editJournal( Journal *jour ) |
3548 | { | 3548 | { |
3549 | if ( !jour ) return; | 3549 | if ( !jour ) return; |
3550 | mDialogManager->hideSearchDialog(); | 3550 | mDialogManager->hideSearchDialog(); |
3551 | mViewManager->showJournalView(); | 3551 | mViewManager->showJournalView(); |
3552 | mNavigator->slotDaySelect( jour->dtStart().date() ); | 3552 | mNavigator->slotDaySelect( jour->dtStart().date() ); |
3553 | } | 3553 | } |
3554 | void CalendarView::editTodo( Todo *todo ) | 3554 | void CalendarView::editTodo( Todo *todo ) |
3555 | { | 3555 | { |
3556 | if ( !todo ) return; | 3556 | if ( !todo ) return; |
3557 | 3557 | ||
3558 | if ( todo->isReadOnly() ) { | 3558 | if ( todo->isReadOnly() ) { |
3559 | showTodo( todo ); | 3559 | showTodo( todo ); |
3560 | return; | 3560 | return; |
3561 | } | 3561 | } |
3562 | showTodoEditor(); | 3562 | showTodoEditor(); |
3563 | mTodoEditor->editTodo( todo ,mFlagEditDescription); | 3563 | mTodoEditor->editTodo( todo ,mFlagEditDescription); |
3564 | mTodoEditor->exec(); | 3564 | mTodoEditor->exec(); |
3565 | setActiveWindow(); | 3565 | setActiveWindow(); |
3566 | 3566 | ||
3567 | } | 3567 | } |
3568 | 3568 | ||
3569 | KOEventViewerDialog* CalendarView::getEventViewerDialog() | 3569 | KOEventViewerDialog* CalendarView::getEventViewerDialog() |
3570 | { | 3570 | { |
3571 | if ( !mEventViewerDialog ) { | 3571 | if ( !mEventViewerDialog ) { |
3572 | mEventViewerDialog = new KOEventViewerDialog(0); | 3572 | mEventViewerDialog = new KOEventViewerDialog(0); |
3573 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); | 3573 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); |
3574 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); | 3574 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); |
3575 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), | 3575 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), |
3576 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 3576 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
3577 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), | 3577 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), |
3578 | viewManager(), SLOT( showAgendaView( bool ) ) ); | 3578 | viewManager(), SLOT( showAgendaView( bool ) ) ); |
3579 | connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), | 3579 | connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), |
3580 | this, SLOT( slotViewerClosed() ) ); | 3580 | this, SLOT( slotViewerClosed() ) ); |
3581 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), | 3581 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), |
3582 | this, SLOT( todoChanged(Todo *) ) ); | 3582 | this, SLOT( todoChanged(Todo *) ) ); |
3583 | connect( mEventViewerDialog, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | 3583 | connect( mEventViewerDialog, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); |
3584 | mEventViewerDialog->resize( 640, 480 ); | 3584 | mEventViewerDialog->resize( 640, 480 ); |
3585 | 3585 | ||
3586 | } | 3586 | } |
3587 | return mEventViewerDialog; | 3587 | return mEventViewerDialog; |
3588 | } | 3588 | } |
3589 | void CalendarView::showEvent(Event *event) | 3589 | void CalendarView::showEvent(Event *event) |
3590 | { | 3590 | { |
3591 | getEventViewerDialog()->setEvent(event); | 3591 | getEventViewerDialog()->setEvent(event); |
3592 | getEventViewerDialog()->showMe(); | 3592 | getEventViewerDialog()->showMe(); |
3593 | } | 3593 | } |
3594 | 3594 | ||
3595 | void CalendarView::showTodo(Todo *event) | 3595 | void CalendarView::showTodo(Todo *event) |
3596 | { | 3596 | { |
3597 | getEventViewerDialog()->setTodo(event); | 3597 | getEventViewerDialog()->setTodo(event); |
3598 | getEventViewerDialog()->showMe(); | 3598 | getEventViewerDialog()->showMe(); |
3599 | } | 3599 | } |
3600 | void CalendarView::showJournal( Journal *jour ) | 3600 | void CalendarView::showJournal( Journal *jour ) |
3601 | { | 3601 | { |
3602 | getEventViewerDialog()->setJournal(jour); | 3602 | getEventViewerDialog()->setJournal(jour); |
3603 | getEventViewerDialog()->showMe(); | 3603 | getEventViewerDialog()->showMe(); |
3604 | 3604 | ||
3605 | } | 3605 | } |
3606 | // void CalendarView::todoModified (Todo *event, int changed) | 3606 | // void CalendarView::todoModified (Todo *event, int changed) |
3607 | // { | 3607 | // { |
3608 | // // if (mDialogList.find (event) != mDialogList.end ()) { | 3608 | // // if (mDialogList.find (event) != mDialogList.end ()) { |
3609 | // // kdDebug() << "Todo modified and open" << endl; | 3609 | // // kdDebug() << "Todo modified and open" << endl; |
3610 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; | 3610 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; |
3611 | // // temp->modified (changed); | 3611 | // // temp->modified (changed); |
3612 | 3612 | ||
3613 | // // } | 3613 | // // } |
3614 | 3614 | ||
3615 | // mViewManager->updateView(); | 3615 | // mViewManager->updateView(); |
3616 | // } | 3616 | // } |
3617 | 3617 | ||
3618 | void CalendarView::appointment_show() | 3618 | void CalendarView::appointment_show() |
3619 | { | 3619 | { |
3620 | Event *anEvent = 0; | 3620 | Event *anEvent = 0; |
3621 | 3621 | ||
3622 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3622 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3623 | 3623 | ||
3624 | if (mViewManager->currentView()->isEventView()) { | 3624 | if (mViewManager->currentView()->isEventView()) { |
3625 | if ( incidence && incidence->typeID() == eventID ) { | 3625 | if ( incidence && incidence->typeID() == eventID ) { |
3626 | anEvent = static_cast<Event *>(incidence); | 3626 | anEvent = static_cast<Event *>(incidence); |
3627 | } | 3627 | } |
3628 | } | 3628 | } |
3629 | 3629 | ||
3630 | if (!anEvent) { | 3630 | if (!anEvent) { |
3631 | KNotifyClient::beep(); | 3631 | KNotifyClient::beep(); |
3632 | return; | 3632 | return; |
3633 | } | 3633 | } |
3634 | 3634 | ||
3635 | showEvent(anEvent); | 3635 | showEvent(anEvent); |
3636 | } | 3636 | } |
3637 | 3637 | ||
3638 | void CalendarView::appointment_edit() | 3638 | void CalendarView::appointment_edit() |
3639 | { | 3639 | { |
3640 | Event *anEvent = 0; | 3640 | Event *anEvent = 0; |
3641 | 3641 | ||
3642 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3642 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3643 | 3643 | ||
3644 | if (mViewManager->currentView()->isEventView()) { | 3644 | if (mViewManager->currentView()->isEventView()) { |
3645 | if ( incidence && incidence->typeID() == eventID ) { | 3645 | if ( incidence && incidence->typeID() == eventID ) { |
3646 | anEvent = static_cast<Event *>(incidence); | 3646 | anEvent = static_cast<Event *>(incidence); |
3647 | } | 3647 | } |
3648 | } | 3648 | } |
3649 | 3649 | ||
3650 | if (!anEvent) { | 3650 | if (!anEvent) { |
3651 | KNotifyClient::beep(); | 3651 | KNotifyClient::beep(); |
3652 | return; | 3652 | return; |
3653 | } | 3653 | } |
3654 | 3654 | ||
3655 | editEvent(anEvent); | 3655 | editEvent(anEvent); |
3656 | } | 3656 | } |
3657 | 3657 | ||
3658 | void CalendarView::appointment_delete() | 3658 | void CalendarView::appointment_delete() |
3659 | { | 3659 | { |
3660 | Event *anEvent = 0; | 3660 | Event *anEvent = 0; |
3661 | 3661 | ||
3662 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3662 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3663 | 3663 | ||
3664 | if (mViewManager->currentView()->isEventView()) { | 3664 | if (mViewManager->currentView()->isEventView()) { |
3665 | if ( incidence && incidence->typeID() == eventID ) { | 3665 | if ( incidence && incidence->typeID() == eventID ) { |
3666 | anEvent = static_cast<Event *>(incidence); | 3666 | anEvent = static_cast<Event *>(incidence); |
3667 | } | 3667 | } |
3668 | } | 3668 | } |
3669 | 3669 | ||
3670 | if (!anEvent) { | 3670 | if (!anEvent) { |
3671 | KNotifyClient::beep(); | 3671 | KNotifyClient::beep(); |
3672 | return; | 3672 | return; |
3673 | } | 3673 | } |
3674 | 3674 | ||
3675 | deleteEvent(anEvent); | 3675 | deleteEvent(anEvent); |
3676 | } | 3676 | } |
3677 | 3677 | ||
3678 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) | 3678 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) |
3679 | { | 3679 | { |
3680 | if (!sub) return; | 3680 | if (!sub) return; |
3681 | if ( sub->relatedTo() == parent ) | 3681 | if ( sub->relatedTo() == parent ) |
3682 | return; | 3682 | return; |
3683 | sub->setRelatedTo(parent); | 3683 | sub->setRelatedTo(parent); |
3684 | sub->updated(); | 3684 | sub->updated(); |
3685 | setModified(true); | 3685 | setModified(true); |
3686 | updateView(); | 3686 | updateView(); |
3687 | } | 3687 | } |
3688 | void CalendarView::todo_unsub(Todo *anTodo ) | 3688 | void CalendarView::todo_unsub(Todo *anTodo ) |
3689 | { | 3689 | { |
3690 | todo_resub( 0, anTodo ); | 3690 | todo_resub( 0, anTodo ); |
3691 | } | 3691 | } |
3692 | 3692 | ||
3693 | void CalendarView::deleteTodo(Todo *todo) | 3693 | void CalendarView::deleteTodo(Todo *todo) |
3694 | { | 3694 | { |
3695 | if (!todo) { | 3695 | if (!todo) { |
3696 | KNotifyClient::beep(); | 3696 | KNotifyClient::beep(); |
3697 | return; | 3697 | return; |
3698 | } | 3698 | } |
3699 | if (KOPrefs::instance()->mConfirm) { | 3699 | if (KOPrefs::instance()->mConfirm) { |
3700 | QString text = KGlobal::formatMessage ( todo->summary(),0 ); | 3700 | QString text = KGlobal::formatMessage ( todo->summary(),0 ); |
3701 | if (!todo->relations().isEmpty()) { | 3701 | if (!todo->relations().isEmpty()) { |
3702 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); | 3702 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); |
3703 | 3703 | ||
3704 | } | 3704 | } |
3705 | switch (msgItemDelete(i18n("Todo:") +"\n"+text)) { | 3705 | switch (msgItemDelete(i18n("Todo:") +"\n"+text)) { |
3706 | case KMessageBox::Continue: // OK | 3706 | case KMessageBox::Continue: // OK |
3707 | bool deleteT = false; | 3707 | bool deleteT = false; |
3708 | if (!todo->relations().isEmpty()) { | 3708 | if (!todo->relations().isEmpty()) { |
3709 | deleteT = removeCompletedSubTodos( todo ); | 3709 | deleteT = removeCompletedSubTodos( todo ); |
3710 | } | 3710 | } |
3711 | // deleteT == true: todo already deleted in removeCompletedSubTodos | 3711 | // deleteT == true: todo already deleted in removeCompletedSubTodos |
3712 | if ( !deleteT ) { | 3712 | if ( !deleteT ) { |
3713 | checkExternalId( todo ); | 3713 | checkExternalId( todo ); |
3714 | calendar()->deleteTodo(todo); | 3714 | calendar()->deleteTodo(todo); |
3715 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 3715 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
3716 | updateView(); | 3716 | updateView(); |
3717 | } | 3717 | } |
3718 | break; | 3718 | break; |
3719 | } // switch | 3719 | } // switch |
3720 | } else { | 3720 | } else { |
3721 | checkExternalId( todo ); | 3721 | checkExternalId( todo ); |
3722 | mCalendar->deleteTodo(todo); | 3722 | mCalendar->deleteTodo(todo); |
3723 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 3723 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
3724 | updateView(); | 3724 | updateView(); |
3725 | } | 3725 | } |
3726 | 3726 | ||
3727 | emit updateSearchDialog(); | 3727 | emit updateSearchDialog(); |
3728 | } | 3728 | } |
3729 | void CalendarView::deleteJournal(Journal *jour) | 3729 | void CalendarView::deleteJournal(Journal *jour) |
3730 | { | 3730 | { |
3731 | if (!jour) { | 3731 | if (!jour) { |
3732 | KNotifyClient::beep(); | 3732 | KNotifyClient::beep(); |
3733 | return; | 3733 | return; |
3734 | } | 3734 | } |
3735 | if (KOPrefs::instance()->mConfirm) { | 3735 | if (KOPrefs::instance()->mConfirm) { |
3736 | 3736 | ||
3737 | QString des; | 3737 | QString des; |
3738 | if ( !jour->summary().isEmpty() ) { | 3738 | if ( !jour->summary().isEmpty() ) { |
3739 | des = jour->summary(); | 3739 | des = jour->summary(); |
3740 | } else { | 3740 | } else { |
3741 | des = jour->description().left(30); | 3741 | des = jour->description().left(30); |
3742 | des = des.simplifyWhiteSpace (); | 3742 | des = des.simplifyWhiteSpace (); |
3743 | des.replace (QRegExp ("\\n"),"" ); | 3743 | des.replace (QRegExp ("\\n"),"" ); |
3744 | des.replace (QRegExp ("\\r"),"" ); | 3744 | des.replace (QRegExp ("\\r"),"" ); |
3745 | } | 3745 | } |
3746 | switch (msgItemDelete( i18n("Journal:") +"\n"+KGlobal::formatMessage ( des,0 ))) { | 3746 | switch (msgItemDelete( i18n("Journal:") +"\n"+KGlobal::formatMessage ( des,0 ))) { |
3747 | case KMessageBox::Continue: // OK | 3747 | case KMessageBox::Continue: // OK |
3748 | calendar()->deleteJournal(jour); | 3748 | calendar()->deleteJournal(jour); |
3749 | updateView(); | 3749 | updateView(); |
3750 | break; | 3750 | break; |
3751 | } // switch | 3751 | } // switch |
3752 | } else { | 3752 | } else { |
3753 | calendar()->deleteJournal(jour);; | 3753 | calendar()->deleteJournal(jour);; |
3754 | updateView(); | 3754 | updateView(); |
3755 | } | 3755 | } |
3756 | emit updateSearchDialog(); | 3756 | emit updateSearchDialog(); |
3757 | } | 3757 | } |
3758 | 3758 | ||
3759 | void CalendarView::deleteEvent(Event *anEvent) | 3759 | void CalendarView::deleteEvent(Event *anEvent) |
3760 | { | 3760 | { |
3761 | if (!anEvent) { | 3761 | if (!anEvent) { |
3762 | KNotifyClient::beep(); | 3762 | KNotifyClient::beep(); |
3763 | return; | 3763 | return; |
3764 | } | 3764 | } |
3765 | 3765 | ||
3766 | if (anEvent->doesRecur()) { | 3766 | if (anEvent->doesRecur()) { |
3767 | QDate itemDate = mViewManager->currentSelectionDate(); | 3767 | QDate itemDate = mViewManager->currentSelectionDate(); |
3768 | int km; | 3768 | int km; |
3769 | if (!itemDate.isValid()) { | 3769 | if (!itemDate.isValid()) { |
3770 | //kdDebug() << "Date Not Valid" << endl; | 3770 | //kdDebug() << "Date Not Valid" << endl; |
3771 | if (KOPrefs::instance()->mConfirm) { | 3771 | if (KOPrefs::instance()->mConfirm) { |
3772 | km = KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + | 3772 | km = KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + |
3773 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), | 3773 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), |
3774 | i18n("KO/Pi Confirmation"),i18n("Delete All")); | 3774 | i18n("KO/Pi Confirmation"),i18n("Delete All")); |
3775 | if ( km == KMessageBox::Continue ) | 3775 | if ( km == KMessageBox::Continue ) |
3776 | km = KMessageBox::No; // No = all below | 3776 | km = KMessageBox::No; // No = all below |
3777 | } else | 3777 | } else |
3778 | km = KMessageBox::No; | 3778 | km = KMessageBox::No; |
3779 | } else { | 3779 | } else { |
3780 | km = KMessageBox::warningYesNoCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + | 3780 | km = KMessageBox::warningYesNoCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + |
3781 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ | 3781 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ |
3782 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), | 3782 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), |
3783 | i18n("KO/Pi Confirmation"),i18n("Current"), | 3783 | i18n("KO/Pi Confirmation"),i18n("Current"), |
3784 | i18n("All")); | 3784 | i18n("All")); |
3785 | } | 3785 | } |
3786 | switch(km) { | 3786 | switch(km) { |
3787 | 3787 | ||
3788 | case KMessageBox::No: // Continue // all | 3788 | case KMessageBox::No: // Continue // all |
3789 | //qDebug("KMessageBox::No "); | 3789 | //qDebug("KMessageBox::No "); |
3790 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3790 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3791 | schedule(Scheduler::Cancel,anEvent); | 3791 | schedule(Scheduler::Cancel,anEvent); |
3792 | 3792 | ||
3793 | checkExternalId( anEvent); | 3793 | checkExternalId( anEvent); |
3794 | mCalendar->deleteEvent(anEvent); | 3794 | mCalendar->deleteEvent(anEvent); |
3795 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); | 3795 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); |
3796 | break; | 3796 | break; |
3797 | 3797 | ||
3798 | // Disabled because it does not work | 3798 | // Disabled because it does not work |
3799 | //#if 0 | 3799 | //#if 0 |
3800 | case KMessageBox::Yes: // just this one | 3800 | case KMessageBox::Yes: // just this one |
3801 | //QDate qd = mNavigator->selectedDates().first(); | 3801 | //QDate qd = mNavigator->selectedDates().first(); |
3802 | //if (!qd.isValid()) { | 3802 | //if (!qd.isValid()) { |
3803 | // kdDebug() << "no date selected, or invalid date" << endl; | 3803 | // kdDebug() << "no date selected, or invalid date" << endl; |
3804 | // KNotifyClient::beep(); | 3804 | // KNotifyClient::beep(); |
3805 | // return; | 3805 | // return; |
3806 | //} | 3806 | //} |
3807 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); | 3807 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); |
3808 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { | 3808 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { |
3809 | anEvent->addExDate(itemDate); | 3809 | anEvent->addExDate(itemDate); |
3810 | int duration = anEvent->recurrence()->duration(); | 3810 | int duration = anEvent->recurrence()->duration(); |
3811 | if ( duration > 0 ) { | 3811 | if ( duration > 0 ) { |
3812 | anEvent->recurrence()->setDuration( duration - 1 ); | 3812 | anEvent->recurrence()->setDuration( duration - 1 ); |
3813 | } | 3813 | } |
3814 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); | 3814 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); |
3815 | } | 3815 | } |
3816 | break; | 3816 | break; |
3817 | //#endif | 3817 | //#endif |
3818 | } // switch | 3818 | } // switch |
3819 | } else { | 3819 | } else { |
3820 | if (KOPrefs::instance()->mConfirm) { | 3820 | if (KOPrefs::instance()->mConfirm) { |
3821 | switch (KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + | 3821 | switch (KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + |
3822 | i18n("\nAre you sure you want\nto delete this event?"), | 3822 | i18n("\nAre you sure you want\nto delete this event?"), |
3823 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { | 3823 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { |
3824 | case KMessageBox::Continue: // OK | 3824 | case KMessageBox::Continue: // OK |
3825 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3825 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3826 | schedule(Scheduler::Cancel,anEvent); | 3826 | schedule(Scheduler::Cancel,anEvent); |
3827 | checkExternalId( anEvent); | 3827 | checkExternalId( anEvent); |
3828 | mCalendar->deleteEvent(anEvent); | 3828 | mCalendar->deleteEvent(anEvent); |
3829 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 3829 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
3830 | break; | 3830 | break; |
3831 | } // switch | 3831 | } // switch |
3832 | } else { | 3832 | } else { |
3833 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3833 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3834 | schedule(Scheduler::Cancel,anEvent); | 3834 | schedule(Scheduler::Cancel,anEvent); |
3835 | checkExternalId( anEvent); | 3835 | checkExternalId( anEvent); |
3836 | mCalendar->deleteEvent(anEvent); | 3836 | mCalendar->deleteEvent(anEvent); |
3837 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 3837 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
3838 | } | 3838 | } |
3839 | } // if-else | 3839 | } // if-else |
3840 | emit updateSearchDialog(); | 3840 | emit updateSearchDialog(); |
3841 | } | 3841 | } |
3842 | 3842 | ||
3843 | bool CalendarView::deleteEvent(const QString &uid) | 3843 | bool CalendarView::deleteEvent(const QString &uid) |
3844 | { | 3844 | { |
3845 | Event *ev = mCalendar->event(uid); | 3845 | Event *ev = mCalendar->event(uid); |
3846 | if (ev) { | 3846 | if (ev) { |
3847 | deleteEvent(ev); | 3847 | deleteEvent(ev); |
3848 | return true; | 3848 | return true; |
3849 | } else { | 3849 | } else { |
3850 | return false; | 3850 | return false; |
3851 | } | 3851 | } |
3852 | } | 3852 | } |
3853 | 3853 | ||
3854 | /*****************************************************************************/ | 3854 | /*****************************************************************************/ |
3855 | 3855 | ||
3856 | void CalendarView::action_mail() | 3856 | void CalendarView::action_mail() |
3857 | { | 3857 | { |
3858 | #ifndef KORG_NOMAIL | 3858 | #ifndef KORG_NOMAIL |
3859 | KOMailClient mailClient; | 3859 | KOMailClient mailClient; |
3860 | 3860 | ||
3861 | Incidence *incidence = currentSelection(); | 3861 | Incidence *incidence = currentSelection(); |
3862 | 3862 | ||
3863 | if (!incidence) { | 3863 | if (!incidence) { |
3864 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 3864 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
3865 | return; | 3865 | return; |
3866 | } | 3866 | } |
3867 | if(incidence->attendeeCount() == 0 ) { | 3867 | if(incidence->attendeeCount() == 0 ) { |
3868 | KMessageBox::sorry(this, | 3868 | KMessageBox::sorry(this, |
3869 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 3869 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
3870 | return; | 3870 | return; |
3871 | } | 3871 | } |
3872 | 3872 | ||
3873 | CalendarLocal cal_tmp; | 3873 | CalendarLocal cal_tmp; |
3874 | Event *event = 0; | 3874 | Event *event = 0; |
3875 | Event *ev = 0; | 3875 | Event *ev = 0; |
3876 | if ( incidence && incidence->typeID() == eventID ) { | 3876 | if ( incidence && incidence->typeID() == eventID ) { |
3877 | event = static_cast<Event *>(incidence); | 3877 | event = static_cast<Event *>(incidence); |
3878 | ev = new Event(*event); | 3878 | ev = new Event(*event); |
3879 | cal_tmp.addEvent(ev); | 3879 | cal_tmp.addEvent(ev); |
3880 | } | 3880 | } |
3881 | ICalFormat mForm(); | 3881 | ICalFormat mForm(); |
3882 | QString attachment = mForm.toString( &cal_tmp ); | 3882 | QString attachment = mForm.toString( &cal_tmp ); |
3883 | if (ev) delete(ev); | 3883 | if (ev) delete(ev); |
3884 | 3884 | ||
3885 | mailClient.mailAttendees(currentSelection(), attachment); | 3885 | mailClient.mailAttendees(currentSelection(), attachment); |
3886 | 3886 | ||
3887 | #endif | 3887 | #endif |
3888 | 3888 | ||
3889 | #if 0 | 3889 | #if 0 |
3890 | Event *anEvent = 0; | 3890 | Event *anEvent = 0; |
3891 | if (mViewManager->currentView()->isEventView()) { | 3891 | if (mViewManager->currentView()->isEventView()) { |
3892 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); | 3892 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); |
3893 | } | 3893 | } |
3894 | 3894 | ||
3895 | if (!anEvent) { | 3895 | if (!anEvent) { |
3896 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 3896 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
3897 | return; | 3897 | return; |
3898 | } | 3898 | } |
3899 | if(anEvent->attendeeCount() == 0 ) { | 3899 | if(anEvent->attendeeCount() == 0 ) { |
3900 | KMessageBox::sorry(this, | 3900 | KMessageBox::sorry(this, |
3901 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 3901 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
3902 | return; | 3902 | return; |
3903 | } | 3903 | } |
3904 | 3904 | ||
3905 | mailobject.emailEvent(anEvent); | 3905 | mailobject.emailEvent(anEvent); |
3906 | #endif | 3906 | #endif |
3907 | } | 3907 | } |
3908 | 3908 | ||
3909 | 3909 | ||
3910 | void CalendarView::schedule_publish(Incidence *incidence) | 3910 | void CalendarView::schedule_publish(Incidence *incidence) |
3911 | { | 3911 | { |
3912 | Event *event = 0; | 3912 | Event *event = 0; |
3913 | Todo *todo = 0; | 3913 | Todo *todo = 0; |
3914 | 3914 | ||
3915 | if (incidence == 0) { | 3915 | if (incidence == 0) { |
3916 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 3916 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
3917 | if (incidence == 0) { | 3917 | if (incidence == 0) { |
3918 | incidence = mTodoList->selectedIncidences().first(); | 3918 | incidence = mTodoList->selectedIncidences().first(); |
3919 | } | 3919 | } |
3920 | } | 3920 | } |
3921 | if ( incidence && incidence->typeID() == eventID ) { | 3921 | if ( incidence && incidence->typeID() == eventID ) { |
3922 | event = static_cast<Event *>(incidence); | 3922 | event = static_cast<Event *>(incidence); |
3923 | } else { | 3923 | } else { |
3924 | if ( incidence && incidence->typeID() == todoID ) { | 3924 | if ( incidence && incidence->typeID() == todoID ) { |
3925 | todo = static_cast<Todo *>(incidence); | 3925 | todo = static_cast<Todo *>(incidence); |
3926 | } | 3926 | } |
3927 | } | 3927 | } |
3928 | 3928 | ||
3929 | if (!event && !todo) { | 3929 | if (!event && !todo) { |
3930 | KMessageBox::sorry(this,i18n("No event selected.")); | 3930 | KMessageBox::sorry(this,i18n("No event selected.")); |
3931 | return; | 3931 | return; |
3932 | } | 3932 | } |
3933 | 3933 | ||
3934 | PublishDialog *publishdlg = new PublishDialog(); | 3934 | PublishDialog *publishdlg = new PublishDialog(); |
3935 | if (incidence->attendeeCount()>0) { | 3935 | if (incidence->attendeeCount()>0) { |
3936 | QPtrList<Attendee> attendees = incidence->attendees(); | 3936 | QPtrList<Attendee> attendees = incidence->attendees(); |
3937 | attendees.first(); | 3937 | attendees.first(); |
3938 | while ( attendees.current()!=0 ) { | 3938 | while ( attendees.current()!=0 ) { |
3939 | publishdlg->addAttendee(attendees.current()); | 3939 | publishdlg->addAttendee(attendees.current()); |
3940 | attendees.next(); | 3940 | attendees.next(); |
3941 | } | 3941 | } |
3942 | } | 3942 | } |
3943 | bool send = true; | 3943 | bool send = true; |
3944 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { | 3944 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { |
3945 | if ( publishdlg->exec() != QDialog::Accepted ) | 3945 | if ( publishdlg->exec() != QDialog::Accepted ) |
3946 | send = false; | 3946 | send = false; |
3947 | } | 3947 | } |
3948 | if ( send ) { | 3948 | if ( send ) { |
3949 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3949 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3950 | if ( event ) { | 3950 | if ( event ) { |
3951 | Event *ev = new Event(*event); | 3951 | Event *ev = new Event(*event); |
3952 | ev->registerObserver(0); | 3952 | ev->registerObserver(0); |
3953 | ev->clearAttendees(); | 3953 | ev->clearAttendees(); |
3954 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 3954 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
3955 | delete(ev); | 3955 | delete(ev); |
3956 | } | 3956 | } |
3957 | } else { | 3957 | } else { |
3958 | if ( todo ) { | 3958 | if ( todo ) { |
3959 | Todo *ev = new Todo(*todo); | 3959 | Todo *ev = new Todo(*todo); |
3960 | ev->registerObserver(0); | 3960 | ev->registerObserver(0); |
3961 | ev->clearAttendees(); | 3961 | ev->clearAttendees(); |
3962 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 3962 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
3963 | delete(ev); | 3963 | delete(ev); |
3964 | } | 3964 | } |
3965 | } | 3965 | } |
3966 | } | 3966 | } |
3967 | } | 3967 | } |
3968 | delete publishdlg; | 3968 | delete publishdlg; |
3969 | } | 3969 | } |
3970 | 3970 | ||
3971 | void CalendarView::schedule_request(Incidence *incidence) | 3971 | void CalendarView::schedule_request(Incidence *incidence) |
3972 | { | 3972 | { |
3973 | schedule(Scheduler::Request,incidence); | 3973 | schedule(Scheduler::Request,incidence); |
3974 | } | 3974 | } |
3975 | 3975 | ||
3976 | void CalendarView::schedule_refresh(Incidence *incidence) | 3976 | void CalendarView::schedule_refresh(Incidence *incidence) |
3977 | { | 3977 | { |
3978 | schedule(Scheduler::Refresh,incidence); | 3978 | schedule(Scheduler::Refresh,incidence); |
3979 | } | 3979 | } |
3980 | 3980 | ||
3981 | void CalendarView::schedule_cancel(Incidence *incidence) | 3981 | void CalendarView::schedule_cancel(Incidence *incidence) |
3982 | { | 3982 | { |
3983 | schedule(Scheduler::Cancel,incidence); | 3983 | schedule(Scheduler::Cancel,incidence); |
3984 | } | 3984 | } |
3985 | 3985 | ||
3986 | void CalendarView::schedule_add(Incidence *incidence) | 3986 | void CalendarView::schedule_add(Incidence *incidence) |
3987 | { | 3987 | { |
3988 | schedule(Scheduler::Add,incidence); | 3988 | schedule(Scheduler::Add,incidence); |
3989 | } | 3989 | } |
3990 | 3990 | ||
3991 | void CalendarView::schedule_reply(Incidence *incidence) | 3991 | void CalendarView::schedule_reply(Incidence *incidence) |
3992 | { | 3992 | { |
3993 | schedule(Scheduler::Reply,incidence); | 3993 | schedule(Scheduler::Reply,incidence); |
3994 | } | 3994 | } |
3995 | 3995 | ||
3996 | void CalendarView::schedule_counter(Incidence *incidence) | 3996 | void CalendarView::schedule_counter(Incidence *incidence) |
3997 | { | 3997 | { |
3998 | schedule(Scheduler::Counter,incidence); | 3998 | schedule(Scheduler::Counter,incidence); |
3999 | } | 3999 | } |
4000 | 4000 | ||
4001 | void CalendarView::schedule_declinecounter(Incidence *incidence) | 4001 | void CalendarView::schedule_declinecounter(Incidence *incidence) |
4002 | { | 4002 | { |
4003 | schedule(Scheduler::Declinecounter,incidence); | 4003 | schedule(Scheduler::Declinecounter,incidence); |
4004 | } | 4004 | } |
4005 | 4005 | ||
4006 | void CalendarView::schedule_publish_freebusy(int daysToPublish) | 4006 | void CalendarView::schedule_publish_freebusy(int daysToPublish) |
4007 | { | 4007 | { |
4008 | QDateTime start = QDateTime::currentDateTime(); | 4008 | QDateTime start = QDateTime::currentDateTime(); |
4009 | QDateTime end = start.addDays(daysToPublish); | 4009 | QDateTime end = start.addDays(daysToPublish); |
4010 | 4010 | ||
4011 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); | 4011 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); |
4012 | freebusy->setOrganizer(KOPrefs::instance()->email()); | 4012 | freebusy->setOrganizer(KOPrefs::instance()->email()); |
4013 | 4013 | ||
4014 | 4014 | ||
4015 | PublishDialog *publishdlg = new PublishDialog(); | 4015 | PublishDialog *publishdlg = new PublishDialog(); |
4016 | if ( publishdlg->exec() == QDialog::Accepted ) { | 4016 | if ( publishdlg->exec() == QDialog::Accepted ) { |
4017 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 4017 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
4018 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { | 4018 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { |
4019 | delete(freebusy); | 4019 | delete(freebusy); |
4020 | } | 4020 | } |
4021 | } | 4021 | } |
4022 | delete publishdlg; | 4022 | delete publishdlg; |
4023 | } | 4023 | } |
4024 | 4024 | ||
4025 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) | 4025 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) |
4026 | { | 4026 | { |
4027 | Event *event = 0; | 4027 | Event *event = 0; |
4028 | Todo *todo = 0; | 4028 | Todo *todo = 0; |
4029 | 4029 | ||
4030 | if (incidence == 0) { | 4030 | if (incidence == 0) { |
4031 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 4031 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
4032 | if (incidence == 0) { | 4032 | if (incidence == 0) { |
4033 | incidence = mTodoList->selectedIncidences().first(); | 4033 | incidence = mTodoList->selectedIncidences().first(); |
4034 | } | 4034 | } |
4035 | } | 4035 | } |
4036 | if ( incidence && incidence->typeID() == eventID ) { | 4036 | if ( incidence && incidence->typeID() == eventID ) { |
4037 | event = static_cast<Event *>(incidence); | 4037 | event = static_cast<Event *>(incidence); |
4038 | } | 4038 | } |
4039 | if ( incidence && incidence->typeID() == todoID ) { | 4039 | if ( incidence && incidence->typeID() == todoID ) { |
4040 | todo = static_cast<Todo *>(incidence); | 4040 | todo = static_cast<Todo *>(incidence); |
4041 | } | 4041 | } |
4042 | 4042 | ||
4043 | if (!event && !todo) { | 4043 | if (!event && !todo) { |
4044 | KMessageBox::sorry(this,i18n("No event selected.")); | 4044 | KMessageBox::sorry(this,i18n("No event selected.")); |
4045 | return; | 4045 | return; |
4046 | } | 4046 | } |
4047 | 4047 | ||
4048 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { | 4048 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { |
4049 | KMessageBox::sorry(this,i18n("The event has no attendees.")); | 4049 | KMessageBox::sorry(this,i18n("The event has no attendees.")); |
4050 | return; | 4050 | return; |
4051 | } | 4051 | } |
4052 | 4052 | ||
4053 | Event *ev = 0; | 4053 | Event *ev = 0; |
4054 | if (event) ev = new Event(*event); | 4054 | if (event) ev = new Event(*event); |
4055 | Todo *to = 0; | 4055 | Todo *to = 0; |
4056 | if (todo) to = new Todo(*todo); | 4056 | if (todo) to = new Todo(*todo); |
4057 | 4057 | ||
4058 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { | 4058 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { |
4059 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 4059 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
4060 | if (!me) { | 4060 | if (!me) { |
4061 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); | 4061 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); |
4062 | return; | 4062 | return; |
4063 | } | 4063 | } |
4064 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { | 4064 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { |
4065 | StatusDialog *statdlg = new StatusDialog(this); | 4065 | StatusDialog *statdlg = new StatusDialog(this); |
4066 | if (!statdlg->exec()==QDialog::Accepted) return; | 4066 | if (!statdlg->exec()==QDialog::Accepted) return; |
4067 | me->setStatus( statdlg->status() ); | 4067 | me->setStatus( statdlg->status() ); |
4068 | delete(statdlg); | 4068 | delete(statdlg); |
4069 | } | 4069 | } |
4070 | Attendee *menew = new Attendee(*me); | 4070 | Attendee *menew = new Attendee(*me); |
4071 | if (ev) { | 4071 | if (ev) { |
4072 | ev->clearAttendees(); | 4072 | ev->clearAttendees(); |
4073 | ev->addAttendee(menew,false); | 4073 | ev->addAttendee(menew,false); |
4074 | } else { | 4074 | } else { |
4075 | if (to) { | 4075 | if (to) { |
4076 | todo->clearAttendees(); | 4076 | todo->clearAttendees(); |
4077 | todo->addAttendee(menew,false); | 4077 | todo->addAttendee(menew,false); |
4078 | } | 4078 | } |
4079 | } | 4079 | } |
4080 | } | 4080 | } |
4081 | 4081 | ||
4082 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 4082 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
4083 | if (ev) { | 4083 | if (ev) { |
4084 | if ( !dlg->addMessage(ev,method) ) delete(ev); | 4084 | if ( !dlg->addMessage(ev,method) ) delete(ev); |
4085 | } else { | 4085 | } else { |
4086 | if (to) { | 4086 | if (to) { |
4087 | if ( !dlg->addMessage(to,method) ) delete(to); | 4087 | if ( !dlg->addMessage(to,method) ) delete(to); |
4088 | } | 4088 | } |
4089 | } | 4089 | } |
4090 | } | 4090 | } |
4091 | 4091 | ||
4092 | void CalendarView::openAddressbook() | 4092 | void CalendarView::openAddressbook() |
4093 | { | 4093 | { |
4094 | KRun::runCommand("kaddressbook"); | 4094 | KRun::runCommand("kaddressbook"); |
4095 | } | 4095 | } |
4096 | 4096 | ||
4097 | void CalendarView::setModified(bool modified) | 4097 | void CalendarView::setModified(bool modified) |
4098 | { | 4098 | { |
4099 | //qDebug("CalendarView::setModified %d ", modified); | 4099 | //qDebug("CalendarView::setModified %d ", modified); |
4100 | if ( modified ) | 4100 | if ( modified ) |
4101 | emit signalmodified(); | 4101 | emit signalmodified(); |
4102 | mModified = modified; | 4102 | mModified = modified; |
4103 | if ( mModified ) | 4103 | if ( mModified ) |
4104 | emit modifiedChanged(mModified); | 4104 | emit modifiedChanged(mModified); |
4105 | 4105 | ||
4106 | } | 4106 | } |
4107 | 4107 | ||
4108 | bool CalendarView::isReadOnly() | 4108 | bool CalendarView::isReadOnly() |
4109 | { | 4109 | { |
4110 | return mReadOnly; | 4110 | return mReadOnly; |
4111 | } | 4111 | } |
4112 | 4112 | ||
4113 | void CalendarView::setReadOnly(bool readOnly) | 4113 | void CalendarView::setReadOnly(bool readOnly) |
4114 | { | 4114 | { |
4115 | if (mReadOnly != readOnly) { | 4115 | if (mReadOnly != readOnly) { |
4116 | mReadOnly = readOnly; | 4116 | mReadOnly = readOnly; |
4117 | emit readOnlyChanged(mReadOnly); | 4117 | emit readOnlyChanged(mReadOnly); |
4118 | } | 4118 | } |
4119 | } | 4119 | } |
4120 | 4120 | ||
4121 | bool CalendarView::isModified() | 4121 | bool CalendarView::isModified() |
4122 | { | 4122 | { |
4123 | return mModified; | 4123 | return mModified; |
4124 | } | 4124 | } |
4125 | void CalendarView::slotprintSelInc() | 4125 | void CalendarView::slotprintSelInc() |
4126 | { | 4126 | { |
4127 | if ( currentSelection() == 0 ) { | 4127 | if ( currentSelection() == 0 ) { |
4128 | KMessageBox::sorry(this,i18n("There is nothing selected!")); | 4128 | KMessageBox::sorry(this,i18n("There is nothing selected!")); |
4129 | return; | 4129 | return; |
4130 | } | 4130 | } |
4131 | showIncidence(); | 4131 | showIncidence(); |
4132 | getEventViewerDialog()->print(); | 4132 | getEventViewerDialog()->print(); |
4133 | 4133 | ||
4134 | } | 4134 | } |
4135 | void CalendarView::printSetup() | 4135 | void CalendarView::printSetup() |
4136 | { | 4136 | { |
4137 | #ifndef KORG_NOPRINTER | 4137 | #ifndef KORG_NOPRINTER |
4138 | createPrinter(); | 4138 | createPrinter(); |
4139 | 4139 | ||
4140 | mCalPrinter->setupPrinter(); | 4140 | mCalPrinter->setupPrinter(); |
4141 | #endif | 4141 | #endif |
4142 | } | 4142 | } |
4143 | 4143 | ||
4144 | void CalendarView::print() | 4144 | void CalendarView::print() |
4145 | { | 4145 | { |
4146 | #ifndef KORG_NOPRINTER | 4146 | #ifndef KORG_NOPRINTER |
4147 | createPrinter(); | 4147 | createPrinter(); |
4148 | 4148 | ||
4149 | DateList tmpDateList = mNavigator->selectedDates(); | 4149 | DateList tmpDateList = mNavigator->selectedDates(); |
4150 | mCalPrinter->print(CalPrinter::Month, | 4150 | mCalPrinter->print(CalPrinter::Month, |
4151 | tmpDateList.first(), tmpDateList.last()); | 4151 | tmpDateList.first(), tmpDateList.last()); |
4152 | #endif | 4152 | #endif |
4153 | } | 4153 | } |
4154 | 4154 | ||
4155 | void CalendarView::printPreview() | 4155 | void CalendarView::printPreview() |
4156 | { | 4156 | { |
4157 | #ifndef KORG_NOPRINTER | 4157 | #ifndef KORG_NOPRINTER |
4158 | kdDebug() << "CalendarView::printPreview()" << endl; | 4158 | kdDebug() << "CalendarView::printPreview()" << endl; |
4159 | 4159 | ||
4160 | createPrinter(); | 4160 | createPrinter(); |
4161 | 4161 | ||
4162 | DateList tmpDateList = mNavigator->selectedDates(); | 4162 | DateList tmpDateList = mNavigator->selectedDates(); |
4163 | 4163 | ||
4164 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), | 4164 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), |
4165 | tmpDateList.last()); | 4165 | tmpDateList.last()); |
4166 | #endif | 4166 | #endif |
4167 | } | 4167 | } |
4168 | 4168 | ||
4169 | void CalendarView::exportICalendar() | 4169 | void CalendarView::exportICalendar() |
4170 | { | 4170 | { |
4171 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); | 4171 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); |
4172 | 4172 | ||
4173 | // Force correct extension | 4173 | // Force correct extension |
4174 | if (filename.right(4) != ".ics") filename += ".ics"; | 4174 | if (filename.right(4) != ".ics") filename += ".ics"; |
4175 | 4175 | ||
4176 | FileStorage storage( mCalendar, filename, new ICalFormat() ); | 4176 | FileStorage storage( mCalendar, filename, new ICalFormat() ); |
4177 | storage.save(); | 4177 | storage.save(); |
4178 | } | 4178 | } |
4179 | 4179 | ||
4180 | bool CalendarView::exportVCalendar( QString filename ) | 4180 | bool CalendarView::exportVCalendar( QString filename ) |
4181 | { | 4181 | { |
4182 | if (mCalendar->journals().count() > 0) { | 4182 | if (mCalendar->journals().count() > 0) { |
4183 | int result = KMessageBox::warningContinueCancel(this, | 4183 | int result = KMessageBox::warningContinueCancel(this, |
4184 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 4184 | i18n("The journal entries can not be\nexported to a vCalendar file."), |
4185 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | 4185 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), |
4186 | true); | 4186 | true); |
4187 | if (result != KMessageBox::Continue) return false; | 4187 | if (result != KMessageBox::Continue) return false; |
4188 | } | 4188 | } |
4189 | 4189 | ||
4190 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); | 4190 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); |
4191 | 4191 | ||
4192 | // Force correct extension | 4192 | // Force correct extension |
4193 | if (filename.right(4) != ".vcs") filename += ".vcs"; | 4193 | if (filename.right(4) != ".vcs") filename += ".vcs"; |
4194 | 4194 | ||
4195 | FileStorage storage( mCalendar, filename, new VCalFormat ); | 4195 | FileStorage storage( mCalendar, filename, new VCalFormat ); |
4196 | return storage.save(); | 4196 | return storage.save(); |
4197 | 4197 | ||
4198 | } | 4198 | } |
4199 | 4199 | ||
4200 | void CalendarView::eventUpdated(Incidence *) | 4200 | void CalendarView::eventUpdated(Incidence *) |
4201 | { | 4201 | { |
4202 | setModified(); | 4202 | setModified(); |
4203 | // Don't call updateView here. The code, which has caused the update of the | 4203 | // Don't call updateView here. The code, which has caused the update of the |
4204 | // event is responsible for updating the view. | 4204 | // event is responsible for updating the view. |
4205 | // updateView(); | 4205 | // updateView(); |
4206 | } | 4206 | } |
4207 | 4207 | ||
4208 | void CalendarView::adaptNavigationUnits() | 4208 | void CalendarView::adaptNavigationUnits() |
4209 | { | 4209 | { |
4210 | if (mViewManager->currentView()->isEventView()) { | 4210 | if (mViewManager->currentView()->isEventView()) { |
4211 | int days = mViewManager->currentView()->currentDateCount(); | 4211 | int days = mViewManager->currentView()->currentDateCount(); |
4212 | if (days == 1) { | 4212 | if (days == 1) { |
4213 | emit changeNavStringPrev(i18n("&Previous Day")); | 4213 | emit changeNavStringPrev(i18n("&Previous Day")); |
4214 | emit changeNavStringNext(i18n("&Next Day")); | 4214 | emit changeNavStringNext(i18n("&Next Day")); |
4215 | } else { | 4215 | } else { |
4216 | emit changeNavStringPrev(i18n("&Previous Week")); | 4216 | emit changeNavStringPrev(i18n("&Previous Week")); |
4217 | emit changeNavStringNext(i18n("&Next Week")); | 4217 | emit changeNavStringNext(i18n("&Next Week")); |
4218 | } | 4218 | } |
4219 | } | 4219 | } |
4220 | } | 4220 | } |
4221 | 4221 | ||
4222 | void CalendarView::processMainViewSelection( Incidence *incidence ) | 4222 | void CalendarView::processMainViewSelection( Incidence *incidence ) |
4223 | { | 4223 | { |
4224 | if ( incidence ) mTodoList->clearSelection(); | 4224 | if ( incidence ) mTodoList->clearSelection(); |
4225 | processIncidenceSelection( incidence ); | 4225 | processIncidenceSelection( incidence ); |
4226 | } | 4226 | } |
4227 | 4227 | ||
4228 | void CalendarView::processTodoListSelection( Incidence *incidence ) | 4228 | void CalendarView::processTodoListSelection( Incidence *incidence ) |
4229 | { | 4229 | { |
4230 | if ( incidence && mViewManager->currentView() ) { | 4230 | if ( incidence && mViewManager->currentView() ) { |
4231 | mViewManager->currentView()->clearSelection(); | 4231 | mViewManager->currentView()->clearSelection(); |
4232 | } | 4232 | } |
4233 | processIncidenceSelection( incidence ); | 4233 | processIncidenceSelection( incidence ); |
4234 | } | 4234 | } |
4235 | 4235 | ||
4236 | void CalendarView::processIncidenceSelection( Incidence *incidence ) | 4236 | void CalendarView::processIncidenceSelection( Incidence *incidence ) |
4237 | { | 4237 | { |
4238 | emit incidenceSelected( incidence ); | 4238 | emit incidenceSelected( incidence ); |
4239 | if ( incidence == mSelectedIncidence ) return; | 4239 | if ( incidence == mSelectedIncidence ) return; |
4240 | mSelectedIncidence = incidence; | 4240 | mSelectedIncidence = incidence; |
4241 | 4241 | ||
4242 | if ( incidence && incidence->typeID() == eventID ) { | 4242 | if ( incidence && incidence->typeID() == eventID ) { |
4243 | Event *event = static_cast<Event *>( incidence ); | 4243 | Event *event = static_cast<Event *>( incidence ); |
4244 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 4244 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
4245 | emit organizerEventsSelected( true ); | 4245 | emit organizerEventsSelected( true ); |
4246 | } else { | 4246 | } else { |
4247 | emit organizerEventsSelected(false); | 4247 | emit organizerEventsSelected(false); |
4248 | } | 4248 | } |
4249 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 4249 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
4250 | KOPrefs::instance()->email() ) ) { | 4250 | KOPrefs::instance()->email() ) ) { |
4251 | emit groupEventsSelected( true ); | 4251 | emit groupEventsSelected( true ); |
4252 | } else { | 4252 | } else { |
4253 | emit groupEventsSelected(false); | 4253 | emit groupEventsSelected(false); |
4254 | } | 4254 | } |
4255 | return; | 4255 | return; |
4256 | } else { | 4256 | } else { |
4257 | if ( incidence && incidence->typeID() == todoID ) { | 4257 | if ( incidence && incidence->typeID() == todoID ) { |
4258 | emit todoSelected( true ); | 4258 | emit todoSelected( true ); |
4259 | Todo *event = static_cast<Todo *>( incidence ); | 4259 | Todo *event = static_cast<Todo *>( incidence ); |
4260 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 4260 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
4261 | emit organizerEventsSelected( true ); | 4261 | emit organizerEventsSelected( true ); |
4262 | } else { | 4262 | } else { |
4263 | emit organizerEventsSelected(false); | 4263 | emit organizerEventsSelected(false); |
4264 | } | 4264 | } |
4265 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 4265 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
4266 | KOPrefs::instance()->email() ) ) { | 4266 | KOPrefs::instance()->email() ) ) { |
4267 | emit groupEventsSelected( true ); | 4267 | emit groupEventsSelected( true ); |
4268 | } else { | 4268 | } else { |
4269 | emit groupEventsSelected(false); | 4269 | emit groupEventsSelected(false); |
4270 | } | 4270 | } |
4271 | return; | 4271 | return; |
4272 | } else { | 4272 | } else { |
4273 | emit todoSelected( false ); | 4273 | emit todoSelected( false ); |
4274 | emit organizerEventsSelected(false); | 4274 | emit organizerEventsSelected(false); |
4275 | emit groupEventsSelected(false); | 4275 | emit groupEventsSelected(false); |
4276 | } | 4276 | } |
4277 | return; | 4277 | return; |
4278 | } | 4278 | } |
4279 | 4279 | ||
4280 | /* if ( incidence && incidence->typeID() == todoID ) { | 4280 | /* if ( incidence && incidence->typeID() == todoID ) { |
4281 | emit todoSelected( true ); | 4281 | emit todoSelected( true ); |
4282 | } else { | 4282 | } else { |
4283 | emit todoSelected( false ); | 4283 | emit todoSelected( false ); |
4284 | }*/ | 4284 | }*/ |
4285 | } | 4285 | } |
4286 | 4286 | ||
4287 | 4287 | ||
4288 | void CalendarView::checkClipboard() | 4288 | void CalendarView::checkClipboard() |
4289 | { | 4289 | { |
4290 | #ifndef KORG_NODND | 4290 | #ifndef KORG_NODND |
4291 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { | 4291 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { |
4292 | emit pasteEnabled(true); | 4292 | emit pasteEnabled(true); |
4293 | } else { | 4293 | } else { |
4294 | emit pasteEnabled(false); | 4294 | emit pasteEnabled(false); |
4295 | } | 4295 | } |
4296 | #endif | 4296 | #endif |
4297 | } | 4297 | } |
4298 | 4298 | ||
4299 | void CalendarView::showDates(const DateList &selectedDates) | 4299 | void CalendarView::showDates(const DateList &selectedDates) |
4300 | { | 4300 | { |
4301 | // kdDebug() << "CalendarView::selectDates()" << endl; | 4301 | // kdDebug() << "CalendarView::selectDates()" << endl; |
4302 | 4302 | ||
4303 | 4303 | ||
4304 | if ( !mBlockShowDates ) { | 4304 | if ( !mBlockShowDates ) { |
4305 | if ( mViewManager->currentView() ) { | 4305 | if ( mViewManager->currentView() ) { |
4306 | updateView( selectedDates.first(), selectedDates.last() ); | 4306 | updateView( selectedDates.first(), selectedDates.last() ); |
4307 | } else { | 4307 | } else { |
4308 | mViewManager->showAgendaView(); | 4308 | mViewManager->showAgendaView(); |
4309 | } | 4309 | } |
4310 | } | 4310 | } |
4311 | 4311 | ||
4312 | QDate date = selectedDates.first(); | 4312 | QDate date = selectedDates.first(); |
4313 | if ( ! date.isValid() ) { | 4313 | if ( ! date.isValid() ) { |
4314 | topLevelWidget()->setCaption(""); | 4314 | topLevelWidget()->setCaption(""); |
4315 | return; | 4315 | return; |
4316 | } | 4316 | } |
4317 | 4317 | ||
4318 | QString selDates; | 4318 | QString selDates; |
4319 | selDates = KGlobal::locale()->formatDate( date, true); | 4319 | selDates = KGlobal::locale()->formatDate( date, true); |
4320 | if (selectedDates.first() < selectedDates.last() ) | 4320 | if (selectedDates.first() < selectedDates.last() ) |
4321 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); | 4321 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); |
4322 | else { | 4322 | else { |
4323 | QString addString; | 4323 | QString addString; |
4324 | if ( date == QDateTime::currentDateTime().date() ) | 4324 | if ( date == QDateTime::currentDateTime().date() ) |
4325 | addString = i18n("Today"); | 4325 | addString = i18n("Today"); |
4326 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 4326 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
4327 | addString = i18n("Tomorrow"); | 4327 | addString = i18n("Tomorrow"); |
4328 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) | 4328 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) |
4329 | addString = i18n("Yesterday"); | 4329 | addString = i18n("Yesterday"); |
4330 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) | 4330 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) |
4331 | addString = i18n("Day before yesterday"); | 4331 | addString = i18n("Day before yesterday"); |
4332 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) | 4332 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) |
4333 | addString = i18n("Day after tomorrow"); | 4333 | addString = i18n("Day after tomorrow"); |
4334 | if ( !addString.isEmpty() ) { | 4334 | if ( !addString.isEmpty() ) { |
4335 | topLevelWidget()->setCaption( addString+", " + selDates ); | 4335 | topLevelWidget()->setCaption( addString+", " + selDates ); |
4336 | return; | 4336 | return; |
4337 | } | 4337 | } |
4338 | } | 4338 | } |
4339 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); | 4339 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); |
4340 | 4340 | ||
4341 | } | 4341 | } |
4342 | 4342 | ||
4343 | QPtrList<CalFilter> CalendarView::filters() | 4343 | QPtrList<CalFilter> CalendarView::filters() |
4344 | { | 4344 | { |
4345 | return mFilters; | 4345 | return mFilters; |
4346 | 4346 | ||
4347 | } | 4347 | } |
4348 | void CalendarView::editFilters() | 4348 | void CalendarView::editFilters() |
4349 | { | 4349 | { |
4350 | // kdDebug() << "CalendarView::editFilters()" << endl; | 4350 | // kdDebug() << "CalendarView::editFilters()" << endl; |
4351 | 4351 | ||
4352 | CalFilter *filter = mFilters.first(); | 4352 | CalFilter *filter = mFilters.first(); |
4353 | while(filter) { | 4353 | while(filter) { |
4354 | filter = mFilters.next(); | 4354 | filter = mFilters.next(); |
4355 | } | 4355 | } |
4356 | 4356 | ||
4357 | mDialogManager->showFilterEditDialog(&mFilters); | 4357 | mDialogManager->showFilterEditDialog(&mFilters); |
4358 | updateFilter(); | 4358 | updateFilter(); |
4359 | } | 4359 | } |
4360 | void CalendarView::toggleFilter() | 4360 | void CalendarView::toggleFilter() |
4361 | { | 4361 | { |
4362 | if ( mLeftFrame->isHidden() ) { | 4362 | if ( mLeftFrame->isHidden() ) { |
4363 | toggleExpand(); | 4363 | toggleExpand(); |
4364 | showFilter( true ); | 4364 | showFilter( true ); |
4365 | } else | 4365 | } else |
4366 | showFilter(! mCalEditView->isVisible()); | 4366 | showFilter(! mCalEditView->isVisible()); |
4367 | } | 4367 | } |
4368 | 4368 | ||
4369 | KOFilterView *CalendarView::filterView() | 4369 | KOFilterView *CalendarView::filterView() |
4370 | { | 4370 | { |
4371 | return mFilterView; | 4371 | return mFilterView; |
4372 | } | 4372 | } |
4373 | void CalendarView::selectFilter( int fil ) | 4373 | void CalendarView::selectFilter( int fil ) |
4374 | { | 4374 | { |
4375 | mFilterView->setSelectedFilter( fil ); | 4375 | mFilterView->setSelectedFilter( fil ); |
4376 | updateUnmanagedViews(); | 4376 | updateUnmanagedViews(); |
4377 | } | 4377 | } |
4378 | void CalendarView::showFilter(bool visible) | 4378 | void CalendarView::showFilter(bool visible) |
4379 | { | 4379 | { |
4380 | #if 1 | 4380 | #if 1 |
4381 | if (visible) { | 4381 | if (visible) { |
4382 | mCalEditView->readConfig(); | 4382 | mCalEditView->readConfig(); |
4383 | mCalEditView->show(); | 4383 | mCalEditView->show(); |
4384 | QValueList<int> sizes; | 4384 | QValueList<int> sizes; |
4385 | sizes = mLeftFrame->sizes(); | 4385 | sizes = mLeftFrame->sizes(); |
4386 | if ( sizes.count() == 4 && sizes[3] < 20 ) { | 4386 | if ( sizes.count() == 4 && sizes[3] < 20 ) { |
4387 | sizes.clear(); | 4387 | sizes.clear(); |
4388 | sizes << 100; | 4388 | sizes << 100; |
4389 | sizes << 0; | 4389 | sizes << 0; |
4390 | sizes << 0; | 4390 | sizes << 0; |
4391 | sizes << 100; | 4391 | sizes << 100; |
4392 | mLeftFrame->setSizes(sizes); | 4392 | mLeftFrame->setSizes(sizes); |
4393 | } | 4393 | } |
4394 | #if 0 | 4394 | #if 0 |
4395 | sizes = mLeftFrame->sizes(); | 4395 | sizes = mLeftFrame->sizes(); |
4396 | int ccc = 0; | 4396 | int ccc = 0; |
4397 | while ( ccc < sizes.count()) { | 4397 | while ( ccc < sizes.count()) { |
4398 | qDebug("size %d %d ", ccc, sizes[ccc]); | 4398 | qDebug("size %d %d ", ccc, sizes[ccc]); |
4399 | ++ccc; | 4399 | ++ccc; |
4400 | } | 4400 | } |
4401 | #endif | 4401 | #endif |
4402 | 4402 | ||
4403 | } | 4403 | } |
4404 | else { | 4404 | else { |
4405 | mCalEditView->hide(); | 4405 | mCalEditView->hide(); |
4406 | } | 4406 | } |
4407 | #else | 4407 | #else |
4408 | if (visible) mFilterView->show(); | 4408 | if (visible) mFilterView->show(); |
4409 | else mFilterView->hide(); | 4409 | else mFilterView->hide(); |
4410 | #endif | 4410 | #endif |
4411 | } | 4411 | } |
4412 | void CalendarView::toggleFilerEnabled( ) | 4412 | void CalendarView::toggleFilerEnabled( ) |
4413 | { | 4413 | { |
4414 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); | 4414 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); |
4415 | if ( !mFilterView->filtersEnabled() ) | 4415 | if ( !mFilterView->filtersEnabled() ) |
4416 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); | 4416 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); |
4417 | updateUnmanagedViews(); | 4417 | updateUnmanagedViews(); |
4418 | 4418 | ||
4419 | } | 4419 | } |
4420 | void CalendarView::updateFilter() | 4420 | void CalendarView::updateFilter() |
4421 | { | 4421 | { |