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.cpp42
1 files changed, 33 insertions, 9 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 689618d..a7f7010 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -83,6 +83,7 @@
#ifndef DESKTOP_VERSION
#include <libkcal/sharpformat.h>
#endif
+#include <libkcal/phoneformat.h>
#ifndef KORG_NOMAIL
#include "komailclient.h"
#endif
@@ -1175,12 +1176,11 @@ bool CalendarView::syncCalendar(QString filename, int mode)
}
void CalendarView::syncPhone()
{
- qDebug("CalendarView::syncPhone() ");
+ syncExternal( 1 );
}
-void CalendarView::syncSharp()
+void CalendarView::syncExternal( int mode )
{
-#ifndef DESKTOP_VERSION
- mGlobalSyncMode = SYNC_MODE_EXTERNAL;
+ mGlobalSyncMode = SYNC_MODE_EXTERNAL;
//mCurrentSyncDevice = "sharp-DTM";
if ( KOPrefs::instance()->mAskForPreferences )
edit_sync_options();
@@ -1188,8 +1188,23 @@ void CalendarView::syncSharp()
CalendarLocal* calendar = new CalendarLocal();
calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
bool syncOK = false;
- SharpFormat sharpFormat;
- if ( sharpFormat.load( calendar, mCalendar ) ) {
+ boo loadSuccess = false;
+ PhoneFormat* phoneFormat = 0;
+#ifndef DESKTOP_VERSION
+ SharpFormat* sharpFormat = 0;
+ if ( mode == 0 ) { // sharp
+ sharpFormat = new SharpFormat () ;
+ loadSuccess = sharpFormat->load( calendar, mCalendar );
+
+ } else
+#endif
+ if ( mode == 1 ) { // phone
+ phoneFormat = new PhoneFormat ();
+ loadSuccess = phoneFormat->load( calendar, mCalendar );
+
+ } else
+ return;
+ if ( loadSuccess ) {
getEventViewerDialog()->setSyncMode( true );
syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
getEventViewerDialog()->setSyncMode( false );
@@ -1205,8 +1220,12 @@ void CalendarView::syncSharp()
inc = iL.next();
}
*/
- // pending: clean last sync event description
- sharpFormat.save(calendar);
+#ifndef DESKTOP_VERSION
+ if ( sharpFormat )
+ sharpFormat->save(calendar);
+#endif
+ if ( phoneFormat )
+ phoneFormat->save(calendar);
iL = calendar->rawIncidences();
inc = iL.first();
Incidence* loc;
@@ -1238,7 +1257,12 @@ void CalendarView::syncSharp()
delete calendar;
updateView();
return ;//syncOK;
-#endif
+
+}
+void CalendarView::syncSharp()
+{
+ syncExternal( 0 );
+
}