summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
Unidiff
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp19
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) :
259 259
260 260
261 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 261 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
262 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
263 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
262 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 264 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
263 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 265 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
264 mSyncManager->setDefaultFileName( defaultFileName()); 266 mSyncManager->setDefaultFileName( defaultFileName());
@@ -1447,6 +1449,7 @@ void MainWindow::slotModifiedChanged( bool changed )
1447{ 1449{
1448 if ( mBlockAtStartup ) 1450 if ( mBlockAtStartup )
1449 return; 1451 return;
1452
1450 int msec; 1453 int msec;
1451 // we store the changes after 1 minute, 1454 // we store the changes after 1 minute,
1452 // and for safety reasons after 10 minutes again 1455 // and for safety reasons after 10 minutes again
@@ -1458,18 +1461,29 @@ void MainWindow::slotModifiedChanged( bool changed )
1458 qDebug("KO: Saving File in %d secs!", msec/1000); 1461 qDebug("KO: Saving File in %d secs!", msec/1000);
1459 mCalendarModifiedFlag = true; 1462 mCalendarModifiedFlag = true;
1460} 1463}
1464void MainWindow::saveStopTimer()
1465{
1466 mSaveTimer.stop();
1467 if (mSaveTimer.isActive() )
1468 qDebug("ti active ");
1469 else
1470 qDebug("KO: Save timer stopped");
1471}
1461void MainWindow::save() 1472void MainWindow::save()
1462{ 1473{
1474 if ( !mCalendarModifiedFlag ) {
1475 qDebug("KO: Calendar not modified. Nothing saved.");
1476 return;
1477 }
1463 if ( mSyncManager->blockSave() ) 1478 if ( mSyncManager->blockSave() )
1464 return; 1479 return;
1465 mSyncManager->setBlockSave(true); 1480 mSyncManager->setBlockSave(true);
1466 if ( mView->checkFileVersion( defaultFileName()) ) { 1481 if ( mView->checkFileVersion( defaultFileName()) ) {
1467
1468 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1482 QTime neededSaveTime = QDateTime::currentDateTime().time();
1469 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1483 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1470 qDebug("KO: Start saving data to file!"); 1484 qDebug("KO: Start saving data to file!");
1471 mView->saveCalendar( defaultFileName() ); 1485 mView->saveCalendar( defaultFileName() );
1472 1486 mCalendarModifiedFlag = false;
1473 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1487 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1474 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1488 qDebug("KO: Needed %d ms for saving.",msNeeded );
1475 QString savemes; 1489 QString savemes;
@@ -1477,7 +1491,6 @@ void MainWindow::save()
1477 setCaption(savemes); 1491 setCaption(savemes);
1478 } else 1492 } else
1479 setCaption(i18n("Saving cancelled!")); 1493 setCaption(i18n("Saving cancelled!"));
1480 mCalendarModifiedFlag = false;
1481 mSyncManager->setBlockSave( false ); 1494 mSyncManager->setBlockSave( false );
1482} 1495}
1483 1496