summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp40
1 files changed, 32 insertions, 8 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 @@
83#ifndef DESKTOP_VERSION 83#ifndef DESKTOP_VERSION
84#include <libkcal/sharpformat.h> 84#include <libkcal/sharpformat.h>
85#endif 85#endif
86#include <libkcal/phoneformat.h>
86#ifndef KORG_NOMAIL 87#ifndef KORG_NOMAIL
87#include "komailclient.h" 88#include "komailclient.h"
88#endif 89#endif
@@ -1175,11 +1176,10 @@ bool CalendarView::syncCalendar(QString filename, int mode)
1175} 1176}
1176void CalendarView::syncPhone() 1177void CalendarView::syncPhone()
1177{ 1178{
1178 qDebug("CalendarView::syncPhone() "); 1179 syncExternal( 1 );
1179} 1180}
1180void CalendarView::syncSharp() 1181void CalendarView::syncExternal( int mode )
1181{ 1182{
1182#ifndef DESKTOP_VERSION
1183 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1183 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1184 //mCurrentSyncDevice = "sharp-DTM"; 1184 //mCurrentSyncDevice = "sharp-DTM";
1185 if ( KOPrefs::instance()->mAskForPreferences ) 1185 if ( KOPrefs::instance()->mAskForPreferences )
@@ -1188,8 +1188,23 @@ void CalendarView::syncSharp()
1188 CalendarLocal* calendar = new CalendarLocal(); 1188 CalendarLocal* calendar = new CalendarLocal();
1189 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1189 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1190 bool syncOK = false; 1190 bool syncOK = false;
1191 SharpFormat sharpFormat; 1191 boo loadSuccess = false;
1192 if ( sharpFormat.load( calendar, mCalendar ) ) { 1192 PhoneFormat* phoneFormat = 0;
1193#ifndef DESKTOP_VERSION
1194 SharpFormat* sharpFormat = 0;
1195 if ( mode == 0 ) { // sharp
1196 sharpFormat = new SharpFormat () ;
1197 loadSuccess = sharpFormat->load( calendar, mCalendar );
1198
1199 } else
1200#endif
1201 if ( mode == 1 ) { // phone
1202 phoneFormat = new PhoneFormat ();
1203 loadSuccess = phoneFormat->load( calendar, mCalendar );
1204
1205 } else
1206 return;
1207 if ( loadSuccess ) {
1193 getEventViewerDialog()->setSyncMode( true ); 1208 getEventViewerDialog()->setSyncMode( true );
1194 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); 1209 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
1195 getEventViewerDialog()->setSyncMode( false ); 1210 getEventViewerDialog()->setSyncMode( false );
@@ -1205,8 +1220,12 @@ void CalendarView::syncSharp()
1205 inc = iL.next(); 1220 inc = iL.next();
1206 } 1221 }
1207 */ 1222 */
1208 // pending: clean last sync event description 1223#ifndef DESKTOP_VERSION
1209 sharpFormat.save(calendar); 1224 if ( sharpFormat )
1225 sharpFormat->save(calendar);
1226#endif
1227 if ( phoneFormat )
1228 phoneFormat->save(calendar);
1210 iL = calendar->rawIncidences(); 1229 iL = calendar->rawIncidences();
1211 inc = iL.first(); 1230 inc = iL.first();
1212 Incidence* loc; 1231 Incidence* loc;
@@ -1238,7 +1257,12 @@ void CalendarView::syncSharp()
1238 delete calendar; 1257 delete calendar;
1239 updateView(); 1258 updateView();
1240 return ;//syncOK; 1259 return ;//syncOK;
1241#endif 1260
1261}
1262void CalendarView::syncSharp()
1263{
1264 syncExternal( 0 );
1265
1242} 1266}
1243 1267
1244 1268