-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 9 | ||||
-rw-r--r-- | kalarmd/simplealarmdaemonimpl.cpp | 8 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 13 | ||||
-rw-r--r-- | korganizer/calendarview.h | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 67 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 5 |
6 files changed, 73 insertions, 32 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index 2c0d626..6f76c7e 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt @@ -138,9 +138,9 @@ { "Descriptions","Beschreibungen" }, { "Deselect all","Deselektiere Alle" }, { "Details","Details" }, { "Dinner","Abendessen" }, -{ "Do you really want\nto close KO/Pi?","Möchten Sie wirklich\nKO/PI verlassen?" }, +{ "Do you really want\nto close KO/Pi?","Möchten Sie wirklich\nKO/PI beenden?" }, { "Due Date","Fällig am" }, { "Due: ","Fällig: "}, { "Due Time","Fällig um" }, { "Due:","Fällig:"}, @@ -768,8 +768,9 @@ { "Not supported \non desktop!\n","Nur verfügbar auf PDA!" }, { "Imported file successfully","Datei erfolgreich importiert" }, { "Error importing file","Fehler beim Importieren der Datei" }, { "Export vcal filename(*.vcs)","Export vcal Dateiname(*.vcs)" }, +{ "Export iCal filename(*.ics)","Export iCal Dateiname(*.ics)" }, { "Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n","Zu speichernde Datei\existiert bereits!\nExist. Datei vom:\n%1\nÜberschreiben?\n" }, { "Overwrite!","Überschreiben!" }, { "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n","Import Datei \n...%1\nvom:\n%2\nDuplizierte Einträge\nwerden nicht importiert!\n" }, { "Load backup filename","Lade Backup Dateiname" }, @@ -1557,11 +1558,11 @@ { "Loading calendar files ... please wait","Lade Kalenderdateien ... bitte warten" }, { "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" }, { "","" }, { "","" }, { "","" }, { "","" }, diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp index 2acfacf..a0ac232 100644 --- a/kalarmd/simplealarmdaemonimpl.cpp +++ b/kalarmd/simplealarmdaemonimpl.cpp @@ -66,16 +66,8 @@ SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent ) mPopUp->insertItem( "New Mail", this, SLOT ( newMail() ) ); mPopUp->insertSeparator(); mPopUp->insertItem( "Multi Sync", this, SLOT ( ringSync() ) ); mTimerPopUp = new QPopupMenu( this ); - QFont fon = mTimerPopUp->font(); - int points = 16; - if ( QApplication::desktop()->width() < 480 ) - points = 12; - fon.setPointSize( points ); - //qDebug("point s %d ", fon.pointSize()); - mTimerPopUp->setFont( fon ); - mPopUp->setFont( fon ); mBeepPopUp = new QPopupMenu( this ); mSoundPopUp = new QPopupMenu( this ); mPausePopUp = new QPopupMenu( this ); QPopupMenu* savePopUp = new QPopupMenu( this ); diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 79fb727..2ba8528 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -2546,8 +2546,9 @@ bool CalendarView::saveCalendars() } cal = calendars.next(); } restoreCalendarSettings(); + //saveError = "test error"; if ( !saveError.isEmpty() ) { saveError = KGlobal::formatMessage( i18n("Calendar(s) not saved:"),0 )+"\n" + saveError; KMessageBox::error(this, saveError, i18n("Error saving data")); return false; @@ -4462,18 +4463,20 @@ void CalendarView::printPreview() mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), tmpDateList.last()); #endif } - -void CalendarView::exportICalendar() +bool CalendarView::exportICalendar( QString filename ) { - QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); - // Force correct extension if (filename.right(4) != ".ics") filename += ".ics"; FileStorage storage( mCalendar, filename, new ICalFormat() ); - storage.save(); + return storage.save(); +} + +bool CalendarView::exportICalendar() +{ + return exportICalendar( KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this) ); } bool CalendarView::exportVCalendar( QString filename ) { diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index b223315..8670832 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -375,9 +375,10 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser void printSetup(); void printPreview(); /** Export as iCalendar file */ - void exportICalendar(); + bool exportICalendar(); + bool exportICalendar( QString fn ); /** Export as vCalendar file */ bool exportVCalendar( QString fn); diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 2af605f..98d3e35 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -522,16 +522,35 @@ void MainWindow::showMaximized () #endif QWidget::showMaximized () ; mClosed = false; } + +bool MainWindow::askForQuitOnSaveError() +{ + bool retval = false; + switch( QMessageBox::information( this, "KO/Pi", + i18n("Error saving data") + "!\n" + + i18n("You can save all data\nto another file via\nFile->Export->Export All Data") + "!\n" + + i18n("Do you really want\nto close KO/Pi?"), + i18n(" Yes, close "), i18n("No"), + 0, 1 ) ) { + case 0: + retval = true; + break; + default: + break; + } + return retval; +} + void MainWindow::closeEvent( QCloseEvent* ce ) { if ( ! KOPrefs::instance()->mAskForQuit ) { saveOnClose(); - if ( mCalendarModifiedFlag ) { + if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { ce->ignore(); return; } mClosed = true; @@ -545,9 +564,9 @@ void MainWindow::closeEvent( QCloseEvent* ce ) i18n("Close"), i18n("No"), 0, 0 ) ) { case 0: saveOnClose(); - if ( mCalendarModifiedFlag ) { + if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { ce->ignore(); return; } mClosed = true; @@ -1164,8 +1183,12 @@ void MainWindow::initActions() connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); importMenu->insertSeparator(); importMenu->insertItem( i18n("Import"), importMenu_X ); //importMenu->insertSeparator(); + action = new QAction( "export ical", i18n("Export All Data"), 0, + this ); + action->addTo( exportMenu_X ); + connect( action, SIGNAL( activated() ), SLOT( exportICalendar() ) ); action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, this ); action->addTo( exportMenu_X ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); @@ -1966,9 +1989,9 @@ void MainWindow::slotModifiedChanged( bool ) msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; else msec = 1000 * 600; mSaveTimer.start( msec, true ); // 1 minute - mSaveTime.restart(); + mSaveTimerStart = QDateTime::currentDateTime(); mSaveDelay = msec/1000; qDebug("KO: Saving File in %d secs!", msec/1000); mCalendarModifiedFlag = true; } @@ -2016,14 +2039,16 @@ void MainWindow::backupAllFiles() } void MainWindow::save() { if ( mSaveDelay ) { - if ( mSaveDelay + 60 < mSaveTime.elapsed()/1000 ) { - qDebug("KO: Save delay %d. Elapsed save time %d ", mSaveDelay, mSaveTime.elapsed()/1000 ); - qDebug("KO: Restarting save timer"); - int msec = 10000; - mSaveTimer.start( msec, true ); // 1 minute - mSaveTime.restart(); + int elapsed = mSaveTimerStart.secsTo( QDateTime::currentDateTime() ); + if ( mSaveDelay < elapsed ) { + qDebug("KO: Pending save after wakeup from suspend detected."); + qDebug("KO: Save delay %d sec. Elapsed save time %d sec.", mSaveDelay, elapsed ); + qDebug("KO: Restarting save timer to save in 15 sec."); + int msec = 15000; + mSaveTimer.start( msec, true ); + mSaveTimerStart = QDateTime::currentDateTime(); mSaveDelay = msec/1000; return; } } @@ -2574,12 +2599,16 @@ void MainWindow::importIcal() return; importFile( fn, true ); } - -void MainWindow::exportVCalendar() +void MainWindow::exportCalendar( bool iCalFormat ) { QString fn = KOPrefs::instance()->mLastVcalFile; + if ( iCalFormat ) { + fn = QDir::homeDirPath()+"/kopiexport.ics"; + fn = KFileDialog::getSaveFileName( fn, i18n("Export iCal filename(*.ics)"), this ); + } + else fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); if ( fn == "" ) return; QFileInfo info; @@ -2595,10 +2624,14 @@ void MainWindow::exportVCalendar() createbup = false; } } if ( createbup ) { - if ( mView->exportVCalendar( fn ) ) { - KOPrefs::instance()->mLastVcalFile = fn; + bool success = false; + if ( iCalFormat ) + success = mView->exportICalendar( fn ); + else + success = mView->exportVCalendar( fn ); + if ( success ) { if ( fn.length() > 20 ) mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; else mes = i18n("KO/Pi:Exported to %1").arg(fn ); @@ -2606,8 +2639,16 @@ void MainWindow::exportVCalendar() } } } +void MainWindow::exportICalendar() +{ + exportCalendar( true ); +} +void MainWindow::exportVCalendar() +{ + exportCalendar( false ); +} QString MainWindow::sentSyncFile() { #ifdef DESKTOP_VERSION return QDir::convertSeparators( locateLocal( "tmp", "copysynccal.ics" ) ); diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 657c0a8..71c069b 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h @@ -92,8 +92,10 @@ class MainWindow : public QMainWindow void printListView(); void saveCalendar(); void loadCalendar(); void exportVCalendar(); + void exportICalendar(); + void exportCalendar( bool ); void fillFilterMenu(); void fillFilterMenuTB(); void selectFilter( int ); void fillFilterMenuPopup(); @@ -115,8 +117,9 @@ class MainWindow : public QMainWindow void hideEvent ( QHideEvent * ); QString sentSyncFile(); void displayText( QString, QString); void enableIncidenceActions( bool ); + bool askForQuitOnSaveError(); private: QCString mCStringMess; @@ -173,9 +176,9 @@ class MainWindow : public QMainWindow QAction *actionFilterMenuTB; void closeEvent( QCloseEvent* ce ); QTimer mSaveTimer; - QTime mSaveTime; + QDateTime mSaveTimerStart; int mSaveDelay; //bool mBlockSaveFlag; bool mCalendarModifiedFlag; QPixmap loadPixmap( QString ); |