summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt9
-rw-r--r--kalarmd/simplealarmdaemonimpl.cpp8
-rw-r--r--korganizer/calendarview.cpp13
-rw-r--r--korganizer/calendarview.h3
-rw-r--r--korganizer/mainwindow.cpp69
-rw-r--r--korganizer/mainwindow.h5
6 files changed, 74 insertions, 33 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
@@ -118,49 +118,49 @@
{ "Days to show in Next-X-Days view:","Welche Tage in Nächste-X-Tagen anzeigen:" },
{ "day","Tag" },
{ "Dec","Dez" },
{ "December","Dezember" },
{ "Default alarm time:","Standard Alarmzeit:" },
{ "Default appointment time:","Standard Termin Startzeit:" },
{ "Default event color:","Standard Terminfarbe:" },
{ "Default","Standard" },
{ "Def. duration of new app.:","Standard Termin Länge:" },
{ "Delete All","Lösche alles" },
{ "Delete all selected","Lösche alle Selektierten" },
{ "Delete Current","Aktuellen löschen" },
{ "Delete Event...","Lösche Termin..." },
{ "Delete Event","Lösche Termin" },
{ "&Delete...","Lösche..." },
{ "Delete...","Lösche..." },
{ "Delete","Lösche" },
{ "Delete Todo...","Lösche Todo..." },
{ "Delete To-Do","Lösche Todo" },
{ "Deleting item %d ...","Lösche Eintrag %d..." },
{ "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:"},
{ "Duration: ","Dauer: " },
{ "Edit...","Bearbeite..." },
{ "Edit Event...","Bearbeite Termin..." },
{ "Edit Event","Bearbeite Termin" },
{ "Edit exceptions","Bearbeite Ausnahmen" },
{ "EditorBox:","Editor Fenster:" },
{ "Edit Recurrence Range","Bearbeite Wiederholung" },
{ "Edit Todo...","Berabeite Todo..." },
{ "Edit To-Do","Todo bearbeiten" },
{ "E&mail address:","E&mail Adresse:" },
{ "(EmptyEmail)","(KeineEmail)" },
{ "(EmptyName)","(KeinName)" },
{ "Enable Recurrence","Wiederholung anschalten" },
{ "End after","Endet nach"},
{ "End by:","Endet am"},
{ "End/Due Date","Ende/Fällig am" },
{ "End:","Ende:" },
{ "End/Due Time","Ende/Fällig um" },
{ "English","Englisch" },
{ "Event","Termin" },
@@ -748,48 +748,49 @@
{ "Default","Standard" },
{ " Categories added to list! "," Kategorien zur Liste hinzugefügt! " },
{ " %d items?"," %d Einträge?" },
{ "\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?","\nDieses ist ein\nwiederholender Termin!.\nSind Sie sicher, dass Sie\ndiesen Termin und alle\nWiederholungen löschen möchten?" },
{ " ?\n\nDelete:\n"," ?\n\nLösche:\n" },
{ "Current","Aktuelle" },
{ "\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n","\nDieses ist ein\nwiederholender Termin!\nMöchten sie alle Wiederholungen\nlöschen, oder nur die aktuelle am:\n" },
{ "All","Alle" },
{ "Data Loss Warning","Datenverlust Warnung" },
{ "Proceed","Weitermachen" },
{ "The journal entries can not be\nexported to a vCalendar file.","Die Journal Einträge können\nnicht in eine vCalendar\nDatei exportiert werden!" },
{ "Filter disabled ","Filter abgeschaltet" },
{ "Filter selected: ","Gewählter Filter: " },
{ "Toggle Cancel","Gecancelt ändern" },
{ "&Toggle Cancel","Gecancel&t ändern" },
{ "Configure Toolbar","Konfiguriere Toolbar" },
{ "Stretched TB","Gedehnte TB" },
{ "Import file \n...%1\ndoes not exist!\nNothing imported!\n","Import Datei \n...%1\nexistiert nicht!\nNichts importiert!\n" },
{ "Import filename(*.ics/*.vcs)","Import Dateiname(*.ics/*.vcs)" },
{ "When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing","Wenn ein Kalender doppelt importiert\nwird, werden doppelte Einträge ignoriert!\nSie können eine Backup Datei anlegen unter\nDatei - Speichere Kalender Backup\num den Import rückgängig machen zu können.\n" },
{ "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" },
{ "Backup file\ndoes not exist!\nNothing loaded!","Backup Datei\nexistiert nicht!\nNichts geladen!" },
{ "KO/Pi:Loaded %1","KO/Pi:Geladen %1" },
{ "Save backup filename","Speichere Backup Dateiname" },
{ "Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n","Backup Datei\nexistiert bereits!\nAlte Backup Datei vom:\n%1\nÜberschreiben?\n" },
{ "KO/Pi:Saved %1","KO/Pi:Gespeichert %1" },
{ "Details of attendee","Teilnehmerdetails" },
{ "Work phone:\n","Telefon Arbeit:\n" },
{ "Work mobile phone:\n","Mobiltelefon Arbeit:\n" },
{ "Home phone:\n","Telefon privat:\n" },
{ "Mobile home phone:\n","Mobiltelefon privat:\n" },
{ "Email:\n","Email:\n" },
{ "Alarm disabled for this item","Alarm deaktiviert für dieses Item" },
{ "Audio Al.: ","Audio Al.: " },
{ "Proc.Al.: ","Proz.Al.: " },
{ "No sound set","Kein Sound definiert" },
{ "*.wav|Wav Files","*.wav|Wav Dateien" },
{ "No program set","Kein Programm definiert" },
{ "Running '%1'","Ausführen '%1'" },
{ "Playing '%1'","Abspielen '%1'" },
{ "User defined (usertranslation.txt)","Benutzerdefiniert (usertranslation.txt)" },
@@ -1537,36 +1538,36 @@
{ "Click this button to display all todos <b>closed</b>","Klicke diesen Knopf um alle Todos <b>geschlossen</b> darzustellen" },
{ "Click this button to toggle show/hide <b>running</b> todos","Klicke diesen Knopf um <b>zeige Laufende</b> umzuschalten" },
{ "Click this button to toggle show/hide <b>completed</b> todos","Klicke diesen Knopf um <b>zeige Erledigte</b> umzuschalten" },
{ "Click this button to add a new subtodo to the currently selected todo","Klicke diesen Knopf um ein Untertodo zu dem gerade selektierten Todo hinzuzufügen" },
{ "In this column you can <b>set a calendar to be visible</b>. If a calendar is not visible its entries are not displayed in the views. You can add items to it and it is loaded/saved as usual.","In dieser Spalte kann man einen <b>Kalender auf sichtbar schalten</b>. Wenn ein Kalender nicht sichtbar ist werden seine Einträge nicht in den Ansichten angezeigt. Man kann Einträge hinzufügen und laden/speichern wie gewöhnlich." },
{ "In this column you can see the <b>name of the calendar</b>. If you click on the name button you will get an information box about the loaded calendar file. If the file was not loaded at startup you can try to load it here again.","In dieser Spalte wird der <b>Name des Kalenders</b> angezeigt. Wenn Sie auf den Namen klicken wird Information über die Kalenderdatei angezeigt. Wenn die Datei beim Start nicht geladen wurde können Sie hier erneut versuchen sie zu laden." },
{ "In this column you can <b>disable the alarms of a calendar all together</b>. The alarm data in the calendar itself is not changed, the alarms are marked internally as "do not use". Useful if you load a calendar of another person but do not want to get notified about alarms of that person.","In dieser Spalte können die <b>Alarme eines Kalenders alle zusammen abgeschaltet werden</b>. Die Alarmdaten im Kalender selbst werden nicht verändert, es werde die Alarme intern als "nicht beachten" markiert. Nützlich wenn Sie den Kalender einer anderen Person laden aber nicht über dessen Alarme unterrichtet werden wollen." },
{ "In this column you can <b>set a calendar and all entries of the calendar to read only</b>. If a calendar is readonly the entries cannot be edited and no items can be added to the calendar. If you change a setting of a calendar to readonly in this column all data will be saved because the data of a readonly calendar is not saved later.","In dieser Spalte können Sie einen <b>Kalender und alle Einträge auf schreibgeschützt setzen</b>. Einträge eines schreibgeschützten Kalenders können nicht verändert werden und es können keine Einträge zum Kalender hinzugefügt werden. Wenn Sie die Einstellung eines Kalenders in dieser Spalte auf schreibgeschützt setzen werden alle Daten automatisch abgespeichert, da die Daten eines schreibgeschützten Kalenders später nicht mehr gespeichert werden." },
{ "Click this button to <b>add a calendar</b>. You can add an existing calendar file or you can add a new calendar and KO/Pi creates a new empty calendar file for you.","Klicken Sie diesen Knopf <b>um einen Kalender hinzuzufügen</b>. Sie können eine existierende Kalenderdatei hinzufügen oder einen neuen Kalender und KO/Pi legt dann eine neue leere Kalenderdatei für Sie an." },
{ "<b>iCal (*.ics) file on disk:</b><br>(will be created, if not existing)","<b>iCal (*.ics) Datei:</b><br>(Datei wird angelegt, wenn sie nicht existiert)" },
{ "Error saving data","Fehler beim Abspeichern" },
{ "Calendar(s) not saved:","Nicht gespeicherte Kalender:" },
{ "Enable conflict detection","Schalte Konflikterkennung an" },
{ "Filter for the edited event","Filter für den bearbeiteten Termin" },
{ "Filter for other events","Filter für die anderen Termine" },
{ "Check Allday with Allday","Prüfe GanzTag mit GanzTag" },
{ "Check Allday with NonAllday","Prüfe GanzTag mit NichtGanzTag" },
{ "Check NonAllday with Allday","Prüfe NichtGanzTag mit GanzTag" },
{ "Check NonAllday with NonAllday","Prüfe NichtGanzTag mit NichtGanzTag" },
{ "Conflict detection","Konflikterkennung" },
{ "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
@@ -46,56 +46,48 @@
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent )
: QLabel( parent )
{
mAlarmDialog = new AlarmDialog( 0 );
mPopUp = new QPopupMenu( this );
mPopUp->insertItem( "What's Next?", this, SLOT ( showWN() ) );
mPopUp->insertItem( "Next Days!", this, SLOT ( showKO() ) );
mPopUp->insertSeparator();
mPopUp->insertItem( "Todo List", this, SLOT ( showTodo() ) );
mPopUp->insertSeparator();
mPopUp->insertItem( "Addresses", this, SLOT ( showAdd() ) );
mPopUp->insertSeparator();
mPopUp->insertItem( "Edit Journal", this, SLOT ( writeJournal() ) );
mPopUp->insertItem( "New Event", this, SLOT ( newEvent() ) );
mPopUp->insertItem( "New Todo", this, SLOT ( newTodo() ) );
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 );
savePopUp->insertItem( "Save", 0 );
savePopUp->insertItem( "Load", 1 );
mSoundPopUp->insertItem( "Buzzer", 0 );
mSoundPopUp->insertItem( "Wav file", 1 );
mPausePopUp->insertItem( " 1 sec", 1 );
mPausePopUp->insertItem( " 2 sec", 2 );
mPausePopUp->insertItem( " 3 sec", 3 );
mPausePopUp->insertItem( " 5 sec", 5 );
mPausePopUp->insertItem( "10 sec", 10 );
mPausePopUp->insertItem( "30 sec", 30 );
mPausePopUp->insertItem( " 1 min", 60 );
mPausePopUp->insertItem( " 5 min", 300 );
mPausePopUp->insertItem( "10 min", 600 );
mSuspendPopUp = new QPopupMenu( this );
mSuspendPopUp->insertItem( "Off", 0 );
mSuspendPopUp->insertItem( " 1x", 1 );
mSuspendPopUp->insertItem( " 2x", 2 );
mSuspendPopUp->insertItem( " 3x", 3 );
mSuspendPopUp->insertItem( " 5x", 5 );
mSuspendPopUp->insertItem( "10x", 10 );
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 79fb727..2ba8528 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2526,48 +2526,49 @@ bool CalendarView::checkFileVersion(QString fn)
return true;
}
bool CalendarView::saveCalendars()
{
QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
KopiCalendarFile * cal = calendars.first();
mCalendar->setDefaultCalendar( 1 );
mCalendar->setDefaultCalendarEnabledOnly();
QString saveError;
if ( !saveCalendar( MainWindow::defaultFileName() ) )
saveError = cal->mName +"\n";
cal = calendars.next();
while ( cal ) {
if ( !cal->isReadOnly && !cal->mErrorOnLoad ) {
mCalendar->setDefaultCalendar( cal->mCalNumber );
mCalendar->setDefaultCalendarEnabledOnly();
if ( saveCalendar( cal->mFileName ) )
cal->mLoadDt = QDateTime::currentDateTime();
else
saveError += cal->mName + "\n";
}
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;
}
return true;
}
bool CalendarView::saveCalendar( QString filename )
{
// Store back all unsaved data into calendar object
// qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
if ( mViewManager->currentView() )
mViewManager->currentView()->flushView();
QDateTime lfv = QDateTime::currentDateTime().addSecs( -2);
mStorage->setSaveFormat( new ICalFormat() );
mStorage->setFileName( filename );
bool success;
success = mStorage->save();
if ( !success ) {
return false;
}
@@ -4442,58 +4443,60 @@ void CalendarView::printSetup()
void CalendarView::print()
{
#ifndef KORG_NOPRINTER
createPrinter();
DateList tmpDateList = mNavigator->selectedDates();
mCalPrinter->print(CalPrinter::Month,
tmpDateList.first(), tmpDateList.last());
#endif
}
void CalendarView::printPreview()
{
#ifndef KORG_NOPRINTER
kdDebug() << "CalendarView::printPreview()" << endl;
createPrinter();
DateList tmpDateList = mNavigator->selectedDates();
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 )
{
if (mCalendar->journals().count() > 0) {
int result = KMessageBox::warningContinueCancel(this,
i18n("The journal entries can not be\nexported to a vCalendar file."),
i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
true);
if (result != KMessageBox::Continue) return false;
}
//QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this);
// Force correct extension
if (filename.right(4) != ".vcs") filename += ".vcs";
FileStorage storage( mCalendar, filename, new VCalFormat );
return storage.save();
}
void CalendarView::eventUpdated(Incidence *)
{
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index b223315..8670832 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -355,49 +355,50 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
void updateUnmanagedViews();
/** cut the current appointment to the clipboard */
void edit_cut();
/** copy the current appointment(s) to the clipboard */
void edit_copy();
/** paste the current vobject(s) in the clipboard buffer into calendar */
void edit_paste();
/** edit viewing and configuration options. */
void edit_options();
void edit_global_options();
/**
Functions for printing, previewing a print, and setting up printing
parameters.
*/
void print();
void printSetup();
void printPreview();
/** Export as iCalendar file */
- void exportICalendar();
+ bool exportICalendar();
+ bool exportICalendar( QString fn );
/** Export as vCalendar file */
bool exportVCalendar( QString fn);
/** pop up a dialog to show an existing appointment. */
void appointment_show();
/**
* pop up an Appointment Dialog to edit an existing appointment. Get
* information on the appointment from the list of unique IDs that is
* currently in the View, called currIds.
*/
void appointment_edit();
/**
* pop up dialog confirming deletion of currently selected event in the
* View.
*/
void appointment_delete();
/** mails the currently selected event to a particular user as a vCalendar
attachment. */
void action_mail();
/* frees a subtodo from it's relation */
void todo_unsub( Todo * );
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 2af605f..98d3e35 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -502,72 +502,91 @@ void MainWindow::toggleBeamReceive()
#ifndef DESKTOP_VERSION
if ( infrared ) {
qDebug("KO: Disable BeamReceive ");
delete infrared;
infrared = 0;
brAction->setOn(false);
return;
}
qDebug("KO: Enable BeamReceive ");
brAction->setOn(true);
infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
#endif
}
void MainWindow::showMaximized ()
{
#ifndef DESKTOP_VERSION
if ( ! globalFlagBlockStartup )
if ( mClosed )
mView->goToday();
#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;
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:
saveOnClose();
- if ( mCalendarModifiedFlag ) {
+ if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
ce->ignore();
return;
}
mClosed = true;
ce->accept();
break;
case 1:
ce->ignore();
break;
case 2:
default:
break;
}
}
void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data )
{
qDebug("KO: QCOP start message received: %s ", cmsg.data() );
mCStringMess = cmsg;
mByteData = data;
}
void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
@@ -1144,48 +1163,52 @@ void MainWindow::initActions()
//#else
#ifdef _OL_IMPORT_
importMenu_X->insertSeparator();
action = new QAction( "import_ol", i18n("Import from OL"), 0,
this );
action->addTo( importMenu_X );
connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
#endif
//#endif
//importMenu->insertSeparator();
#if 0
action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
#endif
action = new QAction( "save_cal", i18n("Save Backup..."), 0,
this );
action->addTo( importMenu );
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() ) );
//LR
QPopupMenu *ex2phone = new QPopupMenu( this );
ex2phone->insertItem(i18n("Complete calendar..."), 1 );
ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
importMenu->insertItem( i18n("Export"), exportMenu_X );
mPrintSelAction = 0;
#ifndef DESKTOP_VERSION
//importMenu->insertSeparator();
brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
this );
brAction->addTo( beamMenu_X );
brAction->setToggleAction (true ) ;
connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
@@ -1946,49 +1969,49 @@ void MainWindow::saveOnClose()
p->mToolBarUpF = filterToolBar->x() > width()/2 ;
}
#endif
save();
mView->writeSettings();
mView->checkSuspendAlarm();
}
void MainWindow::slotModifiedChanged( bool )
{
if ( mBlockAtStartup )
return;
int msec;
if ( mCalendarModifiedFlag ) {
//qDebug(" MainWindow timer is running ");
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
- mSaveTime.restart();
+ mSaveTimerStart = QDateTime::currentDateTime();
mSaveDelay = msec/1000;
qDebug("KO: Saving File in %d secs!", msec/1000);
mCalendarModifiedFlag = true;
}
void MainWindow::saveStopTimer()
{
mSaveTimer.stop();
}
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
QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
bupDir = KGlobalSettings::backupDataDir();
int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
if ( retval == 0 ) {
setCaption(i18n("Backup cancelled" ));
qDebug("KO: Backup cancelled. Will try again tomorrow ");
// retval == 0 : backup skipped for today, try again tomorrow
KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1;
@@ -1996,54 +2019,56 @@ void MainWindow::backupAllFiles()
qDebug("KO: Backup created.");
// backup ok
QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
KopiCalendarFile * cal = calendars.first();
cal = calendars.next();
while ( cal ) {
if ( !cal->mErrorOnLoad ) {
KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
}
cal = calendars.next();
}
KOPrefs::instance()->mLastBackupDate = daysTo;
setCaption(i18n("Backup succesfully finished" ));
} else if ( retval == 2 ){
setCaption(i18n("Backup globally disabled" ));
qDebug("KO: Backup globally cancelled.");
// backup globally cancelled
KPimGlobalPrefs::instance()->mBackupEnabled = false;
}
// retval == 3: do nothing, try again later
}
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;
}
}
if ( mView->viewManager()->journalView() )
mView->viewManager()->journalView()->checkModified();
if ( !mCalendarModifiedFlag ) {
qDebug("KO: Calendar not modified. Nothing saved.");
return;
}
if ( mSyncManager->blockSave() ) {
slotModifiedChanged( true );
return;
}
mSaveDelay = 0;
mSyncManager->setBlockSave(true);
if ( mView->checkAllFileVersions() ) {
if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
QDate reference ( 2000,1,1);
int daysTo = reference.daysTo ( QDate::currentDate() );
if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) {
backupAllFiles();
}
@@ -2554,80 +2579,96 @@ void MainWindow::importFile( QString fn, bool quick )
0, 1 );
}
if ( result == 0 ) {
if ( mView->openCalendar( fn, true )) {
KOPrefs::instance()->mLastImportFile = fn;
setCaption(i18n("Imported file successfully"));
} else {
setCaption(i18n("Error importing file"));
}
mView->updateView();
}
}
void MainWindow::importIcal()
{
QString fn =KOPrefs::instance()->mLastImportFile;
fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
if ( fn == "" )
return;
importFile( fn, true );
}
-
-void MainWindow::exportVCalendar()
+void MainWindow::exportCalendar( bool iCalFormat )
{
QString fn = KOPrefs::instance()->mLastVcalFile;
- fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
+ 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;
info.setFile( fn );
QString mes;
bool createbup = true;
if ( info. exists() ) {
mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
i18n("Overwrite!"), i18n("Cancel"), 0,
0, 1 );
if ( result != 0 ) {
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 );
setCaption(mes);
}
}
}
+void MainWindow::exportICalendar()
+{
+ exportCalendar( true );
+}
+void MainWindow::exportVCalendar()
+{
+ exportCalendar( false );
+}
QString MainWindow::sentSyncFile()
{
#ifdef DESKTOP_VERSION
return QDir::convertSeparators( locateLocal( "tmp", "copysynccal.ics" ) );
#else
return QString( "/tmp/copysynccal.ics" );
#endif
}
void MainWindow::syncFileRequest()
{
while ( mSyncManager->blockSave() ) {
qApp->processEvents();
}
mSyncManager->setBlockSave(true);
if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
mSyncManager->slotSyncMenu( 999 );
}
setCaption(i18n("Saving Data to temp file ..." ));
mView->saveCalendar( sentSyncFile() );
setCaption(i18n("Data saved to temp file!" ));
mSyncManager->setBlockSave( false );
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 657c0a8..71c069b 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -72,71 +72,74 @@ class MainWindow : public QMainWindow
void aboutAutoSaving();;
void aboutKnownBugs();
void processIncidenceSelection( Incidence * );
void importQtopia();
void importBday();
void importOL();
void importIcal();
void importFile( QString, bool );
void quickImportIcal();
void slotModifiedChanged( bool );
void save();
void backupAllFiles();
void saveStopTimer();
void configureToolBar( int );
void printSel();
void printCal();
void printListView();
void saveCalendar();
void loadCalendar();
void exportVCalendar();
+ void exportICalendar();
+ void exportCalendar( bool );
void fillFilterMenu();
void fillFilterMenuTB();
void selectFilter( int );
void fillFilterMenuPopup();
void selectFilterPopup( int );
void exportToPhone( int );
void toggleBeamReceive();
void disableBR(bool);
signals:
void selectWeek ( int );
private slots:
void slotResetFocus();
void slotResetFocusLoop();
void showConfigureAgenda();
void getFile( bool );
void syncFileRequest();
protected:
int mFocusLoop;
void hideEvent ( QHideEvent * );
QString sentSyncFile();
void displayText( QString, QString);
void enableIncidenceActions( bool );
+ bool askForQuitOnSaveError();
private:
QCString mCStringMess;
QByteArray mByteData;
//void setMenuBar( QMenuBar * );
bool mBRdisabled;
#ifndef DESKTOP_VERSION
QCopChannel* infrared;
#endif
QAction* brAction;
KSyncManager* mSyncManager;
bool mClosed;
void saveOnClose();
bool mFlagKeyPressed;
bool mBlockAtStartup;
KMenuBar *menuBar1;
QPEToolBar *iconToolBar;
QPEToolBar *viewToolBar;
QPEToolBar *navigatorToolBar;
QPEToolBar *filterToolBar;
KMenuBar *filterMenubar;
QPopupMenu * filterPopupMenu;
@@ -153,34 +156,34 @@ class MainWindow : public QMainWindow
CalendarLocal *mCalendar;
CalendarView *mView;
QAction *mNewSubTodoAction;
QAction *mWeekAction;
QFont mWeekFont;
QPixmap mWeekPixmap;
QColor mWeekBgColor;
QAction *mShowAction;
QAction *mEditAction;
QAction *mDeleteAction;
QAction *mCloneAction;
QAction *mMoveAction;
QAction *mBeamAction;
QAction *mCancelAction;
QAction *mPrintSelAction;
QAction *mToggleNav;
QAction *mToggleFilter;
QAction *mToggleAllday;
QAction *actionFilterMenuTB;
void closeEvent( QCloseEvent* ce );
QTimer mSaveTimer;
- QTime mSaveTime;
+ QDateTime mSaveTimerStart;
int mSaveDelay;
//bool mBlockSaveFlag;
bool mCalendarModifiedFlag;
QPixmap loadPixmap( QString );
QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80, journalPix;
};
#endif