summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt8
-rw-r--r--korganizer/mainwindow.cpp75
-rw-r--r--korganizer/mainwindow.h4
3 files changed, 70 insertions, 17 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
@@ -1565,4 +1565,12 @@
1565{ "<p><b>Duration:</b> %1 days</p>","<p><b>Dauer:</b> %1 Tage</p>" }, 1565{ "<p><b>Duration:</b> %1 days</p>","<p><b>Dauer:</b> %1 Tage</p>" },
1566{ " (Duration: %1 days)"," (Dauer: %1 Tage)" }, 1566{ " (Duration: %1 days)"," (Dauer: %1 Tage)" },
1567{ "Autosave enabled!","Auto-Speichern angeschaltet!" },
1568{ "Autosave disabled! Save timer stopped!","Auto-Speichern ausgeschaltet! Speicher Timer gestoppt!" },
1569{ "Autosave disabled!","Auto-Speichern ist ausgeschaltet!" },
1570{ "Yes, Save!","Ja, Speichern!" },
1571{ "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?" },
1572{ "<p><b>C+ctrl</b>: Dis/enable automatic saving</p>\n","<p><b>C+ctrl</b>: Auto-Speichern ab/anschalten</p>\n" },
1573{ "","" },
1574{ "","" },
1567{ "","" }, 1575{ "","" },
1568{ "","" }, 1576{ "","" },
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index c597138..66bb19b 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -171,4 +171,5 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) :
171 } 171 }
172 } 172 }
173 mAutoSaveDisabled = false;
173 mClosed = false; 174 mClosed = false;
174 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 175 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
@@ -538,15 +539,31 @@ bool MainWindow::askForQuitOnSaveError()
538 return retval; 539 return retval;
539} 540}
540 541bool MainWindow::checkAutosave()
542{
543 bool savedata = true;
544 if ( mAutoSaveDisabled && mCalendarModifiedFlag ) {
545 switch( QMessageBox::information( this, "KO/Pi",
546 i18n("Calendar is modified\nbut Autosave is disabled!\nDo you want\nto save the data?"),
547 i18n("Yes, Save!"), i18n("No"),
548 0, 0 ) ) {
549 case 1:
550 case 2:
551 savedata = false;
552 break;
553 default:
554 break;
555 }
556 }
557 return savedata;
558}
541void MainWindow::closeEvent( QCloseEvent* ce ) 559void MainWindow::closeEvent( QCloseEvent* ce )
542{ 560{
543
544
545
546 if ( ! KOPrefs::instance()->mAskForQuit ) { 561 if ( ! KOPrefs::instance()->mAskForQuit ) {
547 saveOnClose(); 562 if ( checkAutosave() ) {
548 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { 563 saveOnClose();
549 ce->ignore(); 564 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
550 return; 565 ce->ignore();
566 return;
567 }
551 } 568 }
552 mClosed = true; 569 mClosed = true;
@@ -560,9 +577,11 @@ void MainWindow::closeEvent( QCloseEvent* ce )
560 i18n("Close"), i18n("No"), 577 i18n("Close"), i18n("No"),
561 0, 0 ) ) { 578 0, 0 ) ) {
562 case 0: 579 case 0:
563 saveOnClose(); 580 if ( checkAutosave() ) {
564 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { 581 saveOnClose();
565 ce->ignore(); 582 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
566 return; 583 ce->ignore();
584 return;
585 }
567 } 586 }
568 mClosed = true; 587 mClosed = true;
@@ -1658,4 +1677,5 @@ void MainWindow::keyBindings()
1658 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + 1677 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
1659 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + 1678 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
1679 i18n("<p><b>C+ctrl</b>: Dis/enable automatic saving</p>\n") +
1660 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1680 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1661 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1681 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
@@ -1973,8 +1993,16 @@ void MainWindow::slotModifiedChanged( bool )
1973 1993
1974 int msec; 1994 int msec;
1995 if ( mAutoSaveDisabled ) {
1996 QTimer::singleShot( 0, this , SLOT ( autoSaveWarning() ) );
1997 qDebug("KO: Autosave disabled (data change deteced)!");
1998 }
1975 if ( mCalendarModifiedFlag ) { 1999 if ( mCalendarModifiedFlag ) {
1976 //qDebug(" MainWindow timer is running "); 2000 //qDebug(" MainWindow timer is running ");
1977 return; 2001 return;
1978 } 2002 }
2003 mCalendarModifiedFlag = true;
2004 if ( mAutoSaveDisabled ) {
2005 return;
2006 }
1979 // we store the changes after 1 minute, 2007 // we store the changes after 1 minute,
1980 // and for safety reasons after 10 minutes again 2008 // and for safety reasons after 10 minutes again
@@ -1987,9 +2015,13 @@ void MainWindow::slotModifiedChanged( bool )
1987 mSaveDelay = msec/1000; 2015 mSaveDelay = msec/1000;
1988 qDebug("KO: Saving File in %d secs!", msec/1000); 2016 qDebug("KO: Saving File in %d secs!", msec/1000);
1989 mCalendarModifiedFlag = true; 2017}
2018void MainWindow::autoSaveWarning()
2019{
2020 setCaption(i18n("Autosave disabled!" ));
1990} 2021}
1991void MainWindow::saveStopTimer() 2022void MainWindow::saveStopTimer()
1992{ 2023{
1993 mSaveTimer.stop(); 2024 mSaveTimer.stop();
2025 mSaveDelay = 0;
1994} 2026}
1995void MainWindow::backupAllFiles() 2027void MainWindow::backupAllFiles()
@@ -2208,6 +2240,17 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
2208 mView->viewManager()->showTodoView(); 2240 mView->viewManager()->showTodoView();
2209 break; 2241 break;
2210 case Qt::Key_C: 2242 case Qt::Key_C:
2211 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 2243 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) {
2244 if ( mAutoSaveDisabled ) {
2245 mAutoSaveDisabled = false;
2246 setCaption(i18n("Autosave enabled!" ));
2247 return;
2248 } else {
2249 mAutoSaveDisabled = true;
2250 saveStopTimer();
2251 setCaption(i18n("Autosave disabled! Save timer stopped!" ));
2252 }
2253 } else
2254 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
2212 break; 2255 break;
2213 case Qt::Key_P: 2256 case Qt::Key_P:
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 71c069b..d8018b6 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -53,4 +53,5 @@ class MainWindow : public QMainWindow
53 void receiveStart( const QCString& msg, const QByteArray& data ); 53 void receiveStart( const QCString& msg, const QByteArray& data );
54 protected slots: 54 protected slots:
55 void autoSaveWarning();
55 void loadDataAfterStart(); 56 void loadDataAfterStart();
56 void calHint(); 57 void calHint();
@@ -122,5 +123,6 @@ class MainWindow : public QMainWindow
122 123
123 private: 124 private:
124 125 bool mAutoSaveDisabled;
126 bool checkAutosave();
125 QCString mCStringMess; 127 QCString mCStringMess;
126 QByteArray mByteData; 128 QByteArray mByteData;