-rw-r--r-- | korganizer/mainwindow.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 3feb4ab..a2c20a8 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -259,6 +259,8 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); + connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); + connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); mSyncManager->setDefaultFileName( defaultFileName()); @@ -1447,6 +1449,7 @@ void MainWindow::slotModifiedChanged( bool changed ) { if ( mBlockAtStartup ) return; + int msec; // we store the changes after 1 minute, // and for safety reasons after 10 minutes again @@ -1458,18 +1461,29 @@ void MainWindow::slotModifiedChanged( bool changed ) qDebug("KO: Saving File in %d secs!", msec/1000); mCalendarModifiedFlag = true; } +void MainWindow::saveStopTimer() +{ + mSaveTimer.stop(); + if (mSaveTimer.isActive() ) + qDebug("ti active "); + else + qDebug("KO: Save timer stopped"); +} void MainWindow::save() { + if ( !mCalendarModifiedFlag ) { + qDebug("KO: Calendar not modified. Nothing saved."); + return; + } if ( mSyncManager->blockSave() ) return; mSyncManager->setBlockSave(true); if ( mView->checkFileVersion( defaultFileName()) ) { - QTime neededSaveTime = QDateTime::currentDateTime().time(); setCaption(i18n("KO/Pi:Saving Data to File ..." )); qDebug("KO: Start saving data to file!"); mView->saveCalendar( defaultFileName() ); - + mCalendarModifiedFlag = false; int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); qDebug("KO: Needed %d ms for saving.",msNeeded ); QString savemes; @@ -1477,7 +1491,6 @@ void MainWindow::save() setCaption(savemes); } else setCaption(i18n("Saving cancelled!")); - mCalendarModifiedFlag = false; mSyncManager->setBlockSave( false ); } |