-rw-r--r-- | korganizer/calendarview.cpp | 5 | ||||
-rw-r--r-- | libkcal/sharpformat.cpp | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 5150455..f859b90 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -866,65 +866,68 @@ Event* CalendarView::getLastSyncEvent() | |||
866 | } | 866 | } |
867 | 867 | ||
868 | return lse; | 868 | return lse; |
869 | 869 | ||
870 | } | 870 | } |
871 | // probaly useless | 871 | // probaly useless |
872 | void CalendarView::setupExternSyncProfiles() | 872 | void CalendarView::setupExternSyncProfiles() |
873 | { | 873 | { |
874 | Event* lse; | 874 | Event* lse; |
875 | mExternLastSyncEvent.clear(); | 875 | mExternLastSyncEvent.clear(); |
876 | int i; | 876 | int i; |
877 | for ( i = 0; i < KOPrefs::instance()->mExternSyncProfiles.count(); ++i ) { | 877 | for ( i = 0; i < KOPrefs::instance()->mExternSyncProfiles.count(); ++i ) { |
878 | lse = mCalendar->event( "last-syncEvent-"+ KOPrefs::instance()->mExternSyncProfiles[i] ); | 878 | lse = mCalendar->event( "last-syncEvent-"+ KOPrefs::instance()->mExternSyncProfiles[i] ); |
879 | if ( lse ) | 879 | if ( lse ) |
880 | mExternLastSyncEvent.append( lse ); | 880 | mExternLastSyncEvent.append( lse ); |
881 | else | 881 | else |
882 | qDebug("Last Sync event not found for %s ", KOPrefs::instance()->mExternSyncProfiles[i].latin1()); | 882 | qDebug("Last Sync event not found for %s ", KOPrefs::instance()->mExternSyncProfiles[i].latin1()); |
883 | } | 883 | } |
884 | 884 | ||
885 | } | 885 | } |
886 | // we check, if the to delete event has a id for a profile | 886 | // we check, if the to delete event has a id for a profile |
887 | // if yes, we set this id in the profile to delete | 887 | // if yes, we set this id in the profile to delete |
888 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) | 888 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) |
889 | { | 889 | { |
890 | if ( ! lastSync.count() == 0 ) | 890 | if ( lastSync.count() == 0 ) { |
891 | //qDebug(" lastSync.count() == 0"); | ||
891 | return; | 892 | return; |
893 | } | ||
892 | if ( toDelete->type() == "Journal" ) | 894 | if ( toDelete->type() == "Journal" ) |
893 | return; | 895 | return; |
894 | 896 | ||
895 | Event* eve = lastSync.first(); | 897 | Event* eve = lastSync.first(); |
896 | 898 | ||
897 | while ( eve ) { | 899 | while ( eve ) { |
898 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name | 900 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name |
899 | if ( !id.isEmpty() ) { | 901 | if ( !id.isEmpty() ) { |
900 | QString des = eve->description(); | 902 | QString des = eve->description(); |
901 | QString pref = "e"; | 903 | QString pref = "e"; |
902 | if ( toDelete->type() == "Todo" ) | 904 | if ( toDelete->type() == "Todo" ) |
903 | pref = "t"; | 905 | pref = "t"; |
904 | des += pref+ id + ","; | 906 | des += pref+ id + ","; |
905 | eve->setReadOnly( false ); | 907 | eve->setReadOnly( false ); |
906 | eve->setDescription( des ); | 908 | eve->setDescription( des ); |
909 | //qDebug("setdes %s ", des.latin1()); | ||
907 | eve->setReadOnly( true ); | 910 | eve->setReadOnly( true ); |
908 | } | 911 | } |
909 | eve = lastSync.next(); | 912 | eve = lastSync.next(); |
910 | } | 913 | } |
911 | 914 | ||
912 | } | 915 | } |
913 | void CalendarView::checkExternalId( Incidence * inc ) | 916 | void CalendarView::checkExternalId( Incidence * inc ) |
914 | { | 917 | { |
915 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; | 918 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; |
916 | checkExternSyncEvent( lastSync, inc ); | 919 | checkExternSyncEvent( lastSync, inc ); |
917 | 920 | ||
918 | } | 921 | } |
919 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) | 922 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) |
920 | { | 923 | { |
921 | bool syncOK = true; | 924 | bool syncOK = true; |
922 | int addedEvent = 0; | 925 | int addedEvent = 0; |
923 | int addedEventR = 0; | 926 | int addedEventR = 0; |
924 | int deletedEventR = 0; | 927 | int deletedEventR = 0; |
925 | int deletedEventL = 0; | 928 | int deletedEventL = 0; |
926 | int changedLocal = 0; | 929 | int changedLocal = 0; |
927 | int changedRemote = 0; | 930 | int changedRemote = 0; |
928 | //QPtrList<Event> el = local->rawEvents(); | 931 | //QPtrList<Event> el = local->rawEvents(); |
929 | Event* eventR; | 932 | Event* eventR; |
930 | QString uid; | 933 | QString uid; |
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp index ebfe164..4e54fdf 100644 --- a/libkcal/sharpformat.cpp +++ b/libkcal/sharpformat.cpp | |||
@@ -337,49 +337,49 @@ SharpFormat::~SharpFormat() | |||
337 | ulong SharpFormat::getCsum( const QStringList & attList) | 337 | ulong SharpFormat::getCsum( const QStringList & attList) |
338 | { | 338 | { |
339 | int max = attList.count() -1; | 339 | int max = attList.count() -1; |
340 | ulong cSum = 0; | 340 | ulong cSum = 0; |
341 | int j,k,i; | 341 | int j,k,i; |
342 | int add; | 342 | int add; |
343 | for ( i = 1; i < max ; ++i ) { | 343 | for ( i = 1; i < max ; ++i ) { |
344 | QString s = attList[i]; | 344 | QString s = attList[i]; |
345 | if ( ! s.isEmpty() ){ | 345 | if ( ! s.isEmpty() ){ |
346 | j = s.length(); | 346 | j = s.length(); |
347 | for ( k = 0; k < j; ++k ) { | 347 | for ( k = 0; k < j; ++k ) { |
348 | int mul = k +1; | 348 | int mul = k +1; |
349 | add = s[k].unicode (); | 349 | add = s[k].unicode (); |
350 | if ( k < 16 ) | 350 | if ( k < 16 ) |
351 | mul = mul * mul; | 351 | mul = mul * mul; |
352 | add = add * mul *i*i*i; | 352 | add = add * mul *i*i*i; |
353 | cSum += add; | 353 | cSum += add; |
354 | } | 354 | } |
355 | } | 355 | } |
356 | } | 356 | } |
357 | return cSum; | 357 | return cSum; |
358 | 358 | ||
359 | } | 359 | } |
360 | #include <stdlib.h> | 360 | #include <stdlib.h> |
361 | #define DEBUGMODE true | 361 | #define DEBUGMODE false |
362 | bool SharpFormat::load( Calendar *calendar, Calendar *existngCal ) | 362 | bool SharpFormat::load( Calendar *calendar, Calendar *existngCal ) |
363 | { | 363 | { |
364 | 364 | ||
365 | 365 | ||
366 | bool debug = DEBUGMODE; | 366 | bool debug = DEBUGMODE; |
367 | //debug = true; | 367 | //debug = true; |
368 | QString text; | 368 | QString text; |
369 | QString codec = "utf8"; | 369 | QString codec = "utf8"; |
370 | QLabel status ( i18n("Reading events ..."), 0 ); | 370 | QLabel status ( i18n("Reading events ..."), 0 ); |
371 | 371 | ||
372 | int w = status.sizeHint().width()+20 ; | 372 | int w = status.sizeHint().width()+20 ; |
373 | if ( w < 200 ) w = 200; | 373 | if ( w < 200 ) w = 200; |
374 | int h = status.sizeHint().height()+20 ; | 374 | int h = status.sizeHint().height()+20 ; |
375 | int dw = QApplication::desktop()->width(); | 375 | int dw = QApplication::desktop()->width(); |
376 | int dh = QApplication::desktop()->height(); | 376 | int dh = QApplication::desktop()->height(); |
377 | status.setCaption(i18n("Reading DTM Data") ); | 377 | status.setCaption(i18n("Reading DTM Data") ); |
378 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 378 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
379 | status.show(); | 379 | status.show(); |
380 | status.raise(); | 380 | status.raise(); |
381 | qApp->processEvents(); | 381 | qApp->processEvents(); |
382 | QString fileName; | 382 | QString fileName; |
383 | if ( ! debug ) { | 383 | if ( ! debug ) { |
384 | fileName = "/tmp/kopitempout"; | 384 | fileName = "/tmp/kopitempout"; |
385 | QString command ="db2file datebook -r -c "+ codec + " > " + fileName; | 385 | QString command ="db2file datebook -r -c "+ codec + " > " + fileName; |