author | zautrix <zautrix> | 2004-10-05 08:07:41 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-05 08:07:41 (UTC) |
commit | ad859d26b813101adab963f50e694961702561d9 (patch) (unidiff) | |
tree | 36eb7f12ee6ee80f50cdd13bbfaba74e9a1b37d1 /korganizer/calendarview.cpp | |
parent | fc2c103f45a6d4e4105259436266538c645f2c87 (diff) | |
download | kdepimpi-ad859d26b813101adab963f50e694961702561d9.zip kdepimpi-ad859d26b813101adab963f50e694961702561d9.tar.gz kdepimpi-ad859d26b813101adab963f50e694961702561d9.tar.bz2 |
cleanup
-rw-r--r-- | korganizer/calendarview.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index eaea040..fecc7e2 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1218,20 +1218,20 @@ bool CalendarView::syncCalendar(QString filename, int mode) | |||
1218 | CalendarLocal* calendar = new CalendarLocal(); | 1218 | CalendarLocal* calendar = new CalendarLocal(); |
1219 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1219 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1220 | FileStorage* storage = new FileStorage( calendar ); | 1220 | FileStorage* storage = new FileStorage( calendar ); |
1221 | bool syncOK = false; | 1221 | bool syncOK = false; |
1222 | storage->setFileName( filename ); | 1222 | storage->setFileName( filename ); |
1223 | // qDebug("loading ... "); | 1223 | // qDebug("loading ... "); |
1224 | if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { | 1224 | if ( storage->load() ) { |
1225 | getEventViewerDialog()->setSyncMode( true ); | 1225 | getEventViewerDialog()->setSyncMode( true ); |
1226 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1226 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1227 | getEventViewerDialog()->setSyncMode( false ); | 1227 | getEventViewerDialog()->setSyncMode( false ); |
1228 | if ( syncOK ) { | 1228 | if ( syncOK ) { |
1229 | if ( KOPrefs::instance()->mWriteBackFile ) | 1229 | if ( KOPrefs::instance()->mWriteBackFile ) |
1230 | { | 1230 | { |
1231 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 1231 | storage->setSaveFormat( new ICalFormat() ); |
1232 | storage->save(); | 1232 | storage->save(); |
1233 | } | 1233 | } |
1234 | } | 1234 | } |
1235 | setModified( true ); | 1235 | setModified( true ); |
1236 | } | 1236 | } |
1237 | delete storage; | 1237 | delete storage; |
@@ -1496,13 +1496,13 @@ bool CalendarView::openCalendar(QString filename, bool merge) | |||
1496 | 1496 | ||
1497 | globalFlagBlockAgenda = 1; | 1497 | globalFlagBlockAgenda = 1; |
1498 | if (!merge) mCalendar->close(); | 1498 | if (!merge) mCalendar->close(); |
1499 | 1499 | ||
1500 | mStorage->setFileName( filename ); | 1500 | mStorage->setFileName( filename ); |
1501 | 1501 | ||
1502 | if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { | 1502 | if ( mStorage->load() ) { |
1503 | if ( merge ) ;//setModified( true ); | 1503 | if ( merge ) ;//setModified( true ); |
1504 | else { | 1504 | else { |
1505 | //setModified( true ); | 1505 | //setModified( true ); |
1506 | mViewManager->setDocumentId( filename ); | 1506 | mViewManager->setDocumentId( filename ); |
1507 | mDialogManager->setDocumentId( filename ); | 1507 | mDialogManager->setDocumentId( filename ); |
1508 | mTodoList->setDocumentId( filename ); | 1508 | mTodoList->setDocumentId( filename ); |
@@ -1511,15 +1511,17 @@ bool CalendarView::openCalendar(QString filename, bool merge) | |||
1511 | // if ( getLastSyncEvent() ) | 1511 | // if ( getLastSyncEvent() ) |
1512 | // getLastSyncEvent()->setReadOnly( true ); | 1512 | // getLastSyncEvent()->setReadOnly( true ); |
1513 | mCalendar->reInitAlarmSettings(); | 1513 | mCalendar->reInitAlarmSettings(); |
1514 | setSyncEventsReadOnly(); | 1514 | setSyncEventsReadOnly(); |
1515 | updateUnmanagedViews(); | 1515 | updateUnmanagedViews(); |
1516 | updateView(); | 1516 | updateView(); |
1517 | if ( filename != MainWindow::defaultFileName() ) | ||
1518 | saveCalendar( MainWindow::defaultFileName() ); | ||
1519 | loadedFileVersion = QDateTime::currentDateTime(); | 1517 | loadedFileVersion = QDateTime::currentDateTime(); |
1518 | if ( filename != MainWindow::defaultFileName() ) { | ||
1519 | saveCalendar( MainWindow::defaultFileName() ); | ||
1520 | watchSavedFile(); | ||
1521 | } | ||
1520 | return true; | 1522 | return true; |
1521 | } else { | 1523 | } else { |
1522 | // while failing to load, the calendar object could | 1524 | // while failing to load, the calendar object could |
1523 | // have become partially populated. Clear it out. | 1525 | // have become partially populated. Clear it out. |
1524 | if ( !merge ) mCalendar->close(); | 1526 | if ( !merge ) mCalendar->close(); |
1525 | 1527 | ||
@@ -1597,13 +1599,13 @@ bool CalendarView::saveCalendar( QString filename ) | |||
1597 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 1599 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
1598 | if ( mViewManager->currentView() ) | 1600 | if ( mViewManager->currentView() ) |
1599 | mViewManager->currentView()->flushView(); | 1601 | mViewManager->currentView()->flushView(); |
1600 | 1602 | ||
1601 | //mStorage->setFileName( filename ); | 1603 | //mStorage->setFileName( filename ); |
1602 | 1604 | ||
1603 | mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 1605 | mStorage->setSaveFormat( new ICalFormat() ); |
1604 | mStorage->setFileName( filename ); | 1606 | mStorage->setFileName( filename ); |
1605 | bool success; | 1607 | bool success; |
1606 | success = mStorage->save(); | 1608 | success = mStorage->save(); |
1607 | if ( !success ) { | 1609 | if ( !success ) { |
1608 | return false; | 1610 | return false; |
1609 | } | 1611 | } |
@@ -2298,13 +2300,13 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | |||
2298 | if ( beamDialog->beamVcal() ) { | 2300 | if ( beamDialog->beamVcal() ) { |
2299 | fn += ".vcs"; | 2301 | fn += ".vcs"; |
2300 | FileStorage storage( cal, fn, new VCalFormat ); | 2302 | FileStorage storage( cal, fn, new VCalFormat ); |
2301 | storage.save(); | 2303 | storage.save(); |
2302 | } else { | 2304 | } else { |
2303 | fn += ".ics"; | 2305 | fn += ".ics"; |
2304 | FileStorage storage( cal, fn, new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 2306 | FileStorage storage( cal, fn, new ICalFormat( ) ); |
2305 | storage.save(); | 2307 | storage.save(); |
2306 | } | 2308 | } |
2307 | delete cal; | 2309 | delete cal; |
2308 | mes = i18n("KO/Pi: Ready for beaming"); | 2310 | mes = i18n("KO/Pi: Ready for beaming"); |
2309 | setCaption(mes); | 2311 | setCaption(mes); |
2310 | 2312 | ||
@@ -2853,13 +2855,13 @@ void CalendarView::action_mail() | |||
2853 | Event *ev = 0; | 2855 | Event *ev = 0; |
2854 | if ( incidence && incidence->type() == "Event" ) { | 2856 | if ( incidence && incidence->type() == "Event" ) { |
2855 | event = static_cast<Event *>(incidence); | 2857 | event = static_cast<Event *>(incidence); |
2856 | ev = new Event(*event); | 2858 | ev = new Event(*event); |
2857 | cal_tmp.addEvent(ev); | 2859 | cal_tmp.addEvent(ev); |
2858 | } | 2860 | } |
2859 | ICalFormat mForm( KOPrefs::instance()->mUseQuicksave); | 2861 | ICalFormat mForm(); |
2860 | QString attachment = mForm.toString( &cal_tmp ); | 2862 | QString attachment = mForm.toString( &cal_tmp ); |
2861 | if (ev) delete(ev); | 2863 | if (ev) delete(ev); |
2862 | 2864 | ||
2863 | mailClient.mailAttendees(currentSelection(), attachment); | 2865 | mailClient.mailAttendees(currentSelection(), attachment); |
2864 | 2866 | ||
2865 | #endif | 2867 | #endif |
@@ -3138,13 +3140,13 @@ void CalendarView::exportICalendar() | |||
3138 | { | 3140 | { |
3139 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); | 3141 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); |
3140 | 3142 | ||
3141 | // Force correct extension | 3143 | // Force correct extension |
3142 | if (filename.right(4) != ".ics") filename += ".ics"; | 3144 | if (filename.right(4) != ".ics") filename += ".ics"; |
3143 | 3145 | ||
3144 | FileStorage storage( mCalendar, filename, new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 3146 | FileStorage storage( mCalendar, filename, new ICalFormat() ); |
3145 | storage.save(); | 3147 | storage.save(); |
3146 | } | 3148 | } |
3147 | 3149 | ||
3148 | bool CalendarView::exportVCalendar( QString filename ) | 3150 | bool CalendarView::exportVCalendar( QString filename ) |
3149 | { | 3151 | { |
3150 | if (mCalendar->journals().count() > 0) { | 3152 | if (mCalendar->journals().count() > 0) { |