author | zautrix <zautrix> | 2005-02-03 00:01:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-03 00:01:07 (UTC) |
commit | ca3c58c09b1b7d2733eeacc9e8ca568134926e93 (patch) (side-by-side diff) | |
tree | dbee3bfe638d1ae44288ae6c209e014e40206c0d /korganizer/mainwindow.cpp | |
parent | 279354f19275e5e654636acb87c465edf652eeae (diff) | |
download | kdepimpi-ca3c58c09b1b7d2733eeacc9e8ca568134926e93.zip kdepimpi-ca3c58c09b1b7d2733eeacc9e8ca568134926e93.tar.gz kdepimpi-ca3c58c09b1b7d2733eeacc9e8ca568134926e93.tar.bz2 |
tz fixes
-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 @@ -258,8 +258,10 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : //fillSyncMenu(); 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()); connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); @@ -1446,8 +1448,9 @@ void MainWindow::saveOnClose() 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 if ( !mSyncManager->blockSave() ) @@ -1457,28 +1460,38 @@ void MainWindow::slotModifiedChanged( bool changed ) mSaveTimer.start( msec, true ); // 1 minute 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; savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); setCaption(savemes); } else setCaption(i18n("Saving cancelled!")); - mCalendarModifiedFlag = false; mSyncManager->setBlockSave( false ); } void MainWindow::keyReleaseEvent ( QKeyEvent * e) |