-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 8 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 75 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 4 |
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 | |||
@@ -1563,8 +1563,16 @@ | |||
1563 | { "Export All Data","Exportiere alle Daten" }, | 1563 | { "Export All Data","Exportiere alle Daten" }, |
1564 | { "You can save all data\nto another file via\nFile->Export->Export All Data","Sie können alle Daten in\neine andere Datei speichern unter\nDatei->Exportiere->Exportiere alle Daten" }, | 1564 | { "You can save all data\nto another file via\nFile->Export->Export All Data","Sie können alle Daten in\neine andere Datei speichern unter\nDatei->Exportiere->Exportiere alle Daten" }, |
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 | { "","" }, |
1569 | { "","" }, | 1577 | { "","" }, |
1570 | { "","" }, | 1578 | { "","" }, |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index c597138..66bb19b 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -169,8 +169,9 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) : | |||
169 | p.drawLine( 2,5,8,5); | 169 | p.drawLine( 2,5,8,5); |
170 | p.drawLine( 2,7,6,7); | 170 | p.drawLine( 2,7,6,7); |
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"; |
175 | QString confFile = locateLocal("config","korganizerrc"); | 176 | QString confFile = locateLocal("config","korganizerrc"); |
176 | QFileInfo finf ( confFile ); | 177 | QFileInfo finf ( confFile ); |
@@ -536,19 +537,35 @@ bool MainWindow::askForQuitOnSaveError() | |||
536 | break; | 537 | break; |
537 | } | 538 | } |
538 | return retval; | 539 | return retval; |
539 | } | 540 | } |
540 | 541 | bool 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 | } | ||
541 | void MainWindow::closeEvent( QCloseEvent* ce ) | 559 | void 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; |
553 | ce->accept(); | 570 | ce->accept(); |
554 | return; | 571 | return; |
@@ -558,13 +575,15 @@ void MainWindow::closeEvent( QCloseEvent* ce ) | |||
558 | switch( QMessageBox::information( this, "KO/Pi", | 575 | switch( QMessageBox::information( this, "KO/Pi", |
559 | i18n("Do you really want\nto close KO/Pi?"), | 576 | i18n("Do you really want\nto close KO/Pi?"), |
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; |
569 | ce->accept(); | 588 | ce->accept(); |
570 | break; | 589 | break; |
@@ -1656,8 +1675,9 @@ void MainWindow::keyBindings() | |||
1656 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1675 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1657 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1676 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
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")+ |
1662 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ | 1682 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ |
1663 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1683 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
@@ -1971,12 +1991,20 @@ void MainWindow::slotModifiedChanged( bool ) | |||
1971 | if ( mBlockAtStartup ) | 1991 | if ( mBlockAtStartup ) |
1972 | return; | 1992 | return; |
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 |
1981 | if ( !mSyncManager->blockSave() ) | 2009 | if ( !mSyncManager->blockSave() ) |
1982 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 2010 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
@@ -1985,13 +2013,17 @@ void MainWindow::slotModifiedChanged( bool ) | |||
1985 | mSaveTimer.start( msec, true ); // 1 minute | 2013 | mSaveTimer.start( msec, true ); // 1 minute |
1986 | mSaveTimerStart = QDateTime::currentDateTime(); | 2014 | mSaveTimerStart = QDateTime::currentDateTime(); |
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 | } |
2018 | void MainWindow::autoSaveWarning() | ||
2019 | { | ||
2020 | setCaption(i18n("Autosave disabled!" )); | ||
1990 | } | 2021 | } |
1991 | void MainWindow::saveStopTimer() | 2022 | void MainWindow::saveStopTimer() |
1992 | { | 2023 | { |
1993 | mSaveTimer.stop(); | 2024 | mSaveTimer.stop(); |
2025 | mSaveDelay = 0; | ||
1994 | } | 2026 | } |
1995 | void MainWindow::backupAllFiles() | 2027 | void MainWindow::backupAllFiles() |
1996 | { | 2028 | { |
1997 | QDate reference ( 2000,1,1); | 2029 | QDate reference ( 2000,1,1); |
@@ -2206,10 +2238,21 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) | |||
2206 | break; | 2238 | break; |
2207 | case Qt::Key_V: | 2239 | case Qt::Key_V: |
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: |
2214 | mView->showDatePicker( ); | 2257 | mView->showDatePicker( ); |
2215 | break; | 2258 | break; |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 71c069b..d8018b6 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -51,8 +51,9 @@ class MainWindow : public QMainWindow | |||
51 | void configureAgenda( int ); | 51 | void configureAgenda( int ); |
52 | void recieve( const QCString& msg, const QByteArray& data ); | 52 | void recieve( const QCString& msg, const QByteArray& data ); |
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(); |
57 | void startMultiSync(); | 58 | void startMultiSync(); |
58 | void setCaptionToDates(); | 59 | void setCaptionToDates(); |
@@ -120,9 +121,10 @@ class MainWindow : public QMainWindow | |||
120 | void enableIncidenceActions( bool ); | 121 | void enableIncidenceActions( bool ); |
121 | bool askForQuitOnSaveError(); | 122 | bool askForQuitOnSaveError(); |
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; |
127 | 129 | ||
128 | //void setMenuBar( QMenuBar * ); | 130 | //void setMenuBar( QMenuBar * ); |