-rw-r--r-- | korganizer/calendarview.cpp | 6 | ||||
-rw-r--r-- | libkcal/sharpformat.cpp | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index ce41fbd..5a6d615 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -689,106 +689,106 @@ void CalendarView::confSync() | |||
689 | static KSyncPrefsDialog* sp = 0; | 689 | static KSyncPrefsDialog* sp = 0; |
690 | if ( ! sp ) { | 690 | if ( ! sp ) { |
691 | sp = new KSyncPrefsDialog( this, "syncprefs", true ); | 691 | sp = new KSyncPrefsDialog( this, "syncprefs", true ); |
692 | } | 692 | } |
693 | sp->usrReadConfig(); | 693 | sp->usrReadConfig(); |
694 | #ifndef DESKTOP_VERSION | 694 | #ifndef DESKTOP_VERSION |
695 | sp->showMaximized(); | 695 | sp->showMaximized(); |
696 | #else | 696 | #else |
697 | sp->show(); | 697 | sp->show(); |
698 | #endif | 698 | #endif |
699 | sp->exec(); | 699 | sp->exec(); |
700 | KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); | 700 | KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); |
701 | KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); | 701 | KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); |
702 | } | 702 | } |
703 | 703 | ||
704 | 704 | ||
705 | //KOPrefs::instance()->mWriteBackFile | 705 | //KOPrefs::instance()->mWriteBackFile |
706 | //KOPrefs::instance()->mWriteBackExistingOnly | 706 | //KOPrefs::instance()->mWriteBackExistingOnly |
707 | 707 | ||
708 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 708 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
709 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 709 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
710 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 710 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
711 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 711 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
712 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 712 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
713 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 713 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
714 | 714 | ||
715 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) | 715 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) |
716 | { | 716 | { |
717 | 717 | ||
718 | //void setZaurusId(int id); | 718 | //void setZaurusId(int id); |
719 | // int zaurusId() const; | 719 | // int zaurusId() const; |
720 | // void setZaurusUid(int id); | 720 | // void setZaurusUid(int id); |
721 | // int zaurusUid() const; | 721 | // int zaurusUid() const; |
722 | // void setZaurusStat(int id); | 722 | // void setZaurusStat(int id); |
723 | // int zaurusStat() const; | 723 | // int zaurusStat() const; |
724 | // 0 equal | 724 | // 0 equal |
725 | // 1 take local | 725 | // 1 take local |
726 | // 2 take remote | 726 | // 2 take remote |
727 | // 3 cancel | 727 | // 3 cancel |
728 | QDateTime lastSync = mLastCalendarSync; | 728 | QDateTime lastSync = mLastCalendarSync; |
729 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 729 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
730 | bool remCh, locCh; | 730 | bool remCh, locCh; |
731 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 731 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
732 | if ( remCh ) | 732 | if ( remCh ) |
733 | qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 733 | qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
734 | locCh = ( local->lastModified() > mLastCalendarSync ); | 734 | locCh = ( local->lastModified() > mLastCalendarSync ); |
735 | //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() ); | 735 | //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() ); |
736 | if ( !remCh && ! locCh ) { | 736 | if ( !remCh && ! locCh ) { |
737 | qDebug("both not changed "); | 737 | //qDebug("both not changed "); |
738 | lastSync = local->lastModified().addDays(1); | 738 | lastSync = local->lastModified().addDays(1); |
739 | } else { | 739 | } else { |
740 | if ( locCh ) { | 740 | if ( locCh ) { |
741 | qDebug("loc changed %d %s %s", local->revision() , local->lastModified().toString().latin1(), mLastCalendarSync.toString().latin1()); | 741 | // qDebug("loc changed %d %s %s", local->revision() , local->lastModified().toString().latin1(), mLastCalendarSync.toString().latin1()); |
742 | lastSync = local->lastModified().addDays( -1 ); | 742 | lastSync = local->lastModified().addDays( -1 ); |
743 | if ( !remCh ) | 743 | if ( !remCh ) |
744 | remote->setLastModified( lastSync.addDays( -1 ) ); | 744 | remote->setLastModified( lastSync.addDays( -1 ) ); |
745 | } else { | 745 | } else { |
746 | qDebug(" not loc changed "); | 746 | //qDebug(" not loc changed "); |
747 | lastSync = local->lastModified().addDays( 1 ); | 747 | lastSync = local->lastModified().addDays( 1 ); |
748 | if ( remCh ) | 748 | if ( remCh ) |
749 | remote->setLastModified( lastSync.addDays( 1 ) ); | 749 | remote->setLastModified( lastSync.addDays( 1 ) ); |
750 | 750 | ||
751 | } | 751 | } |
752 | } | 752 | } |
753 | full = true; | 753 | full = true; |
754 | if ( mode < SYNC_PREF_ASK ) | 754 | if ( mode < SYNC_PREF_ASK ) |
755 | mode = SYNC_PREF_ASK; | 755 | mode = SYNC_PREF_ASK; |
756 | } else { | 756 | } else { |
757 | if ( local->lastModified() == remote->lastModified() ) | 757 | if ( local->lastModified() == remote->lastModified() ) |
758 | if ( local->revision() == remote->revision() ) | 758 | if ( local->revision() == remote->revision() ) |
759 | return 0; | 759 | return 0; |
760 | 760 | ||
761 | } | 761 | } |
762 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 762 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); |
763 | 763 | ||
764 | //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision()); | 764 | //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision()); |
765 | //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); | 765 | //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); |
766 | //full = true; //debug only | 766 | //full = true; //debug only |
767 | if ( full ) { | 767 | if ( full ) { |
768 | bool equ = false; | 768 | bool equ = false; |
769 | if ( local->type() == "Event" ) { | 769 | if ( local->type() == "Event" ) { |
770 | equ = (*((Event*) local) == *((Event*) remote)); | 770 | equ = (*((Event*) local) == *((Event*) remote)); |
771 | } | 771 | } |
772 | else if ( local->type() =="Todo" ) | 772 | else if ( local->type() =="Todo" ) |
773 | equ = (*((Todo*) local) == (*(Todo*) remote)); | 773 | equ = (*((Todo*) local) == (*(Todo*) remote)); |
774 | else if ( local->type() =="Journal" ) | 774 | else if ( local->type() =="Journal" ) |
775 | equ = (*((Journal*) local) == *((Journal*) remote)); | 775 | equ = (*((Journal*) local) == *((Journal*) remote)); |
776 | if ( equ ) { | 776 | if ( equ ) { |
777 | //qDebug("equal "); | 777 | //qDebug("equal "); |
778 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 778 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
779 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 779 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
780 | } | 780 | } |
781 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 781 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
782 | return 0; | 782 | return 0; |
783 | 783 | ||
784 | }//else //debug only | 784 | }//else //debug only |
785 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 785 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
786 | } | 786 | } |
787 | int result; | 787 | int result; |
788 | bool localIsNew; | 788 | bool localIsNew; |
789 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); | 789 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); |
790 | 790 | ||
791 | if ( full && mode < SYNC_PREF_NEWEST ) | 791 | if ( full && mode < SYNC_PREF_NEWEST ) |
792 | mode = SYNC_PREF_ASK; | 792 | mode = SYNC_PREF_ASK; |
793 | 793 | ||
794 | switch( mode ) { | 794 | switch( mode ) { |
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp index 89eb72f..a53b3f8 100644 --- a/libkcal/sharpformat.cpp +++ b/libkcal/sharpformat.cpp | |||
@@ -324,98 +324,98 @@ class SharpParser : public QObject | |||
324 | { | 324 | { |
325 | QMap<QString,QString>::ConstIterator it = mCategoriesMap.find( id ); | 325 | QMap<QString,QString>::ConstIterator it = mCategoriesMap.find( id ); |
326 | if ( it == mCategoriesMap.end() ) return id; | 326 | if ( it == mCategoriesMap.end() ) return id; |
327 | else return *it; | 327 | else return *it; |
328 | } | 328 | } |
329 | 329 | ||
330 | static void setCategory( const QString &id, const QString &name ) | 330 | static void setCategory( const QString &id, const QString &name ) |
331 | { | 331 | { |
332 | mCategoriesMap.insert( id, name ); | 332 | mCategoriesMap.insert( id, name ); |
333 | } | 333 | } |
334 | 334 | ||
335 | static QMap<QString,QString> mCategoriesMap; | 335 | static QMap<QString,QString> mCategoriesMap; |
336 | }; | 336 | }; |
337 | 337 | ||
338 | QMap<QString,QString> SharpParser::mCategoriesMap; | 338 | QMap<QString,QString> SharpParser::mCategoriesMap; |
339 | 339 | ||
340 | SharpFormat::SharpFormat() | 340 | SharpFormat::SharpFormat() |
341 | { | 341 | { |
342 | mCategories = 0; | 342 | mCategories = 0; |
343 | } | 343 | } |
344 | 344 | ||
345 | SharpFormat::~SharpFormat() | 345 | SharpFormat::~SharpFormat() |
346 | { | 346 | { |
347 | } | 347 | } |
348 | ulong SharpFormat::getCsum( const QStringList & attList) | 348 | ulong SharpFormat::getCsum( const QStringList & attList) |
349 | { | 349 | { |
350 | int max = attList.count() -1; | 350 | int max = attList.count() -1; |
351 | ulong cSum = 0; | 351 | ulong cSum = 0; |
352 | int j,k,i; | 352 | int j,k,i; |
353 | int add; | 353 | int add; |
354 | for ( i = 1; i < max ; ++i ) { | 354 | for ( i = 1; i < max ; ++i ) { |
355 | QString s = attList[i]; | 355 | QString s = attList[i]; |
356 | if ( ! s.isEmpty() ){ | 356 | if ( ! s.isEmpty() ){ |
357 | j = s.length(); | 357 | j = s.length(); |
358 | for ( k = 0; k < j; ++k ) { | 358 | for ( k = 0; k < j; ++k ) { |
359 | int mul = k +1; | 359 | int mul = k +1; |
360 | add = s[k].unicode (); | 360 | add = s[k].unicode (); |
361 | if ( k < 16 ) | 361 | if ( k < 16 ) |
362 | mul = mul * mul; | 362 | mul = mul * mul; |
363 | add = add * mul *i*i*i; | 363 | add = add * mul *i*i*i; |
364 | cSum += add; | 364 | cSum += add; |
365 | } | 365 | } |
366 | } | 366 | } |
367 | } | 367 | } |
368 | return cSum; | 368 | return cSum; |
369 | 369 | ||
370 | } | 370 | } |
371 | #include <stdlib.h> | 371 | #include <stdlib.h> |
372 | //#define DEBUGMODE false | 372 | #define DEBUGMODE false |
373 | #define DEBUGMODE true | 373 | //#define DEBUGMODE true |
374 | bool SharpFormat::load( Calendar *calendar, Calendar *existngCal ) | 374 | bool SharpFormat::load( Calendar *calendar, Calendar *existngCal ) |
375 | { | 375 | { |
376 | 376 | ||
377 | 377 | ||
378 | bool debug = DEBUGMODE; | 378 | bool debug = DEBUGMODE; |
379 | QString text; | 379 | QString text; |
380 | QString codec = "utf8"; | 380 | QString codec = "utf8"; |
381 | QLabel status ( i18n("Reading events ..."), 0 ); | 381 | QLabel status ( i18n("Reading events ..."), 0 ); |
382 | 382 | ||
383 | int w = status.sizeHint().width()+20 ; | 383 | int w = status.sizeHint().width()+20 ; |
384 | if ( w < 200 ) w = 200; | 384 | if ( w < 200 ) w = 200; |
385 | int h = status.sizeHint().height()+20 ; | 385 | int h = status.sizeHint().height()+20 ; |
386 | int dw = QApplication::desktop()->width(); | 386 | int dw = QApplication::desktop()->width(); |
387 | int dh = QApplication::desktop()->height(); | 387 | int dh = QApplication::desktop()->height(); |
388 | status.setCaption(i18n("Reading DTM Data") ); | 388 | status.setCaption(i18n("Reading DTM Data") ); |
389 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 389 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
390 | status.show(); | 390 | status.show(); |
391 | status.raise(); | 391 | status.raise(); |
392 | qApp->processEvents(); | 392 | qApp->processEvents(); |
393 | QString fileName; | 393 | QString fileName; |
394 | if ( ! debug ) { | 394 | if ( ! debug ) { |
395 | fileName = "/tmp/kopitempout"; | 395 | fileName = "/tmp/kopitempout"; |
396 | QString command ="db2file datebook -r -c "+ codec + " > " + fileName; | 396 | QString command ="db2file datebook -r -c "+ codec + " > " + fileName; |
397 | system ( command.latin1() ); | 397 | system ( command.latin1() ); |
398 | } else { | 398 | } else { |
399 | fileName = "/tmp/events.txt"; | 399 | fileName = "/tmp/events.txt"; |
400 | 400 | ||
401 | } | 401 | } |
402 | QFile file( fileName ); | 402 | QFile file( fileName ); |
403 | if (!file.open( IO_ReadOnly ) ) { | 403 | if (!file.open( IO_ReadOnly ) ) { |
404 | return false; | 404 | return false; |
405 | 405 | ||
406 | } | 406 | } |
407 | QTextStream ts( &file ); | 407 | QTextStream ts( &file ); |
408 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 408 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
409 | text = ts.read(); | 409 | text = ts.read(); |
410 | file.close(); | 410 | file.close(); |
411 | status.setText( i18n("Processing events ...") ); | 411 | status.setText( i18n("Processing events ...") ); |
412 | status.raise(); | 412 | status.raise(); |
413 | qApp->processEvents(); | 413 | qApp->processEvents(); |
414 | fromString2Cal( calendar, existngCal, text, "Event" ); | 414 | fromString2Cal( calendar, existngCal, text, "Event" ); |
415 | status.setText( i18n("Reading todos ...") ); | 415 | status.setText( i18n("Reading todos ...") ); |
416 | qApp->processEvents(); | 416 | qApp->processEvents(); |
417 | if ( ! debug ) { | 417 | if ( ! debug ) { |
418 | fileName = "/tmp/kopitempout"; | 418 | fileName = "/tmp/kopitempout"; |
419 | QString command = "db2file todo -r -c " + codec+ " > " + fileName; | 419 | QString command = "db2file todo -r -c " + codec+ " > " + fileName; |
420 | system ( command.latin1() ); | 420 | system ( command.latin1() ); |
421 | } else { | 421 | } else { |