author | zautrix <zautrix> | 2004-08-01 12:02:39 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-01 12:02:39 (UTC) |
commit | c31e99f265dbe8762efca20667f8ccd973840f8f (patch) (unidiff) | |
tree | 29e7fd6845d187f41f9d80e756611dc8bc182bdc /korganizer | |
parent | e954cc1e29b129982e4d07c4f490d7e881597374 (diff) | |
download | kdepimpi-c31e99f265dbe8762efca20667f8ccd973840f8f.zip kdepimpi-c31e99f265dbe8762efca20667f8ccd973840f8f.tar.gz kdepimpi-c31e99f265dbe8762efca20667f8ccd973840f8f.tar.bz2 |
Changed zaurusstat to tempsyncstat
-rw-r--r-- | korganizer/calendarview.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index fd68dc4..b543eca 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -956,97 +956,97 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
956 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 956 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
957 | bar.show(); | 957 | bar.show(); |
958 | int modulo = (er.count()/10)+1; | 958 | int modulo = (er.count()/10)+1; |
959 | int incCounter = 0; | 959 | int incCounter = 0; |
960 | while ( inR ) { | 960 | while ( inR ) { |
961 | if ( ! bar.isVisible() ) | 961 | if ( ! bar.isVisible() ) |
962 | return false; | 962 | return false; |
963 | if ( incCounter % modulo == 0 ) | 963 | if ( incCounter % modulo == 0 ) |
964 | bar.setProgress( incCounter ); | 964 | bar.setProgress( incCounter ); |
965 | ++incCounter; | 965 | ++incCounter; |
966 | uid = inR->uid(); | 966 | uid = inR->uid(); |
967 | bool skipIncidence = false; | 967 | bool skipIncidence = false; |
968 | if ( uid.left(21) == QString("last-syncEvent-device") ) | 968 | if ( uid.left(21) == QString("last-syncEvent-device") ) |
969 | skipIncidence = true; | 969 | skipIncidence = true; |
970 | 970 | ||
971 | qApp->processEvents(); | 971 | qApp->processEvents(); |
972 | if ( !skipIncidence ) { | 972 | if ( !skipIncidence ) { |
973 | inL = local->incidence( uid ); | 973 | inL = local->incidence( uid ); |
974 | if ( inL ) { // maybe conflict - same uid in both calendars | 974 | if ( inL ) { // maybe conflict - same uid in both calendars |
975 | int maxrev = inL->revision(); | 975 | int maxrev = inL->revision(); |
976 | if ( maxrev < inR->revision() ) | 976 | if ( maxrev < inR->revision() ) |
977 | maxrev = inR->revision(); | 977 | maxrev = inR->revision(); |
978 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 978 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
979 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 979 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
980 | if ( take == 3 ) | 980 | if ( take == 3 ) |
981 | return false; | 981 | return false; |
982 | if ( take == 1 ) {// take local | 982 | if ( take == 1 ) {// take local |
983 | inL->setZaurusUid( inR->zaurusUid() ); | 983 | inL->setZaurusUid( inR->zaurusUid() ); |
984 | remote->deleteIncidence( inR ); | 984 | remote->deleteIncidence( inR ); |
985 | if ( inL->revision() < maxrev ) | 985 | if ( inL->revision() < maxrev ) |
986 | inL->setRevision( maxrev ); | 986 | inL->setRevision( maxrev ); |
987 | remote->addIncidence( inL->clone() ); | 987 | remote->addIncidence( inL->clone() ); |
988 | ++changedRemote; | 988 | ++changedRemote; |
989 | } else { | 989 | } else { |
990 | if ( inR->revision() < maxrev ) | 990 | if ( inR->revision() < maxrev ) |
991 | inR->setRevision( maxrev ); | 991 | inR->setRevision( maxrev ); |
992 | local->deleteIncidence( inL ); | 992 | local->deleteIncidence( inL ); |
993 | local->addIncidence( inR->clone() ); | 993 | local->addIncidence( inR->clone() ); |
994 | ++changedLocal; | 994 | ++changedLocal; |
995 | } | 995 | } |
996 | } | 996 | } |
997 | } else { // no conflict | 997 | } else { // no conflict |
998 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 998 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
999 | QString des = eventLSync->description(); | 999 | QString des = eventLSync->description(); |
1000 | QString pref = "e"; | 1000 | QString pref = "e"; |
1001 | if ( inR->type() == "Todo" ) | 1001 | if ( inR->type() == "Todo" ) |
1002 | pref = "t"; | 1002 | pref = "t"; |
1003 | if ( des.find(pref+QString::number( inR->zaurusId() ) +"," ) >= 0 && mode != 5) { // delete it | 1003 | if ( des.find(pref+QString::number( inR->zaurusId() ) +"," ) >= 0 && mode != 5) { // delete it |
1004 | inR->setZaurusStat( SYNC_TEMPSTATE_DELETE ); | 1004 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1005 | //remote->deleteIncidence( inR ); | 1005 | //remote->deleteIncidence( inR ); |
1006 | ++deletedEventR; | 1006 | ++deletedEventR; |
1007 | } else { | 1007 | } else { |
1008 | inR->setLastModified( modifiedCalendar ); | 1008 | inR->setLastModified( modifiedCalendar ); |
1009 | local->addIncidence( inR->clone() ); | 1009 | local->addIncidence( inR->clone() ); |
1010 | ++addedEvent; | 1010 | ++addedEvent; |
1011 | } | 1011 | } |
1012 | } else { | 1012 | } else { |
1013 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1013 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1014 | inR->setLastModified( modifiedCalendar ); | 1014 | inR->setLastModified( modifiedCalendar ); |
1015 | local->addIncidence( inR->clone() ); | 1015 | local->addIncidence( inR->clone() ); |
1016 | ++addedEvent; | 1016 | ++addedEvent; |
1017 | } else { | 1017 | } else { |
1018 | checkSharpEvent(eventRSyncSharp, inR); | 1018 | checkSharpEvent(eventRSyncSharp, inR); |
1019 | remote->deleteIncidence( inR ); | 1019 | remote->deleteIncidence( inR ); |
1020 | ++deletedEventR; | 1020 | ++deletedEventR; |
1021 | } | 1021 | } |
1022 | } | 1022 | } |
1023 | } | 1023 | } |
1024 | } | 1024 | } |
1025 | inR = er.next(); | 1025 | inR = er.next(); |
1026 | } | 1026 | } |
1027 | QPtrList<Incidence> el = local->rawIncidences(); | 1027 | QPtrList<Incidence> el = local->rawIncidences(); |
1028 | inL = el.first(); | 1028 | inL = el.first(); |
1029 | modulo = (el.count()/10)+1; | 1029 | modulo = (el.count()/10)+1; |
1030 | bar.setCaption (i18n("Add / remove events") ); | 1030 | bar.setCaption (i18n("Add / remove events") ); |
1031 | bar.setTotalSteps ( el.count() ) ; | 1031 | bar.setTotalSteps ( el.count() ) ; |
1032 | bar.show(); | 1032 | bar.show(); |
1033 | incCounter = 0; | 1033 | incCounter = 0; |
1034 | 1034 | ||
1035 | while ( inL ) { | 1035 | while ( inL ) { |
1036 | 1036 | ||
1037 | qApp->processEvents(); | 1037 | qApp->processEvents(); |
1038 | if ( ! bar.isVisible() ) | 1038 | if ( ! bar.isVisible() ) |
1039 | return false; | 1039 | return false; |
1040 | if ( incCounter % modulo == 0 ) | 1040 | if ( incCounter % modulo == 0 ) |
1041 | bar.setProgress( incCounter ); | 1041 | bar.setProgress( incCounter ); |
1042 | ++incCounter; | 1042 | ++incCounter; |
1043 | uid = inL->uid(); | 1043 | uid = inL->uid(); |
1044 | bool skipIncidence = false; | 1044 | bool skipIncidence = false; |
1045 | if ( uid.left(21) == QString("last-syncEvent-device") ) | 1045 | if ( uid.left(21) == QString("last-syncEvent-device") ) |
1046 | skipIncidence = true; | 1046 | skipIncidence = true; |
1047 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) | 1047 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) |
1048 | skipIncidence = true; | 1048 | skipIncidence = true; |
1049 | if ( !skipIncidence ) { | 1049 | if ( !skipIncidence ) { |
1050 | inR = remote->incidence( uid ); | 1050 | inR = remote->incidence( uid ); |
1051 | if ( ! inR ) { | 1051 | if ( ! inR ) { |
1052 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1052 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
@@ -1126,97 +1126,97 @@ bool CalendarView::syncCalendar(QString filename, int mode) | |||
1126 | if ( KOPrefs::instance()->mWriteBackFile ) | 1126 | if ( KOPrefs::instance()->mWriteBackFile ) |
1127 | { | 1127 | { |
1128 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 1128 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); |
1129 | storage->save(); | 1129 | storage->save(); |
1130 | } | 1130 | } |
1131 | } | 1131 | } |
1132 | setModified( true ); | 1132 | setModified( true ); |
1133 | } | 1133 | } |
1134 | delete storage; | 1134 | delete storage; |
1135 | delete calendar; | 1135 | delete calendar; |
1136 | if ( syncOK ) | 1136 | if ( syncOK ) |
1137 | updateView(); | 1137 | updateView(); |
1138 | return syncOK; | 1138 | return syncOK; |
1139 | } | 1139 | } |
1140 | void CalendarView::syncSharp() | 1140 | void CalendarView::syncSharp() |
1141 | { | 1141 | { |
1142 | #ifndef DESKTOP_VERSION | 1142 | #ifndef DESKTOP_VERSION |
1143 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1143 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1144 | //mCurrentSyncDevice = "sharp-DTM"; | 1144 | //mCurrentSyncDevice = "sharp-DTM"; |
1145 | if ( KOPrefs::instance()->mAskForPreferences ) | 1145 | if ( KOPrefs::instance()->mAskForPreferences ) |
1146 | edit_sync_options(); | 1146 | edit_sync_options(); |
1147 | qApp->processEvents(); | 1147 | qApp->processEvents(); |
1148 | CalendarLocal* calendar = new CalendarLocal(); | 1148 | CalendarLocal* calendar = new CalendarLocal(); |
1149 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1149 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1150 | bool syncOK = false; | 1150 | bool syncOK = false; |
1151 | SharpFormat sharpFormat; | 1151 | SharpFormat sharpFormat; |
1152 | if ( sharpFormat.load( calendar, mCalendar ) ) { | 1152 | if ( sharpFormat.load( calendar, mCalendar ) ) { |
1153 | getEventViewerDialog()->setSyncMode( true ); | 1153 | getEventViewerDialog()->setSyncMode( true ); |
1154 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); | 1154 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); |
1155 | getEventViewerDialog()->setSyncMode( false ); | 1155 | getEventViewerDialog()->setSyncMode( false ); |
1156 | qApp->processEvents(); | 1156 | qApp->processEvents(); |
1157 | if ( syncOK ) { | 1157 | if ( syncOK ) { |
1158 | if ( KOPrefs::instance()->mWriteBackFile ) | 1158 | if ( KOPrefs::instance()->mWriteBackFile ) |
1159 | { | 1159 | { |
1160 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1160 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1161 | Incidence* inc = iL.first(); | 1161 | Incidence* inc = iL.first(); |
1162 | /* obsolete | 1162 | /* obsolete |
1163 | while ( inc ) { | 1163 | while ( inc ) { |
1164 | inc->setZaurusStat( inc->revision () ); | 1164 | inc->setZaurusStat( inc->revision () ); |
1165 | inc = iL.next(); | 1165 | inc = iL.next(); |
1166 | } | 1166 | } |
1167 | */ | 1167 | */ |
1168 | // pending: clean last sync event description | 1168 | // pending: clean last sync event description |
1169 | sharpFormat.save(calendar); | 1169 | sharpFormat.save(calendar); |
1170 | iL = calendar->rawIncidences(); | 1170 | iL = calendar->rawIncidences(); |
1171 | inc = iL.first(); | 1171 | inc = iL.first(); |
1172 | Incidence* loc; | 1172 | Incidence* loc; |
1173 | while ( inc ) { | 1173 | while ( inc ) { |
1174 | if ( inc->zaurusStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1174 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1175 | loc = mCalendar->incidence(inc->uid() ); | 1175 | loc = mCalendar->incidence(inc->uid() ); |
1176 | if ( loc ) { | 1176 | if ( loc ) { |
1177 | loc->setZaurusId( inc->zaurusId() ); | 1177 | loc->setZaurusId( inc->zaurusId() ); |
1178 | loc->setZaurusUid( inc->zaurusUid() ); | 1178 | loc->setZaurusUid( inc->zaurusUid() ); |
1179 | } | 1179 | } |
1180 | } | 1180 | } |
1181 | inc = iL.next(); | 1181 | inc = iL.next(); |
1182 | } | 1182 | } |
1183 | Incidence* lse = getLastSyncEvent(); | 1183 | Incidence* lse = getLastSyncEvent(); |
1184 | if ( lse ) { | 1184 | if ( lse ) { |
1185 | lse->setReadOnly( false ); | 1185 | lse->setReadOnly( false ); |
1186 | lse->setDescription( "" ); | 1186 | lse->setDescription( "" ); |
1187 | lse->setReadOnly( true ); | 1187 | lse->setReadOnly( true ); |
1188 | } | 1188 | } |
1189 | } | 1189 | } |
1190 | } | 1190 | } |
1191 | setModified( true ); | 1191 | setModified( true ); |
1192 | } else { | 1192 | } else { |
1193 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1193 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1194 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1194 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1195 | question, i18n("Ok")) ; | 1195 | question, i18n("Ok")) ; |
1196 | 1196 | ||
1197 | } | 1197 | } |
1198 | delete calendar; | 1198 | delete calendar; |
1199 | updateView(); | 1199 | updateView(); |
1200 | return ;//syncOK; | 1200 | return ;//syncOK; |
1201 | #endif | 1201 | #endif |
1202 | } | 1202 | } |
1203 | 1203 | ||
1204 | 1204 | ||
1205 | #include <kabc/stdaddressbook.h> | 1205 | #include <kabc/stdaddressbook.h> |
1206 | bool CalendarView::importBday() | 1206 | bool CalendarView::importBday() |
1207 | { | 1207 | { |
1208 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1208 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1209 | KABC::AddressBook::Iterator it; | 1209 | KABC::AddressBook::Iterator it; |
1210 | int count = 0; | 1210 | int count = 0; |
1211 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1211 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1212 | ++count; | 1212 | ++count; |
1213 | } | 1213 | } |
1214 | QProgressBar bar(count,0 ); | 1214 | QProgressBar bar(count,0 ); |
1215 | int w = 300; | 1215 | int w = 300; |
1216 | if ( QApplication::desktop()->width() < 320 ) | 1216 | if ( QApplication::desktop()->width() < 320 ) |
1217 | w = 220; | 1217 | w = 220; |
1218 | int h = bar.sizeHint().height() ; | 1218 | int h = bar.sizeHint().height() ; |
1219 | int dw = QApplication::desktop()->width(); | 1219 | int dw = QApplication::desktop()->width(); |
1220 | int dh = QApplication::desktop()->height(); | 1220 | int dh = QApplication::desktop()->height(); |
1221 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1221 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1222 | bar.show(); | 1222 | bar.show(); |