summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-10-12 11:14:13 (UTC)
committer zautrix <zautrix>2005-10-12 11:14:13 (UTC)
commita72f3f3acfac791715a1c512fc4cc4c3facdbb62 (patch) (unidiff)
tree202c588777f8d4585a8c57164b1b412d7ad73e8a
parent3ecfc912f657a710ed35c93dc6eb2991cce06835 (diff)
downloadkdepimpi-a72f3f3acfac791715a1c512fc4cc4c3facdbb62.zip
kdepimpi-a72f3f3acfac791715a1c512fc4cc4c3facdbb62.tar.gz
kdepimpi-a72f3f3acfac791715a1c512fc4cc4c3facdbb62.tar.bz2
fix
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
@@ -1564,6 +1564,14 @@
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{ "","" },
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index c597138..66bb19b 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -170,6 +170,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) :
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");
@@ -537,18 +538,34 @@ bool MainWindow::askForQuitOnSaveError()
537 } 538 }
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 ) {
562 if ( checkAutosave() ) {
547 saveOnClose(); 563 saveOnClose();
548 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { 564 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
549 ce->ignore(); 565 ce->ignore();
550 return; 566 return;
551 } 567 }
568 }
552 mClosed = true; 569 mClosed = true;
553 ce->accept(); 570 ce->accept();
554 return; 571 return;
@@ -560,11 +577,13 @@ 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:
580 if ( checkAutosave() ) {
563 saveOnClose(); 581 saveOnClose();
564 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { 582 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
565 ce->ignore(); 583 ce->ignore();
566 return; 584 return;
567 } 585 }
586 }
568 mClosed = true; 587 mClosed = true;
569 ce->accept(); 588 ce->accept();
570 break; 589 break;
@@ -1657,6 +1676,7 @@ void MainWindow::keyBindings()
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")+
@@ -1972,10 +1992,18 @@ void MainWindow::slotModifiedChanged( bool )
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() )
@@ -1986,11 +2014,15 @@ void MainWindow::slotModifiedChanged( bool )
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}
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()
1996{ 2028{
@@ -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:
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
2211 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 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
@@ -52,6 +52,7 @@ class MainWindow : public QMainWindow
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();
@@ -121,7 +122,8 @@ class MainWindow : public QMainWindow
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