summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt8
-rw-r--r--korganizer/mainwindow.cpp53
-rw-r--r--korganizer/mainwindow.h4
3 files changed, 59 insertions, 6 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index ea653b2..e8b54fd 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1566,2 +1566,10 @@
{ " (Duration: %1 days)"," (Dauer: %1 Tage)" },
+{ "Autosave enabled!","Auto-Speichern angeschaltet!" },
+{ "Autosave disabled! Save timer stopped!","Auto-Speichern ausgeschaltet! Speicher Timer gestoppt!" },
+{ "Autosave disabled!","Auto-Speichern ist ausgeschaltet!" },
+{ "Yes, Save!","Ja, Speichern!" },
+{ "Calendar is modified\nbut Autosave is disabled!\nDo you want\nto save the data?","Der Kalender wurde verändert,\naber Auto-Speichern ist\nabgeschaltet. Möchten Sie\ndie Daten speichern?" },
+{ "<p><b>C+ctrl</b>: Dis/enable automatic saving</p>\n","<p><b>C+ctrl</b>: Auto-Speichern ab/anschalten</p>\n" },
+{ "","" },
+{ "","" },
{ "","" },
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index c597138..66bb19b 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -172,2 +172,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) :
}
+ mAutoSaveDisabled = false;
mClosed = false;
@@ -539,9 +540,24 @@ bool MainWindow::askForQuitOnSaveError()
}
-
+bool MainWindow::checkAutosave()
+{
+ bool savedata = true;
+ if ( mAutoSaveDisabled && mCalendarModifiedFlag ) {
+ switch( QMessageBox::information( this, "KO/Pi",
+ i18n("Calendar is modified\nbut Autosave is disabled!\nDo you want\nto save the data?"),
+ i18n("Yes, Save!"), i18n("No"),
+ 0, 0 ) ) {
+ case 1:
+ case 2:
+ savedata = false;
+ break;
+ default:
+ break;
+ }
+ }
+ return savedata;
+}
void MainWindow::closeEvent( QCloseEvent* ce )
{
-
-
-
if ( ! KOPrefs::instance()->mAskForQuit ) {
+ if ( checkAutosave() ) {
saveOnClose();
@@ -551,2 +567,3 @@ void MainWindow::closeEvent( QCloseEvent* ce )
}
+ }
mClosed = true;
@@ -562,2 +579,3 @@ void MainWindow::closeEvent( QCloseEvent* ce )
case 0:
+ if ( checkAutosave() ) {
saveOnClose();
@@ -567,2 +585,3 @@ void MainWindow::closeEvent( QCloseEvent* ce )
}
+ }
mClosed = true;
@@ -1659,2 +1678,3 @@ void MainWindow::keyBindings()
i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
+ i18n("<p><b>C+ctrl</b>: Dis/enable automatic saving</p>\n") +
i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
@@ -1974,2 +1994,6 @@ void MainWindow::slotModifiedChanged( bool )
int msec;
+ if ( mAutoSaveDisabled ) {
+ QTimer::singleShot( 0, this , SLOT ( autoSaveWarning() ) );
+ qDebug("KO: Autosave disabled (data change deteced)!");
+ }
if ( mCalendarModifiedFlag ) {
@@ -1978,2 +2002,6 @@ void MainWindow::slotModifiedChanged( bool )
}
+ mCalendarModifiedFlag = true;
+ if ( mAutoSaveDisabled ) {
+ return;
+ }
// we store the changes after 1 minute,
@@ -1988,3 +2016,6 @@ void MainWindow::slotModifiedChanged( bool )
qDebug("KO: Saving File in %d secs!", msec/1000);
- mCalendarModifiedFlag = true;
+}
+void MainWindow::autoSaveWarning()
+{
+ setCaption(i18n("Autosave disabled!" ));
}
@@ -1993,2 +2024,3 @@ void MainWindow::saveStopTimer()
mSaveTimer.stop();
+ mSaveDelay = 0;
}
@@ -2210,2 +2242,13 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
case Qt::Key_C:
+ if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) {
+ if ( mAutoSaveDisabled ) {
+ mAutoSaveDisabled = false;
+ setCaption(i18n("Autosave enabled!" ));
+ return;
+ } else {
+ mAutoSaveDisabled = true;
+ saveStopTimer();
+ setCaption(i18n("Autosave disabled! Save timer stopped!" ));
+ }
+ } else
mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 71c069b..d8018b6 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -54,2 +54,3 @@ class MainWindow : public QMainWindow
protected slots:
+ void autoSaveWarning();
void loadDataAfterStart();
@@ -123,3 +124,4 @@ class MainWindow : public QMainWindow
private:
-
+ bool mAutoSaveDisabled;
+ bool checkAutosave();
QCString mCStringMess;