summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kabc/addressbook.cpp8
-rw-r--r--kabc/addressbook.h1
-rw-r--r--kabc/addressee.cpp3
-rw-r--r--kaddressbook/kabcore.cpp4
-rw-r--r--korganizer/calendarview.cpp1
-rw-r--r--libkcal/calendar.h1
-rw-r--r--libkcal/calendarlocal.cpp23
-rw-r--r--libkcal/calendarlocal.h1
-rw-r--r--libkcal/incidencebase.cpp3
-rw-r--r--libkdepim/ksyncmanager.cpp40
-rw-r--r--libkdepim/ksyncmanager.h1
11 files changed, 82 insertions, 4 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 3641c0c..2785131 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -552,8 +552,16 @@ void AddressBook::smplifyAddressees()
552 (*ait).simplifyPhoneNumberTypes(); 552 (*ait).simplifyPhoneNumberTypes();
553 (*ait).simplifyAddresses(); 553 (*ait).simplifyAddresses();
554 } 554 }
555} 555}
556void AddressBook::removeSyncInfo( QString syncProfile)
557{
558 Iterator ait;
559 for ( ait = begin(); ait != end(); ++ait ) {
560 (*ait).removeID( syncProfile );
561 }
562
563}
556void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync ) 564void 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 ) {
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index 5edca06..f124dc9 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -143,8 +143,9 @@ class AddressBook : public QObject
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 );
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 40877ef..a660a9d 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -552,8 +552,11 @@ void Addressee::simplifyPhoneNumberTypes()
552} 552}
553void Addressee::removeID(const QString &prof) 553void Addressee::removeID(const QString &prof)
554{ 554{
555 detach(); 555 detach();
556 if ( prof.isEmpty() )
557 mData->mExternalId = ":";
558 else
556 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); 559 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof);
557 560
558} 561}
559void Addressee::setID( const QString & prof , const QString & id ) 562void Addressee::setID( const QString & prof , const QString & id )
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index efae874..e56e46a 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2811,10 +2811,10 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
2811 2811
2812} 2812}
2813void KABCore::removeSyncInfo( QString syncProfile) 2813void 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
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index af01625..a08f243 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -3767,6 +3767,7 @@ void CalendarView::setSyncManager(KSyncManager* manager)
3767 3767
3768void CalendarView::removeSyncInfo( QString syncProfile) 3768void 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
@@ -77,8 +77,9 @@ public:
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.
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 21b4aaf..3f46d53 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -220,9 +220,30 @@ Todo *CalendarLocal::todo( QString syncProf, QString id )
220 } 220 }
221 221
222 return 0; 222 return 0;
223} 223}
224 224void 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}
225QPtrList<Event> CalendarLocal::getExternLastSyncEvents() 246QPtrList<Event> CalendarLocal::getExternLastSyncEvents()
226{ 247{
227 QPtrList<Event> el; 248 QPtrList<Event> el;
228 Event *todo; 249 Event *todo;
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index 5b6c64c..98ec710 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -68,8 +68,9 @@ class CalendarLocal : public Calendar
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 /**
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index b36dc1a..9aa517c 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -352,8 +352,11 @@ void IncidenceBase::setTempSyncStat( int id )
352} 352}
353 353
354void IncidenceBase::removeID(const QString &prof) 354void IncidenceBase::removeID(const QString &prof)
355{ 355{
356 if ( prof.isEmpty() )
357 mExternalId = ":";
358 else
356 mExternalId = KIdManager::removeId ( mExternalId, prof); 359 mExternalId = KIdManager::removeId ( mExternalId, prof);
357 360
358} 361}
359void IncidenceBase::setID( const QString & prof , const QString & id ) 362void IncidenceBase::setID( const QString & prof , const QString & id )
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 4390a06..feb184b 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -86,17 +86,22 @@ void KSyncManager::fillSyncMenu()
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");
@@ -132,27 +137,54 @@ void KSyncManager::fillSyncMenu()
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 );
159}
160void KSyncManager::slotClearMenu( int action )
161{
162 QString syncDevice;
163 if ( action > 999 ) {
164 syncDevice = mSyncProfileNames[action - 1000] ;
150} 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}
152void KSyncManager::slotSyncMenu( int action ) 182void 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
@@ -834,10 +866,16 @@ void KSyncManager::confSync()
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}
842void KSyncManager::syncKDE() 880void KSyncManager::syncKDE()
843{ 881{
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index af4f1ab..aa32e28 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -153,8 +153,9 @@ class KSyncManager : public QObject
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