author | zautrix <zautrix> | 2004-08-07 21:04:24 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-07 21:04:24 (UTC) |
commit | a9c3191a42084b6631dededef1709fa67eb2c048 (patch) (unidiff) | |
tree | 9950e3c8fc54c2994a4a50417008921bfdc58889 /korganizer | |
parent | 809e502f4b6e84524c10fa963e2d17564e6b1af9 (diff) | |
download | kdepimpi-a9c3191a42084b6631dededef1709fa67eb2c048.zip kdepimpi-a9c3191a42084b6631dededef1709fa67eb2c048.tar.gz kdepimpi-a9c3191a42084b6631dededef1709fa67eb2c048.tar.bz2 |
more phone sync
-rw-r--r-- | korganizer/calendarview.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index b307649..d6ead37 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1151,85 +1151,90 @@ bool CalendarView::syncCalendar(QString filename, int mode) | |||
1151 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1151 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
1152 | CalendarLocal* calendar = new CalendarLocal(); | 1152 | CalendarLocal* calendar = new CalendarLocal(); |
1153 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1153 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1154 | FileStorage* storage = new FileStorage( calendar ); | 1154 | FileStorage* storage = new FileStorage( calendar ); |
1155 | bool syncOK = false; | 1155 | bool syncOK = false; |
1156 | storage->setFileName( filename ); | 1156 | storage->setFileName( filename ); |
1157 | // qDebug("loading ... "); | 1157 | // qDebug("loading ... "); |
1158 | if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { | 1158 | if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { |
1159 | getEventViewerDialog()->setSyncMode( true ); | 1159 | getEventViewerDialog()->setSyncMode( true ); |
1160 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1160 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1161 | getEventViewerDialog()->setSyncMode( false ); | 1161 | getEventViewerDialog()->setSyncMode( false ); |
1162 | if ( syncOK ) { | 1162 | if ( syncOK ) { |
1163 | if ( KOPrefs::instance()->mWriteBackFile ) | 1163 | if ( KOPrefs::instance()->mWriteBackFile ) |
1164 | { | 1164 | { |
1165 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 1165 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); |
1166 | storage->save(); | 1166 | storage->save(); |
1167 | } | 1167 | } |
1168 | } | 1168 | } |
1169 | setModified( true ); | 1169 | setModified( true ); |
1170 | } | 1170 | } |
1171 | delete storage; | 1171 | delete storage; |
1172 | delete calendar; | 1172 | delete calendar; |
1173 | if ( syncOK ) | 1173 | if ( syncOK ) |
1174 | updateView(); | 1174 | updateView(); |
1175 | return syncOK; | 1175 | return syncOK; |
1176 | } | 1176 | } |
1177 | void CalendarView::syncPhone() | 1177 | void CalendarView::syncPhone() |
1178 | { | 1178 | { |
1179 | syncExternal( 1 ); | 1179 | syncExternal( 1 ); |
1180 | } | 1180 | } |
1181 | void CalendarView::syncExternal( int mode ) | 1181 | void CalendarView::syncExternal( int mode ) |
1182 | { | 1182 | { |
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 ) |
1186 | edit_sync_options(); | 1186 | edit_sync_options(); |
1187 | qApp->processEvents(); | 1187 | qApp->processEvents(); |
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 | bool loadSuccess = false; | 1191 | bool loadSuccess = false; |
1192 | PhoneFormat* phoneFormat = 0; | 1192 | PhoneFormat* phoneFormat = 0; |
1193 | #ifndef DESKTOP_VERSION | 1193 | #ifndef DESKTOP_VERSION |
1194 | SharpFormat* sharpFormat = 0; | 1194 | SharpFormat* sharpFormat = 0; |
1195 | if ( mode == 0 ) { // sharp | 1195 | if ( mode == 0 ) { // sharp |
1196 | sharpFormat = new SharpFormat () ; | 1196 | sharpFormat = new SharpFormat () ; |
1197 | loadSuccess = sharpFormat->load( calendar, mCalendar ); | 1197 | loadSuccess = sharpFormat->load( calendar, mCalendar ); |
1198 | 1198 | ||
1199 | } else | 1199 | } else |
1200 | #endif | 1200 | #endif |
1201 | if ( mode == 1 ) { // phone | 1201 | if ( mode == 1 ) { // phone |
1202 | phoneFormat = new PhoneFormat (); | 1202 | phoneFormat = new PhoneFormat (); |
1203 | loadSuccess = phoneFormat->load( calendar, mCalendar ); | 1203 | loadSuccess = phoneFormat->load( calendar, |
1204 | mCalendar, | ||
1205 | mCurrentSyncDevice, | ||
1206 | KOPrefs::instance()->mPhoneDevice, | ||
1207 | KOPrefs::instance()->mPhoneConnection, | ||
1208 | KOPrefs::instance()->mPhoneModel); | ||
1204 | 1209 | ||
1205 | } else | 1210 | } else |
1206 | return; | 1211 | return; |
1207 | if ( loadSuccess ) { | 1212 | if ( loadSuccess ) { |
1208 | getEventViewerDialog()->setSyncMode( true ); | 1213 | getEventViewerDialog()->setSyncMode( true ); |
1209 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); | 1214 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); |
1210 | getEventViewerDialog()->setSyncMode( false ); | 1215 | getEventViewerDialog()->setSyncMode( false ); |
1211 | qApp->processEvents(); | 1216 | qApp->processEvents(); |
1212 | if ( syncOK ) { | 1217 | if ( syncOK ) { |
1213 | if ( KOPrefs::instance()->mWriteBackFile ) | 1218 | if ( KOPrefs::instance()->mWriteBackFile ) |
1214 | { | 1219 | { |
1215 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1220 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1216 | Incidence* inc = iL.first(); | 1221 | Incidence* inc = iL.first(); |
1217 | /* obsolete | 1222 | /* obsolete |
1218 | while ( inc ) { | 1223 | while ( inc ) { |
1219 | inc->setZaurusStat( inc->revision () ); | 1224 | inc->setZaurusStat( inc->revision () ); |
1220 | inc = iL.next(); | 1225 | inc = iL.next(); |
1221 | } | 1226 | } |
1222 | */ | 1227 | */ |
1223 | #ifndef DESKTOP_VERSION | 1228 | #ifndef DESKTOP_VERSION |
1224 | if ( sharpFormat ) | 1229 | if ( sharpFormat ) |
1225 | sharpFormat->save(calendar); | 1230 | sharpFormat->save(calendar); |
1226 | #endif | 1231 | #endif |
1227 | if ( phoneFormat ) | 1232 | if ( phoneFormat ) |
1228 | phoneFormat->save(calendar); | 1233 | phoneFormat->save(calendar); |
1229 | iL = calendar->rawIncidences(); | 1234 | iL = calendar->rawIncidences(); |
1230 | inc = iL.first(); | 1235 | inc = iL.first(); |
1231 | Incidence* loc; | 1236 | Incidence* loc; |
1232 | while ( inc ) { | 1237 | while ( inc ) { |
1233 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1238 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1234 | loc = mCalendar->incidence(inc->uid() ); | 1239 | loc = mCalendar->incidence(inc->uid() ); |
1235 | if ( loc ) { | 1240 | if ( loc ) { |