summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-10-12 11:14:13 (UTC)
committer zautrix <zautrix>2005-10-12 11:14:13 (UTC)
commita72f3f3acfac791715a1c512fc4cc4c3facdbb62 (patch) (side-by-side diff)
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
@@ -1559,15 +1559,23 @@
{ "Show multiday allday ev. in date nav.","Zeige Multi-Ganzt.Term.in Datums Nav." },
{ "Include events which "show as free"","Inklusive Termine mit "Zeige Zeit als frei"" },
{ "Conflict detection checks an <b>edited event</b> with <b>other events</b> for overlapping.","Konflikterkennung prüft einen <b>bearbeiteten Termin</b> auf Überschneidungen mit <b>anderen Terminen</b>." },
{ " Yes, close "," Ja, beenden " },
{ "Export All Data","Exportiere alle Daten" },
{ "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" },
{ "<p><b>Duration:</b> %1 days</p>","<p><b>Dauer:</b> %1 Tage</p>" },
{ " (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
@@ -165,16 +165,17 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) :
{
QPainter p ( sgListViewJournalPix );
p.drawRect( 0,0,11,11);
p.drawLine( 2,3,5,3);
p.drawLine( 2,5,8,5);
p.drawLine( 2,7,6,7);
}
}
+ mAutoSaveDisabled = false;
mClosed = false;
//QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
QString confFile = locateLocal("config","korganizerrc");
QFileInfo finf ( confFile );
bool showWarning = !finf.exists();
setIcon(SmallIcon( "ko24" ) );
mBlockAtStartup = true;
mFlagKeyPressed = false;
@@ -532,44 +533,62 @@ bool MainWindow::askForQuitOnSaveError()
case 0:
retval = true;
break;
default:
break;
}
return retval;
}
-
+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();
if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
ce->ignore();
return;
}
+ }
mClosed = true;
ce->accept();
return;
}
switch( QMessageBox::information( this, "KO/Pi",
i18n("Do you really want\nto close KO/Pi?"),
i18n("Close"), i18n("No"),
0, 0 ) ) {
case 0:
+ if ( checkAutosave() ) {
saveOnClose();
if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
ce->ignore();
return;
}
+ }
mClosed = true;
ce->accept();
break;
case 1:
ce->ignore();
break;
case 2:
@@ -1652,16 +1671,17 @@ void MainWindow::about()
}
void MainWindow::keyBindings()
{
QString cap = i18n("KO/Pi Keys + Colors");
QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
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") +
i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+
i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+
i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+
i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
@@ -1967,35 +1987,47 @@ void MainWindow::saveOnClose()
mView->checkSuspendAlarm();
}
void MainWindow::slotModifiedChanged( bool )
{
if ( mBlockAtStartup )
return;
int msec;
+ if ( mAutoSaveDisabled ) {
+ QTimer::singleShot( 0, this , SLOT ( autoSaveWarning() ) );
+ qDebug("KO: Autosave disabled (data change deteced)!");
+ }
if ( mCalendarModifiedFlag ) {
//qDebug(" MainWindow timer is running ");
return;
}
+ mCalendarModifiedFlag = true;
+ if ( mAutoSaveDisabled ) {
+ return;
+ }
// we store the changes after 1 minute,
// and for safety reasons after 10 minutes again
if ( !mSyncManager->blockSave() )
msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
else
msec = 1000 * 600;
mSaveTimer.start( msec, true ); // 1 minute
mSaveTimerStart = QDateTime::currentDateTime();
mSaveDelay = msec/1000;
qDebug("KO: Saving File in %d secs!", msec/1000);
- mCalendarModifiedFlag = true;
+}
+void MainWindow::autoSaveWarning()
+{
+ setCaption(i18n("Autosave disabled!" ));
}
void MainWindow::saveStopTimer()
{
mSaveTimer.stop();
+ mSaveDelay = 0;
}
void MainWindow::backupAllFiles()
{
QDate reference ( 2000,1,1);
int daysTo = reference.daysTo ( QDate::currentDate() );
setCaption(i18n("Creating backup ... please wait ..." ));
qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate);
// we need the file path, the backup dir and the number of bups as param
@@ -2203,16 +2235,27 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
break;
case Qt::Key_N:
mView->viewManager()->showNextView();
break;
case Qt::Key_V:
mView->viewManager()->showTodoView();
break;
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() );
break;
case Qt::Key_P:
mView->showDatePicker( );
break;
case Qt::Key_F:
mView->editFilters();
break;
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 71c069b..d8018b6 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -47,16 +47,17 @@ class MainWindow : public QMainWindow
void updateWeekNum(const KCal::DateList &);
void updateWeek(QDate);
void updateFilterToolbar();
virtual void showMaximized ();
void configureAgenda( int );
void recieve( const QCString& msg, const QByteArray& data );
void receiveStart( const QCString& msg, const QByteArray& data );
protected slots:
+ void autoSaveWarning();
void loadDataAfterStart();
void calHint();
void startMultiSync();
void setCaptionToDates();
void weekAction();
void about();
void licence();
void faq();
@@ -116,17 +117,18 @@ class MainWindow : public QMainWindow
int mFocusLoop;
void hideEvent ( QHideEvent * );
QString sentSyncFile();
void displayText( QString, QString);
void enableIncidenceActions( bool );
bool askForQuitOnSaveError();
private:
-
+ bool mAutoSaveDisabled;
+ bool checkAutosave();
QCString mCStringMess;
QByteArray mByteData;
//void setMenuBar( QMenuBar * );
bool mBRdisabled;
#ifndef DESKTOP_VERSION
QCopChannel* infrared;
#endif