summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-09-17 22:07:21 (UTC)
committer zautrix <zautrix>2005-09-17 22:07:21 (UTC)
commit64199073c047a30f3cff85fe6ee30691ff0db2f7 (patch) (side-by-side diff)
tree5ff49088999f2c02fb2a40760b881c02f50cfc35 /korganizer
parente228113016abd6f75824633da9520c1ec1763f23 (diff)
downloadkdepimpi-64199073c047a30f3cff85fe6ee30691ff0db2f7.zip
kdepimpi-64199073c047a30f3cff85fe6ee30691ff0db2f7.tar.gz
kdepimpi-64199073c047a30f3cff85fe6ee30691ff0db2f7.tar.bz2
savetimer
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp4
-rw-r--r--korganizer/mainwindow.cpp22
-rw-r--r--korganizer/mainwindow.h2
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
@@ -2502,4 +2502,4 @@ bool CalendarView::checkFileVersion(QString fn)
QDateTime dt = finf.lastModified ();
- qDebug("loaded file version %s %s", fn.latin1(), loadedFileVersion.toString().latin1());
- qDebug("file on disk version %s %s", fn.latin1(),dt.toString().latin1());
+ //qDebug("loaded file version %s %s", fn.latin1(), loadedFileVersion.toString().latin1());
+ //qDebug("file on disk version %s %s", fn.latin1(),dt.toString().latin1());
if ( dt <= loadedFileVersion )
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 70baf5c..2af605f 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -404,3 +404,4 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) :
setCaption(i18n("Loading calendar files ... please wait" ));
- QTimer::singleShot( 10, this, SLOT ( loadDataAfterStart() ));
+ mSaveDelay = 0;
+ QTimer::singleShot( 1, this, SLOT ( loadDataAfterStart() ));
}
@@ -1968,2 +1969,4 @@ void MainWindow::slotModifiedChanged( bool )
mSaveTimer.start( msec, true ); // 1 minute
+ mSaveTime.restart();
+ mSaveDelay = msec/1000;
qDebug("KO: Saving File in %d secs!", msec/1000);
@@ -2015,2 +2018,13 @@ void MainWindow::save()
{
+ if ( mSaveDelay ) {
+ if ( mSaveDelay + 60 < mSaveTime.elapsed()/1000 ) {
+ qDebug("KO: Save delay %d. Elapsed save time %d ", mSaveDelay, mSaveTime.elapsed()/1000 );
+ qDebug("KO: Restarting save timer");
+ int msec = 10000;
+ mSaveTimer.start( msec, true ); // 1 minute
+ mSaveTime.restart();
+ mSaveDelay = msec/1000;
+ return;
+ }
+ }
@@ -2026,2 +2040,3 @@ void MainWindow::save()
}
+ mSaveDelay = 0;
mSyncManager->setBlockSave(true);
@@ -2036,3 +2051,4 @@ void MainWindow::save()
}
- QTime neededSaveTime = QDateTime::currentDateTime().time();
+ QTime neededSaveTime;
+ neededSaveTime.start();
if ( !isMinimized () )
@@ -2042,3 +2058,3 @@ void MainWindow::save()
mCalendarModifiedFlag = false;
- int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
+ int msNeeded = neededSaveTime.elapsed();
qDebug("KO: Needed %d ms for saving.",msNeeded );
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index fdcf7c4..657c0a8 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -176,2 +176,4 @@ class MainWindow : public QMainWindow
QTimer mSaveTimer;
+ QTime mSaveTime;
+ int mSaveDelay;
//bool mBlockSaveFlag;