-rw-r--r-- | kabc/addressbook.cpp | 8 | ||||
-rw-r--r-- | kabc/addressbook.h | 1 | ||||
-rw-r--r-- | kabc/addressee.cpp | 5 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 4 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 1 | ||||
-rw-r--r-- | libkcal/calendar.h | 1 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 23 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 1 | ||||
-rw-r--r-- | libkcal/incidencebase.cpp | 5 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 42 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 1 |
11 files changed, 85 insertions, 7 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 3641c0c..2785131 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -532,48 +532,56 @@ void AddressBook::removeUntagged() | |||
532 | Iterator todel; | 532 | Iterator todel; |
533 | for ( ait = begin(); ait != end(); ++ait ) { | 533 | for ( ait = begin(); ait != end(); ++ait ) { |
534 | if ( todelete ) | 534 | if ( todelete ) |
535 | removeAddressee( todel ); | 535 | removeAddressee( todel ); |
536 | if (!(*ait).tagged()) { | 536 | if (!(*ait).tagged()) { |
537 | todelete = true; | 537 | todelete = true; |
538 | todel = ait; | 538 | todel = ait; |
539 | } else | 539 | } else |
540 | todelete = false; | 540 | todelete = false; |
541 | } | 541 | } |
542 | if ( todelete ) | 542 | if ( todelete ) |
543 | removeAddressee( todel ); | 543 | removeAddressee( todel ); |
544 | deleteRemovedAddressees(); | 544 | deleteRemovedAddressees(); |
545 | } | 545 | } |
546 | void AddressBook::smplifyAddressees() | 546 | void AddressBook::smplifyAddressees() |
547 | { | 547 | { |
548 | Iterator ait; | 548 | Iterator ait; |
549 | for ( ait = begin(); ait != end(); ++ait ) { | 549 | for ( ait = begin(); ait != end(); ++ait ) { |
550 | (*ait).simplifyEmails(); | 550 | (*ait).simplifyEmails(); |
551 | (*ait).simplifyPhoneNumbers(); | 551 | (*ait).simplifyPhoneNumbers(); |
552 | (*ait).simplifyPhoneNumberTypes(); | 552 | (*ait).simplifyPhoneNumberTypes(); |
553 | (*ait).simplifyAddresses(); | 553 | (*ait).simplifyAddresses(); |
554 | } | 554 | } |
555 | } | 555 | } |
556 | void AddressBook::removeSyncInfo( QString syncProfile) | ||
557 | { | ||
558 | Iterator ait; | ||
559 | for ( ait = begin(); ait != end(); ++ait ) { | ||
560 | (*ait).removeID( syncProfile ); | ||
561 | } | ||
562 | |||
563 | } | ||
556 | void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync ) | 564 | void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync ) |
557 | { | 565 | { |
558 | Iterator ait; | 566 | Iterator ait; |
559 | for ( ait = begin(); ait != end(); ++ait ) { | 567 | for ( ait = begin(); ait != end(); ++ait ) { |
560 | QString id = (*ait).IDStr(); | 568 | QString id = (*ait).IDStr(); |
561 | (*ait).setIDStr( ":"); | 569 | (*ait).setIDStr( ":"); |
562 | (*ait).setExternalUID( id ); | 570 | (*ait).setExternalUID( id ); |
563 | (*ait).setOriginalExternalUID( id ); | 571 | (*ait).setOriginalExternalUID( id ); |
564 | if ( isPreSync ) | 572 | if ( isPreSync ) |
565 | (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); | 573 | (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); |
566 | else { | 574 | else { |
567 | (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); | 575 | (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); |
568 | (*ait).setID( currentSyncDevice,id ); | 576 | (*ait).setID( currentSyncDevice,id ); |
569 | 577 | ||
570 | } | 578 | } |
571 | } | 579 | } |
572 | } | 580 | } |
573 | void AddressBook::findNewExtIds( QString fileName, QString currentSyncDevice ) | 581 | void AddressBook::findNewExtIds( QString fileName, QString currentSyncDevice ) |
574 | { | 582 | { |
575 | 583 | ||
576 | setUntagged(); | 584 | setUntagged(); |
577 | KABC::Addressee::List list; | 585 | KABC::Addressee::List list; |
578 | QFile file( fileName ); | 586 | QFile file( fileName ); |
579 | file.open( IO_ReadOnly ); | 587 | file.open( IO_ReadOnly ); |
diff --git a/kabc/addressbook.h b/kabc/addressbook.h index 5edca06..f124dc9 100644 --- a/kabc/addressbook.h +++ b/kabc/addressbook.h | |||
@@ -123,48 +123,49 @@ class AddressBook : public QObject | |||
123 | Requests a ticket for saving the addressbook. Calling this function locks | 123 | Requests a ticket for saving the addressbook. Calling this function locks |
124 | the addressbook for all other processes. If the address book is already | 124 | the addressbook for all other processes. If the address book is already |
125 | locked the function returns 0. You need the returned @ref Ticket object | 125 | locked the function returns 0. You need the returned @ref Ticket object |
126 | for calling the @ref save() function. | 126 | for calling the @ref save() function. |
127 | 127 | ||
128 | @see save() | 128 | @see save() |
129 | */ | 129 | */ |
130 | Ticket *requestSaveTicket( Resource *resource=0 ); | 130 | Ticket *requestSaveTicket( Resource *resource=0 ); |
131 | 131 | ||
132 | /** | 132 | /** |
133 | Load address book from file. | 133 | Load address book from file. |
134 | */ | 134 | */ |
135 | bool load(); | 135 | bool load(); |
136 | 136 | ||
137 | /** | 137 | /** |
138 | Save address book. The address book is saved to the file, the Ticket | 138 | Save address book. The address book is saved to the file, the Ticket |
139 | object has been requested for by @ref requestSaveTicket(). | 139 | object has been requested for by @ref requestSaveTicket(). |
140 | 140 | ||
141 | @param ticket a ticket object returned by @ref requestSaveTicket() | 141 | @param ticket a ticket object returned by @ref requestSaveTicket() |
142 | */ | 142 | */ |
143 | bool save( Ticket *ticket ); | 143 | bool save( Ticket *ticket ); |
144 | bool saveAB( ); | 144 | bool saveAB( ); |
145 | bool saveABphone( QString fileName ); | 145 | bool saveABphone( QString fileName ); |
146 | void smplifyAddressees(); | 146 | void smplifyAddressees(); |
147 | void removeSyncInfo( QString syncProfile); | ||
147 | void preparePhoneSync( QString currentSyncDevice, bool isPreSync ); | 148 | void preparePhoneSync( QString currentSyncDevice, bool isPreSync ); |
148 | void export2File( QString fileName ); | 149 | void export2File( QString fileName ); |
149 | bool export2PhoneFormat( QStringList uids ,QString fileName ); | 150 | bool export2PhoneFormat( QStringList uids ,QString fileName ); |
150 | int importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false ); | 151 | int importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false ); |
151 | void setUntagged( bool setNonSyncTagged = false ); | 152 | void setUntagged( bool setNonSyncTagged = false ); |
152 | void removeUntagged(); | 153 | void removeUntagged(); |
153 | void findNewExtIds( QString fileName, QString currentSyncDevice ); | 154 | void findNewExtIds( QString fileName, QString currentSyncDevice ); |
154 | /** | 155 | /** |
155 | Returns a iterator for first entry of address book. | 156 | Returns a iterator for first entry of address book. |
156 | */ | 157 | */ |
157 | Iterator begin(); | 158 | Iterator begin(); |
158 | 159 | ||
159 | /** | 160 | /** |
160 | Returns a const iterator for first entry of address book. | 161 | Returns a const iterator for first entry of address book. |
161 | */ | 162 | */ |
162 | ConstIterator begin() const; | 163 | ConstIterator begin() const; |
163 | 164 | ||
164 | /** | 165 | /** |
165 | Returns a iterator for first entry of address book. | 166 | Returns a iterator for first entry of address book. |
166 | */ | 167 | */ |
167 | Iterator end(); | 168 | Iterator end(); |
168 | 169 | ||
169 | /** | 170 | /** |
170 | Returns a const iterator for first entry of address book. | 171 | Returns a const iterator for first entry of address book. |
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 40877ef..a660a9d 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -532,49 +532,52 @@ void Addressee::simplifyPhoneNumbers() | |||
532 | } | 532 | } |
533 | } | 533 | } |
534 | } | 534 | } |
535 | // remove non-numeric characters | 535 | // remove non-numeric characters |
536 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 536 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
537 | ++phoneIter ) { | 537 | ++phoneIter ) { |
538 | if ( ! ( *phoneIter ).simplifyNumber() ) | 538 | if ( ! ( *phoneIter ).simplifyNumber() ) |
539 | removeNumbers.append( ( *phoneIter ) ); | 539 | removeNumbers.append( ( *phoneIter ) ); |
540 | } | 540 | } |
541 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 541 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
542 | ++phoneIter ) { | 542 | ++phoneIter ) { |
543 | removePhoneNumber(( *phoneIter )); | 543 | removePhoneNumber(( *phoneIter )); |
544 | } | 544 | } |
545 | } | 545 | } |
546 | void Addressee::simplifyPhoneNumberTypes() | 546 | void Addressee::simplifyPhoneNumberTypes() |
547 | { | 547 | { |
548 | KABC::PhoneNumber::List::Iterator phoneIter; | 548 | KABC::PhoneNumber::List::Iterator phoneIter; |
549 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 549 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
550 | ++phoneIter ) | 550 | ++phoneIter ) |
551 | ( *phoneIter ).simplifyType(); | 551 | ( *phoneIter ).simplifyType(); |
552 | } | 552 | } |
553 | void Addressee::removeID(const QString &prof) | 553 | void Addressee::removeID(const QString &prof) |
554 | { | 554 | { |
555 | detach(); | 555 | detach(); |
556 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | 556 | if ( prof.isEmpty() ) |
557 | mData->mExternalId = ":"; | ||
558 | else | ||
559 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | ||
557 | 560 | ||
558 | } | 561 | } |
559 | void Addressee::setID( const QString & prof , const QString & id ) | 562 | void Addressee::setID( const QString & prof , const QString & id ) |
560 | { | 563 | { |
561 | detach(); | 564 | detach(); |
562 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); | 565 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); |
563 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 566 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
564 | } | 567 | } |
565 | void Addressee::setTempSyncStat( int id ) | 568 | void Addressee::setTempSyncStat( int id ) |
566 | { | 569 | { |
567 | if ( mData->mTempSyncStat == id ) return; | 570 | if ( mData->mTempSyncStat == id ) return; |
568 | detach(); | 571 | detach(); |
569 | mData->mTempSyncStat = id; | 572 | mData->mTempSyncStat = id; |
570 | } | 573 | } |
571 | int Addressee::tempSyncStat() const | 574 | int Addressee::tempSyncStat() const |
572 | { | 575 | { |
573 | return mData->mTempSyncStat; | 576 | return mData->mTempSyncStat; |
574 | } | 577 | } |
575 | 578 | ||
576 | QString Addressee::getID( const QString & prof) | 579 | QString Addressee::getID( const QString & prof) |
577 | { | 580 | { |
578 | return KIdManager::getId ( mData->mExternalId, prof ); | 581 | return KIdManager::getId ( mData->mExternalId, prof ); |
579 | } | 582 | } |
580 | 583 | ||
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index efae874..e56e46a 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2791,50 +2791,50 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | |||
2791 | if ( syncOK ) { | 2791 | if ( syncOK ) { |
2792 | if ( syncManager->mWriteBackFile ) | 2792 | if ( syncManager->mWriteBackFile ) |
2793 | { | 2793 | { |
2794 | if ( external ) | 2794 | if ( external ) |
2795 | abLocal.removeSyncAddressees( !isXML); | 2795 | abLocal.removeSyncAddressees( !isXML); |
2796 | qDebug("Saving remote AB "); | 2796 | qDebug("Saving remote AB "); |
2797 | if ( ! abLocal.saveAB()) | 2797 | if ( ! abLocal.saveAB()) |
2798 | qDebug("Error writing back AB to file "); | 2798 | qDebug("Error writing back AB to file "); |
2799 | if ( isXML ) { | 2799 | if ( isXML ) { |
2800 | // afterwrite processing | 2800 | // afterwrite processing |
2801 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2801 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); |
2802 | } | 2802 | } |
2803 | } | 2803 | } |
2804 | } | 2804 | } |
2805 | setModified(); | 2805 | setModified(); |
2806 | 2806 | ||
2807 | } | 2807 | } |
2808 | if ( syncOK ) | 2808 | if ( syncOK ) |
2809 | mViewManager->refreshView(); | 2809 | mViewManager->refreshView(); |
2810 | return syncOK; | 2810 | return syncOK; |
2811 | 2811 | ||
2812 | } | 2812 | } |
2813 | void KABCore::removeSyncInfo( QString syncProfile) | 2813 | void KABCore::removeSyncInfo( QString syncProfile) |
2814 | { | 2814 | { |
2815 | qDebug("removeSyncInfo for profile %s ", syncProfile.latin1()); | 2815 | qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); |
2816 | 2816 | mAddressBook->removeSyncInfo( syncProfile ); | |
2817 | } | 2817 | } |
2818 | 2818 | ||
2819 | 2819 | ||
2820 | //this is a overwritten callbackmethods from the syncinterface | 2820 | //this is a overwritten callbackmethods from the syncinterface |
2821 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) | 2821 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) |
2822 | { | 2822 | { |
2823 | if ( resource == "phone" ) | 2823 | if ( resource == "phone" ) |
2824 | return syncPhone(); | 2824 | return syncPhone(); |
2825 | disableBR( true ); | 2825 | disableBR( true ); |
2826 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 2826 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
2827 | 2827 | ||
2828 | AddressBook abLocal( resource,"syncContact"); | 2828 | AddressBook abLocal( resource,"syncContact"); |
2829 | bool syncOK = false; | 2829 | bool syncOK = false; |
2830 | if ( abLocal.load() ) { | 2830 | if ( abLocal.load() ) { |
2831 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 2831 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
2832 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2832 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2833 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); | 2833 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); |
2834 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 2834 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
2835 | if ( syncOK ) { | 2835 | if ( syncOK ) { |
2836 | if ( syncManager->mWriteBackFile ) { | 2836 | if ( syncManager->mWriteBackFile ) { |
2837 | abLocal.removeSyncAddressees( false ); | 2837 | abLocal.removeSyncAddressees( false ); |
2838 | abLocal.saveAB(); | 2838 | abLocal.saveAB(); |
2839 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2839 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); |
2840 | } | 2840 | } |
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index af01625..a08f243 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -3747,26 +3747,27 @@ bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | |||
3747 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3747 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3748 | return syncCalendar( filename, mode ); | 3748 | return syncCalendar( filename, mode ); |
3749 | } | 3749 | } |
3750 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 3750 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
3751 | { | 3751 | { |
3752 | mSyncKDE = false; | 3752 | mSyncKDE = false; |
3753 | //mSyncManager = manager; | 3753 | //mSyncManager = manager; |
3754 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3754 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3755 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3755 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3756 | if ( resource == "sharp" ) | 3756 | if ( resource == "sharp" ) |
3757 | syncExternal( 0 ); | 3757 | syncExternal( 0 ); |
3758 | if ( resource == "phone" ) | 3758 | if ( resource == "phone" ) |
3759 | syncExternal( 1 ); | 3759 | syncExternal( 1 ); |
3760 | // pending setmodified | 3760 | // pending setmodified |
3761 | return true; | 3761 | return true; |
3762 | } | 3762 | } |
3763 | void CalendarView::setSyncManager(KSyncManager* manager) | 3763 | void CalendarView::setSyncManager(KSyncManager* manager) |
3764 | { | 3764 | { |
3765 | mSyncManager = manager; | 3765 | mSyncManager = manager; |
3766 | } | 3766 | } |
3767 | 3767 | ||
3768 | void CalendarView::removeSyncInfo( QString syncProfile) | 3768 | void CalendarView::removeSyncInfo( QString syncProfile) |
3769 | { | 3769 | { |
3770 | qDebug("removeSyncInfo for profile %s ", syncProfile.latin1()); | 3770 | qDebug("removeSyncInfo for profile %s ", syncProfile.latin1()); |
3771 | mCalendar->removeSyncInfo( syncProfile ); | ||
3771 | 3772 | ||
3772 | } | 3773 | } |
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index b801186..b7d6a1f 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h | |||
@@ -57,48 +57,49 @@ namespace KCal { | |||
57 | visible in the Calendar. You shouldn't delete any Event object you get from | 57 | visible in the Calendar. You shouldn't delete any Event object you get from |
58 | Calendar. | 58 | Calendar. |
59 | */ | 59 | */ |
60 | class Calendar : public QObject, public CustomProperties, | 60 | class Calendar : public QObject, public CustomProperties, |
61 | public IncidenceBase::Observer | 61 | public IncidenceBase::Observer |
62 | { | 62 | { |
63 | Q_OBJECT | 63 | Q_OBJECT |
64 | public: | 64 | public: |
65 | Calendar(); | 65 | Calendar(); |
66 | Calendar(const QString &timeZoneId); | 66 | Calendar(const QString &timeZoneId); |
67 | virtual ~Calendar(); | 67 | virtual ~Calendar(); |
68 | void deleteIncidence(Incidence *in); | 68 | void deleteIncidence(Incidence *in); |
69 | void resetTempSyncStat(); | 69 | void resetTempSyncStat(); |
70 | void resetPilotStat(int id); | 70 | void resetPilotStat(int id); |
71 | /** | 71 | /** |
72 | Clears out the current calendar, freeing all used memory etc. | 72 | Clears out the current calendar, freeing all used memory etc. |
73 | */ | 73 | */ |
74 | virtual void close() = 0; | 74 | virtual void close() = 0; |
75 | 75 | ||
76 | /** | 76 | /** |
77 | Sync changes in memory to persistant storage. | 77 | Sync changes in memory to persistant storage. |
78 | */ | 78 | */ |
79 | virtual void save() = 0; | 79 | virtual void save() = 0; |
80 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; | 80 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; |
81 | virtual void removeSyncInfo( QString syncProfile) = 0; | ||
81 | virtual bool isSaving() { return false; } | 82 | virtual bool isSaving() { return false; } |
82 | 83 | ||
83 | /** | 84 | /** |
84 | Return the owner of the calendar's full name. | 85 | Return the owner of the calendar's full name. |
85 | */ | 86 | */ |
86 | const QString &getOwner() const; | 87 | const QString &getOwner() const; |
87 | /** | 88 | /** |
88 | Set the owner of the calendar. Should be owner's full name. | 89 | Set the owner of the calendar. Should be owner's full name. |
89 | */ | 90 | */ |
90 | void setOwner( const QString &os ); | 91 | void setOwner( const QString &os ); |
91 | /** | 92 | /** |
92 | Return the email address of the calendar owner. | 93 | Return the email address of the calendar owner. |
93 | */ | 94 | */ |
94 | const QString &getEmail(); | 95 | const QString &getEmail(); |
95 | /** | 96 | /** |
96 | Set the email address of the calendar owner. | 97 | Set the email address of the calendar owner. |
97 | */ | 98 | */ |
98 | void setEmail( const QString & ); | 99 | void setEmail( const QString & ); |
99 | 100 | ||
100 | /** | 101 | /** |
101 | Set time zone from a timezone string (e.g. -2:00) | 102 | Set time zone from a timezone string (e.g. -2:00) |
102 | */ | 103 | */ |
103 | void setTimeZone( const QString &tz ); | 104 | void setTimeZone( const QString &tz ); |
104 | /** | 105 | /** |
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 21b4aaf..3f46d53 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -200,49 +200,70 @@ bool CalendarLocal::addTodo( Todo *todo ) | |||
200 | 200 | ||
201 | void CalendarLocal::deleteTodo( Todo *todo ) | 201 | void CalendarLocal::deleteTodo( Todo *todo ) |
202 | { | 202 | { |
203 | // Handle orphaned children | 203 | // Handle orphaned children |
204 | removeRelations( todo ); | 204 | removeRelations( todo ); |
205 | 205 | ||
206 | if ( mTodoList.removeRef( todo ) ) { | 206 | if ( mTodoList.removeRef( todo ) ) { |
207 | setModified( true ); | 207 | setModified( true ); |
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | QPtrList<Todo> CalendarLocal::rawTodos() | 211 | QPtrList<Todo> CalendarLocal::rawTodos() |
212 | { | 212 | { |
213 | return mTodoList; | 213 | return mTodoList; |
214 | } | 214 | } |
215 | Todo *CalendarLocal::todo( QString syncProf, QString id ) | 215 | Todo *CalendarLocal::todo( QString syncProf, QString id ) |
216 | { | 216 | { |
217 | Todo *todo; | 217 | Todo *todo; |
218 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 218 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
219 | if ( todo->getID( syncProf ) == id ) return todo; | 219 | if ( todo->getID( syncProf ) == id ) return todo; |
220 | } | 220 | } |
221 | 221 | ||
222 | return 0; | 222 | return 0; |
223 | } | 223 | } |
224 | 224 | void CalendarLocal::removeSyncInfo( QString syncProfile) | |
225 | { | ||
226 | QPtrList<Incidence> all = rawIncidences() ; | ||
227 | Incidence *inc; | ||
228 | for ( inc = all.first(); inc; inc = all.next() ) { | ||
229 | inc->removeID( syncProfile ); | ||
230 | } | ||
231 | if ( syncProfile.isEmpty() ) { | ||
232 | QPtrList<Event> el; | ||
233 | Event *todo; | ||
234 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | ||
235 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) | ||
236 | el.append( todo ); | ||
237 | } | ||
238 | for ( todo = el.first(); todo; todo = el.next() ) { | ||
239 | deleteIncidence ( todo ); | ||
240 | } | ||
241 | } else { | ||
242 | Event *lse = event( "last-syncEvent-"+ syncProfile); | ||
243 | deleteIncidence ( lse ); | ||
244 | } | ||
245 | } | ||
225 | QPtrList<Event> CalendarLocal::getExternLastSyncEvents() | 246 | QPtrList<Event> CalendarLocal::getExternLastSyncEvents() |
226 | { | 247 | { |
227 | QPtrList<Event> el; | 248 | QPtrList<Event> el; |
228 | Event *todo; | 249 | Event *todo; |
229 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 250 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
230 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) | 251 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) |
231 | if ( todo->summary().left(3) == "E: " ) | 252 | if ( todo->summary().left(3) == "E: " ) |
232 | el.append( todo ); | 253 | el.append( todo ); |
233 | } | 254 | } |
234 | 255 | ||
235 | return el; | 256 | return el; |
236 | 257 | ||
237 | } | 258 | } |
238 | Event *CalendarLocal::event( QString syncProf, QString id ) | 259 | Event *CalendarLocal::event( QString syncProf, QString id ) |
239 | { | 260 | { |
240 | Event *todo; | 261 | Event *todo; |
241 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 262 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
242 | if ( todo->getID( syncProf ) == id ) return todo; | 263 | if ( todo->getID( syncProf ) == id ) return todo; |
243 | } | 264 | } |
244 | 265 | ||
245 | return 0; | 266 | return 0; |
246 | } | 267 | } |
247 | Todo *CalendarLocal::todo( const QString &uid ) | 268 | Todo *CalendarLocal::todo( const QString &uid ) |
248 | { | 269 | { |
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index 5b6c64c..98ec710 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h | |||
@@ -48,48 +48,49 @@ class CalendarLocal : public Calendar | |||
48 | Loads a calendar on disk in vCalendar or iCalendar format into the current | 48 | Loads a calendar on disk in vCalendar or iCalendar format into the current |
49 | calendar. Any information already present is lost. | 49 | calendar. Any information already present is lost. |
50 | @return true, if successfull, false on error. | 50 | @return true, if successfull, false on error. |
51 | @param fileName the name of the calendar on disk. | 51 | @param fileName the name of the calendar on disk. |
52 | */ | 52 | */ |
53 | bool load( const QString &fileName ); | 53 | bool load( const QString &fileName ); |
54 | /** | 54 | /** |
55 | Writes out the calendar to disk in the specified \a format. | 55 | Writes out the calendar to disk in the specified \a format. |
56 | CalendarLocal takes ownership of the CalFormat object. | 56 | CalendarLocal takes ownership of the CalFormat object. |
57 | @return true, if successfull, false on error. | 57 | @return true, if successfull, false on error. |
58 | @param fileName the name of the file | 58 | @param fileName the name of the file |
59 | */ | 59 | */ |
60 | bool save( const QString &fileName, CalFormat *format = 0 ); | 60 | bool save( const QString &fileName, CalFormat *format = 0 ); |
61 | 61 | ||
62 | /** | 62 | /** |
63 | Clears out the current calendar, freeing all used memory etc. etc. | 63 | Clears out the current calendar, freeing all used memory etc. etc. |
64 | */ | 64 | */ |
65 | void close(); | 65 | void close(); |
66 | 66 | ||
67 | void save() {} | 67 | void save() {} |
68 | 68 | ||
69 | /** | 69 | /** |
70 | Add Event to calendar. | 70 | Add Event to calendar. |
71 | */ | 71 | */ |
72 | void removeSyncInfo( QString syncProfile); | ||
72 | bool addAnniversaryNoDup( Event *event ); | 73 | bool addAnniversaryNoDup( Event *event ); |
73 | bool addEventNoDup( Event *event ); | 74 | bool addEventNoDup( Event *event ); |
74 | bool addEvent( Event *event ); | 75 | bool addEvent( Event *event ); |
75 | /** | 76 | /** |
76 | Deletes an event from this calendar. | 77 | Deletes an event from this calendar. |
77 | */ | 78 | */ |
78 | void deleteEvent( Event *event ); | 79 | void deleteEvent( Event *event ); |
79 | 80 | ||
80 | /** | 81 | /** |
81 | Retrieves an event on the basis of the unique string ID. | 82 | Retrieves an event on the basis of the unique string ID. |
82 | */ | 83 | */ |
83 | Event *event( const QString &uid ); | 84 | Event *event( const QString &uid ); |
84 | /** | 85 | /** |
85 | Return unfiltered list of all events in calendar. | 86 | Return unfiltered list of all events in calendar. |
86 | */ | 87 | */ |
87 | QPtrList<Event> rawEvents(); | 88 | QPtrList<Event> rawEvents(); |
88 | QPtrList<Event> getExternLastSyncEvents(); | 89 | QPtrList<Event> getExternLastSyncEvents(); |
89 | /** | 90 | /** |
90 | Add a todo to the todolist. | 91 | Add a todo to the todolist. |
91 | */ | 92 | */ |
92 | bool addTodo( Todo *todo ); | 93 | bool addTodo( Todo *todo ); |
93 | bool addTodoNoDup( Todo *todo ); | 94 | bool addTodoNoDup( Todo *todo ); |
94 | /** | 95 | /** |
95 | Remove a todo from the todolist. | 96 | Remove a todo from the todolist. |
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index b36dc1a..9aa517c 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp | |||
@@ -332,49 +332,52 @@ int IncidenceBase::syncStatus() const | |||
332 | 332 | ||
333 | void IncidenceBase::setPilotId( int id ) | 333 | void IncidenceBase::setPilotId( int id ) |
334 | { | 334 | { |
335 | if (mReadOnly) return; | 335 | if (mReadOnly) return; |
336 | mPilotId = id; | 336 | mPilotId = id; |
337 | } | 337 | } |
338 | 338 | ||
339 | int IncidenceBase::pilotId() const | 339 | int IncidenceBase::pilotId() const |
340 | { | 340 | { |
341 | return mPilotId; | 341 | return mPilotId; |
342 | } | 342 | } |
343 | 343 | ||
344 | int IncidenceBase::tempSyncStat() const | 344 | int IncidenceBase::tempSyncStat() const |
345 | { | 345 | { |
346 | return mTempSyncStat; | 346 | return mTempSyncStat; |
347 | } | 347 | } |
348 | void IncidenceBase::setTempSyncStat( int id ) | 348 | void IncidenceBase::setTempSyncStat( int id ) |
349 | { | 349 | { |
350 | if (mReadOnly) return; | 350 | if (mReadOnly) return; |
351 | mTempSyncStat = id; | 351 | mTempSyncStat = id; |
352 | } | 352 | } |
353 | 353 | ||
354 | void IncidenceBase::removeID(const QString &prof) | 354 | void IncidenceBase::removeID(const QString &prof) |
355 | { | 355 | { |
356 | mExternalId = KIdManager::removeId ( mExternalId, prof); | 356 | if ( prof.isEmpty() ) |
357 | mExternalId = ":"; | ||
358 | else | ||
359 | mExternalId = KIdManager::removeId ( mExternalId, prof); | ||
357 | 360 | ||
358 | } | 361 | } |
359 | void IncidenceBase::setID( const QString & prof , const QString & id ) | 362 | void IncidenceBase::setID( const QString & prof , const QString & id ) |
360 | { | 363 | { |
361 | mExternalId = KIdManager::setId ( mExternalId, prof, id ); | 364 | mExternalId = KIdManager::setId ( mExternalId, prof, id ); |
362 | } | 365 | } |
363 | QString IncidenceBase::getID( const QString & prof) | 366 | QString IncidenceBase::getID( const QString & prof) |
364 | { | 367 | { |
365 | return KIdManager::getId ( mExternalId, prof ); | 368 | return KIdManager::getId ( mExternalId, prof ); |
366 | } | 369 | } |
367 | 370 | ||
368 | // example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0: | 371 | // example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0: |
369 | // format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0 | 372 | // format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0 |
370 | void IncidenceBase::setCsum( const QString & prof , const QString & id ) | 373 | void IncidenceBase::setCsum( const QString & prof , const QString & id ) |
371 | { | 374 | { |
372 | mExternalId = KIdManager::setCsum ( mExternalId, prof, id ); | 375 | mExternalId = KIdManager::setCsum ( mExternalId, prof, id ); |
373 | } | 376 | } |
374 | QString IncidenceBase::getCsum( const QString & prof) | 377 | QString IncidenceBase::getCsum( const QString & prof) |
375 | { | 378 | { |
376 | return KIdManager::getCsum ( mExternalId, prof ); | 379 | return KIdManager::getCsum ( mExternalId, prof ); |
377 | } | 380 | } |
378 | 381 | ||
379 | void IncidenceBase::setIDStr( const QString & s ) | 382 | void IncidenceBase::setIDStr( const QString & s ) |
380 | { | 383 | { |
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 4390a06..feb184b 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -66,113 +66,145 @@ KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, Targ | |||
66 | if ( QApplication::desktop()->width() < 320 ) | 66 | if ( QApplication::desktop()->width() < 320 ) |
67 | w = 220; | 67 | w = 220; |
68 | int h = bar->sizeHint().height() ; | 68 | int h = bar->sizeHint().height() ; |
69 | int dw = QApplication::desktop()->width(); | 69 | int dw = QApplication::desktop()->width(); |
70 | int dh = QApplication::desktop()->height(); | 70 | int dh = QApplication::desktop()->height(); |
71 | bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 71 | bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
72 | if ( mPrefs->mPassiveSyncAutoStart ) | 72 | if ( mPrefs->mPassiveSyncAutoStart ) |
73 | enableQuick( false ); | 73 | enableQuick( false ); |
74 | 74 | ||
75 | } | 75 | } |
76 | 76 | ||
77 | KSyncManager::~KSyncManager() | 77 | KSyncManager::~KSyncManager() |
78 | { | 78 | { |
79 | delete bar; | 79 | delete bar; |
80 | } | 80 | } |
81 | 81 | ||
82 | 82 | ||
83 | void KSyncManager::fillSyncMenu() | 83 | void KSyncManager::fillSyncMenu() |
84 | { | 84 | { |
85 | if ( mSyncMenu->count() ) | 85 | if ( mSyncMenu->count() ) |
86 | mSyncMenu->clear(); | 86 | mSyncMenu->clear(); |
87 | 87 | ||
88 | mSyncMenu->insertItem( i18n("Configure..."), 0 ); | 88 | mSyncMenu->insertItem( i18n("Configure..."), 0 ); |
89 | mSyncMenu->insertSeparator(); | 89 | mSyncMenu->insertSeparator(); |
90 | QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu ); | ||
91 | mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 ); | ||
92 | clearMenu->insertItem( i18n("For all profiles"), 1 ); | ||
93 | clearMenu->insertSeparator(); | ||
94 | connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) ); | ||
95 | mSyncMenu->insertSeparator(); | ||
90 | if ( mServerSocket == 0 ) { | 96 | if ( mServerSocket == 0 ) { |
91 | mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); | 97 | mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); |
92 | } else { | 98 | } else { |
93 | mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); | 99 | mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); |
94 | } | 100 | } |
95 | mSyncMenu->insertSeparator(); | 101 | mSyncMenu->insertSeparator(); |
96 | mSyncMenu->insertItem( i18n("Multiple sync"), 1 ); | 102 | mSyncMenu->insertItem( i18n("Multiple sync"), 1 ); |
97 | mSyncMenu->insertSeparator(); | 103 | mSyncMenu->insertSeparator(); |
98 | |||
99 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 104 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
100 | config.setGroup("General"); | 105 | config.setGroup("General"); |
101 | QStringList prof = config.readListEntry("SyncProfileNames"); | 106 | QStringList prof = config.readListEntry("SyncProfileNames"); |
102 | mLocalMachineName = config.readEntry("LocalMachineName","undefined"); | 107 | mLocalMachineName = config.readEntry("LocalMachineName","undefined"); |
103 | if ( prof.count() < 2 ) { | 108 | if ( prof.count() < 2 ) { |
104 | prof.clear(); | 109 | prof.clear(); |
105 | QString externalName; | 110 | QString externalName; |
106 | #ifdef DESKTOP_VERSION | 111 | #ifdef DESKTOP_VERSION |
107 | #ifdef _WIN32_ | 112 | #ifdef _WIN32_ |
108 | externalName = "OutLook(not_implemented)"; | 113 | externalName = "OutLook(not_implemented)"; |
109 | #else | 114 | #else |
110 | externalName = "KDE_Desktop"; | 115 | externalName = "KDE_Desktop"; |
111 | #endif | 116 | #endif |
112 | #else | 117 | #else |
113 | externalName = "Sharp_DTM"; | 118 | externalName = "Sharp_DTM"; |
114 | #endif | 119 | #endif |
115 | prof << externalName; | 120 | prof << externalName; |
116 | prof << i18n("Local_file"); | 121 | prof << i18n("Local_file"); |
117 | prof << i18n("Last_file"); | 122 | prof << i18n("Last_file"); |
118 | KSyncProfile* temp = new KSyncProfile (); | 123 | KSyncProfile* temp = new KSyncProfile (); |
119 | temp->setName( prof[0] ); | 124 | temp->setName( prof[0] ); |
120 | temp->writeConfig(&config); | 125 | temp->writeConfig(&config); |
121 | temp->setName( prof[1] ); | 126 | temp->setName( prof[1] ); |
122 | temp->writeConfig(&config); | 127 | temp->writeConfig(&config); |
123 | temp->setName( prof[2] ); | 128 | temp->setName( prof[2] ); |
124 | temp->writeConfig(&config); | 129 | temp->writeConfig(&config); |
125 | config.setGroup("General"); | 130 | config.setGroup("General"); |
126 | config.writeEntry("SyncProfileNames",prof); | 131 | config.writeEntry("SyncProfileNames",prof); |
127 | config.writeEntry("ExternSyncProfiles",externalName); | 132 | config.writeEntry("ExternSyncProfiles",externalName); |
128 | config.sync(); | 133 | config.sync(); |
129 | delete temp; | 134 | delete temp; |
130 | } | 135 | } |
131 | mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); | 136 | mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); |
132 | mSyncProfileNames = prof; | 137 | mSyncProfileNames = prof; |
133 | unsigned int i; | 138 | unsigned int i; |
134 | for ( i = 0; i < prof.count(); ++i ) { | 139 | for ( i = 0; i < prof.count(); ++i ) { |
135 | mSyncMenu->insertItem( prof[i], 1000+i ); | 140 | mSyncMenu->insertItem( prof[i], 1000+i ); |
141 | clearMenu->insertItem( prof[i], 1000+i ); | ||
136 | if ( i == 2 ) | 142 | if ( i == 2 ) |
137 | mSyncMenu->insertSeparator(); | 143 | mSyncMenu->insertSeparator(); |
138 | } | 144 | } |
139 | QDir app_dir; | 145 | QDir app_dir; |
140 | //US do not display SharpDTM if app is pwmpi, or no sharpfiles available | 146 | //US do not display SharpDTM if app is pwmpi, or no sharpfiles available |
141 | if ( mTargetApp == PWMPI) { | 147 | if ( mTargetApp == PWMPI) { |
142 | mSyncMenu->removeItem( 1000 ); | 148 | mSyncMenu->removeItem( 1000 ); |
149 | clearMenu->removeItem( 1000 ); | ||
143 | } | 150 | } |
144 | #ifndef DESKTOP_VERSION | 151 | #ifndef DESKTOP_VERSION |
145 | else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { | 152 | else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { |
146 | mSyncMenu->removeItem( 1000 ); | 153 | mSyncMenu->removeItem( 1000 ); |
154 | clearMenu->removeItem( 1000 ); | ||
147 | } | 155 | } |
148 | #endif | 156 | #endif |
149 | mSyncMenu->removeItem( 1002 ); | 157 | mSyncMenu->removeItem( 1002 ); |
158 | clearMenu->removeItem( 1002 ); | ||
150 | } | 159 | } |
160 | void KSyncManager::slotClearMenu( int action ) | ||
161 | { | ||
162 | QString syncDevice; | ||
163 | if ( action > 999 ) { | ||
164 | syncDevice = mSyncProfileNames[action - 1000] ; | ||
165 | } | ||
151 | 166 | ||
167 | |||
168 | |||
169 | int result = 0; | ||
170 | QString sd; | ||
171 | if ( syncDevice.isEmpty() ) | ||
172 | sd = i18n("Do you want to\nclear all sync info\nof all profiles?"); | ||
173 | else | ||
174 | sd = i18n("Do you want to\nclear the sync\ninfo of profile\n%1?\n"). arg( syncDevice ); | ||
175 | |||
176 | result = QMessageBox::warning( mParent, i18n("Warning!"),sd,i18n("OK"), i18n("Cancel"), 0, | ||
177 | 0, 1 ); | ||
178 | if ( result ) | ||
179 | return; | ||
180 | mImplementation->removeSyncInfo( syncDevice ); | ||
181 | } | ||
152 | void KSyncManager::slotSyncMenu( int action ) | 182 | void KSyncManager::slotSyncMenu( int action ) |
153 | { | 183 | { |
154 | qDebug("syncaction %d ", action); | 184 | qDebug("syncaction %d ", action); |
185 | if ( action == 5000 ) | ||
186 | return; | ||
155 | if ( action == 0 ) { | 187 | if ( action == 0 ) { |
156 | 188 | ||
157 | // seems to be a Qt2 event handling bug | 189 | // seems to be a Qt2 event handling bug |
158 | // syncmenu.clear causes a segfault at first time | 190 | // syncmenu.clear causes a segfault at first time |
159 | // when we call it after the main event loop, it is ok | 191 | // when we call it after the main event loop, it is ok |
160 | // same behaviour when calling OM/Pi via QCOP for the first time | 192 | // same behaviour when calling OM/Pi via QCOP for the first time |
161 | QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); | 193 | QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); |
162 | //confSync(); | 194 | //confSync(); |
163 | 195 | ||
164 | return; | 196 | return; |
165 | } | 197 | } |
166 | if ( action == 1 ) { | 198 | if ( action == 1 ) { |
167 | multiSync( true ); | 199 | multiSync( true ); |
168 | return; | 200 | return; |
169 | } | 201 | } |
170 | if ( action == 2 ) { | 202 | if ( action == 2 ) { |
171 | enableQuick(); | 203 | enableQuick(); |
172 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 204 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
173 | return; | 205 | return; |
174 | } | 206 | } |
175 | if ( action == 3 ) { | 207 | if ( action == 3 ) { |
176 | delete mServerSocket; | 208 | delete mServerSocket; |
177 | mServerSocket = 0; | 209 | mServerSocket = 0; |
178 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 210 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
@@ -814,50 +846,56 @@ QString KSyncManager::getPassword( ) | |||
814 | dia.show(); | 846 | dia.show(); |
815 | int res = dia.exec(); | 847 | int res = dia.exec(); |
816 | if ( res ) | 848 | if ( res ) |
817 | retfile = lab.text(); | 849 | retfile = lab.text(); |
818 | dia.hide(); | 850 | dia.hide(); |
819 | qApp->processEvents(); | 851 | qApp->processEvents(); |
820 | return retfile; | 852 | return retfile; |
821 | 853 | ||
822 | } | 854 | } |
823 | 855 | ||
824 | 856 | ||
825 | void KSyncManager::confSync() | 857 | void KSyncManager::confSync() |
826 | { | 858 | { |
827 | static KSyncPrefsDialog* sp = 0; | 859 | static KSyncPrefsDialog* sp = 0; |
828 | if ( ! sp ) { | 860 | if ( ! sp ) { |
829 | sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); | 861 | sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); |
830 | } | 862 | } |
831 | sp->usrReadConfig(); | 863 | sp->usrReadConfig(); |
832 | #ifndef DESKTOP_VERSION | 864 | #ifndef DESKTOP_VERSION |
833 | sp->showMaximized(); | 865 | sp->showMaximized(); |
834 | #else | 866 | #else |
835 | sp->show(); | 867 | sp->show(); |
836 | #endif | 868 | #endif |
837 | sp->exec(); | 869 | sp->exec(); |
870 | QStringList oldSyncProfileNames = mSyncProfileNames; | ||
838 | mSyncProfileNames = sp->getSyncProfileNames(); | 871 | mSyncProfileNames = sp->getSyncProfileNames(); |
839 | mLocalMachineName = sp->getLocalMachineName (); | 872 | mLocalMachineName = sp->getLocalMachineName (); |
873 | int ii; | ||
874 | for ( ii = 0; ii < oldSyncProfileNames.count(); ++ii ) { | ||
875 | if ( ! mSyncProfileNames.contains( oldSyncProfileNames[ii] ) ) | ||
876 | mImplementation->removeSyncInfo( oldSyncProfileNames[ii] ); | ||
877 | } | ||
840 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 878 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
841 | } | 879 | } |
842 | void KSyncManager::syncKDE() | 880 | void KSyncManager::syncKDE() |
843 | { | 881 | { |
844 | emit save(); | 882 | emit save(); |
845 | switch(mTargetApp) | 883 | switch(mTargetApp) |
846 | { | 884 | { |
847 | case (KAPI): | 885 | case (KAPI): |
848 | 886 | ||
849 | break; | 887 | break; |
850 | case (KOPI): | 888 | case (KOPI): |
851 | { | 889 | { |
852 | #ifdef DESKTOP_VERSION | 890 | #ifdef DESKTOP_VERSION |
853 | QString command = qApp->applicationDirPath () + "/kdecaldump"; | 891 | QString command = qApp->applicationDirPath () + "/kdecaldump"; |
854 | #else | 892 | #else |
855 | QString command = "kdecaldump"; | 893 | QString command = "kdecaldump"; |
856 | #endif | 894 | #endif |
857 | if ( ! QFile::exists ( command ) ) | 895 | if ( ! QFile::exists ( command ) ) |
858 | command = "kdecaldump"; | 896 | command = "kdecaldump"; |
859 | QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; | 897 | QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; |
860 | system ( command.latin1()); | 898 | system ( command.latin1()); |
861 | if ( syncWithFile( fileName,true ) ) { | 899 | if ( syncWithFile( fileName,true ) ) { |
862 | if ( mWriteBackFile ) { | 900 | if ( mWriteBackFile ) { |
863 | command += " --read"; | 901 | command += " --read"; |
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index af4f1ab..aa32e28 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h | |||
@@ -133,48 +133,49 @@ class KSyncManager : public QObject | |||
133 | QString mLocalMachineName; | 133 | QString mLocalMachineName; |
134 | QStringList mExternSyncProfiles; | 134 | QStringList mExternSyncProfiles; |
135 | QStringList mSyncProfileNames; | 135 | QStringList mSyncProfileNames; |
136 | bool mAskForPreferences; | 136 | bool mAskForPreferences; |
137 | bool mShowSyncSummary; | 137 | bool mShowSyncSummary; |
138 | bool mIsKapiFile; | 138 | bool mIsKapiFile; |
139 | bool mWriteBackExistingOnly; | 139 | bool mWriteBackExistingOnly; |
140 | int mSyncAlgoPrefs; | 140 | int mSyncAlgoPrefs; |
141 | bool mWriteBackFile; | 141 | bool mWriteBackFile; |
142 | int mWriteBackInFuture; | 142 | int mWriteBackInFuture; |
143 | QString mPhoneDevice; | 143 | QString mPhoneDevice; |
144 | QString mPhoneConnection; | 144 | QString mPhoneConnection; |
145 | QString mPhoneModel; | 145 | QString mPhoneModel; |
146 | QString mPassWordPiSync; | 146 | QString mPassWordPiSync; |
147 | QString mActiveSyncPort; | 147 | QString mActiveSyncPort; |
148 | QString mActiveSyncIP ; | 148 | QString mActiveSyncIP ; |
149 | 149 | ||
150 | signals: | 150 | signals: |
151 | void save(); | 151 | void save(); |
152 | void request_file(); | 152 | void request_file(); |
153 | void getFile( bool ); | 153 | void getFile( bool ); |
154 | 154 | ||
155 | public slots: | 155 | public slots: |
156 | void slotSyncMenu( int ); | 156 | void slotSyncMenu( int ); |
157 | void slotClearMenu( int action ); | ||
157 | void deleteCommandSocket(KCommandSocket*s, int state); | 158 | void deleteCommandSocket(KCommandSocket*s, int state); |
158 | void readFileFromSocket(); | 159 | void readFileFromSocket(); |
159 | void fillSyncMenu(); | 160 | void fillSyncMenu(); |
160 | 161 | ||
161 | private: | 162 | private: |
162 | void syncPi(); | 163 | void syncPi(); |
163 | KServerSocket * mServerSocket; | 164 | KServerSocket * mServerSocket; |
164 | KPimPrefs* mPrefs; | 165 | KPimPrefs* mPrefs; |
165 | QString mDefFileName; | 166 | QString mDefFileName; |
166 | QString mCurrentSyncDevice; | 167 | QString mCurrentSyncDevice; |
167 | QString mCurrentSyncName; | 168 | QString mCurrentSyncName; |
168 | void quickSyncLocalFile(); | 169 | void quickSyncLocalFile(); |
169 | bool syncWithFile( QString fn , bool quick ); | 170 | bool syncWithFile( QString fn , bool quick ); |
170 | void syncLocalFile(); | 171 | void syncLocalFile(); |
171 | void syncPhone(); | 172 | void syncPhone(); |
172 | void syncSharp(); | 173 | void syncSharp(); |
173 | void syncKDE(); | 174 | void syncKDE(); |
174 | bool syncExternalApplication(QString); | 175 | bool syncExternalApplication(QString); |
175 | int mCurrentSyncProfile ; | 176 | int mCurrentSyncProfile ; |
176 | void syncRemote( KSyncProfile* prof, bool ask = true); | 177 | void syncRemote( KSyncProfile* prof, bool ask = true); |
177 | bool edit_sync_options(); | 178 | bool edit_sync_options(); |
178 | bool edit_pisync_options(); | 179 | bool edit_pisync_options(); |
179 | int ringSync(); | 180 | int ringSync(); |
180 | QString getPassword( ); | 181 | QString getPassword( ); |