-rw-r--r-- | korganizer/mainwindow.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 7ce0251..45775c5 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1970,32 +1970,33 @@ void MainWindow::backupAllFiles() | |||
1970 | qDebug("KO: Backup globally cancelled."); | 1970 | qDebug("KO: Backup globally cancelled."); |
1971 | // backup globally cancelled | 1971 | // backup globally cancelled |
1972 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 1972 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
1973 | } | 1973 | } |
1974 | // retval == 3: do nothing, try again later | 1974 | // retval == 3: do nothing, try again later |
1975 | } | 1975 | } |
1976 | void MainWindow::save() | 1976 | void MainWindow::save() |
1977 | { | 1977 | { |
1978 | 1978 | ||
1979 | if ( mView->viewManager()->journalView() ) | 1979 | if ( mView->viewManager()->journalView() ) |
1980 | mView->viewManager()->journalView()->checkModified(); | 1980 | mView->viewManager()->journalView()->checkModified(); |
1981 | if ( !mCalendarModifiedFlag ) { | 1981 | if ( !mCalendarModifiedFlag ) { |
1982 | qDebug("KO: Calendar not modified. Nothing saved."); | 1982 | qDebug("KO: Calendar not modified. Nothing saved."); |
1983 | return; | 1983 | return; |
1984 | } | 1984 | } |
1985 | if ( mSyncManager->blockSave() ) { | 1985 | if ( mSyncManager->blockSave() ) { |
1986 | slotModifiedChanged( true ); | ||
1986 | return; | 1987 | return; |
1987 | } | 1988 | } |
1988 | mSyncManager->setBlockSave(true); | 1989 | mSyncManager->setBlockSave(true); |
1989 | if ( mView->checkAllFileVersions() ) { | 1990 | if ( mView->checkAllFileVersions() ) { |
1990 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ | 1991 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ |
1991 | QDate reference ( 2000,1,1); | 1992 | QDate reference ( 2000,1,1); |
1992 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1993 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1993 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { | 1994 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { |
1994 | backupAllFiles(); | 1995 | backupAllFiles(); |
1995 | } | 1996 | } |
1996 | ; // KPimGlobalPrefs::instance()->mLastBackupDate | 1997 | ; // KPimGlobalPrefs::instance()->mLastBackupDate |
1997 | } | 1998 | } |
1998 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1999 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1999 | if ( !isMinimized () ) | 2000 | if ( !isMinimized () ) |
2000 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 2001 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
2001 | qDebug("KO: Start saving data to file!"); | 2002 | qDebug("KO: Start saving data to file!"); |
@@ -2546,39 +2547,45 @@ void MainWindow::exportVCalendar() | |||
2546 | setCaption(mes); | 2547 | setCaption(mes); |
2547 | } | 2548 | } |
2548 | } | 2549 | } |
2549 | 2550 | ||
2550 | } | 2551 | } |
2551 | QString MainWindow::sentSyncFile() | 2552 | QString MainWindow::sentSyncFile() |
2552 | { | 2553 | { |
2553 | #ifdef DESKTOP_VERSION | 2554 | #ifdef DESKTOP_VERSION |
2554 | return locateLocal( "tmp", "copysynccal.ics" ); | 2555 | return locateLocal( "tmp", "copysynccal.ics" ); |
2555 | #else | 2556 | #else |
2556 | return QString( "/tmp/copysynccal.ics" ); | 2557 | return QString( "/tmp/copysynccal.ics" ); |
2557 | #endif | 2558 | #endif |
2558 | } | 2559 | } |
2559 | 2560 | ||
2560 | void MainWindow::syncFileRequest() | 2561 | void MainWindow::syncFileRequest() |
2561 | { | 2562 | { |
2563 | while ( mSyncManager->blockSave() ) { | ||
2564 | qApp->processEvents(); | ||
2565 | } | ||
2566 | mSyncManager->setBlockSave(true); | ||
2567 | |||
2562 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2568 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2563 | mSyncManager->slotSyncMenu( 999 ); | 2569 | mSyncManager->slotSyncMenu( 999 ); |
2564 | } | 2570 | } |
2565 | 2571 | ||
2566 | setCaption(i18n("Saving Data to temp file ..." )); | 2572 | setCaption(i18n("Saving Data to temp file ..." )); |
2567 | mView->saveCalendar( sentSyncFile() ); | 2573 | mView->saveCalendar( sentSyncFile() ); |
2568 | setCaption(i18n("Data saved to temp file!" )); | 2574 | setCaption(i18n("Data saved to temp file!" )); |
2575 | mSyncManager->setBlockSave( false ); | ||
2569 | 2576 | ||
2570 | } | 2577 | } |
2571 | void MainWindow::getFile( bool success ) | 2578 | void MainWindow::getFile( bool success ) |
2572 | { | 2579 | { |
2573 | if ( ! success ) { | 2580 | if ( ! success ) { |
2574 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2581 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2575 | return; | 2582 | return; |
2576 | } | 2583 | } |
2577 | mView->mergeFile( sentSyncFile() ); | 2584 | mView->mergeFile( sentSyncFile() ); |
2578 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2585 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2579 | mSyncManager->slotSyncMenu( 999 ); | 2586 | mSyncManager->slotSyncMenu( 999 ); |
2580 | } | 2587 | } |
2581 | setCaption( i18n("Pi-Sync successful!") ); | 2588 | setCaption( i18n("Pi-Sync successful!") ); |
2582 | } | 2589 | } |
2583 | void MainWindow::printListView() | 2590 | void MainWindow::printListView() |
2584 | { | 2591 | { |