summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp15
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/mainwindow.cpp3
3 files changed, 17 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 3635cfa..eaea040 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1547,2 +1547,15 @@ bool CalendarView::checkFileChanged(QString fn)
}
+void CalendarView::watchSavedFile()
+{
+ QFileInfo finf ( MainWindow::defaultFileName());
+ if ( !finf.exists() )
+ return;
+ QDateTime dt = finf.lastModified ();
+ if ( dt < loadedFileVersion ) {
+ QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) );
+ return;
+ }
+ loadedFileVersion = dt;
+}
+
bool CalendarView::checkFileVersion(QString fn)
@@ -1557,3 +1570,3 @@ bool CalendarView::checkFileVersion(QString fn)
return true;
- int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) ,
+ int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) ,
i18n("KO/Pi Warning"),i18n("Overwrite"),
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index a3315ad..355bb84 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -174,2 +174,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
public slots:
+ void watchSavedFile();
void recheckTimerAlarm();
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 1c4a186..6315c64 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1410,2 +1410,3 @@ void MainWindow::save()
qDebug("KO: Start saving data to file!");
+ mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
mView->saveCalendar( defaultFileName() );
@@ -1413,3 +1414,3 @@ void MainWindow::save()
int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
- mView->setLoadedFileVersion(QDateTime::currentDateTime());
+ mView->watchSavedFile();
qDebug("KO: Needed %d ms for saving.",msNeeded );