author | zautrix <zautrix> | 2005-07-03 07:33:48 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-03 07:33:48 (UTC) |
commit | 914c795a77d8bb28fc8c2155cfc9524f3effdde1 (patch) (unidiff) | |
tree | 25f8bb908b4afd982a874fc890c5e3ae75fe6d6d | |
parent | 3e2908a91251482d91404464aaf98ce902a319ce (diff) | |
download | kdepimpi-914c795a77d8bb28fc8c2155cfc9524f3effdde1.zip kdepimpi-914c795a77d8bb28fc8c2155cfc9524f3effdde1.tar.gz kdepimpi-914c795a77d8bb28fc8c2155cfc9524f3effdde1.tar.bz2 |
slider fix
-rw-r--r-- | korganizer/calendarview.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 6746de2..a10e93c 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2249,771 +2249,776 @@ void CalendarView::readSettings() | |||
2249 | x = list[0].toInt(); | 2249 | x = list[0].toInt(); |
2250 | y = list[1].toInt(); | 2250 | y = list[1].toInt(); |
2251 | w = list[2].toInt(); | 2251 | w = list[2].toInt(); |
2252 | h = list[3].toInt(); | 2252 | h = list[3].toInt(); |
2253 | KApplication::testCoords( &x,&y,&w,&h ); | 2253 | KApplication::testCoords( &x,&y,&w,&h ); |
2254 | mTodoEditor->setGeometry(x,y,w,h); | 2254 | mTodoEditor->setGeometry(x,y,w,h); |
2255 | 2255 | ||
2256 | } | 2256 | } |
2257 | list = config->readListEntry("ViewerLayout"); | 2257 | list = config->readListEntry("ViewerLayout"); |
2258 | if ( ! list.isEmpty() ) { | 2258 | if ( ! list.isEmpty() ) { |
2259 | x = list[0].toInt(); | 2259 | x = list[0].toInt(); |
2260 | y = list[1].toInt(); | 2260 | y = list[1].toInt(); |
2261 | w = list[2].toInt(); | 2261 | w = list[2].toInt(); |
2262 | h = list[3].toInt(); | 2262 | h = list[3].toInt(); |
2263 | KApplication::testCoords( &x,&y,&w,&h ); | 2263 | KApplication::testCoords( &x,&y,&w,&h ); |
2264 | getEventViewerDialog()->setGeometry(x,y,w,h); | 2264 | getEventViewerDialog()->setGeometry(x,y,w,h); |
2265 | } | 2265 | } |
2266 | #endif | 2266 | #endif |
2267 | config->setGroup( "Views" ); | 2267 | config->setGroup( "Views" ); |
2268 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 2268 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
2269 | 2269 | ||
2270 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | 2270 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); |
2271 | 2271 | ||
2272 | int resetval = 0; | 2272 | int resetval = 0; |
2273 | int maxVal = 0; | 2273 | int maxVal = 0; |
2274 | if (sizes.count() != 3) { | 2274 | if (sizes.count() != 3) { |
2275 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2275 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2276 | resetval = mDateNavigator->sizeHint().width()+2; | 2276 | resetval = mDateNavigator->sizeHint().width()+2; |
2277 | } else { | 2277 | } else { |
2278 | resetval = mDateNavigator->sizeHint().height()+2; | 2278 | resetval = mDateNavigator->sizeHint().height()+2; |
2279 | } | 2279 | } |
2280 | } | 2280 | } |
2281 | if ( resetval ) { | 2281 | if ( resetval ) { |
2282 | sizes.clear(); | 2282 | sizes.clear(); |
2283 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2283 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2284 | maxVal = QApplication::desktop()->width() -10; | 2284 | maxVal = QApplication::desktop()->width() -10; |
2285 | } else { | 2285 | } else { |
2286 | maxVal = QApplication::desktop()->height()-10; | 2286 | maxVal = QApplication::desktop()->height()-10; |
2287 | } | 2287 | } |
2288 | sizes << resetval; | 2288 | sizes << resetval; |
2289 | if ( maxVal < resetval + resetval) | 2289 | if ( maxVal < resetval + resetval) |
2290 | resetval = maxVal - resetval; | 2290 | resetval = maxVal - resetval; |
2291 | sizes << resetval; | 2291 | sizes << resetval; |
2292 | sizes << 100; | 2292 | sizes << 100; |
2293 | } | 2293 | } |
2294 | mLeftFrame->setSizes(sizes); | 2294 | mLeftFrame->setSizes(sizes); |
2295 | sizes = config->readIntListEntry("Main Splitter Frame"); | 2295 | sizes = config->readIntListEntry("Main Splitter Frame"); |
2296 | resetval = 0; | 2296 | resetval = 0; |
2297 | maxVal = 0; | 2297 | maxVal = 0; |
2298 | if (sizes.count() != 2) { | 2298 | if (sizes.count() != 2) { |
2299 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2299 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2300 | resetval = mDateNavigator->sizeHint().width()+2; | 2300 | resetval = mDateNavigator->sizeHint().width()+2; |
2301 | } else { | 2301 | } else { |
2302 | resetval = mDateNavigator->sizeHint().height()+2; | 2302 | resetval = mDateNavigator->sizeHint().height()+2; |
2303 | } | 2303 | } |
2304 | } | 2304 | } |
2305 | if ( resetval ) { | 2305 | if ( resetval ) { |
2306 | sizes.clear(); | 2306 | sizes.clear(); |
2307 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2307 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2308 | maxVal = QApplication::desktop()->width() -10; | 2308 | maxVal = QApplication::desktop()->width() -10; |
2309 | } else { | 2309 | } else { |
2310 | maxVal = QApplication::desktop()->height()-10; | 2310 | maxVal = QApplication::desktop()->height()-10; |
2311 | } | 2311 | } |
2312 | sizes << resetval; | 2312 | sizes << resetval; |
2313 | if ( maxVal < resetval + resetval) | 2313 | if ( maxVal < resetval + resetval) |
2314 | resetval = maxVal - resetval; | 2314 | resetval = maxVal - resetval; |
2315 | sizes << resetval; | 2315 | sizes << resetval; |
2316 | } | 2316 | } |
2317 | mMainFrame->setSizes(sizes); | 2317 | mMainFrame->setSizes(sizes); |
2318 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 2318 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
2319 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 2319 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
2320 | else mNavigator->selectDates( dateCount ); | 2320 | else mNavigator->selectDates( dateCount ); |
2321 | // mViewManager->readSettings( config ); | 2321 | // mViewManager->readSettings( config ); |
2322 | updateConfig(); | 2322 | updateConfig(); |
2323 | globalFlagBlockAgenda = 2; | 2323 | globalFlagBlockAgenda = 2; |
2324 | mViewManager->readSettings( config ); | 2324 | mViewManager->readSettings( config ); |
2325 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); | 2325 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); |
2326 | } | 2326 | } |
2327 | 2327 | ||
2328 | void CalendarView::checkSuspendAlarm() | 2328 | void CalendarView::checkSuspendAlarm() |
2329 | { | 2329 | { |
2330 | if ( mSuspendTimer->isActive() ) { | 2330 | if ( mSuspendTimer->isActive() ) { |
2331 | KMessageBox::information( this, i18n("<b>WARNING:</b> There is a pending suspended alarm!"), i18n("Pending Suspend Alarm")); | 2331 | KMessageBox::information( this, i18n("<b>WARNING:</b> There is a pending suspended alarm!"), i18n("Pending Suspend Alarm")); |
2332 | } | 2332 | } |
2333 | } | 2333 | } |
2334 | void CalendarView::writeSettings() | 2334 | void CalendarView::writeSettings() |
2335 | { | 2335 | { |
2336 | // kdDebug() << "CalendarView::writeSettings" << endl; | 2336 | // kdDebug() << "CalendarView::writeSettings" << endl; |
2337 | 2337 | ||
2338 | KConfig *config = KOGlobals::config(); | 2338 | KConfig *config = KOGlobals::config(); |
2339 | 2339 | ||
2340 | mViewManager->writeSettings( config ); | 2340 | mViewManager->writeSettings( config ); |
2341 | mTodoList->saveLayout(config,QString("Todo Layout")); | 2341 | mTodoList->saveLayout(config,QString("Todo Layout")); |
2342 | mDialogManager->writeSettings( config ); | 2342 | mDialogManager->writeSettings( config ); |
2343 | //KOPrefs::instance()->usrWriteConfig(); | 2343 | //KOPrefs::instance()->usrWriteConfig(); |
2344 | KOPrefs::instance()->writeConfig(); | 2344 | KOPrefs::instance()->writeConfig(); |
2345 | 2345 | ||
2346 | writeFilterSettings(config); | 2346 | writeFilterSettings(config); |
2347 | config->setGroup( "AppRun" ); | 2347 | config->setGroup( "AppRun" ); |
2348 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 2348 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
2349 | int days = dt.daysTo( QDate::currentDate() ); | 2349 | int days = dt.daysTo( QDate::currentDate() ); |
2350 | dt = dt.addDays( days ); | 2350 | dt = dt.addDays( days ); |
2351 | int secs = dt.secsTo( QDateTime::currentDateTime() ); | 2351 | int secs = dt.secsTo( QDateTime::currentDateTime() ); |
2352 | config->writeEntry( "LatestProgramStopDays", days ); | 2352 | config->writeEntry( "LatestProgramStopDays", days ); |
2353 | config->writeEntry( "LatestProgramStopSecs", secs ); | 2353 | config->writeEntry( "LatestProgramStopSecs", secs ); |
2354 | //qDebug("KO: Writing stop time: %d ", secs); | 2354 | //qDebug("KO: Writing stop time: %d ", secs); |
2355 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 2355 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
2356 | //QDateTime latest = dt.addSecs ( secs ); | 2356 | //QDateTime latest = dt.addSecs ( secs ); |
2357 | //qDebug("KO: Termination on %s ", latest.toString().latin1()); | 2357 | //qDebug("KO: Termination on %s ", latest.toString().latin1()); |
2358 | config->setGroup( "Views" ); | 2358 | config->setGroup( "Views" ); |
2359 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 2359 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
2360 | 2360 | ||
2361 | #if 0 | 2361 | #if 0 |
2362 | qDebug("********************* "); | 2362 | qDebug("********************* "); |
2363 | qDebug("Testcode secsto "); | 2363 | qDebug("Testcode secsto "); |
2364 | QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); | 2364 | QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); |
2365 | QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); | 2365 | QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); |
2366 | int secsto = dt_nodaylight.secsTo( dt_daylight ); | 2366 | int secsto = dt_nodaylight.secsTo( dt_daylight ); |
2367 | QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); | 2367 | QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); |
2368 | qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); | 2368 | qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); |
2369 | qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); | 2369 | qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); |
2370 | qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); | 2370 | qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); |
2371 | qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); | 2371 | qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); |
2372 | qDebug("********************* testcode end"); | 2372 | qDebug("********************* testcode end"); |
2373 | 2373 | ||
2374 | #endif | 2374 | #endif |
2375 | 2375 | ||
2376 | QValueList<int> listINT = mLeftFrame->sizes(); | 2376 | QValueList<int> listINT = mLeftFrame->sizes(); |
2377 | config->writeEntry("Left Splitter Frame",listINT); | 2377 | config->writeEntry("Left Splitter Frame",listINT); |
2378 | QValueList<int> listINT2 = mMainFrame->sizes(); | 2378 | QValueList<int> listINT2 = mMainFrame->sizes(); |
2379 | config->writeEntry("Main Splitter Frame",listINT2); | 2379 | config->writeEntry("Main Splitter Frame",listINT2); |
2380 | #ifdef DESKTOP_VERSION | 2380 | #ifdef DESKTOP_VERSION |
2381 | config->setGroup("WidgetLayout"); | 2381 | config->setGroup("WidgetLayout"); |
2382 | QStringList list ;//= config->readListEntry("MainLayout"); | 2382 | QStringList list ;//= config->readListEntry("MainLayout"); |
2383 | int x,y,w,h; | 2383 | int x,y,w,h; |
2384 | QWidget* wid; | 2384 | QWidget* wid; |
2385 | wid = topLevelWidget(); | 2385 | wid = topLevelWidget(); |
2386 | x = wid->geometry().x(); | 2386 | x = wid->geometry().x(); |
2387 | y = wid->geometry().y(); | 2387 | y = wid->geometry().y(); |
2388 | w = wid->width(); | 2388 | w = wid->width(); |
2389 | h = wid->height(); | 2389 | h = wid->height(); |
2390 | list.clear(); | 2390 | list.clear(); |
2391 | list << QString::number( x ); | 2391 | list << QString::number( x ); |
2392 | list << QString::number( y ); | 2392 | list << QString::number( y ); |
2393 | list << QString::number( w ); | 2393 | list << QString::number( w ); |
2394 | list << QString::number( h ); | 2394 | list << QString::number( h ); |
2395 | config->writeEntry("MainLayout",list ); | 2395 | config->writeEntry("MainLayout",list ); |
2396 | 2396 | ||
2397 | wid = mEventEditor; | 2397 | wid = mEventEditor; |
2398 | x = wid->geometry().x(); | 2398 | x = wid->geometry().x(); |
2399 | y = wid->geometry().y(); | 2399 | y = wid->geometry().y(); |
2400 | w = wid->width(); | 2400 | w = wid->width(); |
2401 | h = wid->height(); | 2401 | h = wid->height(); |
2402 | list.clear(); | 2402 | list.clear(); |
2403 | list << QString::number( x ); | 2403 | list << QString::number( x ); |
2404 | list << QString::number( y ); | 2404 | list << QString::number( y ); |
2405 | list << QString::number( w ); | 2405 | list << QString::number( w ); |
2406 | list << QString::number( h ); | 2406 | list << QString::number( h ); |
2407 | config->writeEntry("EditEventLayout",list ); | 2407 | config->writeEntry("EditEventLayout",list ); |
2408 | 2408 | ||
2409 | wid = mTodoEditor; | 2409 | wid = mTodoEditor; |
2410 | x = wid->geometry().x(); | 2410 | x = wid->geometry().x(); |
2411 | y = wid->geometry().y(); | 2411 | y = wid->geometry().y(); |
2412 | w = wid->width(); | 2412 | w = wid->width(); |
2413 | h = wid->height(); | 2413 | h = wid->height(); |
2414 | list.clear(); | 2414 | list.clear(); |
2415 | list << QString::number( x ); | 2415 | list << QString::number( x ); |
2416 | list << QString::number( y ); | 2416 | list << QString::number( y ); |
2417 | list << QString::number( w ); | 2417 | list << QString::number( w ); |
2418 | list << QString::number( h ); | 2418 | list << QString::number( h ); |
2419 | config->writeEntry("EditTodoLayout",list ); | 2419 | config->writeEntry("EditTodoLayout",list ); |
2420 | wid = getEventViewerDialog(); | 2420 | wid = getEventViewerDialog(); |
2421 | x = wid->geometry().x(); | 2421 | x = wid->geometry().x(); |
2422 | y = wid->geometry().y(); | 2422 | y = wid->geometry().y(); |
2423 | w = wid->width(); | 2423 | w = wid->width(); |
2424 | h = wid->height(); | 2424 | h = wid->height(); |
2425 | list.clear(); | 2425 | list.clear(); |
2426 | list << QString::number( x ); | 2426 | list << QString::number( x ); |
2427 | list << QString::number( y ); | 2427 | list << QString::number( y ); |
2428 | list << QString::number( w ); | 2428 | list << QString::number( w ); |
2429 | list << QString::number( h ); | 2429 | list << QString::number( h ); |
2430 | config->writeEntry("ViewerLayout",list ); | 2430 | config->writeEntry("ViewerLayout",list ); |
2431 | wid = mDialogManager->getSearchDialog(); | 2431 | wid = mDialogManager->getSearchDialog(); |
2432 | if ( wid ) { | 2432 | if ( wid ) { |
2433 | x = wid->geometry().x(); | 2433 | x = wid->geometry().x(); |
2434 | y = wid->geometry().y(); | 2434 | y = wid->geometry().y(); |
2435 | w = wid->width(); | 2435 | w = wid->width(); |
2436 | h = wid->height(); | 2436 | h = wid->height(); |
2437 | list.clear(); | 2437 | list.clear(); |
2438 | list << QString::number( x ); | 2438 | list << QString::number( x ); |
2439 | list << QString::number( y ); | 2439 | list << QString::number( y ); |
2440 | list << QString::number( w ); | 2440 | list << QString::number( w ); |
2441 | list << QString::number( h ); | 2441 | list << QString::number( h ); |
2442 | config->writeEntry("SearchLayout",list ); | 2442 | config->writeEntry("SearchLayout",list ); |
2443 | } | 2443 | } |
2444 | #endif | 2444 | #endif |
2445 | 2445 | ||
2446 | 2446 | ||
2447 | config->sync(); | 2447 | config->sync(); |
2448 | } | 2448 | } |
2449 | 2449 | ||
2450 | void CalendarView::readFilterSettings(KConfig *config) | 2450 | void CalendarView::readFilterSettings(KConfig *config) |
2451 | { | 2451 | { |
2452 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2452 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2453 | 2453 | ||
2454 | mFilters.clear(); | 2454 | mFilters.clear(); |
2455 | 2455 | ||
2456 | config->setGroup("General"); | 2456 | config->setGroup("General"); |
2457 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2457 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2458 | 2458 | ||
2459 | QStringList::ConstIterator it = filterList.begin(); | 2459 | QStringList::ConstIterator it = filterList.begin(); |
2460 | QStringList::ConstIterator end = filterList.end(); | 2460 | QStringList::ConstIterator end = filterList.end(); |
2461 | while(it != end) { | 2461 | while(it != end) { |
2462 | // kdDebug() << " filter: " << (*it) << endl; | 2462 | // kdDebug() << " filter: " << (*it) << endl; |
2463 | 2463 | ||
2464 | CalFilter *filter; | 2464 | CalFilter *filter; |
2465 | filter = new CalFilter(*it); | 2465 | filter = new CalFilter(*it); |
2466 | config->setGroup("Filter_" + (*it).utf8()); | 2466 | config->setGroup("Filter_" + (*it).utf8()); |
2467 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2467 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2468 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2468 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2469 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2469 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2470 | mFilters.append(filter); | 2470 | mFilters.append(filter); |
2471 | 2471 | ||
2472 | ++it; | 2472 | ++it; |
2473 | } | 2473 | } |
2474 | 2474 | ||
2475 | if (mFilters.count() == 0) { | 2475 | if (mFilters.count() == 0) { |
2476 | CalFilter *filter = new CalFilter(i18n("Default")); | 2476 | CalFilter *filter = new CalFilter(i18n("Default")); |
2477 | mFilters.append(filter); | 2477 | mFilters.append(filter); |
2478 | } | 2478 | } |
2479 | mFilterView->updateFilters(); | 2479 | mFilterView->updateFilters(); |
2480 | config->setGroup("FilterView"); | 2480 | config->setGroup("FilterView"); |
2481 | 2481 | ||
2482 | mFilterView->blockSignals(true); | 2482 | mFilterView->blockSignals(true); |
2483 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2483 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2484 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2484 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2485 | mFilterView->blockSignals(false); | 2485 | mFilterView->blockSignals(false); |
2486 | // We do it manually to avoid it being done twice by the above calls | 2486 | // We do it manually to avoid it being done twice by the above calls |
2487 | updateFilter(); | 2487 | updateFilter(); |
2488 | } | 2488 | } |
2489 | 2489 | ||
2490 | void CalendarView::writeFilterSettings(KConfig *config) | 2490 | void CalendarView::writeFilterSettings(KConfig *config) |
2491 | { | 2491 | { |
2492 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2492 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2493 | 2493 | ||
2494 | QStringList filterList; | 2494 | QStringList filterList; |
2495 | 2495 | ||
2496 | CalFilter *filter = mFilters.first(); | 2496 | CalFilter *filter = mFilters.first(); |
2497 | while(filter) { | 2497 | while(filter) { |
2498 | // kdDebug() << " fn: " << filter->name() << endl; | 2498 | // kdDebug() << " fn: " << filter->name() << endl; |
2499 | filterList << filter->name(); | 2499 | filterList << filter->name(); |
2500 | config->setGroup("Filter_" + filter->name().utf8()); | 2500 | config->setGroup("Filter_" + filter->name().utf8()); |
2501 | config->writeEntry("Criteria",filter->criteria()); | 2501 | config->writeEntry("Criteria",filter->criteria()); |
2502 | config->writeEntry("CategoryList",filter->categoryList()); | 2502 | config->writeEntry("CategoryList",filter->categoryList()); |
2503 | filter = mFilters.next(); | 2503 | filter = mFilters.next(); |
2504 | } | 2504 | } |
2505 | config->setGroup("General"); | 2505 | config->setGroup("General"); |
2506 | config->writeEntry("CalendarFilters",filterList); | 2506 | config->writeEntry("CalendarFilters",filterList); |
2507 | 2507 | ||
2508 | config->setGroup("FilterView"); | 2508 | config->setGroup("FilterView"); |
2509 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2509 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2510 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2510 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2511 | } | 2511 | } |
2512 | 2512 | ||
2513 | 2513 | ||
2514 | void CalendarView::goToday() | 2514 | void CalendarView::goToday() |
2515 | { | 2515 | { |
2516 | if ( mViewManager->currentView()->isMonthView() ) | 2516 | if ( mViewManager->currentView()->isMonthView() ) |
2517 | mNavigator->selectTodayMonth(); | 2517 | mNavigator->selectTodayMonth(); |
2518 | else | 2518 | else |
2519 | mNavigator->selectToday(); | 2519 | mNavigator->selectToday(); |
2520 | } | 2520 | } |
2521 | 2521 | ||
2522 | void CalendarView::goNext() | 2522 | void CalendarView::goNext() |
2523 | { | 2523 | { |
2524 | mNavigator->selectNext(); | 2524 | mNavigator->selectNext(); |
2525 | } | 2525 | } |
2526 | 2526 | ||
2527 | void CalendarView::goPrevious() | 2527 | void CalendarView::goPrevious() |
2528 | { | 2528 | { |
2529 | mNavigator->selectPrevious(); | 2529 | mNavigator->selectPrevious(); |
2530 | } | 2530 | } |
2531 | void CalendarView::goNextMonth() | 2531 | void CalendarView::goNextMonth() |
2532 | { | 2532 | { |
2533 | mNavigator->selectNextMonth(); | 2533 | mNavigator->selectNextMonth(); |
2534 | } | 2534 | } |
2535 | 2535 | ||
2536 | void CalendarView::goPreviousMonth() | 2536 | void CalendarView::goPreviousMonth() |
2537 | { | 2537 | { |
2538 | mNavigator->selectPreviousMonth(); | 2538 | mNavigator->selectPreviousMonth(); |
2539 | } | 2539 | } |
2540 | 2540 | ||
2541 | void CalendarView::updateConfig() | 2541 | void CalendarView::updateConfig() |
2542 | { | 2542 | { |
2543 | if ( KOPrefs::instance()->mUseAppColors ) | 2543 | if ( KOPrefs::instance()->mUseAppColors ) |
2544 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2544 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2545 | emit configChanged(); | 2545 | emit configChanged(); |
2546 | mTodoList->updateConfig(); | 2546 | mTodoList->updateConfig(); |
2547 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2547 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2548 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2548 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2549 | // To make the "fill window" configurations work | 2549 | // To make the "fill window" configurations work |
2550 | //mViewManager->raiseCurrentView(); | 2550 | //mViewManager->raiseCurrentView(); |
2551 | } | 2551 | } |
2552 | 2552 | ||
2553 | 2553 | ||
2554 | void CalendarView::eventChanged(Event *event) | 2554 | void CalendarView::eventChanged(Event *event) |
2555 | { | 2555 | { |
2556 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2556 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2557 | //updateUnmanagedViews(); | 2557 | //updateUnmanagedViews(); |
2558 | } | 2558 | } |
2559 | 2559 | ||
2560 | void CalendarView::eventAdded(Event *event) | 2560 | void CalendarView::eventAdded(Event *event) |
2561 | { | 2561 | { |
2562 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2562 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2563 | } | 2563 | } |
2564 | 2564 | ||
2565 | void CalendarView::eventToBeDeleted(Event *) | 2565 | void CalendarView::eventToBeDeleted(Event *) |
2566 | { | 2566 | { |
2567 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2567 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2568 | } | 2568 | } |
2569 | 2569 | ||
2570 | void CalendarView::eventDeleted() | 2570 | void CalendarView::eventDeleted() |
2571 | { | 2571 | { |
2572 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2572 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2573 | } | 2573 | } |
2574 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2574 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2575 | { | 2575 | { |
2576 | changeIncidenceDisplay((Incidence *)which, action); | 2576 | changeIncidenceDisplay((Incidence *)which, action); |
2577 | mDateNavigator->updateView(); //LR | 2577 | mDateNavigator->updateView(); //LR |
2578 | //mDialogManager->updateSearchDialog(); | 2578 | //mDialogManager->updateSearchDialog(); |
2579 | 2579 | ||
2580 | if (which) { | 2580 | if (which) { |
2581 | mViewManager->updateWNview(); | 2581 | mViewManager->updateWNview(); |
2582 | //mTodoList->updateView(); | 2582 | //mTodoList->updateView(); |
2583 | } | 2583 | } |
2584 | 2584 | ||
2585 | } | 2585 | } |
2586 | 2586 | ||
2587 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2587 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2588 | { | 2588 | { |
2589 | updateUnmanagedViews(); | 2589 | updateUnmanagedViews(); |
2590 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2590 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2591 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2591 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2592 | mCalendar->checkAlarmForIncidence( 0, true ); | 2592 | mCalendar->checkAlarmForIncidence( 0, true ); |
2593 | if ( mEventViewerDialog ) | 2593 | if ( mEventViewerDialog ) |
2594 | mEventViewerDialog->hide(); | 2594 | mEventViewerDialog->hide(); |
2595 | } | 2595 | } |
2596 | else | 2596 | else |
2597 | mCalendar->checkAlarmForIncidence( which , false ); | 2597 | mCalendar->checkAlarmForIncidence( which , false ); |
2598 | } | 2598 | } |
2599 | 2599 | ||
2600 | // most of the changeEventDisplays() right now just call the view's | 2600 | // most of the changeEventDisplays() right now just call the view's |
2601 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2601 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2602 | void CalendarView::changeEventDisplay(Event *which, int action) | 2602 | void CalendarView::changeEventDisplay(Event *which, int action) |
2603 | { | 2603 | { |
2604 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2604 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2605 | changeIncidenceDisplay((Incidence *)which, action); | 2605 | changeIncidenceDisplay((Incidence *)which, action); |
2606 | mDateNavigator->updateView(); | 2606 | mDateNavigator->updateView(); |
2607 | //mDialogManager->updateSearchDialog(); | 2607 | //mDialogManager->updateSearchDialog(); |
2608 | 2608 | ||
2609 | if (which) { | 2609 | if (which) { |
2610 | // If there is an event view visible update the display | 2610 | // If there is an event view visible update the display |
2611 | mViewManager->currentView()->changeEventDisplay(which,action); | 2611 | mViewManager->currentView()->changeEventDisplay(which,action); |
2612 | // TODO: check, if update needed | 2612 | // TODO: check, if update needed |
2613 | // if (which->getTodoStatus()) { | 2613 | // if (which->getTodoStatus()) { |
2614 | mTodoList->updateView(); | 2614 | mTodoList->updateView(); |
2615 | // } | 2615 | // } |
2616 | } else { | 2616 | } else { |
2617 | mViewManager->currentView()->updateView(); | 2617 | mViewManager->currentView()->updateView(); |
2618 | } | 2618 | } |
2619 | } | 2619 | } |
2620 | 2620 | ||
2621 | 2621 | ||
2622 | void CalendarView::updateTodoViews() | 2622 | void CalendarView::updateTodoViews() |
2623 | { | 2623 | { |
2624 | mTodoList->updateView(); | 2624 | mTodoList->updateView(); |
2625 | mViewManager->currentView()->updateView(); | 2625 | mViewManager->currentView()->updateView(); |
2626 | 2626 | ||
2627 | } | 2627 | } |
2628 | 2628 | ||
2629 | 2629 | ||
2630 | void CalendarView::updateView(const QDate &start, const QDate &end) | 2630 | void CalendarView::updateView(const QDate &start, const QDate &end) |
2631 | { | 2631 | { |
2632 | #ifdef DESKTOP_VERSION | 2632 | #ifdef DESKTOP_VERSION |
2633 | mDateScrollBar->blockSignals( true ); | 2633 | if ( ! mDateScrollBar->draggingSlider () ) { |
2634 | mDateScrollBar->setValue( start.dayOfYear()-1); | 2634 | int dof = start.dayOfYear()-1; |
2635 | mDateScrollBar->blockSignals( false ); | 2635 | if ( dof != mDateScrollBar->value() ) { |
2636 | mDateScrollBar->blockSignals( true ); | ||
2637 | mDateScrollBar->setValue( start.dayOfYear()-1); | ||
2638 | mDateScrollBar->blockSignals( false ); | ||
2639 | } | ||
2640 | } | ||
2636 | #endif | 2641 | #endif |
2637 | mTodoList->updateView(); | 2642 | mTodoList->updateView(); |
2638 | mViewManager->updateView(start, end); | 2643 | mViewManager->updateView(start, end); |
2639 | //mDateNavigator->updateView(); | 2644 | //mDateNavigator->updateView(); |
2640 | } | 2645 | } |
2641 | 2646 | ||
2642 | void CalendarView::clearAllViews() | 2647 | void CalendarView::clearAllViews() |
2643 | { | 2648 | { |
2644 | mTodoList->clearList(); | 2649 | mTodoList->clearList(); |
2645 | mViewManager->clearAllViews(); | 2650 | mViewManager->clearAllViews(); |
2646 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 2651 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
2647 | if ( sd ) { | 2652 | if ( sd ) { |
2648 | KOListView* kol = sd->listview(); | 2653 | KOListView* kol = sd->listview(); |
2649 | if ( kol ) | 2654 | if ( kol ) |
2650 | kol->clearList(); | 2655 | kol->clearList(); |
2651 | } | 2656 | } |
2652 | } | 2657 | } |
2653 | void CalendarView::updateView() | 2658 | void CalendarView::updateView() |
2654 | { | 2659 | { |
2655 | DateList tmpList = mNavigator->selectedDates(); | 2660 | DateList tmpList = mNavigator->selectedDates(); |
2656 | 2661 | ||
2657 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2662 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2658 | mTodoList->updateView(); | 2663 | mTodoList->updateView(); |
2659 | // We assume that the navigator only selects consecutive days. | 2664 | // We assume that the navigator only selects consecutive days. |
2660 | updateView( tmpList.first(), tmpList.last() ); | 2665 | updateView( tmpList.first(), tmpList.last() ); |
2661 | } | 2666 | } |
2662 | 2667 | ||
2663 | void CalendarView::updateUnmanagedViews() | 2668 | void CalendarView::updateUnmanagedViews() |
2664 | { | 2669 | { |
2665 | mDateNavigator->updateDayMatrix(); | 2670 | mDateNavigator->updateDayMatrix(); |
2666 | } | 2671 | } |
2667 | 2672 | ||
2668 | int CalendarView::msgItemDelete(const QString name) | 2673 | int CalendarView::msgItemDelete(const QString name) |
2669 | { | 2674 | { |
2670 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2675 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2671 | i18n("This item will be\npermanently deleted."), | 2676 | i18n("This item will be\npermanently deleted."), |
2672 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2677 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2673 | } | 2678 | } |
2674 | 2679 | ||
2675 | 2680 | ||
2676 | void CalendarView::edit_cut() | 2681 | void CalendarView::edit_cut() |
2677 | { | 2682 | { |
2678 | Event *anEvent=0; | 2683 | Event *anEvent=0; |
2679 | 2684 | ||
2680 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2685 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2681 | 2686 | ||
2682 | if (mViewManager->currentView()->isEventView()) { | 2687 | if (mViewManager->currentView()->isEventView()) { |
2683 | if ( incidence && incidence->typeID() == eventID ) { | 2688 | if ( incidence && incidence->typeID() == eventID ) { |
2684 | anEvent = static_cast<Event *>(incidence); | 2689 | anEvent = static_cast<Event *>(incidence); |
2685 | } | 2690 | } |
2686 | } | 2691 | } |
2687 | 2692 | ||
2688 | if (!anEvent) { | 2693 | if (!anEvent) { |
2689 | KNotifyClient::beep(); | 2694 | KNotifyClient::beep(); |
2690 | return; | 2695 | return; |
2691 | } | 2696 | } |
2692 | DndFactory factory( mCalendar ); | 2697 | DndFactory factory( mCalendar ); |
2693 | factory.cutIncidence(anEvent); | 2698 | factory.cutIncidence(anEvent); |
2694 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2699 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2695 | } | 2700 | } |
2696 | 2701 | ||
2697 | void CalendarView::edit_copy() | 2702 | void CalendarView::edit_copy() |
2698 | { | 2703 | { |
2699 | Event *anEvent=0; | 2704 | Event *anEvent=0; |
2700 | 2705 | ||
2701 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2706 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2702 | 2707 | ||
2703 | if (mViewManager->currentView()->isEventView()) { | 2708 | if (mViewManager->currentView()->isEventView()) { |
2704 | if ( incidence && incidence->typeID() == eventID ) { | 2709 | if ( incidence && incidence->typeID() == eventID ) { |
2705 | anEvent = static_cast<Event *>(incidence); | 2710 | anEvent = static_cast<Event *>(incidence); |
2706 | } | 2711 | } |
2707 | } | 2712 | } |
2708 | 2713 | ||
2709 | if (!anEvent) { | 2714 | if (!anEvent) { |
2710 | KNotifyClient::beep(); | 2715 | KNotifyClient::beep(); |
2711 | return; | 2716 | return; |
2712 | } | 2717 | } |
2713 | DndFactory factory( mCalendar ); | 2718 | DndFactory factory( mCalendar ); |
2714 | factory.copyIncidence(anEvent); | 2719 | factory.copyIncidence(anEvent); |
2715 | } | 2720 | } |
2716 | 2721 | ||
2717 | void CalendarView::edit_paste() | 2722 | void CalendarView::edit_paste() |
2718 | { | 2723 | { |
2719 | QDate date = mNavigator->selectedDates().first(); | 2724 | QDate date = mNavigator->selectedDates().first(); |
2720 | 2725 | ||
2721 | DndFactory factory( mCalendar ); | 2726 | DndFactory factory( mCalendar ); |
2722 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2727 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2723 | 2728 | ||
2724 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2729 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2725 | } | 2730 | } |
2726 | void CalendarView::edit_global_options() | 2731 | void CalendarView::edit_global_options() |
2727 | { | 2732 | { |
2728 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | 2733 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; |
2729 | emit save(); | 2734 | emit save(); |
2730 | emit saveStopTimer(); | 2735 | emit saveStopTimer(); |
2731 | mDialogManager->showGlobalOptionsDialog(); | 2736 | mDialogManager->showGlobalOptionsDialog(); |
2732 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { | 2737 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
2733 | emit saveStopTimer(); | 2738 | emit saveStopTimer(); |
2734 | 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!"), | 2739 | 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!"), |
2735 | i18n("Timezone settings"),i18n("Reload"))) { | 2740 | i18n("Timezone settings"),i18n("Reload"))) { |
2736 | qDebug("KO: TZ reload cancelled "); | 2741 | qDebug("KO: TZ reload cancelled "); |
2737 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2742 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2738 | return; | 2743 | return; |
2739 | } | 2744 | } |
2740 | qDebug("KO: Timezone change "); | 2745 | qDebug("KO: Timezone change "); |
2741 | loadCalendars(); | 2746 | loadCalendars(); |
2742 | setModified(true); | 2747 | setModified(true); |
2743 | } | 2748 | } |
2744 | else | 2749 | else |
2745 | qDebug("KO: No tz change "); | 2750 | qDebug("KO: No tz change "); |
2746 | } | 2751 | } |
2747 | void CalendarView::edit_options() | 2752 | void CalendarView::edit_options() |
2748 | { | 2753 | { |
2749 | mDialogManager->showOptionsDialog(); | 2754 | mDialogManager->showOptionsDialog(); |
2750 | } | 2755 | } |
2751 | 2756 | ||
2752 | 2757 | ||
2753 | void CalendarView::slotSelectPickerDate( QDate d) | 2758 | void CalendarView::slotSelectPickerDate( QDate d) |
2754 | { | 2759 | { |
2755 | mDateFrame->hide(); | 2760 | mDateFrame->hide(); |
2756 | if ( mDatePickerMode == 1 ) { | 2761 | if ( mDatePickerMode == 1 ) { |
2757 | mNavigator->slotDaySelect( d ); | 2762 | mNavigator->slotDaySelect( d ); |
2758 | } else if ( mDatePickerMode == 2 ) { | 2763 | } else if ( mDatePickerMode == 2 ) { |
2759 | if ( mMoveIncidence->typeID() == todoID ) { | 2764 | if ( mMoveIncidence->typeID() == todoID ) { |
2760 | Todo * to = (Todo *) mMoveIncidence; | 2765 | Todo * to = (Todo *) mMoveIncidence; |
2761 | QTime tim; | 2766 | QTime tim; |
2762 | int len = 0; | 2767 | int len = 0; |
2763 | if ( to->hasStartDate() && to->hasDueDate() ) | 2768 | if ( to->hasStartDate() && to->hasDueDate() ) |
2764 | len = to->dtStart().secsTo( to->dtDue()); | 2769 | len = to->dtStart().secsTo( to->dtDue()); |
2765 | if ( to->hasDueDate() ) | 2770 | if ( to->hasDueDate() ) |
2766 | tim = to->dtDue().time(); | 2771 | tim = to->dtDue().time(); |
2767 | else { | 2772 | else { |
2768 | tim = QTime ( 0,0,0 ); | 2773 | tim = QTime ( 0,0,0 ); |
2769 | to->setFloats( true ); | 2774 | to->setFloats( true ); |
2770 | to->setHasDueDate( true ); | 2775 | to->setHasDueDate( true ); |
2771 | } | 2776 | } |
2772 | QDateTime dt ( d,tim ); | 2777 | QDateTime dt ( d,tim ); |
2773 | to->setDtDue( dt ); | 2778 | to->setDtDue( dt ); |
2774 | 2779 | ||
2775 | if ( to->hasStartDate() ) { | 2780 | if ( to->hasStartDate() ) { |
2776 | if ( len>0 ) | 2781 | if ( len>0 ) |
2777 | to->setDtStart(to->dtDue().addSecs( -len )); | 2782 | to->setDtStart(to->dtDue().addSecs( -len )); |
2778 | else | 2783 | else |
2779 | if (to->dtStart() > to->dtDue() ) | 2784 | if (to->dtStart() > to->dtDue() ) |
2780 | to->setDtStart(to->dtDue().addDays( -3 )); | 2785 | to->setDtStart(to->dtDue().addDays( -3 )); |
2781 | } | 2786 | } |
2782 | 2787 | ||
2783 | todoChanged( to ); | 2788 | todoChanged( to ); |
2784 | } else { | 2789 | } else { |
2785 | if ( mMoveIncidence->doesRecur() ) { | 2790 | if ( mMoveIncidence->doesRecur() ) { |
2786 | #if 0 | 2791 | #if 0 |
2787 | // PENDING implement this | 2792 | // PENDING implement this |
2788 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); | 2793 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); |
2789 | mCalendar()->addIncidence( newInc ); | 2794 | mCalendar()->addIncidence( newInc ); |
2790 | if ( mMoveIncidence->typeID() == todoID ) | 2795 | if ( mMoveIncidence->typeID() == todoID ) |
2791 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); | 2796 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); |
2792 | else | 2797 | else |
2793 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); | 2798 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); |
2794 | mMoveIncidence = newInc; | 2799 | mMoveIncidence = newInc; |
2795 | 2800 | ||
2796 | #endif | 2801 | #endif |
2797 | } | 2802 | } |
2798 | QTime tim = mMoveIncidence->dtStart().time(); | 2803 | QTime tim = mMoveIncidence->dtStart().time(); |
2799 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 2804 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
2800 | QDateTime dt ( d,tim ); | 2805 | QDateTime dt ( d,tim ); |
2801 | mMoveIncidence->setDtStart( dt ); | 2806 | mMoveIncidence->setDtStart( dt ); |
2802 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 2807 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
2803 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 2808 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
2804 | } | 2809 | } |
2805 | 2810 | ||
2806 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 2811 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
2807 | } | 2812 | } |
2808 | } | 2813 | } |
2809 | 2814 | ||
2810 | void CalendarView::removeCategories() | 2815 | void CalendarView::removeCategories() |
2811 | { | 2816 | { |
2812 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2817 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2813 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2818 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2814 | QStringList catIncList; | 2819 | QStringList catIncList; |
2815 | QStringList newCatList; | 2820 | QStringList newCatList; |
2816 | Incidence* inc = incList.first(); | 2821 | Incidence* inc = incList.first(); |
2817 | uint i; | 2822 | uint i; |
2818 | while ( inc ) { | 2823 | while ( inc ) { |
2819 | newCatList.clear(); | 2824 | newCatList.clear(); |
2820 | catIncList = inc->categories() ; | 2825 | catIncList = inc->categories() ; |
2821 | for( i = 0; i< catIncList.count(); ++i ) { | 2826 | for( i = 0; i< catIncList.count(); ++i ) { |
2822 | if ( catList.contains (catIncList[i])) | 2827 | if ( catList.contains (catIncList[i])) |
2823 | newCatList.append( catIncList[i] ); | 2828 | newCatList.append( catIncList[i] ); |
2824 | } | 2829 | } |
2825 | newCatList.sort(); | 2830 | newCatList.sort(); |
2826 | inc->setCategories( newCatList.join(",") ); | 2831 | inc->setCategories( newCatList.join(",") ); |
2827 | inc = incList.next(); | 2832 | inc = incList.next(); |
2828 | } | 2833 | } |
2829 | } | 2834 | } |
2830 | 2835 | ||
2831 | int CalendarView::addCategories() | 2836 | int CalendarView::addCategories() |
2832 | { | 2837 | { |
2833 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2838 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2834 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2839 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2835 | QStringList catIncList; | 2840 | QStringList catIncList; |
2836 | Incidence* inc = incList.first(); | 2841 | Incidence* inc = incList.first(); |
2837 | uint i; | 2842 | uint i; |
2838 | int count = 0; | 2843 | int count = 0; |
2839 | while ( inc ) { | 2844 | while ( inc ) { |
2840 | catIncList = inc->categories() ; | 2845 | catIncList = inc->categories() ; |
2841 | for( i = 0; i< catIncList.count(); ++i ) { | 2846 | for( i = 0; i< catIncList.count(); ++i ) { |
2842 | if ( !catList.contains (catIncList[i])) { | 2847 | if ( !catList.contains (catIncList[i])) { |
2843 | catList.append( catIncList[i] ); | 2848 | catList.append( catIncList[i] ); |
2844 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2849 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2845 | ++count; | 2850 | ++count; |
2846 | } | 2851 | } |
2847 | } | 2852 | } |
2848 | inc = incList.next(); | 2853 | inc = incList.next(); |
2849 | } | 2854 | } |
2850 | catList.sort(); | 2855 | catList.sort(); |
2851 | KOPrefs::instance()->mCustomCategories = catList; | 2856 | KOPrefs::instance()->mCustomCategories = catList; |
2852 | return count; | 2857 | return count; |
2853 | } | 2858 | } |
2854 | 2859 | ||
2855 | void CalendarView::editCategories() | 2860 | void CalendarView::editCategories() |
2856 | { | 2861 | { |
2857 | qDebug("CalendarView::editCategories() "); | 2862 | qDebug("CalendarView::editCategories() "); |
2858 | KPIM::CategoryEditDialog ced (KOPrefs::instance(),this ); | 2863 | KPIM::CategoryEditDialog ced (KOPrefs::instance(),this ); |
2859 | ced.exec(); | 2864 | ced.exec(); |
2860 | } | 2865 | } |
2861 | void CalendarView::manageCategories() | 2866 | void CalendarView::manageCategories() |
2862 | { | 2867 | { |
2863 | KOCatPrefs* cp = new KOCatPrefs(); | 2868 | KOCatPrefs* cp = new KOCatPrefs(); |
2864 | cp->show(); | 2869 | cp->show(); |
2865 | int w =cp->sizeHint().width() ; | 2870 | int w =cp->sizeHint().width() ; |
2866 | int h = cp->sizeHint().height() ; | 2871 | int h = cp->sizeHint().height() ; |
2867 | int dw = QApplication::desktop()->width(); | 2872 | int dw = QApplication::desktop()->width(); |
2868 | int dh = QApplication::desktop()->height(); | 2873 | int dh = QApplication::desktop()->height(); |
2869 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2874 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2870 | if ( !cp->exec() ) { | 2875 | if ( !cp->exec() ) { |
2871 | delete cp; | 2876 | delete cp; |
2872 | return; | 2877 | return; |
2873 | } | 2878 | } |
2874 | int count = 0; | 2879 | int count = 0; |
2875 | if ( cp->addCat() ) { | 2880 | if ( cp->addCat() ) { |
2876 | count = addCategories(); | 2881 | count = addCategories(); |
2877 | if ( count ) { | 2882 | if ( count ) { |
2878 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); | 2883 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); |
2879 | writeSettings(); | 2884 | writeSettings(); |
2880 | } else | 2885 | } else |
2881 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); | 2886 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); |
2882 | } else { | 2887 | } else { |
2883 | removeCategories(); | 2888 | removeCategories(); |
2884 | updateView(); | 2889 | updateView(); |
2885 | } | 2890 | } |
2886 | delete cp; | 2891 | delete cp; |
2887 | } | 2892 | } |
2888 | 2893 | ||
2889 | void CalendarView::beamIncidence(Incidence * Inc) | 2894 | void CalendarView::beamIncidence(Incidence * Inc) |
2890 | { | 2895 | { |
2891 | QPtrList<Incidence> delSel ; | 2896 | QPtrList<Incidence> delSel ; |
2892 | delSel.append(Inc); | 2897 | delSel.append(Inc); |
2893 | beamIncidenceList( delSel ); | 2898 | beamIncidenceList( delSel ); |
2894 | } | 2899 | } |
2895 | void CalendarView::beamCalendar() | 2900 | void CalendarView::beamCalendar() |
2896 | { | 2901 | { |
2897 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); | 2902 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); |
2898 | //qDebug("beamCalendar() "); | 2903 | //qDebug("beamCalendar() "); |
2899 | beamIncidenceList( delSel ); | 2904 | beamIncidenceList( delSel ); |
2900 | } | 2905 | } |
2901 | void CalendarView::beamFilteredCalendar() | 2906 | void CalendarView::beamFilteredCalendar() |
2902 | { | 2907 | { |
2903 | QPtrList<Incidence> delSel = mCalendar->incidences(); | 2908 | QPtrList<Incidence> delSel = mCalendar->incidences(); |
2904 | //qDebug("beamFilteredCalendar() "); | 2909 | //qDebug("beamFilteredCalendar() "); |
2905 | beamIncidenceList( delSel ); | 2910 | beamIncidenceList( delSel ); |
2906 | } | 2911 | } |
2907 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | 2912 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) |
2908 | { | 2913 | { |
2909 | 2914 | ||
2910 | KOBeamPrefs beamDialog; | 2915 | KOBeamPrefs beamDialog; |
2911 | if ( beamDialog.exec () == QDialog::Rejected ) | 2916 | if ( beamDialog.exec () == QDialog::Rejected ) |
2912 | return; | 2917 | return; |
2913 | #ifdef DESKTOP_VERSION | 2918 | #ifdef DESKTOP_VERSION |
2914 | QString fn = locateLocal( "tmp", "kopibeamfile" ); | 2919 | QString fn = locateLocal( "tmp", "kopibeamfile" ); |
2915 | #else | 2920 | #else |
2916 | QString fn = "/tmp/kopibeamfile"; | 2921 | QString fn = "/tmp/kopibeamfile"; |
2917 | #endif | 2922 | #endif |
2918 | QString mes; | 2923 | QString mes; |
2919 | bool createbup = true; | 2924 | bool createbup = true; |
2920 | if ( createbup ) { | 2925 | if ( createbup ) { |
2921 | QString description = "\n"; | 2926 | QString description = "\n"; |
2922 | CalendarLocal* cal = new CalendarLocal(); | 2927 | CalendarLocal* cal = new CalendarLocal(); |
2923 | if ( beamDialog.beamLocal() ) | 2928 | if ( beamDialog.beamLocal() ) |
2924 | cal->setLocalTime(); | 2929 | cal->setLocalTime(); |
2925 | else | 2930 | else |
2926 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2931 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2927 | Incidence *incidence = delSel.first(); | 2932 | Incidence *incidence = delSel.first(); |
2928 | bool addText = false; | 2933 | bool addText = false; |
2929 | if ( delSel.count() < 10 ) | 2934 | if ( delSel.count() < 10 ) |
2930 | addText = true; | 2935 | addText = true; |
2931 | else { | 2936 | else { |
2932 | description.sprintf(i18n(" %d items?"),delSel.count() ); | 2937 | description.sprintf(i18n(" %d items?"),delSel.count() ); |
2933 | } | 2938 | } |
2934 | while ( incidence ) { | 2939 | while ( incidence ) { |
2935 | Incidence *in = incidence->clone(); | 2940 | Incidence *in = incidence->clone(); |
2936 | if ( ! in->summary().isEmpty() ) { | 2941 | if ( ! in->summary().isEmpty() ) { |
2937 | in->setDescription(""); | 2942 | in->setDescription(""); |
2938 | } else { | 2943 | } else { |
2939 | in->setSummary( in->description().left(20)); | 2944 | in->setSummary( in->description().left(20)); |
2940 | in->setDescription(""); | 2945 | in->setDescription(""); |
2941 | } | 2946 | } |
2942 | if ( addText ) | 2947 | if ( addText ) |
2943 | description += in->summary() + "\n"; | 2948 | description += in->summary() + "\n"; |
2944 | cal->addIncidence( in ); | 2949 | cal->addIncidence( in ); |
2945 | incidence = delSel.next(); | 2950 | incidence = delSel.next(); |
2946 | } | 2951 | } |
2947 | if ( beamDialog.beamVcal() ) { | 2952 | if ( beamDialog.beamVcal() ) { |
2948 | fn += ".vcs"; | 2953 | fn += ".vcs"; |
2949 | FileStorage storage( cal, fn, new VCalFormat ); | 2954 | FileStorage storage( cal, fn, new VCalFormat ); |
2950 | storage.save(); | 2955 | storage.save(); |
2951 | } else { | 2956 | } else { |
2952 | fn += ".ics"; | 2957 | fn += ".ics"; |
2953 | FileStorage storage( cal, fn, new ICalFormat( ) ); | 2958 | FileStorage storage( cal, fn, new ICalFormat( ) ); |
2954 | storage.save(); | 2959 | storage.save(); |
2955 | } | 2960 | } |
2956 | delete cal; | 2961 | delete cal; |
2957 | mes = i18n("KO/Pi: Ready for beaming"); | 2962 | mes = i18n("KO/Pi: Ready for beaming"); |
2958 | topLevelWidget()->setCaption(mes); | 2963 | topLevelWidget()->setCaption(mes); |
2959 | KApplication::convert2latin1( fn ); | 2964 | KApplication::convert2latin1( fn ); |
2960 | #ifndef DESKTOP_VERSION | 2965 | #ifndef DESKTOP_VERSION |
2961 | Ir *ir = new Ir( this ); | 2966 | Ir *ir = new Ir( this ); |
2962 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 2967 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
2963 | ir->send( fn, description, "text/x-vCalendar" ); | 2968 | ir->send( fn, description, "text/x-vCalendar" ); |
2964 | #endif | 2969 | #endif |
2965 | } | 2970 | } |
2966 | } | 2971 | } |
2967 | 2972 | ||
2968 | #ifndef DESKTOP_VERSION | 2973 | #ifndef DESKTOP_VERSION |
2969 | void CalendarView::beamDone( Ir *ir ) | 2974 | void CalendarView::beamDone( Ir *ir ) |
2970 | { | 2975 | { |
2971 | delete ir; | 2976 | delete ir; |
2972 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); | 2977 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); |
2973 | topLevelWidget()->raise(); | 2978 | topLevelWidget()->raise(); |
2974 | } | 2979 | } |
2975 | #else | 2980 | #else |
2976 | void CalendarView::beamDone( Ir *){;} | 2981 | void CalendarView::beamDone( Ir *){;} |
2977 | #endif | 2982 | #endif |
2978 | void CalendarView::moveIncidence(Incidence * inc ) | 2983 | void CalendarView::moveIncidence(Incidence * inc ) |
2979 | { | 2984 | { |
2980 | if ( !inc ) return; | 2985 | if ( !inc ) return; |
2981 | showDatePickerPopup(); | 2986 | showDatePickerPopup(); |
2982 | mDatePickerMode = 2; | 2987 | mDatePickerMode = 2; |
2983 | mMoveIncidence = inc ; | 2988 | mMoveIncidence = inc ; |
2984 | QDate da; | 2989 | QDate da; |
2985 | if ( mMoveIncidence->typeID() == todoID ) { | 2990 | if ( mMoveIncidence->typeID() == todoID ) { |
2986 | Todo * to = (Todo *) mMoveIncidence; | 2991 | Todo * to = (Todo *) mMoveIncidence; |
2987 | if ( to->hasDueDate() ) | 2992 | if ( to->hasDueDate() ) |
2988 | da = to->dtDue().date(); | 2993 | da = to->dtDue().date(); |
2989 | else | 2994 | else |
2990 | da = QDate::currentDate(); | 2995 | da = QDate::currentDate(); |
2991 | } else { | 2996 | } else { |
2992 | da = mMoveIncidence->dtStart().date(); | 2997 | da = mMoveIncidence->dtStart().date(); |
2993 | } | 2998 | } |
2994 | //PENDING set date for recurring incidence to date of recurrence | 2999 | //PENDING set date for recurring incidence to date of recurrence |
2995 | //mMoveIncidenceOldDate; | 3000 | //mMoveIncidenceOldDate; |
2996 | mDatePicker->setDate( da ); | 3001 | mDatePicker->setDate( da ); |
2997 | } | 3002 | } |
2998 | void CalendarView::showDatePickerPopup() | 3003 | void CalendarView::showDatePickerPopup() |
2999 | { | 3004 | { |
3000 | if ( mDateFrame->isVisible() ) | 3005 | if ( mDateFrame->isVisible() ) |
3001 | mDateFrame->hide(); | 3006 | mDateFrame->hide(); |
3002 | else { | 3007 | else { |
3003 | int offX = 0, offY = 0; | 3008 | int offX = 0, offY = 0; |
3004 | #ifdef DESKTOP_VERSION | 3009 | #ifdef DESKTOP_VERSION |
3005 | int w =mDatePicker->sizeHint().width() ; | 3010 | int w =mDatePicker->sizeHint().width() ; |
3006 | int h = mDatePicker->sizeHint().height() ; | 3011 | int h = mDatePicker->sizeHint().height() ; |
3007 | int dw = topLevelWidget()->width(); | 3012 | int dw = topLevelWidget()->width(); |
3008 | int dh = topLevelWidget()->height(); | 3013 | int dh = topLevelWidget()->height(); |
3009 | offX = topLevelWidget()->x(); | 3014 | offX = topLevelWidget()->x(); |
3010 | offY = topLevelWidget()->y(); | 3015 | offY = topLevelWidget()->y(); |
3011 | #else | 3016 | #else |
3012 | int w =mDatePicker->sizeHint().width() ; | 3017 | int w =mDatePicker->sizeHint().width() ; |
3013 | int h = mDatePicker->sizeHint().height() ; | 3018 | int h = mDatePicker->sizeHint().height() ; |
3014 | int dw = QApplication::desktop()->width(); | 3019 | int dw = QApplication::desktop()->width(); |
3015 | int dh = QApplication::desktop()->height(); | 3020 | int dh = QApplication::desktop()->height(); |
3016 | #endif | 3021 | #endif |
3017 | mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); | 3022 | mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); |
3018 | mDateFrame->show(); | 3023 | mDateFrame->show(); |
3019 | } | 3024 | } |