summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 79fb727..2ba8528 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2538,24 +2538,25 @@ bool CalendarView::saveCalendars()
2538 while ( cal ) { 2538 while ( cal ) {
2539 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { 2539 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) {
2540 mCalendar->setDefaultCalendar( cal->mCalNumber ); 2540 mCalendar->setDefaultCalendar( cal->mCalNumber );
2541 mCalendar->setDefaultCalendarEnabledOnly(); 2541 mCalendar->setDefaultCalendarEnabledOnly();
2542 if ( saveCalendar( cal->mFileName ) ) 2542 if ( saveCalendar( cal->mFileName ) )
2543 cal->mLoadDt = QDateTime::currentDateTime(); 2543 cal->mLoadDt = QDateTime::currentDateTime();
2544 else 2544 else
2545 saveError += cal->mName + "\n"; 2545 saveError += cal->mName + "\n";
2546 } 2546 }
2547 cal = calendars.next(); 2547 cal = calendars.next();
2548 } 2548 }
2549 restoreCalendarSettings(); 2549 restoreCalendarSettings();
2550 //saveError = "test error";
2550 if ( !saveError.isEmpty() ) { 2551 if ( !saveError.isEmpty() ) {
2551 saveError = KGlobal::formatMessage( i18n("Calendar(s) not saved:"),0 )+"\n" + saveError; 2552 saveError = KGlobal::formatMessage( i18n("Calendar(s) not saved:"),0 )+"\n" + saveError;
2552 KMessageBox::error(this, saveError, i18n("Error saving data")); 2553 KMessageBox::error(this, saveError, i18n("Error saving data"));
2553 return false; 2554 return false;
2554 } 2555 }
2555 return true; 2556 return true;
2556} 2557}
2557bool CalendarView::saveCalendar( QString filename ) 2558bool CalendarView::saveCalendar( QString filename )
2558{ 2559{
2559 2560
2560 // Store back all unsaved data into calendar object 2561 // Store back all unsaved data into calendar object
2561 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 2562 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
@@ -4454,34 +4455,36 @@ void CalendarView::printPreview()
4454{ 4455{
4455#ifndef KORG_NOPRINTER 4456#ifndef KORG_NOPRINTER
4456 kdDebug() << "CalendarView::printPreview()" << endl; 4457 kdDebug() << "CalendarView::printPreview()" << endl;
4457 4458
4458 createPrinter(); 4459 createPrinter();
4459 4460
4460 DateList tmpDateList = mNavigator->selectedDates(); 4461 DateList tmpDateList = mNavigator->selectedDates();
4461 4462
4462 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), 4463 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(),
4463 tmpDateList.last()); 4464 tmpDateList.last());
4464#endif 4465#endif
4465} 4466}
4466 4467bool CalendarView::exportICalendar( QString filename )
4467void CalendarView::exportICalendar()
4468{ 4468{
4469 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this);
4470
4471 // Force correct extension 4469 // Force correct extension
4472 if (filename.right(4) != ".ics") filename += ".ics"; 4470 if (filename.right(4) != ".ics") filename += ".ics";
4473 4471
4474 FileStorage storage( mCalendar, filename, new ICalFormat() ); 4472 FileStorage storage( mCalendar, filename, new ICalFormat() );
4475 storage.save(); 4473 return storage.save();
4474}
4475
4476bool CalendarView::exportICalendar()
4477{
4478 return exportICalendar( KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this) );
4476} 4479}
4477 4480
4478bool CalendarView::exportVCalendar( QString filename ) 4481bool CalendarView::exportVCalendar( QString filename )
4479{ 4482{
4480 if (mCalendar->journals().count() > 0) { 4483 if (mCalendar->journals().count() > 0) {
4481 int result = KMessageBox::warningContinueCancel(this, 4484 int result = KMessageBox::warningContinueCancel(this,
4482 i18n("The journal entries can not be\nexported to a vCalendar file."), 4485 i18n("The journal entries can not be\nexported to a vCalendar file."),
4483 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 4486 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
4484 true); 4487 true);
4485 if (result != KMessageBox::Continue) return false; 4488 if (result != KMessageBox::Continue) return false;
4486 } 4489 }
4487 4490