summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp5
-rw-r--r--kaddressbook/kabcore.cpp29
-rw-r--r--kaddressbook/kabcore.h7
3 files changed, 34 insertions, 7 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 17b9ba2..adb451f 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -65,386 +65,389 @@ struct AddressBook::Iterator::IteratorData
65 Addressee::List::Iterator mIt; 65 Addressee::List::Iterator mIt;
66}; 66};
67 67
68struct AddressBook::ConstIterator::ConstIteratorData 68struct AddressBook::ConstIterator::ConstIteratorData
69{ 69{
70 Addressee::List::ConstIterator mIt; 70 Addressee::List::ConstIterator mIt;
71}; 71};
72 72
73AddressBook::Iterator::Iterator() 73AddressBook::Iterator::Iterator()
74{ 74{
75 d = new IteratorData; 75 d = new IteratorData;
76} 76}
77 77
78AddressBook::Iterator::Iterator( const AddressBook::Iterator &i ) 78AddressBook::Iterator::Iterator( const AddressBook::Iterator &i )
79{ 79{
80 d = new IteratorData; 80 d = new IteratorData;
81 d->mIt = i.d->mIt; 81 d->mIt = i.d->mIt;
82} 82}
83 83
84AddressBook::Iterator &AddressBook::Iterator::operator=( const AddressBook::Iterator &i ) 84AddressBook::Iterator &AddressBook::Iterator::operator=( const AddressBook::Iterator &i )
85{ 85{
86 if( this == &i ) return *this; // guard against self assignment 86 if( this == &i ) return *this; // guard against self assignment
87 delete d; // delete the old data the Iterator was completely constructed before 87 delete d; // delete the old data the Iterator was completely constructed before
88 d = new IteratorData; 88 d = new IteratorData;
89 d->mIt = i.d->mIt; 89 d->mIt = i.d->mIt;
90 return *this; 90 return *this;
91} 91}
92 92
93AddressBook::Iterator::~Iterator() 93AddressBook::Iterator::~Iterator()
94{ 94{
95 delete d; 95 delete d;
96} 96}
97 97
98const Addressee &AddressBook::Iterator::operator*() const 98const Addressee &AddressBook::Iterator::operator*() const
99{ 99{
100 return *(d->mIt); 100 return *(d->mIt);
101} 101}
102 102
103Addressee &AddressBook::Iterator::operator*() 103Addressee &AddressBook::Iterator::operator*()
104{ 104{
105 return *(d->mIt); 105 return *(d->mIt);
106} 106}
107 107
108Addressee *AddressBook::Iterator::operator->() 108Addressee *AddressBook::Iterator::operator->()
109{ 109{
110 return &(*(d->mIt)); 110 return &(*(d->mIt));
111} 111}
112 112
113AddressBook::Iterator &AddressBook::Iterator::operator++() 113AddressBook::Iterator &AddressBook::Iterator::operator++()
114{ 114{
115 (d->mIt)++; 115 (d->mIt)++;
116 return *this; 116 return *this;
117} 117}
118 118
119AddressBook::Iterator &AddressBook::Iterator::operator++(int) 119AddressBook::Iterator &AddressBook::Iterator::operator++(int)
120{ 120{
121 (d->mIt)++; 121 (d->mIt)++;
122 return *this; 122 return *this;
123} 123}
124 124
125AddressBook::Iterator &AddressBook::Iterator::operator--() 125AddressBook::Iterator &AddressBook::Iterator::operator--()
126{ 126{
127 (d->mIt)--; 127 (d->mIt)--;
128 return *this; 128 return *this;
129} 129}
130 130
131AddressBook::Iterator &AddressBook::Iterator::operator--(int) 131AddressBook::Iterator &AddressBook::Iterator::operator--(int)
132{ 132{
133 (d->mIt)--; 133 (d->mIt)--;
134 return *this; 134 return *this;
135} 135}
136 136
137bool AddressBook::Iterator::operator==( const Iterator &it ) 137bool AddressBook::Iterator::operator==( const Iterator &it )
138{ 138{
139 return ( d->mIt == it.d->mIt ); 139 return ( d->mIt == it.d->mIt );
140} 140}
141 141
142bool AddressBook::Iterator::operator!=( const Iterator &it ) 142bool AddressBook::Iterator::operator!=( const Iterator &it )
143{ 143{
144 return ( d->mIt != it.d->mIt ); 144 return ( d->mIt != it.d->mIt );
145} 145}
146 146
147 147
148AddressBook::ConstIterator::ConstIterator() 148AddressBook::ConstIterator::ConstIterator()
149{ 149{
150 d = new ConstIteratorData; 150 d = new ConstIteratorData;
151} 151}
152 152
153AddressBook::ConstIterator::ConstIterator( const AddressBook::ConstIterator &i ) 153AddressBook::ConstIterator::ConstIterator( const AddressBook::ConstIterator &i )
154{ 154{
155 d = new ConstIteratorData; 155 d = new ConstIteratorData;
156 d->mIt = i.d->mIt; 156 d->mIt = i.d->mIt;
157} 157}
158 158
159AddressBook::ConstIterator &AddressBook::ConstIterator::operator=( const AddressBook::ConstIterator &i ) 159AddressBook::ConstIterator &AddressBook::ConstIterator::operator=( const AddressBook::ConstIterator &i )
160{ 160{
161 if( this == &i ) return *this; // guard for self assignment 161 if( this == &i ) return *this; // guard for self assignment
162 delete d; // delete the old data because the Iterator was really constructed before 162 delete d; // delete the old data because the Iterator was really constructed before
163 d = new ConstIteratorData; 163 d = new ConstIteratorData;
164 d->mIt = i.d->mIt; 164 d->mIt = i.d->mIt;
165 return *this; 165 return *this;
166} 166}
167 167
168AddressBook::ConstIterator::~ConstIterator() 168AddressBook::ConstIterator::~ConstIterator()
169{ 169{
170 delete d; 170 delete d;
171} 171}
172 172
173const Addressee &AddressBook::ConstIterator::operator*() const 173const Addressee &AddressBook::ConstIterator::operator*() const
174{ 174{
175 return *(d->mIt); 175 return *(d->mIt);
176} 176}
177 177
178const Addressee* AddressBook::ConstIterator::operator->() const 178const Addressee* AddressBook::ConstIterator::operator->() const
179{ 179{
180 return &(*(d->mIt)); 180 return &(*(d->mIt));
181} 181}
182 182
183AddressBook::ConstIterator &AddressBook::ConstIterator::operator++() 183AddressBook::ConstIterator &AddressBook::ConstIterator::operator++()
184{ 184{
185 (d->mIt)++; 185 (d->mIt)++;
186 return *this; 186 return *this;
187} 187}
188 188
189AddressBook::ConstIterator &AddressBook::ConstIterator::operator++(int) 189AddressBook::ConstIterator &AddressBook::ConstIterator::operator++(int)
190{ 190{
191 (d->mIt)++; 191 (d->mIt)++;
192 return *this; 192 return *this;
193} 193}
194 194
195AddressBook::ConstIterator &AddressBook::ConstIterator::operator--() 195AddressBook::ConstIterator &AddressBook::ConstIterator::operator--()
196{ 196{
197 (d->mIt)--; 197 (d->mIt)--;
198 return *this; 198 return *this;
199} 199}
200 200
201AddressBook::ConstIterator &AddressBook::ConstIterator::operator--(int) 201AddressBook::ConstIterator &AddressBook::ConstIterator::operator--(int)
202{ 202{
203 (d->mIt)--; 203 (d->mIt)--;
204 return *this; 204 return *this;
205} 205}
206 206
207bool AddressBook::ConstIterator::operator==( const ConstIterator &it ) 207bool AddressBook::ConstIterator::operator==( const ConstIterator &it )
208{ 208{
209 return ( d->mIt == it.d->mIt ); 209 return ( d->mIt == it.d->mIt );
210} 210}
211 211
212bool AddressBook::ConstIterator::operator!=( const ConstIterator &it ) 212bool AddressBook::ConstIterator::operator!=( const ConstIterator &it )
213{ 213{
214 return ( d->mIt != it.d->mIt ); 214 return ( d->mIt != it.d->mIt );
215} 215}
216 216
217 217
218AddressBook::AddressBook() 218AddressBook::AddressBook()
219{ 219{
220 init(0, "contact"); 220 init(0, "contact");
221} 221}
222 222
223AddressBook::AddressBook( const QString &config ) 223AddressBook::AddressBook( const QString &config )
224{ 224{
225 init(config, "contact"); 225 init(config, "contact");
226} 226}
227 227
228AddressBook::AddressBook( const QString &config, const QString &family ) 228AddressBook::AddressBook( const QString &config, const QString &family )
229{ 229{
230 init(config, family); 230 init(config, family);
231 231
232} 232}
233 233
234// the default family is "contact" 234// the default family is "contact"
235void AddressBook::init(const QString &config, const QString &family ) 235void AddressBook::init(const QString &config, const QString &family )
236{ 236{
237 blockLSEchange = false; 237 blockLSEchange = false;
238 d = new AddressBookData; 238 d = new AddressBookData;
239 QString fami = family; 239 QString fami = family;
240 qDebug("new ab "); 240 qDebug("new ab ");
241 if (config != 0) { 241 if (config != 0) {
242 qDebug("config != 0 "); 242 qDebug("config != 0 ");
243 if ( family == "syncContact" ) { 243 if ( family == "syncContact" ) {
244 qDebug("creating sync config "); 244 qDebug("creating sync config ");
245 fami = "contact"; 245 fami = "contact";
246 KConfig* con = new KConfig( locateLocal("config", "syncContactrc") ); 246 KConfig* con = new KConfig( locateLocal("config", "syncContactrc") );
247 con->setGroup( "General" ); 247 con->setGroup( "General" );
248 con->writeEntry( "ResourceKeys", QString("sync") ); 248 con->writeEntry( "ResourceKeys", QString("sync") );
249 con->writeEntry( "Standard", QString("sync") ); 249 con->writeEntry( "Standard", QString("sync") );
250 con->setGroup( "Resource_sync" ); 250 con->setGroup( "Resource_sync" );
251 con->writeEntry( "FileName", config ); 251 con->writeEntry( "FileName", config );
252 con->writeEntry( "FileFormat", QString("vcard") ); 252 con->writeEntry( "FileFormat", QString("vcard") );
253 con->writeEntry( "ResourceIdentifier", QString("sync") ); 253 con->writeEntry( "ResourceIdentifier", QString("sync") );
254 con->writeEntry( "ResourceName", QString("sync_res") ); 254 con->writeEntry( "ResourceName", QString("sync_res") );
255 if ( config.right(4) == ".xml" ) 255 if ( config.right(4) == ".xml" )
256 con->writeEntry( "ResourceType", QString("qtopia") ); 256 con->writeEntry( "ResourceType", QString("qtopia") );
257 else 257 else if ( config == "sharp" ) {
258 con->writeEntry( "ResourceType", QString("sharp") );
259 } else {
258 con->writeEntry( "ResourceType", QString("file") ); 260 con->writeEntry( "ResourceType", QString("file") );
261 }
259 //con->sync(); 262 //con->sync();
260 d->mConfig = con; 263 d->mConfig = con;
261 } 264 }
262 else 265 else
263 d->mConfig = new KConfig( locateLocal("config", config) ); 266 d->mConfig = new KConfig( locateLocal("config", config) );
264// qDebug("AddressBook::init 1 config=%s",config.latin1() ); 267// qDebug("AddressBook::init 1 config=%s",config.latin1() );
265 } 268 }
266 else { 269 else {
267 d->mConfig = 0; 270 d->mConfig = 0;
268// qDebug("AddressBook::init 1 config=0"); 271// qDebug("AddressBook::init 1 config=0");
269 } 272 }
270 273
271//US d->mErrorHandler = 0; 274//US d->mErrorHandler = 0;
272 d->mManager = new KRES::Manager<Resource>( fami, false ); 275 d->mManager = new KRES::Manager<Resource>( fami, false );
273 d->mManager->readConfig( d->mConfig ); 276 d->mManager->readConfig( d->mConfig );
274 if ( family == "syncContact" ) { 277 if ( family == "syncContact" ) {
275 KRES::Manager<Resource> *manager = d->mManager; 278 KRES::Manager<Resource> *manager = d->mManager;
276 KRES::Manager<Resource>::ActiveIterator it; 279 KRES::Manager<Resource>::ActiveIterator it;
277 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { 280 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
278 (*it)->setAddressBook( this ); 281 (*it)->setAddressBook( this );
279 if ( !(*it)->open() ) 282 if ( !(*it)->open() )
280 error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) ); 283 error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) );
281 } 284 }
282 Resource *res = standardResource(); 285 Resource *res = standardResource();
283 if ( !res ) { 286 if ( !res ) {
284 qDebug("ERROR: no standard resource"); 287 qDebug("ERROR: no standard resource");
285 res = manager->createResource( "file" ); 288 res = manager->createResource( "file" );
286 if ( res ) 289 if ( res )
287 { 290 {
288 addResource( res ); 291 addResource( res );
289 } 292 }
290 else 293 else
291 qDebug(" No resource available!!!"); 294 qDebug(" No resource available!!!");
292 } 295 }
293 setStandardResource( res ); 296 setStandardResource( res );
294 manager->writeConfig(); 297 manager->writeConfig();
295 } 298 }
296 addCustomField( i18n( "Department" ), KABC::Field::Organization, 299 addCustomField( i18n( "Department" ), KABC::Field::Organization,
297 "X-Department", "KADDRESSBOOK" ); 300 "X-Department", "KADDRESSBOOK" );
298 addCustomField( i18n( "Profession" ), KABC::Field::Organization, 301 addCustomField( i18n( "Profession" ), KABC::Field::Organization,
299 "X-Profession", "KADDRESSBOOK" ); 302 "X-Profession", "KADDRESSBOOK" );
300 addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 303 addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
301 "X-AssistantsName", "KADDRESSBOOK" ); 304 "X-AssistantsName", "KADDRESSBOOK" );
302 addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 305 addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
303 "X-ManagersName", "KADDRESSBOOK" ); 306 "X-ManagersName", "KADDRESSBOOK" );
304 addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 307 addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
305 "X-SpousesName", "KADDRESSBOOK" ); 308 "X-SpousesName", "KADDRESSBOOK" );
306 addCustomField( i18n( "Office" ), KABC::Field::Personal, 309 addCustomField( i18n( "Office" ), KABC::Field::Personal,
307 "X-Office", "KADDRESSBOOK" ); 310 "X-Office", "KADDRESSBOOK" );
308 addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 311 addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
309 "X-IMAddress", "KADDRESSBOOK" ); 312 "X-IMAddress", "KADDRESSBOOK" );
310 addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 313 addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
311 "X-Anniversary", "KADDRESSBOOK" ); 314 "X-Anniversary", "KADDRESSBOOK" );
312 315
313 //US added this field to become compatible with Opie/qtopia addressbook 316 //US added this field to become compatible with Opie/qtopia addressbook
314 // values can be "female" or "male" or "". An empty field represents undefined. 317 // values can be "female" or "male" or "". An empty field represents undefined.
315 addCustomField( i18n( "Gender" ), KABC::Field::Personal, 318 addCustomField( i18n( "Gender" ), KABC::Field::Personal,
316 "X-Gender", "KADDRESSBOOK" ); 319 "X-Gender", "KADDRESSBOOK" );
317 addCustomField( i18n( "Children" ), KABC::Field::Personal, 320 addCustomField( i18n( "Children" ), KABC::Field::Personal,
318 "X-Children", "KADDRESSBOOK" ); 321 "X-Children", "KADDRESSBOOK" );
319 addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 322 addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
320 "X-FreeBusyUrl", "KADDRESSBOOK" ); 323 "X-FreeBusyUrl", "KADDRESSBOOK" );
321 addCustomField( i18n( "ExternalID" ), KABC::Field::Personal, 324 addCustomField( i18n( "ExternalID" ), KABC::Field::Personal,
322 "X-ExternalID", "KADDRESSBOOK" ); 325 "X-ExternalID", "KADDRESSBOOK" );
323} 326}
324 327
325AddressBook::~AddressBook() 328AddressBook::~AddressBook()
326{ 329{
327 delete d->mConfig; d->mConfig = 0; 330 delete d->mConfig; d->mConfig = 0;
328 delete d->mManager; d->mManager = 0; 331 delete d->mManager; d->mManager = 0;
329//US delete d->mErrorHandler; d->mErrorHandler = 0; 332//US delete d->mErrorHandler; d->mErrorHandler = 0;
330 delete d; d = 0; 333 delete d; d = 0;
331} 334}
332 335
333bool AddressBook::load() 336bool AddressBook::load()
334{ 337{
335 338
336 339
337 clear(); 340 clear();
338 341
339 KRES::Manager<Resource>::ActiveIterator it; 342 KRES::Manager<Resource>::ActiveIterator it;
340 bool ok = true; 343 bool ok = true;
341 for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) 344 for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it )
342 if ( !(*it)->load() ) { 345 if ( !(*it)->load() ) {
343 error( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) ); 346 error( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) );
344 ok = false; 347 ok = false;
345 } 348 }
346 349
347 // mark all addressees as unchanged 350 // mark all addressees as unchanged
348 Addressee::List::Iterator addrIt; 351 Addressee::List::Iterator addrIt;
349 for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) { 352 for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) {
350 (*addrIt).setChanged( false ); 353 (*addrIt).setChanged( false );
351 QString id = (*addrIt).custom( "KADDRESSBOOK", "X-ExternalID" ); 354 QString id = (*addrIt).custom( "KADDRESSBOOK", "X-ExternalID" );
352 if ( !id.isEmpty() ) { 355 if ( !id.isEmpty() ) {
353 //qDebug("setId aa %s ", id.latin1()); 356 //qDebug("setId aa %s ", id.latin1());
354 (*addrIt).setIDStr(id ); 357 (*addrIt).setIDStr(id );
355 } 358 }
356 } 359 }
357 blockLSEchange = true; 360 blockLSEchange = true;
358 return ok; 361 return ok;
359} 362}
360 363
361bool AddressBook::save( Ticket *ticket ) 364bool AddressBook::save( Ticket *ticket )
362{ 365{
363 kdDebug(5700) << "AddressBook::save()"<< endl; 366 kdDebug(5700) << "AddressBook::save()"<< endl;
364 367
365 if ( ticket->resource() ) { 368 if ( ticket->resource() ) {
366 deleteRemovedAddressees(); 369 deleteRemovedAddressees();
367 return ticket->resource()->save( ticket ); 370 return ticket->resource()->save( ticket );
368 } 371 }
369 372
370 return false; 373 return false;
371} 374}
372bool AddressBook::saveAB() 375bool AddressBook::saveAB()
373{ 376{
374 bool ok = true; 377 bool ok = true;
375 378
376 deleteRemovedAddressees(); 379 deleteRemovedAddressees();
377 Iterator ait; 380 Iterator ait;
378 for ( ait = begin(); ait != end(); ++ait ) { 381 for ( ait = begin(); ait != end(); ++ait ) {
379 if ( !(*ait).IDStr().isEmpty() ) { 382 if ( !(*ait).IDStr().isEmpty() ) {
380 (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() ); 383 (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() );
381 } 384 }
382 } 385 }
383 KRES::Manager<Resource>::ActiveIterator it; 386 KRES::Manager<Resource>::ActiveIterator it;
384 KRES::Manager<Resource> *manager = d->mManager; 387 KRES::Manager<Resource> *manager = d->mManager;
385 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { 388 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
386 if ( !(*it)->readOnly() && (*it)->isOpen() ) { 389 if ( !(*it)->readOnly() && (*it)->isOpen() ) {
387 Ticket *ticket = requestSaveTicket( *it ); 390 Ticket *ticket = requestSaveTicket( *it );
388// qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); 391// qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() );
389 if ( !ticket ) { 392 if ( !ticket ) {
390 error( i18n( "Unable to save to resource '%1'. It is locked." ) 393 error( i18n( "Unable to save to resource '%1'. It is locked." )
391 .arg( (*it)->resourceName() ) ); 394 .arg( (*it)->resourceName() ) );
392 return false; 395 return false;
393 } 396 }
394 397
395 //if ( !save( ticket ) ) 398 //if ( !save( ticket ) )
396 if ( ticket->resource() ) { 399 if ( ticket->resource() ) {
397 if ( ! ticket->resource()->save( ticket ) ) 400 if ( ! ticket->resource()->save( ticket ) )
398 ok = false; 401 ok = false;
399 } else 402 } else
400 ok = false; 403 ok = false;
401 404
402 } 405 }
403 } 406 }
404 return ok; 407 return ok;
405} 408}
406 409
407AddressBook::Iterator AddressBook::begin() 410AddressBook::Iterator AddressBook::begin()
408{ 411{
409 Iterator it = Iterator(); 412 Iterator it = Iterator();
410 it.d->mIt = d->mAddressees.begin(); 413 it.d->mIt = d->mAddressees.begin();
411 return it; 414 return it;
412} 415}
413 416
414AddressBook::ConstIterator AddressBook::begin() const 417AddressBook::ConstIterator AddressBook::begin() const
415{ 418{
416 ConstIterator it = ConstIterator(); 419 ConstIterator it = ConstIterator();
417 it.d->mIt = d->mAddressees.begin(); 420 it.d->mIt = d->mAddressees.begin();
418 return it; 421 return it;
419} 422}
420 423
421AddressBook::Iterator AddressBook::end() 424AddressBook::Iterator AddressBook::end()
422{ 425{
423 Iterator it = Iterator(); 426 Iterator it = Iterator();
424 it.d->mIt = d->mAddressees.end(); 427 it.d->mIt = d->mAddressees.end();
425 return it; 428 return it;
426} 429}
427 430
428AddressBook::ConstIterator AddressBook::end() const 431AddressBook::ConstIterator AddressBook::end() const
429{ 432{
430 ConstIterator it = ConstIterator(); 433 ConstIterator it = ConstIterator();
431 it.d->mIt = d->mAddressees.end(); 434 it.d->mIt = d->mAddressees.end();
432 return it; 435 return it;
433} 436}
434 437
435void AddressBook::clear() 438void AddressBook::clear()
436{ 439{
437 d->mAddressees.clear(); 440 d->mAddressees.clear();
438} 441}
439 442
440Ticket *AddressBook::requestSaveTicket( Resource *resource ) 443Ticket *AddressBook::requestSaveTicket( Resource *resource )
441{ 444{
442 kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl; 445 kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl;
443 446
444 if ( !resource ) 447 if ( !resource )
445 { 448 {
446 qDebug("AddressBook::requestSaveTicket no resource" ); 449 qDebug("AddressBook::requestSaveTicket no resource" );
447 resource = standardResource(); 450 resource = standardResource();
448 } 451 }
449 452
450 KRES::Manager<Resource>::ActiveIterator it; 453 KRES::Manager<Resource>::ActiveIterator it;
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index f8683e7..c1ead9d 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2837,208 +2837,231 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2837 QStringList el = local->uidList(); 2837 QStringList el = local->uidList();
2838 modulo = (el.count()/10)+1; 2838 modulo = (el.count()/10)+1;
2839 bar.setCaption (i18n("Add / remove addressees") ); 2839 bar.setCaption (i18n("Add / remove addressees") );
2840 bar.setTotalSteps ( el.count() ) ; 2840 bar.setTotalSteps ( el.count() ) ;
2841 bar.show(); 2841 bar.show();
2842 incCounter = 0; 2842 incCounter = 0;
2843 while ( incCounter < el.count()) { 2843 while ( incCounter < el.count()) {
2844 qApp->processEvents(); 2844 qApp->processEvents();
2845 if ( ! bar.isVisible() ) 2845 if ( ! bar.isVisible() )
2846 return false; 2846 return false;
2847 if ( incCounter % modulo == 0 ) 2847 if ( incCounter % modulo == 0 )
2848 bar.setProgress( incCounter ); 2848 bar.setProgress( incCounter );
2849 uid = el[ incCounter ]; 2849 uid = el[ incCounter ];
2850 bool skipIncidence = false; 2850 bool skipIncidence = false;
2851 if ( uid.left(19) == QString("last-syncAddressee-") ) 2851 if ( uid.left(19) == QString("last-syncAddressee-") )
2852 skipIncidence = true; 2852 skipIncidence = true;
2853 if ( !skipIncidence ) { 2853 if ( !skipIncidence ) {
2854 inL = local->findByUid( uid ); 2854 inL = local->findByUid( uid );
2855 inR = remote->findByUid( uid ); 2855 inR = remote->findByUid( uid );
2856 if ( inR.isEmpty() ) { 2856 if ( inR.isEmpty() ) {
2857 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2857 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2858 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 2858 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
2859 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 2859 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
2860 local->removeAddressee( inL ); 2860 local->removeAddressee( inL );
2861 ++deletedAddresseeL; 2861 ++deletedAddresseeL;
2862 } else { 2862 } else {
2863 if ( ! KABPrefs::instance()->mWriteBackExistingOnly ) { 2863 if ( ! KABPrefs::instance()->mWriteBackExistingOnly ) {
2864 inL.removeID(mCurrentSyncDevice ); 2864 inL.removeID(mCurrentSyncDevice );
2865 ++addedAddresseeR; 2865 ++addedAddresseeR;
2866 inL.setRevision( modifiedCalendar ); 2866 inL.setRevision( modifiedCalendar );
2867 local->insertAddressee( inL, false ); 2867 local->insertAddressee( inL, false );
2868 inR = inL; 2868 inR = inL;
2869 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); 2869 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL );
2870 inR.setResource( 0 ); 2870 inR.setResource( 0 );
2871 remote->insertAddressee( inR, false ); 2871 remote->insertAddressee( inR, false );
2872 } 2872 }
2873 } 2873 }
2874 } else { 2874 } else {
2875 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { 2875 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) {
2876 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 2876 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
2877 local->removeAddressee( inL ); 2877 local->removeAddressee( inL );
2878 ++deletedAddresseeL; 2878 ++deletedAddresseeL;
2879 } else { 2879 } else {
2880 if ( ! KABPrefs::instance()->mWriteBackExistingOnly ) { 2880 if ( ! KABPrefs::instance()->mWriteBackExistingOnly ) {
2881 ++addedAddresseeR; 2881 ++addedAddresseeR;
2882 inL.setRevision( modifiedCalendar ); 2882 inL.setRevision( modifiedCalendar );
2883 local->insertAddressee( inL, false ); 2883 local->insertAddressee( inL, false );
2884 inR = inL; 2884 inR = inL;
2885 inR.setResource( 0 ); 2885 inR.setResource( 0 );
2886 remote->insertAddressee( inR, false ); 2886 remote->insertAddressee( inR, false );
2887 } 2887 }
2888 } 2888 }
2889 } 2889 }
2890 } 2890 }
2891 } 2891 }
2892 ++incCounter; 2892 ++incCounter;
2893 } 2893 }
2894 el.clear(); 2894 el.clear();
2895 bar.hide(); 2895 bar.hide();
2896 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); 2896 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 );
2897 // get rid of micro seconds 2897 // get rid of micro seconds
2898 QTime t = mLastAddressbookSync.time(); 2898 QTime t = mLastAddressbookSync.time();
2899 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 2899 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) );
2900 addresseeLSync.setRevision( mLastAddressbookSync ); 2900 addresseeLSync.setRevision( mLastAddressbookSync );
2901 addresseeRSync.setRevision( mLastAddressbookSync ); 2901 addresseeRSync.setRevision( mLastAddressbookSync );
2902 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; 2902 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ;
2903 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); 2903 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName );
2904 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; 2904 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ;
2905 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); 2905 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") );
2906 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; 2906 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ;
2907 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); 2907 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() );
2908 addresseeRSync.setNote( "" ) ; 2908 addresseeRSync.setNote( "" ) ;
2909 addresseeLSync.setNote( "" ); 2909 addresseeLSync.setNote( "" );
2910 2910
2911 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 2911 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
2912 remote->insertAddressee( addresseeRSync, false ); 2912 remote->insertAddressee( addresseeRSync, false );
2913 local->insertAddressee( addresseeLSync, false ); 2913 local->insertAddressee( addresseeLSync, false );
2914 QString mes; 2914 QString mes;
2915 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR ); 2915 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR );
2916 if ( KABPrefs::instance()->mShowSyncSummary ) { 2916 if ( KABPrefs::instance()->mShowSyncSummary ) {
2917 KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") ); 2917 KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") );
2918 } 2918 }
2919 qDebug( mes ); 2919 qDebug( mes );
2920 return syncOK; 2920 return syncOK;
2921} 2921}
2922 2922
2923bool KABCore::syncAB(QString filename, int mode) 2923bool KABCore::syncAB(QString filename, int mode)
2924{ 2924{
2925 2925
2926 //pending prepare addresseeview for output 2926 //pending prepare addresseeview for output
2927 //pending detect, if remote file has REV field. if not switch to external sync 2927 //pending detect, if remote file has REV field. if not switch to external sync
2928 mGlobalSyncMode = SYNC_MODE_NORMAL; 2928 mGlobalSyncMode = SYNC_MODE_NORMAL;
2929 AddressBook abLocal(filename,"syncContact"); 2929 AddressBook abLocal(filename,"syncContact");
2930 bool syncOK = false; 2930 bool syncOK = false;
2931 if ( abLocal.load() ) { 2931 if ( abLocal.load() ) {
2932 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); 2932 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode );
2933 bool external = false; 2933 bool external = false;
2934 bool isXML = false; 2934 bool isXML = false;
2935 if ( filename.right(4) == ".xml") { 2935 if ( filename.right(4) == ".xml") {
2936 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2936 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2937 isXML = true; 2937 isXML = true;
2938 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice ); 2938 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
2939 } else { 2939 } else {
2940 Addressee lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2940 Addressee lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
2941 if ( ! lse.isEmpty() ) { 2941 if ( ! lse.isEmpty() ) {
2942 if ( lse.familyName().left(4) == "!E: " ) 2942 if ( lse.familyName().left(4) == "!E: " )
2943 external = true; 2943 external = true;
2944 } else { 2944 } else {
2945 bool found = false; 2945 bool found = false;
2946 AddressBook::Iterator it; 2946 AddressBook::Iterator it;
2947 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2947 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2948 if ( (*it).revision().date().year() > 2003 ) { 2948 if ( (*it).revision().date().year() > 2003 ) {
2949 found = true; 2949 found = true;
2950 break; 2950 break;
2951 } 2951 }
2952 } 2952 }
2953 external = ! found; 2953 external = ! found;
2954 } 2954 }
2955 2955
2956 if ( external ) { 2956 if ( external ) {
2957 qDebug("Setting vcf mode to external "); 2957 qDebug("Setting vcf mode to external ");
2958 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2958 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2959 AddressBook::Iterator it; 2959 AddressBook::Iterator it;
2960 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2960 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2961 (*it).setID( mCurrentSyncDevice, (*it).uid() ); 2961 (*it).setID( mCurrentSyncDevice, (*it).uid() );
2962 (*it).computeCsum( mCurrentSyncDevice ); 2962 (*it).computeCsum( mCurrentSyncDevice );
2963 } 2963 }
2964 } 2964 }
2965 } 2965 }
2966 //AddressBook::Iterator it; 2966 //AddressBook::Iterator it;
2967 //QStringList vcards; 2967 //QStringList vcards;
2968 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2968 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2969 // qDebug("Name %s ", (*it).familyName().latin1()); 2969 // qDebug("Name %s ", (*it).familyName().latin1());
2970 //} 2970 //}
2971 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); 2971 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
2972 if ( syncOK ) { 2972 if ( syncOK ) {
2973 if ( KABPrefs::instance()->mWriteBackFile ) 2973 if ( KABPrefs::instance()->mWriteBackFile )
2974 { 2974 {
2975 if ( external ) 2975 if ( external )
2976 abLocal.removeSyncAddressees( !isXML); 2976 abLocal.removeSyncAddressees( !isXML);
2977 qDebug("Saving remote AB "); 2977 qDebug("Saving remote AB ");
2978 abLocal.saveAB(); 2978 abLocal.saveAB();
2979 if ( isXML ) { 2979 if ( isXML ) {
2980 // afterwrite processing 2980 // afterwrite processing
2981 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); 2981 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2982 } 2982 }
2983 } 2983 }
2984 } 2984 }
2985 setModified(); 2985 setModified();
2986 2986
2987 } 2987 }
2988 if ( syncOK ) 2988 if ( syncOK )
2989 mViewManager->refreshView(); 2989 mViewManager->refreshView();
2990 return syncOK; 2990 return syncOK;
2991#if 0 2991#if 0
2992 2992
2993 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { 2993 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) {
2994 getEventViewerDialog()->setSyncMode( true ); 2994 getEventViewerDialog()->setSyncMode( true );
2995 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 2995 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
2996 getEventViewerDialog()->setSyncMode( false ); 2996 getEventViewerDialog()->setSyncMode( false );
2997 if ( syncOK ) { 2997 if ( syncOK ) {
2998 if ( KOPrefs::instance()->mWriteBackFile ) 2998 if ( KOPrefs::instance()->mWriteBackFile )
2999 { 2999 {
3000 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); 3000 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
3001 storage->save(); 3001 storage->save();
3002 } 3002 }
3003 } 3003 }
3004 setModified(); 3004 setModified();
3005 } 3005 }
3006 3006
3007#endif 3007#endif
3008} 3008}
3009 3009
3010void KABCore::confSync() 3010void KABCore::confSync()
3011{ 3011{
3012 static KSyncPrefsDialog* sp = 0; 3012 static KSyncPrefsDialog* sp = 0;
3013 if ( ! sp ) { 3013 if ( ! sp ) {
3014 sp = new KSyncPrefsDialog( this, "syncprefs", true ); 3014 sp = new KSyncPrefsDialog( this, "syncprefs", true );
3015 } 3015 }
3016 sp->usrReadConfig(); 3016 sp->usrReadConfig();
3017#ifndef DESKTOP_VERSION 3017#ifndef DESKTOP_VERSION
3018 sp->showMaximized(); 3018 sp->showMaximized();
3019#else 3019#else
3020 sp->show(); 3020 sp->show();
3021#endif 3021#endif
3022 sp->exec(); 3022 sp->exec();
3023 KABPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); 3023 KABPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames();
3024 KABPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); 3024 KABPrefs::instance()->mLocalMachineName = sp->getLocalMachineName ();
3025 fillSyncMenu(); 3025 fillSyncMenu();
3026} 3026}
3027void KABCore::syncSharp() 3027void KABCore::syncSharp()
3028{ 3028{
3029 if ( ! syncExternal("sharp") )
3030 qDebug("ERROR sync sharp ");;
3031}
3032bool KABCore::syncExternal(QString resource)
3033{
3029 if ( mModified ) 3034 if ( mModified )
3030 save(); 3035 save();
3031 qDebug("pending syncSharp() "); 3036 if ( KABPrefs::instance()->mAskForPreferences )
3032 //mView->syncSharp(); 3037 edit_sync_options();
3033 setModified(); 3038 qDebug("syncSharp() ");
3039 AddressBook abLocal( resource,"syncContact");
3040 bool syncOK = false;
3041 if ( abLocal.load() ) {
3042 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
3043 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3044 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
3045 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, KABPrefs::instance()->mSyncAlgoPrefs );
3046 if ( syncOK ) {
3047 if ( KABPrefs::instance()->mWriteBackFile ) {
3048 abLocal.saveAB();
3049 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
3050 }
3051 }
3052 setModified();
3053 }
3054 if ( syncOK )
3055 mViewManager->refreshView();
3056 return syncOK;
3034 3057
3035} 3058}
3036void KABCore::syncPhone() 3059void KABCore::syncPhone()
3037{ 3060{
3038 if ( mModified ) 3061 if ( mModified )
3039 save(); 3062 save();
3040 qDebug("pending syncPhone(); "); 3063 qDebug("pending syncPhone(); ");
3041 //mView->syncPhone(); 3064 //mView->syncPhone();
3042 setModified(); 3065 setModified();
3043 3066
3044} 3067}
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index f01f306..e89bf41 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -271,214 +271,215 @@ class KABCore : public QWidget
271 271
272 /** 272 /**
273 DCOP METHODS. 273 DCOP METHODS.
274 */ 274 */
275 void addEmail( QString addr ); 275 void addEmail( QString addr );
276 void importVCard( const KURL& url, bool showPreview ); 276 void importVCard( const KURL& url, bool showPreview );
277 void importVCard( const QString& vCard, bool showPreview ); 277 void importVCard( const QString& vCard, bool showPreview );
278 void newContact(); 278 void newContact();
279 QString getNameByPhone( const QString& phone ); 279 QString getNameByPhone( const QString& phone );
280 /** 280 /**
281 END DCOP METHODS 281 END DCOP METHODS
282 */ 282 */
283 283
284 /** 284 /**
285 Saves the contents of the AddressBook back to disk. 285 Saves the contents of the AddressBook back to disk.
286 */ 286 */
287 void save(); 287 void save();
288 288
289 /** 289 /**
290 Undos the last command using the undo stack. 290 Undos the last command using the undo stack.
291 */ 291 */
292 void undo(); 292 void undo();
293 293
294 /** 294 /**
295 Redos the last command that was undone, using the redo stack. 295 Redos the last command that was undone, using the redo stack.
296 */ 296 */
297 void redo(); 297 void redo();
298 298
299 /** 299 /**
300 Shows the edit dialog for the given uid. If the uid is QString::null, 300 Shows the edit dialog for the given uid. If the uid is QString::null,
301 the method will try to find a selected addressee in the view. 301 the method will try to find a selected addressee in the view.
302 */ 302 */
303 void editContact( const QString &uid /*US = QString::null*/ ); 303 void editContact( const QString &uid /*US = QString::null*/ );
304//US added a second method without defaultparameter 304//US added a second method without defaultparameter
305 void editContact2(); 305 void editContact2();
306 306
307 /** 307 /**
308 Shows or edits the detail view for the given uid. If the uid is QString::null, 308 Shows or edits the detail view for the given uid. If the uid is QString::null,
309 the method will try to find a selected addressee in the view. 309 the method will try to find a selected addressee in the view.
310 */ 310 */
311 void executeContact( const QString &uid /*US = QString::null*/ ); 311 void executeContact( const QString &uid /*US = QString::null*/ );
312 312
313 /** 313 /**
314 Launches the configuration dialog. 314 Launches the configuration dialog.
315 */ 315 */
316 void openConfigDialog(); 316 void openConfigDialog();
317 317
318 /** 318 /**
319 Launches the ldap search dialog. 319 Launches the ldap search dialog.
320 */ 320 */
321 void openLDAPDialog(); 321 void openLDAPDialog();
322 322
323 /** 323 /**
324 Creates a KAddressBookPrinter, which will display the print 324 Creates a KAddressBookPrinter, which will display the print
325 dialog and do the printing. 325 dialog and do the printing.
326 */ 326 */
327 void print(); 327 void print();
328 328
329 /** 329 /**
330 Registers a new GUI client, so plugins can register its actions. 330 Registers a new GUI client, so plugins can register its actions.
331 */ 331 */
332 void addGUIClient( KXMLGUIClient *client ); 332 void addGUIClient( KXMLGUIClient *client );
333 333
334 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 334 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
335 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 335 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
336 336
337 337
338 signals: 338 signals:
339 void contactSelected( const QString &name ); 339 void contactSelected( const QString &name );
340 void contactSelected( const QPixmap &pixmap ); 340 void contactSelected( const QPixmap &pixmap );
341 public slots: 341 public slots:
342 void setDetailsVisible( bool visible ); 342 void setDetailsVisible( bool visible );
343 void setDetailsToState(); 343 void setDetailsToState();
344 void slotSyncMenu( int ); 344 void slotSyncMenu( int );
345 private slots: 345 private slots:
346 void setJumpButtonBarVisible( bool visible ); 346 void setJumpButtonBarVisible( bool visible );
347 void importFromOL(); 347 void importFromOL();
348 void extensionModified( const KABC::Addressee::List &list ); 348 void extensionModified( const KABC::Addressee::List &list );
349 void extensionChanged( int id ); 349 void extensionChanged( int id );
350 void clipboardDataChanged(); 350 void clipboardDataChanged();
351 void updateActionMenu(); 351 void updateActionMenu();
352 void configureKeyBindings(); 352 void configureKeyBindings();
353 void removeVoice(); 353 void removeVoice();
354#ifdef KAB_EMBEDDED 354#ifdef KAB_EMBEDDED
355 void configureResources(); 355 void configureResources();
356#endif //KAB_EMBEDDED 356#endif //KAB_EMBEDDED
357 357
358 void slotEditorDestroyed( const QString &uid ); 358 void slotEditorDestroyed( const QString &uid );
359 void configurationChanged(); 359 void configurationChanged();
360 void addressBookChanged(); 360 void addressBookChanged();
361 361
362 private: 362 private:
363 void initGUI(); 363 void initGUI();
364 void initActions(); 364 void initActions();
365 365
366 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 366 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
367 const char *name = 0 ); 367 const char *name = 0 );
368 368
369 KXMLGUIClient *mGUIClient; 369 KXMLGUIClient *mGUIClient;
370 370
371 KABC::AddressBook *mAddressBook; 371 KABC::AddressBook *mAddressBook;
372 372
373 ViewManager *mViewManager; 373 ViewManager *mViewManager;
374 // QSplitter *mDetailsSplitter; 374 // QSplitter *mDetailsSplitter;
375 KDGanttMinimizeSplitter *mExtensionBarSplitter; 375 KDGanttMinimizeSplitter *mExtensionBarSplitter;
376 ViewContainer *mDetails; 376 ViewContainer *mDetails;
377 KDGanttMinimizeSplitter* mMiniSplitter; 377 KDGanttMinimizeSplitter* mMiniSplitter;
378 XXPortManager *mXXPortManager; 378 XXPortManager *mXXPortManager;
379 JumpButtonBar *mJumpButtonBar; 379 JumpButtonBar *mJumpButtonBar;
380 IncSearchWidget *mIncSearchWidget; 380 IncSearchWidget *mIncSearchWidget;
381 ExtensionManager *mExtensionManager; 381 ExtensionManager *mExtensionManager;
382 382
383 KCMultiDialog *mConfigureDialog; 383 KCMultiDialog *mConfigureDialog;
384 384
385#ifndef KAB_EMBEDDED 385#ifndef KAB_EMBEDDED
386 LDAPSearchDialog *mLdapSearchDialog; 386 LDAPSearchDialog *mLdapSearchDialog;
387#endif //KAB_EMBEDDED 387#endif //KAB_EMBEDDED
388 // QDict<AddresseeEditorDialog> mEditorDict; 388 // QDict<AddresseeEditorDialog> mEditorDict;
389 AddresseeEditorDialog *mEditorDialog; 389 AddresseeEditorDialog *mEditorDialog;
390 bool mReadWrite; 390 bool mReadWrite;
391 bool mModified; 391 bool mModified;
392 bool mIsPart; 392 bool mIsPart;
393 bool mMultipleViewsAtOnce; 393 bool mMultipleViewsAtOnce;
394 394
395 395
396 //US file menu 396 //US file menu
397 KAction *mActionMail; 397 KAction *mActionMail;
398 KAction *mActionBeam; 398 KAction *mActionBeam;
399 KAction* mActionPrint; 399 KAction* mActionPrint;
400 KAction* mActionNewContact; 400 KAction* mActionNewContact;
401 KAction *mActionSave; 401 KAction *mActionSave;
402 KAction *mActionEditAddressee; 402 KAction *mActionEditAddressee;
403 KAction *mActionMailVCard; 403 KAction *mActionMailVCard;
404 KAction *mActionBeamVCard; 404 KAction *mActionBeamVCard;
405 405
406 KAction *mActionQuit; 406 KAction *mActionQuit;
407 407
408 //US edit menu 408 //US edit menu
409 KAction *mActionCopy; 409 KAction *mActionCopy;
410 KAction *mActionCut; 410 KAction *mActionCut;
411 KAction *mActionPaste; 411 KAction *mActionPaste;
412 KAction *mActionSelectAll; 412 KAction *mActionSelectAll;
413 KAction *mActionUndo; 413 KAction *mActionUndo;
414 KAction *mActionRedo; 414 KAction *mActionRedo;
415 KAction *mActionDelete; 415 KAction *mActionDelete;
416 416
417 //US settings menu 417 //US settings menu
418 KAction *mActionConfigResources; 418 KAction *mActionConfigResources;
419 KAction *mActionConfigKAddressbook; 419 KAction *mActionConfigKAddressbook;
420 KAction *mActionConfigShortcuts; 420 KAction *mActionConfigShortcuts;
421 KAction *mActionConfigureToolbars; 421 KAction *mActionConfigureToolbars;
422 KAction *mActionKeyBindings; 422 KAction *mActionKeyBindings;
423 KToggleAction *mActionJumpBar; 423 KToggleAction *mActionJumpBar;
424 KToggleAction *mActionDetails; 424 KToggleAction *mActionDetails;
425 KAction *mActionWhoAmI; 425 KAction *mActionWhoAmI;
426 KAction *mActionCategories; 426 KAction *mActionCategories;
427 KAction *mActionAboutKAddressbook; 427 KAction *mActionAboutKAddressbook;
428 KAction *mActionLicence; 428 KAction *mActionLicence;
429 KAction *mActionFaq; 429 KAction *mActionFaq;
430 430
431 KAction *mActionDeleteView; 431 KAction *mActionDeleteView;
432 432
433 QPopupMenu *viewMenu; 433 QPopupMenu *viewMenu;
434 QPopupMenu *filterMenu; 434 QPopupMenu *filterMenu;
435 QPopupMenu *settingsMenu; 435 QPopupMenu *settingsMenu;
436 QPopupMenu *changeMenu; 436 QPopupMenu *changeMenu;
437//US QAction *mActionSave; 437//US QAction *mActionSave;
438 QPopupMenu *ImportMenu; 438 QPopupMenu *ImportMenu;
439 QPopupMenu *ExportMenu; 439 QPopupMenu *ExportMenu;
440 //LR additional methods 440 //LR additional methods
441 KAction *mActionRemoveVoice; 441 KAction *mActionRemoveVoice;
442 KAction * mActionImportOL; 442 KAction * mActionImportOL;
443 443
444#ifndef KAB_EMBEDDED 444#ifndef KAB_EMBEDDED
445 KAddressBookService *mAddressBookService; 445 KAddressBookService *mAddressBookService;
446#endif //KAB_EMBEDDED 446#endif //KAB_EMBEDDED
447 447
448 class KABCorePrivate; 448 class KABCorePrivate;
449 KABCorePrivate *d; 449 KABCorePrivate *d;
450 bool mBlockSaveFlag; 450 bool mBlockSaveFlag;
451 451
452#ifdef KAB_EMBEDDED 452#ifdef KAB_EMBEDDED
453 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 453 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
454#endif //KAB_EMBEDDED 454#endif //KAB_EMBEDDED
455 // LR ******************************* 455 // LR *******************************
456 // sync stuff! 456 // sync stuff!
457 QPopupMenu *syncMenu; 457 QPopupMenu *syncMenu;
458 void fillSyncMenu(); 458 void fillSyncMenu();
459 QString mCurrentSyncDevice; 459 QString mCurrentSyncDevice;
460 QString mCurrentSyncName; 460 QString mCurrentSyncName;
461 void quickSyncLocalFile(); 461 void quickSyncLocalFile();
462 bool syncWithFile( QString fn , bool quick ); 462 bool syncWithFile( QString fn , bool quick );
463 void KABCore::syncLocalFile(); 463 void syncLocalFile();
464 void KABCore::syncPhone(); 464 void syncPhone();
465 void KABCore::syncSharp(); 465 void syncSharp();
466 bool syncExternal(QString);
466 void multiSync( bool askforPrefs ); 467 void multiSync( bool askforPrefs );
467 int mCurrentSyncProfile ; 468 int mCurrentSyncProfile ;
468 void syncRemote( KSyncProfile* prof, bool ask = true); 469 void syncRemote( KSyncProfile* prof, bool ask = true);
469 void edit_sync_options(); 470 void edit_sync_options();
470 bool syncAB(QString filename, int mode); 471 bool syncAB(QString filename, int mode);
471 int ringSync(); 472 int ringSync();
472 QString getPassword( ); 473 QString getPassword( );
473 int mGlobalSyncMode; 474 int mGlobalSyncMode;
474 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 475 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
475 KABC::Addressee getLastSyncAddressee(); 476 KABC::Addressee getLastSyncAddressee();
476 QDateTime mLastAddressbookSync; 477 QDateTime mLastAddressbookSync;
477 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 478 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
478 public slots: 479 public slots:
479 void confSync(); 480 void confSync();
480 // ********************* 481 // *********************
481 482
482}; 483};
483 484
484#endif 485#endif