author | zautrix <zautrix> | 2005-09-17 22:07:21 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-09-17 22:07:21 (UTC) |
commit | 64199073c047a30f3cff85fe6ee30691ff0db2f7 (patch) (unidiff) | |
tree | 5ff49088999f2c02fb2a40760b881c02f50cfc35 /korganizer | |
parent | e228113016abd6f75824633da9520c1ec1763f23 (diff) | |
download | kdepimpi-64199073c047a30f3cff85fe6ee30691ff0db2f7.zip kdepimpi-64199073c047a30f3cff85fe6ee30691ff0db2f7.tar.gz kdepimpi-64199073c047a30f3cff85fe6ee30691ff0db2f7.tar.bz2 |
savetimer
-rw-r--r-- | korganizer/calendarview.cpp | 4 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 22 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 2 |
3 files changed, 23 insertions, 5 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 14094bb..79fb727 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2439,130 +2439,130 @@ void CalendarView::showOpenError() | |||
2439 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 2439 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
2440 | { | 2440 | { |
2441 | loadedFileVersion = dt; | 2441 | loadedFileVersion = dt; |
2442 | } | 2442 | } |
2443 | bool CalendarView::checkFileChanged(QString fn) | 2443 | bool CalendarView::checkFileChanged(QString fn) |
2444 | { | 2444 | { |
2445 | QFileInfo finf ( fn ); | 2445 | QFileInfo finf ( fn ); |
2446 | if ( !finf.exists() ) | 2446 | if ( !finf.exists() ) |
2447 | return true; | 2447 | return true; |
2448 | QDateTime dt = finf.lastModified (); | 2448 | QDateTime dt = finf.lastModified (); |
2449 | if ( dt <= loadedFileVersion ) | 2449 | if ( dt <= loadedFileVersion ) |
2450 | return false; | 2450 | return false; |
2451 | return true; | 2451 | return true; |
2452 | 2452 | ||
2453 | } | 2453 | } |
2454 | void CalendarView::watchSavedFile() | 2454 | void CalendarView::watchSavedFile() |
2455 | { | 2455 | { |
2456 | QFileInfo finf ( MainWindow::defaultFileName()); | 2456 | QFileInfo finf ( MainWindow::defaultFileName()); |
2457 | if ( !finf.exists() ) | 2457 | if ( !finf.exists() ) |
2458 | return; | 2458 | return; |
2459 | QDateTime dt = finf.lastModified (); | 2459 | QDateTime dt = finf.lastModified (); |
2460 | if ( dt < loadedFileVersion ) { | 2460 | if ( dt < loadedFileVersion ) { |
2461 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); | 2461 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); |
2462 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); | 2462 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); |
2463 | return; | 2463 | return; |
2464 | } | 2464 | } |
2465 | loadedFileVersion = dt; | 2465 | loadedFileVersion = dt; |
2466 | } | 2466 | } |
2467 | bool CalendarView::checkAllFileVersions() | 2467 | bool CalendarView::checkAllFileVersions() |
2468 | { | 2468 | { |
2469 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 2469 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
2470 | KopiCalendarFile * cal = calendars.first(); | 2470 | KopiCalendarFile * cal = calendars.first(); |
2471 | mCalendar->setDefaultCalendar( 1 ); | 2471 | mCalendar->setDefaultCalendar( 1 ); |
2472 | mCalendar->setDefaultCalendarEnabledOnly(); | 2472 | mCalendar->setDefaultCalendarEnabledOnly(); |
2473 | if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { | 2473 | if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { |
2474 | if ( !checkFileVersion(MainWindow::defaultFileName())) { | 2474 | if ( !checkFileVersion(MainWindow::defaultFileName())) { |
2475 | restoreCalendarSettings(); | 2475 | restoreCalendarSettings(); |
2476 | return false; | 2476 | return false; |
2477 | } | 2477 | } |
2478 | } | 2478 | } |
2479 | cal = calendars.next(); | 2479 | cal = calendars.next(); |
2480 | QDateTime storeTemp = loadedFileVersion; | 2480 | QDateTime storeTemp = loadedFileVersion; |
2481 | while ( cal ) { | 2481 | while ( cal ) { |
2482 | if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { | 2482 | if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { |
2483 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 2483 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
2484 | mCalendar->setDefaultCalendarEnabledOnly(); | 2484 | mCalendar->setDefaultCalendarEnabledOnly(); |
2485 | loadedFileVersion = cal->mLoadDt.addSecs( 15 ); | 2485 | loadedFileVersion = cal->mLoadDt.addSecs( 15 ); |
2486 | if ( !checkFileVersion(cal->mFileName )) { | 2486 | if ( !checkFileVersion(cal->mFileName )) { |
2487 | loadedFileVersion = storeTemp; | 2487 | loadedFileVersion = storeTemp; |
2488 | restoreCalendarSettings(); | 2488 | restoreCalendarSettings(); |
2489 | return false; | 2489 | return false; |
2490 | } | 2490 | } |
2491 | } | 2491 | } |
2492 | cal = calendars.next(); | 2492 | cal = calendars.next(); |
2493 | } | 2493 | } |
2494 | loadedFileVersion = storeTemp; | 2494 | loadedFileVersion = storeTemp; |
2495 | return true; | 2495 | return true; |
2496 | } | 2496 | } |
2497 | bool CalendarView::checkFileVersion(QString fn) | 2497 | bool CalendarView::checkFileVersion(QString fn) |
2498 | { | 2498 | { |
2499 | QFileInfo finf ( fn ); | 2499 | QFileInfo finf ( fn ); |
2500 | if ( !finf.exists() ) | 2500 | if ( !finf.exists() ) |
2501 | return true; | 2501 | return true; |
2502 | QDateTime dt = finf.lastModified (); | 2502 | QDateTime dt = finf.lastModified (); |
2503 | qDebug("loaded file version %s %s", fn.latin1(), loadedFileVersion.toString().latin1()); | 2503 | //qDebug("loaded file version %s %s", fn.latin1(), loadedFileVersion.toString().latin1()); |
2504 | qDebug("file on disk version %s %s", fn.latin1(),dt.toString().latin1()); | 2504 | //qDebug("file on disk version %s %s", fn.latin1(),dt.toString().latin1()); |
2505 | if ( dt <= loadedFileVersion ) | 2505 | if ( dt <= loadedFileVersion ) |
2506 | return true; | 2506 | return true; |
2507 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file\n%1\non disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg(KGlobal::formatMessage(fn,0)).arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , | 2507 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file\n%1\non disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg(KGlobal::formatMessage(fn,0)).arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , |
2508 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 2508 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
2509 | i18n("Sync+save")); | 2509 | i18n("Sync+save")); |
2510 | 2510 | ||
2511 | if ( km == KMessageBox::Cancel ) | 2511 | if ( km == KMessageBox::Cancel ) |
2512 | return false; | 2512 | return false; |
2513 | if ( km == KMessageBox::Yes ) | 2513 | if ( km == KMessageBox::Yes ) |
2514 | return true; | 2514 | return true; |
2515 | 2515 | ||
2516 | setSyncDevice("deleteaftersync" ); | 2516 | setSyncDevice("deleteaftersync" ); |
2517 | mSyncManager->mAskForPreferences = true; | 2517 | mSyncManager->mAskForPreferences = true; |
2518 | mSyncManager->mSyncAlgoPrefs = 3; | 2518 | mSyncManager->mSyncAlgoPrefs = 3; |
2519 | mSyncManager->mWriteBackFile = false; | 2519 | mSyncManager->mWriteBackFile = false; |
2520 | mSyncManager->mWriteBackExistingOnly = false; | 2520 | mSyncManager->mWriteBackExistingOnly = false; |
2521 | mSyncManager->mShowSyncSummary = false; | 2521 | mSyncManager->mShowSyncSummary = false; |
2522 | syncCalendar( fn, 3 ); | 2522 | syncCalendar( fn, 3 ); |
2523 | Event * e = getLastSyncEvent(); | 2523 | Event * e = getLastSyncEvent(); |
2524 | if ( e ) | 2524 | if ( e ) |
2525 | mCalendar->deleteEvent( e ); | 2525 | mCalendar->deleteEvent( e ); |
2526 | return true; | 2526 | return true; |
2527 | } | 2527 | } |
2528 | bool CalendarView::saveCalendars() | 2528 | bool CalendarView::saveCalendars() |
2529 | { | 2529 | { |
2530 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 2530 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
2531 | KopiCalendarFile * cal = calendars.first(); | 2531 | KopiCalendarFile * cal = calendars.first(); |
2532 | mCalendar->setDefaultCalendar( 1 ); | 2532 | mCalendar->setDefaultCalendar( 1 ); |
2533 | mCalendar->setDefaultCalendarEnabledOnly(); | 2533 | mCalendar->setDefaultCalendarEnabledOnly(); |
2534 | QString saveError; | 2534 | QString saveError; |
2535 | if ( !saveCalendar( MainWindow::defaultFileName() ) ) | 2535 | if ( !saveCalendar( MainWindow::defaultFileName() ) ) |
2536 | saveError = cal->mName +"\n"; | 2536 | saveError = cal->mName +"\n"; |
2537 | cal = calendars.next(); | 2537 | cal = calendars.next(); |
2538 | while ( cal ) { | 2538 | while ( cal ) { |
2539 | if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { | 2539 | if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { |
2540 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 2540 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
2541 | mCalendar->setDefaultCalendarEnabledOnly(); | 2541 | mCalendar->setDefaultCalendarEnabledOnly(); |
2542 | if ( saveCalendar( cal->mFileName ) ) | 2542 | if ( saveCalendar( cal->mFileName ) ) |
2543 | cal->mLoadDt = QDateTime::currentDateTime(); | 2543 | cal->mLoadDt = QDateTime::currentDateTime(); |
2544 | else | 2544 | else |
2545 | saveError += cal->mName + "\n"; | 2545 | saveError += cal->mName + "\n"; |
2546 | } | 2546 | } |
2547 | cal = calendars.next(); | 2547 | cal = calendars.next(); |
2548 | } | 2548 | } |
2549 | restoreCalendarSettings(); | 2549 | restoreCalendarSettings(); |
2550 | if ( !saveError.isEmpty() ) { | 2550 | if ( !saveError.isEmpty() ) { |
2551 | saveError = KGlobal::formatMessage( i18n("Calendar(s) not saved:"),0 )+"\n" + saveError; | 2551 | saveError = KGlobal::formatMessage( i18n("Calendar(s) not saved:"),0 )+"\n" + saveError; |
2552 | KMessageBox::error(this, saveError, i18n("Error saving data")); | 2552 | KMessageBox::error(this, saveError, i18n("Error saving data")); |
2553 | return false; | 2553 | return false; |
2554 | } | 2554 | } |
2555 | return true; | 2555 | return true; |
2556 | } | 2556 | } |
2557 | bool CalendarView::saveCalendar( QString filename ) | 2557 | bool CalendarView::saveCalendar( QString filename ) |
2558 | { | 2558 | { |
2559 | 2559 | ||
2560 | // Store back all unsaved data into calendar object | 2560 | // Store back all unsaved data into calendar object |
2561 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 2561 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
2562 | if ( mViewManager->currentView() ) | 2562 | if ( mViewManager->currentView() ) |
2563 | mViewManager->currentView()->flushView(); | 2563 | mViewManager->currentView()->flushView(); |
2564 | 2564 | ||
2565 | 2565 | ||
2566 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); | 2566 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); |
2567 | mStorage->setSaveFormat( new ICalFormat() ); | 2567 | mStorage->setSaveFormat( new ICalFormat() ); |
2568 | mStorage->setFileName( filename ); | 2568 | mStorage->setFileName( filename ); |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 70baf5c..2af605f 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -341,129 +341,130 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) : | |||
341 | KMessageBox::information( this, message); | 341 | KMessageBox::information( this, message); |
342 | mView->openCalendar( oldFile ); | 342 | mView->openCalendar( oldFile ); |
343 | qApp->processEvents(); | 343 | qApp->processEvents(); |
344 | } | 344 | } |
345 | } | 345 | } |
346 | mView->saveCalendar( defaultFileName() ); | 346 | mView->saveCalendar( defaultFileName() ); |
347 | newFile = true; | 347 | newFile = true; |
348 | } | 348 | } |
349 | 349 | ||
350 | //QTime neededSaveTime = QDateTime::currentDateTime().time(); | 350 | //QTime neededSaveTime = QDateTime::currentDateTime().time(); |
351 | //mView->loadCalendars(); | 351 | //mView->loadCalendars(); |
352 | //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 352 | //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
353 | //qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 353 | //qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
354 | 354 | ||
355 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 355 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
356 | KOPrefs::instance()->setAllDefaults(); | 356 | KOPrefs::instance()->setAllDefaults(); |
357 | } | 357 | } |
358 | 358 | ||
359 | 359 | ||
360 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 360 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
361 | SLOT( disableBR(bool) ) ); | 361 | SLOT( disableBR(bool) ) ); |
362 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 362 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
363 | setCentralWidget( mView ); | 363 | setCentralWidget( mView ); |
364 | globalFlagBlockStartup = 0; | 364 | globalFlagBlockStartup = 0; |
365 | //mView->show(); | 365 | //mView->show(); |
366 | //delete splash; | 366 | //delete splash; |
367 | if ( newFile ) | 367 | if ( newFile ) |
368 | mView->updateConfig(); | 368 | mView->updateConfig(); |
369 | // qApp->processEvents(); | 369 | // qApp->processEvents(); |
370 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 370 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
371 | //fillSyncMenu(); | 371 | //fillSyncMenu(); |
372 | 372 | ||
373 | 373 | ||
374 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 374 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
375 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 375 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
376 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 376 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
377 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 377 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
378 | mSyncManager->setDefaultFileName( sentSyncFile()); | 378 | mSyncManager->setDefaultFileName( sentSyncFile()); |
379 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 379 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
380 | mSyncManager->fillSyncMenu(); | 380 | mSyncManager->fillSyncMenu(); |
381 | 381 | ||
382 | 382 | ||
383 | 383 | ||
384 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 384 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
385 | if ( showWarning ) { | 385 | if ( showWarning ) { |
386 | KMessageBox::information( this, | 386 | KMessageBox::information( this, |
387 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 387 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
388 | qApp->processEvents(); | 388 | qApp->processEvents(); |
389 | mView->dialogManager()->showSyncOptions(); | 389 | mView->dialogManager()->showSyncOptions(); |
390 | } | 390 | } |
391 | 391 | ||
392 | //US listen for result adressed from Ka/Pi | 392 | //US listen for result adressed from Ka/Pi |
393 | 393 | ||
394 | #ifndef DESKTOP_VERSION | 394 | #ifndef DESKTOP_VERSION |
395 | infrared = 0; | 395 | infrared = 0; |
396 | #endif | 396 | #endif |
397 | updateFilterToolbar(); | 397 | updateFilterToolbar(); |
398 | updateWeek( mView->startDate() ); | 398 | updateWeek( mView->startDate() ); |
399 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 399 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
400 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 400 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
401 | mBRdisabled = false; | 401 | mBRdisabled = false; |
402 | //toggleBeamReceive(); | 402 | //toggleBeamReceive(); |
403 | 403 | ||
404 | setCaption(i18n("Loading calendar files ... please wait" )); | 404 | setCaption(i18n("Loading calendar files ... please wait" )); |
405 | QTimer::singleShot( 10, this, SLOT ( loadDataAfterStart() )); | 405 | mSaveDelay = 0; |
406 | QTimer::singleShot( 1, this, SLOT ( loadDataAfterStart() )); | ||
406 | } | 407 | } |
407 | MainWindow::~MainWindow() | 408 | MainWindow::~MainWindow() |
408 | { | 409 | { |
409 | //qDebug("MainWindow::~MainWindow() "); | 410 | //qDebug("MainWindow::~MainWindow() "); |
410 | //save toolbar location | 411 | //save toolbar location |
411 | delete mCalendar; | 412 | delete mCalendar; |
412 | delete mSyncManager; | 413 | delete mSyncManager; |
413 | #ifndef DESKTOP_VERSION | 414 | #ifndef DESKTOP_VERSION |
414 | if ( infrared ) | 415 | if ( infrared ) |
415 | delete infrared; | 416 | delete infrared; |
416 | #endif | 417 | #endif |
417 | 418 | ||
418 | 419 | ||
419 | } | 420 | } |
420 | 421 | ||
421 | void MainWindow::loadDataAfterStart() | 422 | void MainWindow::loadDataAfterStart() |
422 | { | 423 | { |
423 | 424 | ||
424 | qDebug("KO: Start loading files..." ); | 425 | qDebug("KO: Start loading files..." ); |
425 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 426 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
426 | mView->loadCalendars(); | 427 | mView->loadCalendars(); |
427 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 428 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
428 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 429 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
429 | //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); | 430 | //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); |
430 | mView->setModified( false ); | 431 | mView->setModified( false ); |
431 | mBlockAtStartup = false; | 432 | mBlockAtStartup = false; |
432 | mView->setModified( false ); | 433 | mView->setModified( false ); |
433 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 434 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
434 | processIncidenceSelection( 0 ); | 435 | processIncidenceSelection( 0 ); |
435 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 436 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
436 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 437 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
437 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 438 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
438 | SLOT( slotModifiedChanged( bool ) ) ); | 439 | SLOT( slotModifiedChanged( bool ) ) ); |
439 | 440 | ||
440 | #ifndef DESKTOP_VERSION | 441 | #ifndef DESKTOP_VERSION |
441 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 442 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
442 | connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); | 443 | connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); |
443 | disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); | 444 | disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); |
444 | if ( !mCStringMess.isEmpty() ) | 445 | if ( !mCStringMess.isEmpty() ) |
445 | recieve( mCStringMess, mByteData ); | 446 | recieve( mCStringMess, mByteData ); |
446 | #endif | 447 | #endif |
447 | 448 | ||
448 | 449 | ||
449 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); | 450 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); |
450 | } | 451 | } |
451 | 452 | ||
452 | void MainWindow::slotResetFocus() | 453 | void MainWindow::slotResetFocus() |
453 | { | 454 | { |
454 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); | 455 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); |
455 | mFocusLoop = 3; | 456 | mFocusLoop = 3; |
456 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | 457 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); |
457 | } | 458 | } |
458 | void MainWindow::slotResetFocusLoop() | 459 | void MainWindow::slotResetFocusLoop() |
459 | { | 460 | { |
460 | --mFocusLoop; | 461 | --mFocusLoop; |
461 | QWidget* fw = mView->viewManager()->currentView(); | 462 | QWidget* fw = mView->viewManager()->currentView(); |
462 | if ( fw ) { | 463 | if ( fw ) { |
463 | //qDebug("loop "); | 464 | //qDebug("loop "); |
464 | fw->setFocus(); | 465 | fw->setFocus(); |
465 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) | 466 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) |
466 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | 467 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); |
467 | } | 468 | } |
468 | 469 | ||
469 | } | 470 | } |
@@ -1905,203 +1906,218 @@ void MainWindow::saveOnClose() | |||
1905 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1906 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1906 | if ( p->mToolBarHor ) | 1907 | if ( p->mToolBarHor ) |
1907 | p->mToolBarUp = myP.y() > height()/2; | 1908 | p->mToolBarUp = myP.y() > height()/2; |
1908 | else | 1909 | else |
1909 | p->mToolBarUp = myP.x() > width()/2; | 1910 | p->mToolBarUp = myP.x() > width()/2; |
1910 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1911 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1911 | if ( p->mToolBarHorV ) | 1912 | if ( p->mToolBarHorV ) |
1912 | p->mToolBarUpV = myP.y() > height()/2; | 1913 | p->mToolBarUpV = myP.y() > height()/2; |
1913 | else | 1914 | else |
1914 | p->mToolBarUpV = myP.x() > width()/2 ; | 1915 | p->mToolBarUpV = myP.x() > width()/2 ; |
1915 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1916 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1916 | if ( p->mToolBarHorN ) | 1917 | if ( p->mToolBarHorN ) |
1917 | p->mToolBarUpN = myP.y() > height()/2; | 1918 | p->mToolBarUpN = myP.y() > height()/2; |
1918 | else | 1919 | else |
1919 | p->mToolBarUpN = myP.x() > width()/2 ; | 1920 | p->mToolBarUpN = myP.x() > width()/2 ; |
1920 | if ( filterToolBar ) { | 1921 | if ( filterToolBar ) { |
1921 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1922 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1922 | if ( p->mToolBarHorF ) | 1923 | if ( p->mToolBarHorF ) |
1923 | p->mToolBarUpF = myP.y() > height()/2; | 1924 | p->mToolBarUpF = myP.y() > height()/2; |
1924 | else | 1925 | else |
1925 | p->mToolBarUpF = myP.x() > width()/2 ; | 1926 | p->mToolBarUpF = myP.x() > width()/2 ; |
1926 | } | 1927 | } |
1927 | #else | 1928 | #else |
1928 | if ( p->mToolBarHor ) | 1929 | if ( p->mToolBarHor ) |
1929 | p->mToolBarUp = iconToolBar->y() > height()/2; | 1930 | p->mToolBarUp = iconToolBar->y() > height()/2; |
1930 | else | 1931 | else |
1931 | p->mToolBarUp = iconToolBar->x() > width()/2; | 1932 | p->mToolBarUp = iconToolBar->x() > width()/2; |
1932 | if ( p->mToolBarHorV ) | 1933 | if ( p->mToolBarHorV ) |
1933 | p->mToolBarUpV = viewToolBar->y() > height()/2; | 1934 | p->mToolBarUpV = viewToolBar->y() > height()/2; |
1934 | else | 1935 | else |
1935 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; | 1936 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; |
1936 | 1937 | ||
1937 | if ( p->mToolBarHorN ) | 1938 | if ( p->mToolBarHorN ) |
1938 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; | 1939 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; |
1939 | else | 1940 | else |
1940 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; | 1941 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; |
1941 | if ( filterToolBar ) { | 1942 | if ( filterToolBar ) { |
1942 | if ( p->mToolBarHorF ) | 1943 | if ( p->mToolBarHorF ) |
1943 | p->mToolBarUpF = filterToolBar->y() > height()/2; | 1944 | p->mToolBarUpF = filterToolBar->y() > height()/2; |
1944 | else | 1945 | else |
1945 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; | 1946 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; |
1946 | } | 1947 | } |
1947 | #endif | 1948 | #endif |
1948 | save(); | 1949 | save(); |
1949 | mView->writeSettings(); | 1950 | mView->writeSettings(); |
1950 | mView->checkSuspendAlarm(); | 1951 | mView->checkSuspendAlarm(); |
1951 | } | 1952 | } |
1952 | void MainWindow::slotModifiedChanged( bool ) | 1953 | void MainWindow::slotModifiedChanged( bool ) |
1953 | { | 1954 | { |
1954 | if ( mBlockAtStartup ) | 1955 | if ( mBlockAtStartup ) |
1955 | return; | 1956 | return; |
1956 | 1957 | ||
1957 | int msec; | 1958 | int msec; |
1958 | if ( mCalendarModifiedFlag ) { | 1959 | if ( mCalendarModifiedFlag ) { |
1959 | //qDebug(" MainWindow timer is running "); | 1960 | //qDebug(" MainWindow timer is running "); |
1960 | return; | 1961 | return; |
1961 | } | 1962 | } |
1962 | // we store the changes after 1 minute, | 1963 | // we store the changes after 1 minute, |
1963 | // and for safety reasons after 10 minutes again | 1964 | // and for safety reasons after 10 minutes again |
1964 | if ( !mSyncManager->blockSave() ) | 1965 | if ( !mSyncManager->blockSave() ) |
1965 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1966 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1966 | else | 1967 | else |
1967 | msec = 1000 * 600; | 1968 | msec = 1000 * 600; |
1968 | mSaveTimer.start( msec, true ); // 1 minute | 1969 | mSaveTimer.start( msec, true ); // 1 minute |
1970 | mSaveTime.restart(); | ||
1971 | mSaveDelay = msec/1000; | ||
1969 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1972 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1970 | mCalendarModifiedFlag = true; | 1973 | mCalendarModifiedFlag = true; |
1971 | } | 1974 | } |
1972 | void MainWindow::saveStopTimer() | 1975 | void MainWindow::saveStopTimer() |
1973 | { | 1976 | { |
1974 | mSaveTimer.stop(); | 1977 | mSaveTimer.stop(); |
1975 | } | 1978 | } |
1976 | void MainWindow::backupAllFiles() | 1979 | void MainWindow::backupAllFiles() |
1977 | { | 1980 | { |
1978 | QDate reference ( 2000,1,1); | 1981 | QDate reference ( 2000,1,1); |
1979 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1982 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1980 | setCaption(i18n("Creating backup ... please wait ..." )); | 1983 | setCaption(i18n("Creating backup ... please wait ..." )); |
1981 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); | 1984 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); |
1982 | // we need the file path, the backup dir and the number of bups as param | 1985 | // we need the file path, the backup dir and the number of bups as param |
1983 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 1986 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
1984 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 1987 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
1985 | bupDir = KGlobalSettings::backupDataDir(); | 1988 | bupDir = KGlobalSettings::backupDataDir(); |
1986 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1989 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1987 | if ( retval == 0 ) { | 1990 | if ( retval == 0 ) { |
1988 | setCaption(i18n("Backup cancelled" )); | 1991 | setCaption(i18n("Backup cancelled" )); |
1989 | qDebug("KO: Backup cancelled. Will try again tomorrow "); | 1992 | qDebug("KO: Backup cancelled. Will try again tomorrow "); |
1990 | // retval == 0 : backup skipped for today, try again tomorrow | 1993 | // retval == 0 : backup skipped for today, try again tomorrow |
1991 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; | 1994 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; |
1992 | } else if ( retval == 1 ){ | 1995 | } else if ( retval == 1 ){ |
1993 | qDebug("KO: Backup created."); | 1996 | qDebug("KO: Backup created."); |
1994 | // backup ok | 1997 | // backup ok |
1995 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1998 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1996 | KopiCalendarFile * cal = calendars.first(); | 1999 | KopiCalendarFile * cal = calendars.first(); |
1997 | cal = calendars.next(); | 2000 | cal = calendars.next(); |
1998 | while ( cal ) { | 2001 | while ( cal ) { |
1999 | if ( !cal->mErrorOnLoad ) { | 2002 | if ( !cal->mErrorOnLoad ) { |
2000 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 2003 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
2001 | } | 2004 | } |
2002 | cal = calendars.next(); | 2005 | cal = calendars.next(); |
2003 | } | 2006 | } |
2004 | KOPrefs::instance()->mLastBackupDate = daysTo; | 2007 | KOPrefs::instance()->mLastBackupDate = daysTo; |
2005 | setCaption(i18n("Backup succesfully finished" )); | 2008 | setCaption(i18n("Backup succesfully finished" )); |
2006 | } else if ( retval == 2 ){ | 2009 | } else if ( retval == 2 ){ |
2007 | setCaption(i18n("Backup globally disabled" )); | 2010 | setCaption(i18n("Backup globally disabled" )); |
2008 | qDebug("KO: Backup globally cancelled."); | 2011 | qDebug("KO: Backup globally cancelled."); |
2009 | // backup globally cancelled | 2012 | // backup globally cancelled |
2010 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 2013 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
2011 | } | 2014 | } |
2012 | // retval == 3: do nothing, try again later | 2015 | // retval == 3: do nothing, try again later |
2013 | } | 2016 | } |
2014 | void MainWindow::save() | 2017 | void MainWindow::save() |
2015 | { | 2018 | { |
2019 | if ( mSaveDelay ) { | ||
2020 | if ( mSaveDelay + 60 < mSaveTime.elapsed()/1000 ) { | ||
2021 | qDebug("KO: Save delay %d. Elapsed save time %d ", mSaveDelay, mSaveTime.elapsed()/1000 ); | ||
2022 | qDebug("KO: Restarting save timer"); | ||
2023 | int msec = 10000; | ||
2024 | mSaveTimer.start( msec, true ); // 1 minute | ||
2025 | mSaveTime.restart(); | ||
2026 | mSaveDelay = msec/1000; | ||
2027 | return; | ||
2028 | } | ||
2029 | } | ||
2016 | 2030 | ||
2017 | if ( mView->viewManager()->journalView() ) | 2031 | if ( mView->viewManager()->journalView() ) |
2018 | mView->viewManager()->journalView()->checkModified(); | 2032 | mView->viewManager()->journalView()->checkModified(); |
2019 | if ( !mCalendarModifiedFlag ) { | 2033 | if ( !mCalendarModifiedFlag ) { |
2020 | qDebug("KO: Calendar not modified. Nothing saved."); | 2034 | qDebug("KO: Calendar not modified. Nothing saved."); |
2021 | return; | 2035 | return; |
2022 | } | 2036 | } |
2023 | if ( mSyncManager->blockSave() ) { | 2037 | if ( mSyncManager->blockSave() ) { |
2024 | slotModifiedChanged( true ); | 2038 | slotModifiedChanged( true ); |
2025 | return; | 2039 | return; |
2026 | } | 2040 | } |
2041 | mSaveDelay = 0; | ||
2027 | mSyncManager->setBlockSave(true); | 2042 | mSyncManager->setBlockSave(true); |
2028 | if ( mView->checkAllFileVersions() ) { | 2043 | if ( mView->checkAllFileVersions() ) { |
2029 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ | 2044 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ |
2030 | QDate reference ( 2000,1,1); | 2045 | QDate reference ( 2000,1,1); |
2031 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 2046 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
2032 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { | 2047 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { |
2033 | backupAllFiles(); | 2048 | backupAllFiles(); |
2034 | } | 2049 | } |
2035 | ; // KPimGlobalPrefs::instance()->mLastBackupDate | 2050 | ; // KPimGlobalPrefs::instance()->mLastBackupDate |
2036 | } | 2051 | } |
2037 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 2052 | QTime neededSaveTime; |
2053 | neededSaveTime.start(); | ||
2038 | if ( !isMinimized () ) | 2054 | if ( !isMinimized () ) |
2039 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 2055 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
2040 | qDebug("KO: Start saving data to file!"); | 2056 | qDebug("KO: Start saving data to file!"); |
2041 | if ( mView->saveCalendars() ) | 2057 | if ( mView->saveCalendars() ) |
2042 | mCalendarModifiedFlag = false; | 2058 | mCalendarModifiedFlag = false; |
2043 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 2059 | int msNeeded = neededSaveTime.elapsed(); |
2044 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 2060 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
2045 | QString savemes; | 2061 | QString savemes; |
2046 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 2062 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
2047 | if ( !isMinimized () ) | 2063 | if ( !isMinimized () ) |
2048 | setCaption(savemes); | 2064 | setCaption(savemes); |
2049 | else | 2065 | else |
2050 | qDebug(savemes); | 2066 | qDebug(savemes); |
2051 | } else { | 2067 | } else { |
2052 | setCaption(i18n("Saving cancelled!")); | 2068 | setCaption(i18n("Saving cancelled!")); |
2053 | mCalendarModifiedFlag = false; | 2069 | mCalendarModifiedFlag = false; |
2054 | slotModifiedChanged( true ); | 2070 | slotModifiedChanged( true ); |
2055 | } | 2071 | } |
2056 | mSyncManager->setBlockSave( false ); | 2072 | mSyncManager->setBlockSave( false ); |
2057 | } | 2073 | } |
2058 | 2074 | ||
2059 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 2075 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
2060 | { | 2076 | { |
2061 | if ( !e->isAutoRepeat() ) { | 2077 | if ( !e->isAutoRepeat() ) { |
2062 | mFlagKeyPressed = false; | 2078 | mFlagKeyPressed = false; |
2063 | } | 2079 | } |
2064 | } | 2080 | } |
2065 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 2081 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
2066 | { | 2082 | { |
2067 | qApp->processEvents(); | 2083 | qApp->processEvents(); |
2068 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 2084 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
2069 | e->ignore(); | 2085 | e->ignore(); |
2070 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 2086 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
2071 | return; | 2087 | return; |
2072 | } | 2088 | } |
2073 | if (! e->isAutoRepeat() ) | 2089 | if (! e->isAutoRepeat() ) |
2074 | mFlagKeyPressed = true; | 2090 | mFlagKeyPressed = true; |
2075 | KOPrefs *p = KOPrefs::instance(); | 2091 | KOPrefs *p = KOPrefs::instance(); |
2076 | bool showSelectedDates = false; | 2092 | bool showSelectedDates = false; |
2077 | int size; | 2093 | int size; |
2078 | int pro = 0; | 2094 | int pro = 0; |
2079 | //qDebug("MainWindow::keyPressEvent "); | 2095 | //qDebug("MainWindow::keyPressEvent "); |
2080 | switch ( e->key() ) { | 2096 | switch ( e->key() ) { |
2081 | case Qt::Key_Right: | 2097 | case Qt::Key_Right: |
2082 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 2098 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
2083 | mView->goNextMonth(); | 2099 | mView->goNextMonth(); |
2084 | else | 2100 | else |
2085 | mView->goNext(); | 2101 | mView->goNext(); |
2086 | showSelectedDates = true; | 2102 | showSelectedDates = true; |
2087 | break; | 2103 | break; |
2088 | case Qt::Key_Left: | 2104 | case Qt::Key_Left: |
2089 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2105 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2090 | mView->goPreviousMonth(); | 2106 | mView->goPreviousMonth(); |
2091 | else | 2107 | else |
2092 | mView->goPrevious(); | 2108 | mView->goPrevious(); |
2093 | showSelectedDates = true; | 2109 | showSelectedDates = true; |
2094 | break; | 2110 | break; |
2095 | case Qt::Key_Down: | 2111 | case Qt::Key_Down: |
2096 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 2112 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
2097 | break; | 2113 | break; |
2098 | case Qt::Key_Up: | 2114 | case Qt::Key_Up: |
2099 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 2115 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
2100 | break; | 2116 | break; |
2101 | case Qt::Key_K: | 2117 | case Qt::Key_K: |
2102 | mView->viewManager()->showMonthViewWeek(); | 2118 | mView->viewManager()->showMonthViewWeek(); |
2103 | break; | 2119 | break; |
2104 | case Qt::Key_I: | 2120 | case Qt::Key_I: |
2105 | mView->showIncidence(); | 2121 | mView->showIncidence(); |
2106 | break; | 2122 | break; |
2107 | case Qt::Key_Delete: | 2123 | case Qt::Key_Delete: |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index fdcf7c4..657c0a8 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -113,72 +113,74 @@ class MainWindow : public QMainWindow | |||
113 | protected: | 113 | protected: |
114 | int mFocusLoop; | 114 | int mFocusLoop; |
115 | void hideEvent ( QHideEvent * ); | 115 | void hideEvent ( QHideEvent * ); |
116 | QString sentSyncFile(); | 116 | QString sentSyncFile(); |
117 | void displayText( QString, QString); | 117 | void displayText( QString, QString); |
118 | void enableIncidenceActions( bool ); | 118 | void enableIncidenceActions( bool ); |
119 | 119 | ||
120 | private: | 120 | private: |
121 | 121 | ||
122 | QCString mCStringMess; | 122 | QCString mCStringMess; |
123 | QByteArray mByteData; | 123 | QByteArray mByteData; |
124 | 124 | ||
125 | //void setMenuBar( QMenuBar * ); | 125 | //void setMenuBar( QMenuBar * ); |
126 | bool mBRdisabled; | 126 | bool mBRdisabled; |
127 | #ifndef DESKTOP_VERSION | 127 | #ifndef DESKTOP_VERSION |
128 | QCopChannel* infrared; | 128 | QCopChannel* infrared; |
129 | #endif | 129 | #endif |
130 | QAction* brAction; | 130 | QAction* brAction; |
131 | KSyncManager* mSyncManager; | 131 | KSyncManager* mSyncManager; |
132 | bool mClosed; | 132 | bool mClosed; |
133 | void saveOnClose(); | 133 | void saveOnClose(); |
134 | bool mFlagKeyPressed; | 134 | bool mFlagKeyPressed; |
135 | bool mBlockAtStartup; | 135 | bool mBlockAtStartup; |
136 | KMenuBar *menuBar1; | 136 | KMenuBar *menuBar1; |
137 | QPEToolBar *iconToolBar; | 137 | QPEToolBar *iconToolBar; |
138 | QPEToolBar *viewToolBar; | 138 | QPEToolBar *viewToolBar; |
139 | QPEToolBar *navigatorToolBar; | 139 | QPEToolBar *navigatorToolBar; |
140 | QPEToolBar *filterToolBar; | 140 | QPEToolBar *filterToolBar; |
141 | KMenuBar *filterMenubar; | 141 | KMenuBar *filterMenubar; |
142 | QPopupMenu * filterPopupMenu; | 142 | QPopupMenu * filterPopupMenu; |
143 | QPopupMenu * mCurrentItemMenu; | 143 | QPopupMenu * mCurrentItemMenu; |
144 | void initActions(); | 144 | void initActions(); |
145 | void setDefaultPreferences(); | 145 | void setDefaultPreferences(); |
146 | void resizeEvent( QResizeEvent* e); | 146 | void resizeEvent( QResizeEvent* e); |
147 | void keyPressEvent ( QKeyEvent * ) ; | 147 | void keyPressEvent ( QKeyEvent * ) ; |
148 | void keyReleaseEvent ( QKeyEvent * ) ; | 148 | void keyReleaseEvent ( QKeyEvent * ) ; |
149 | QPopupMenu *configureToolBarMenu; | 149 | QPopupMenu *configureToolBarMenu; |
150 | QPopupMenu *selectFilterMenu; | 150 | QPopupMenu *selectFilterMenu; |
151 | QPopupMenu *selectFilterMenuTB; | 151 | QPopupMenu *selectFilterMenuTB; |
152 | QPopupMenu *configureAgendaMenu, *syncMenu; | 152 | QPopupMenu *configureAgendaMenu, *syncMenu; |
153 | CalendarLocal *mCalendar; | 153 | CalendarLocal *mCalendar; |
154 | CalendarView *mView; | 154 | CalendarView *mView; |
155 | QAction *mNewSubTodoAction; | 155 | QAction *mNewSubTodoAction; |
156 | QAction *mWeekAction; | 156 | QAction *mWeekAction; |
157 | QFont mWeekFont; | 157 | QFont mWeekFont; |
158 | QPixmap mWeekPixmap; | 158 | QPixmap mWeekPixmap; |
159 | QColor mWeekBgColor; | 159 | QColor mWeekBgColor; |
160 | 160 | ||
161 | QAction *mShowAction; | 161 | QAction *mShowAction; |
162 | QAction *mEditAction; | 162 | QAction *mEditAction; |
163 | QAction *mDeleteAction; | 163 | QAction *mDeleteAction; |
164 | QAction *mCloneAction; | 164 | QAction *mCloneAction; |
165 | QAction *mMoveAction; | 165 | QAction *mMoveAction; |
166 | QAction *mBeamAction; | 166 | QAction *mBeamAction; |
167 | QAction *mCancelAction; | 167 | QAction *mCancelAction; |
168 | QAction *mPrintSelAction; | 168 | QAction *mPrintSelAction; |
169 | 169 | ||
170 | QAction *mToggleNav; | 170 | QAction *mToggleNav; |
171 | QAction *mToggleFilter; | 171 | QAction *mToggleFilter; |
172 | QAction *mToggleAllday; | 172 | QAction *mToggleAllday; |
173 | QAction *actionFilterMenuTB; | 173 | QAction *actionFilterMenuTB; |
174 | 174 | ||
175 | void closeEvent( QCloseEvent* ce ); | 175 | void closeEvent( QCloseEvent* ce ); |
176 | QTimer mSaveTimer; | 176 | QTimer mSaveTimer; |
177 | QTime mSaveTime; | ||
178 | int mSaveDelay; | ||
177 | //bool mBlockSaveFlag; | 179 | //bool mBlockSaveFlag; |
178 | bool mCalendarModifiedFlag; | 180 | bool mCalendarModifiedFlag; |
179 | QPixmap loadPixmap( QString ); | 181 | QPixmap loadPixmap( QString ); |
180 | QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80, journalPix; | 182 | QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80, journalPix; |
181 | }; | 183 | }; |
182 | 184 | ||
183 | 185 | ||
184 | #endif | 186 | #endif |