summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (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
@@ -1545,6 +1545,19 @@ bool CalendarView::checkFileChanged(QString fn)
return true;
}
+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)
{
QFileInfo finf ( fn );
@@ -1555,7 +1568,7 @@ bool CalendarView::checkFileVersion(QString fn)
//qDebug("file on disk version %s",dt.toString().latin1());
if ( dt <= loadedFileVersion )
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"),
i18n("Sync+save"));
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index a3315ad..355bb84 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -172,6 +172,7 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
public slots:
+ void watchSavedFile();
void recheckTimerAlarm();
void checkNextTimerAlarm();
void addAlarm(const QDateTime &qdt, const QString &noti );
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 1c4a186..6315c64 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1408,10 +1408,11 @@ void MainWindow::save()
QTime neededSaveTime = QDateTime::currentDateTime().time();
setCaption(i18n("KO/Pi:Saving Data to File ..." ));
qDebug("KO: Start saving data to file!");
+ mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
mView->saveCalendar( defaultFileName() );
int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
- mView->setLoadedFileVersion(QDateTime::currentDateTime());
+ mView->watchSavedFile();
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 );