summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp20
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
@@ -1208,40 +1208,40 @@ void CalendarView::setSyncDevice( QString s )
{
mCurrentSyncDevice= s;
}
void CalendarView::setSyncName( QString s )
{
mCurrentSyncName= s;
}
bool CalendarView::syncCalendar(QString filename, int mode)
{
mGlobalSyncMode = SYNC_MODE_NORMAL;
CalendarLocal* calendar = new CalendarLocal();
calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
FileStorage* storage = new FileStorage( calendar );
bool syncOK = false;
storage->setFileName( filename );
// qDebug("loading ... ");
- if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) {
+ if ( storage->load() ) {
getEventViewerDialog()->setSyncMode( true );
syncOK = synchronizeCalendar( mCalendar, calendar, mode );
getEventViewerDialog()->setSyncMode( false );
if ( syncOK ) {
if ( KOPrefs::instance()->mWriteBackFile )
{
- storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
+ storage->setSaveFormat( new ICalFormat() );
storage->save();
}
}
setModified( true );
}
delete storage;
delete calendar;
if ( syncOK )
updateView();
return syncOK;
}
void CalendarView::syncPhone()
{
syncExternal( 1 );
}
void CalendarView::syncExternal( int mode )
@@ -1486,50 +1486,52 @@ bool CalendarView::openCalendar(QString filename, bool merge)
{
if (filename.isEmpty()) {
return false;
}
if (!QFile::exists(filename)) {
KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
return false;
}
globalFlagBlockAgenda = 1;
if (!merge) mCalendar->close();
mStorage->setFileName( filename );
- if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) {
+ if ( mStorage->load() ) {
if ( merge ) ;//setModified( true );
else {
//setModified( true );
mViewManager->setDocumentId( filename );
mDialogManager->setDocumentId( filename );
mTodoList->setDocumentId( filename );
}
globalFlagBlockAgenda = 2;
// if ( getLastSyncEvent() )
// getLastSyncEvent()->setReadOnly( true );
mCalendar->reInitAlarmSettings();
setSyncEventsReadOnly();
updateUnmanagedViews();
updateView();
- if ( filename != MainWindow::defaultFileName() )
- saveCalendar( MainWindow::defaultFileName() );
loadedFileVersion = QDateTime::currentDateTime();
+ if ( filename != MainWindow::defaultFileName() ) {
+ saveCalendar( MainWindow::defaultFileName() );
+ watchSavedFile();
+ }
return true;
} else {
// while failing to load, the calendar object could
// have become partially populated. Clear it out.
if ( !merge ) mCalendar->close();
KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename));
globalFlagBlockAgenda = 2;
updateView();
}
return false;
}
void CalendarView::setLoadedFileVersion(QDateTime dt)
{
loadedFileVersion = dt;
@@ -1587,33 +1589,33 @@ bool CalendarView::checkFileVersion(QString fn)
Event * e = getLastSyncEvent();
mCalendar->deleteEvent ( e );
updateView();
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();
//mStorage->setFileName( filename );
- mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
+ mStorage->setSaveFormat( new ICalFormat() );
mStorage->setFileName( filename );
bool success;
success = mStorage->save();
if ( !success ) {
return false;
}
return true;
}
void CalendarView::closeCalendar()
{
// child windows no longer valid
emit closingDown();
@@ -2288,33 +2290,33 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
else {
description.sprintf(i18n(" %d items?"),delSel.count() );
}
while ( incidence ) {
Incidence *in = incidence->clone();
if ( addText )
description += in->summary() + "\n";
cal->addIncidence( in );
incidence = delSel.next();
}
if ( beamDialog->beamVcal() ) {
fn += ".vcs";
FileStorage storage( cal, fn, new VCalFormat );
storage.save();
} else {
fn += ".ics";
- FileStorage storage( cal, fn, new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
+ FileStorage storage( cal, fn, new ICalFormat( ) );
storage.save();
}
delete cal;
mes = i18n("KO/Pi: Ready for beaming");
setCaption(mes);
#ifndef DESKTOP_VERSION
Ir *ir = new Ir( this );
connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
ir->send( fn, description, "text/x-vCalendar" );
#endif
}
}
void CalendarView::beamDone( Ir *ir )
{
#ifndef DESKTOP_VERSION
@@ -2843,33 +2845,33 @@ void CalendarView::action_mail()
return;
}
if(incidence->attendeeCount() == 0 ) {
KMessageBox::sorry(this,
i18n("Can't generate mail:\nNo attendees defined.\n"));
return;
}
CalendarLocal cal_tmp;
Event *event = 0;
Event *ev = 0;
if ( incidence && incidence->type() == "Event" ) {
event = static_cast<Event *>(incidence);
ev = new Event(*event);
cal_tmp.addEvent(ev);
}
- ICalFormat mForm( KOPrefs::instance()->mUseQuicksave);
+ ICalFormat mForm();
QString attachment = mForm.toString( &cal_tmp );
if (ev) delete(ev);
mailClient.mailAttendees(currentSelection(), attachment);
#endif
#if 0
Event *anEvent = 0;
if (mViewManager->currentView()->isEventView()) {
anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first());
}
if (!anEvent) {
KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
return;
@@ -3128,33 +3130,33 @@ void CalendarView::printPreview()
createPrinter();
DateList tmpDateList = mNavigator->selectedDates();
mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(),
tmpDateList.last());
#endif
}
void CalendarView::exportICalendar()
{
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( KOPrefs::instance()->mUseQuicksave) );
+ FileStorage storage( mCalendar, filename, new ICalFormat() );
storage.save();
}
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