summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-09 02:17:06 (UTC)
committer zautrix <zautrix>2004-10-09 02:17:06 (UTC)
commitc2165f4e14bc2f7ab2ef19f5c35497dde5e87a0d (patch) (unidiff)
treeb83f7cfe5d4bb681b756fe95446e5e3fc193bc36
parent07fdef2c2ea1153d39d7114b3d5bd4abc4f4c861 (diff)
downloadkdepimpi-c2165f4e14bc2f7ab2ef19f5c35497dde5e87a0d.zip
kdepimpi-c2165f4e14bc2f7ab2ef19f5c35497dde5e87a0d.tar.gz
kdepimpi-c2165f4e14bc2f7ab2ef19f5c35497dde5e87a0d.tar.bz2
import ir fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/kopiWhatsNew.txt8
-rw-r--r--kabc/addressbook.cpp16
-rw-r--r--kabc/addressbook.h2
-rw-r--r--kabc/addressee.cpp17
-rw-r--r--kabc/addressee.h1
-rw-r--r--kaddressbook/kabcore.cpp22
-rw-r--r--kaddressbook/kabcore.h1
-rw-r--r--kaddressbook/kaddressbookmain.cpp12
-rw-r--r--kaddressbook/kaddressbookmain.h2
-rw-r--r--kaddressbook/mainembedded.cpp8
-rw-r--r--korganizer/mainwindow.cpp15
-rw-r--r--libkdepim/ksyncmanager.cpp6
12 files changed, 79 insertions, 31 deletions
diff --git a/bin/kdepim/korganizer/kopiWhatsNew.txt b/bin/kdepim/korganizer/kopiWhatsNew.txt
index eea860c..3f95dcf 100644
--- a/bin/kdepim/korganizer/kopiWhatsNew.txt
+++ b/bin/kdepim/korganizer/kopiWhatsNew.txt
@@ -1,69 +1,75 @@
1Info about the changes in new versions of KO/Pi 1Info about the changes in new versions of KO/Pi
2and KDE-Pim/Pi 2and KDE-Pim/Pi
3 3
4********** VERSION 1.9.7 ************ 4********** VERSION 1.9.7 ************
5 5
6KO/Pi - KA/Pi on Windows: 6KO/Pi - KA/Pi on Windows:
7Now a directory can be defined by the user, where the 7Now a directory can be defined by the user, where the
8application/config data should be saved. 8application/config data should be saved.
9 Define your desired path in the evironment variable 9 Define your desired path in the evironment variable
10 MICROKDEHOME 10 MICROKDEHOME
11 before starting KO/Pi or KA/Pi. 11 before starting KO/Pi or KA/Pi.
12 12
13An easy Kx/Pi to Kx/Pi syncing is now possible 13An easy Kx/Pi to Kx/Pi syncing is now possible
14(it is called Pi-Sync) via network. 14(it is called Pi-Sync) via network.
15Please look at the Sync Howto. 15Please look at the Sync Howto.
16 16
17Exporting of data to mobile phones is now possible. 17Exporting of calendar data and contacts to mobile phones is now possible.
18The SyncHowto is updated with information howto 18The SyncHowto is updated with information howto
19access/sync mobile phones. 19access/sync mobile phones.
20Please look at the Sync Howto. 20Please look at the Sync Howto.
21 21
22Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly.
23Please disable Fastload for the original contact/calendar applications
24and close them.
25KO/Pi and KA/Pi must be running in order to receive the data.
26(KO/Pi and KA/Pi are always running if Fastload for them is enabled!)
27
22 28
23********** VERSION 1.9.6 ************ 29********** VERSION 1.9.6 ************
24 30
25Changes in the external application communication on the Zaurus 31Changes in the external application communication on the Zaurus
26in order to use less RAM when the apps are running. 32in order to use less RAM when the apps are running.
27First syncing of addressbooks (KA/Pi) is possible. 33First syncing of addressbooks (KA/Pi) is possible.
28 34
29 35
30********** VERSION 1.9.5a ************ 36********** VERSION 1.9.5a ************
31 37
32Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. 38Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5.
33Fixed some small bugs. 39Fixed some small bugs.
34KA/Pi shows now the birthday in summary view. 40KA/Pi shows now the birthday in summary view.
35Now OM/Pi and KA/Pi are using the date format defined in KO/Pi 41Now OM/Pi and KA/Pi are using the date format defined in KO/Pi
36for displaying dates. 42for displaying dates.
37 43
38 44
39********** VERSION 1.9.5 ************ 45********** VERSION 1.9.5 ************
40 46
41There is still no Addressbook syncing! 47There is still no Addressbook syncing!
42 48
43New in 1.9.5: 49New in 1.9.5:
44 50
45Many bugfixes. 51Many bugfixes.
46Better searching in KA/Pi. 52Better searching in KA/Pi.
47You can configure in KA/Pi if you want to search only after 53You can configure in KA/Pi if you want to search only after
48<return> key pressed. 54<return> key pressed.
49 55
50Better mail downloading in OM/Pi. 56Better mail downloading in OM/Pi.
51 57
52First experimental alpha version of sync of KO/Pi with mobile phones. 58First experimental alpha version of sync of KO/Pi with mobile phones.
53See gammu documentation for supported phones. 59See gammu documentation for supported phones.
54You need to install the package kammu_1.9.5_arm.ipk for sync of KO/Pi with mobile phones. kammu_1.9.5_arm.ipk needs libbluetooth and libsdp. 60You need to install the package kammu_1.9.5_arm.ipk for sync of KO/Pi with mobile phones. kammu_1.9.5_arm.ipk needs libbluetooth and libsdp.
55Quick hint how to use: 61Quick hint how to use:
56NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! 62NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL!
57Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. 63Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp.
58Create syncprofile - mobile device 64Create syncprofile - mobile device
59Remove entry for model. (Leave empty ). 65Remove entry for model. (Leave empty ).
60Enable infrared on Zaurus and your Phone. 66Enable infrared on Zaurus and your Phone.
61Sync. 67Sync.
62To get a more detailed log, start kopi from konsole. 68To get a more detailed log, start kopi from konsole.
63 69
64********** VERSION 1.9.4 ************ 70********** VERSION 1.9.4 ************
65 71
66This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. 72This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus.
67 73
68WARNING: 74WARNING:
69PLEASE BACKUP ALL YOUR DATA! 75PLEASE BACKUP ALL YOUR DATA!
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index dc3cda1..bf6d053 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -357,112 +357,120 @@ bool AddressBook::load()
357 QString id = (*addrIt).custom( "KADDRESSBOOK", "X-ExternalID" ); 357 QString id = (*addrIt).custom( "KADDRESSBOOK", "X-ExternalID" );
358 if ( !id.isEmpty() ) { 358 if ( !id.isEmpty() ) {
359 //qDebug("setId aa %s ", id.latin1()); 359 //qDebug("setId aa %s ", id.latin1());
360 (*addrIt).setIDStr(id ); 360 (*addrIt).setIDStr(id );
361 } 361 }
362 } 362 }
363 blockLSEchange = true; 363 blockLSEchange = true;
364 return ok; 364 return ok;
365} 365}
366 366
367bool AddressBook::save( Ticket *ticket ) 367bool AddressBook::save( Ticket *ticket )
368{ 368{
369 kdDebug(5700) << "AddressBook::save()"<< endl; 369 kdDebug(5700) << "AddressBook::save()"<< endl;
370 370
371 if ( ticket->resource() ) { 371 if ( ticket->resource() ) {
372 deleteRemovedAddressees(); 372 deleteRemovedAddressees();
373 return ticket->resource()->save( ticket ); 373 return ticket->resource()->save( ticket );
374 } 374 }
375 375
376 return false; 376 return false;
377} 377}
378void AddressBook::export2File( QString fileName ) 378void AddressBook::export2File( QString fileName )
379{ 379{
380 380
381 QFile outFile( fileName ); 381 QFile outFile( fileName );
382 if ( !outFile.open( IO_WriteOnly ) ) { 382 if ( !outFile.open( IO_WriteOnly ) ) {
383 QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" ); 383 QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" );
384 KMessageBox::error( 0, text.arg( fileName ) ); 384 KMessageBox::error( 0, text.arg( fileName ) );
385 return ; 385 return ;
386 } 386 }
387 QTextStream t( &outFile ); 387 QTextStream t( &outFile );
388 t.setEncoding( QTextStream::UnicodeUTF8 ); 388 t.setEncoding( QTextStream::UnicodeUTF8 );
389 Iterator it; 389 Iterator it;
390 KABC::VCardConverter::Version version; 390 KABC::VCardConverter::Version version;
391 version = KABC::VCardConverter::v3_0; 391 version = KABC::VCardConverter::v3_0;
392 for ( it = begin(); it != end(); ++it ) { 392 for ( it = begin(); it != end(); ++it ) {
393 if ( !(*it).IDStr().isEmpty() ) { 393 if ( !(*it).IDStr().isEmpty() ) {
394 (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); 394 (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() );
395 } 395 }
396 KABC::VCardConverter converter; 396 KABC::VCardConverter converter;
397 QString vcard; 397 QString vcard;
398 //Resource *resource() const; 398 //Resource *resource() const;
399 converter.addresseeToVCard( *it, vcard, version ); 399 converter.addresseeToVCard( *it, vcard, version );
400 t << vcard << "\r\n"; 400 t << vcard << "\r\n";
401 } 401 }
402 t << "\r\n\r\n"; 402 t << "\r\n\r\n";
403 outFile.close(); 403 outFile.close();
404} 404}
405void AddressBook::importFromFile( QString fileName ) 405void AddressBook::importFromFile( QString fileName, bool replaceLabel )
406{ 406{
407 407
408 KABC::Addressee::List list; 408 KABC::Addressee::List list;
409 QFile file( fileName ); 409 QFile file( fileName );
410 410
411 file.open( IO_ReadOnly ); 411 file.open( IO_ReadOnly );
412 QByteArray rawData = file.readAll(); 412 QByteArray rawData = file.readAll();
413 file.close(); 413 file.close();
414 414 qDebug("AddressBook::importFromFile ");
415 QString data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); 415 QString data;
416 if ( replaceLabel ) {
417 data = QString::fromLatin1( rawData.data(), rawData.size() + 1 );
418 data.replace ( QRegExp("LABEL") , "ADR" );
419 data.replace ( QRegExp("CHARSET=ISO-8859-1") , "" );
420 } else
421 data = QString::fromUtf8( rawData.data(), rawData.size() + 1 );
416 KABC::VCardTool tool; 422 KABC::VCardTool tool;
417 list = tool.parseVCards( data ); 423 list = tool.parseVCards( data );
418 KABC::Addressee::List::Iterator it; 424 KABC::Addressee::List::Iterator it;
419 for ( it = list.begin(); it != list.end(); ++it ) { 425 for ( it = list.begin(); it != list.end(); ++it ) {
420 (*it).setResource( 0 ); 426 (*it).setResource( 0 );
427 if ( replaceLabel )
428 (*it).removeVoice();
421 insertAddressee( (*it), false, true ); 429 insertAddressee( (*it), false, true );
422 } 430 }
423 431
424} 432}
425 433
426bool AddressBook::saveAB() 434bool AddressBook::saveAB()
427{ 435{
428 bool ok = true; 436 bool ok = true;
429 437
430 deleteRemovedAddressees(); 438 deleteRemovedAddressees();
431 Iterator ait; 439 Iterator ait;
432 for ( ait = begin(); ait != end(); ++ait ) { 440 for ( ait = begin(); ait != end(); ++ait ) {
433 if ( !(*ait).IDStr().isEmpty() ) { 441 if ( !(*ait).IDStr().isEmpty() ) {
434 (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() ); 442 (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() );
435 } 443 }
436 } 444 }
437 KRES::Manager<Resource>::ActiveIterator it; 445 KRES::Manager<Resource>::ActiveIterator it;
438 KRES::Manager<Resource> *manager = d->mManager; 446 KRES::Manager<Resource> *manager = d->mManager;
439 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { 447 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
440 if ( !(*it)->readOnly() && (*it)->isOpen() ) { 448 if ( !(*it)->readOnly() && (*it)->isOpen() ) {
441 Ticket *ticket = requestSaveTicket( *it ); 449 Ticket *ticket = requestSaveTicket( *it );
442// qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); 450// qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() );
443 if ( !ticket ) { 451 if ( !ticket ) {
444 error( i18n( "Unable to save to resource '%1'. It is locked." ) 452 error( i18n( "Unable to save to resource '%1'. It is locked." )
445 .arg( (*it)->resourceName() ) ); 453 .arg( (*it)->resourceName() ) );
446 return false; 454 return false;
447 } 455 }
448 456
449 //if ( !save( ticket ) ) 457 //if ( !save( ticket ) )
450 if ( ticket->resource() ) { 458 if ( ticket->resource() ) {
451 if ( ! ticket->resource()->save( ticket ) ) 459 if ( ! ticket->resource()->save( ticket ) )
452 ok = false; 460 ok = false;
453 } else 461 } else
454 ok = false; 462 ok = false;
455 463
456 } 464 }
457 } 465 }
458 return ok; 466 return ok;
459} 467}
460 468
461AddressBook::Iterator AddressBook::begin() 469AddressBook::Iterator AddressBook::begin()
462{ 470{
463 Iterator it = Iterator(); 471 Iterator it = Iterator();
464 it.d->mIt = d->mAddressees.begin(); 472 it.d->mIt = d->mAddressees.begin();
465 return it; 473 return it;
466} 474}
467 475
468AddressBook::ConstIterator AddressBook::begin() const 476AddressBook::ConstIterator AddressBook::begin() const
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index 3603ec1..cea1b03 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -98,97 +98,97 @@ class AddressBook : public QObject
98 ConstIterator &operator=( const ConstIterator & ); 98 ConstIterator &operator=( const ConstIterator & );
99 const Addressee &operator*() const; 99 const Addressee &operator*() const;
100 const Addressee* operator->() const; 100 const Addressee* operator->() const;
101 ConstIterator &operator++(); 101 ConstIterator &operator++();
102 ConstIterator &operator++(int); 102 ConstIterator &operator++(int);
103 ConstIterator &operator--(); 103 ConstIterator &operator--();
104 ConstIterator &operator--(int); 104 ConstIterator &operator--(int);
105 bool operator==( const ConstIterator &it ); 105 bool operator==( const ConstIterator &it );
106 bool operator!=( const ConstIterator &it ); 106 bool operator!=( const ConstIterator &it );
107 107
108 struct ConstIteratorData; 108 struct ConstIteratorData;
109 ConstIteratorData *d; 109 ConstIteratorData *d;
110 }; 110 };
111 111
112 /** 112 /**
113 Constructs a address book object. 113 Constructs a address book object.
114 114
115 @param format File format class. 115 @param format File format class.
116 */ 116 */
117 AddressBook(); 117 AddressBook();
118 AddressBook( const QString &config ); 118 AddressBook( const QString &config );
119 AddressBook( const QString &config, const QString &family ); 119 AddressBook( const QString &config, const QString &family );
120 virtual ~AddressBook(); 120 virtual ~AddressBook();
121 121
122 /** 122 /**
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 void export2File( QString fileName ); 145 void export2File( QString fileName );
146 void importFromFile( QString fileName ); 146 void importFromFile( QString fileName, bool replaceLabel = false );
147 /** 147 /**
148 Returns a iterator for first entry of address book. 148 Returns a iterator for first entry of address book.
149 */ 149 */
150 Iterator begin(); 150 Iterator begin();
151 151
152 /** 152 /**
153 Returns a const iterator for first entry of address book. 153 Returns a const iterator for first entry of address book.
154 */ 154 */
155 ConstIterator begin() const; 155 ConstIterator begin() const;
156 156
157 /** 157 /**
158 Returns a iterator for first entry of address book. 158 Returns a iterator for first entry of address book.
159 */ 159 */
160 Iterator end(); 160 Iterator end();
161 161
162 /** 162 /**
163 Returns a const iterator for first entry of address book. 163 Returns a const iterator for first entry of address book.
164 */ 164 */
165 ConstIterator end() const; 165 ConstIterator end() const;
166 166
167 /** 167 /**
168 Removes all entries from address book. 168 Removes all entries from address book.
169 */ 169 */
170 void clear(); 170 void clear();
171 171
172 /** 172 /**
173 Insert an Addressee object into address book. If an object with the same 173 Insert an Addressee object into address book. If an object with the same
174 unique id already exists in the address book it it replaced by the new 174 unique id already exists in the address book it it replaced by the new
175 one. If not the new object is appended to the address book. 175 one. If not the new object is appended to the address book.
176 */ 176 */
177 void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false); 177 void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false);
178 178
179 /** 179 /**
180 Removes entry from the address book. 180 Removes entry from the address book.
181 */ 181 */
182 void removeAddressee( const Addressee & ); 182 void removeAddressee( const Addressee & );
183 183
184 /** 184 /**
185 This is like @ref removeAddressee() just above, with the difference that 185 This is like @ref removeAddressee() just above, with the difference that
186 the first element is a iterator, returned by @ref begin(). 186 the first element is a iterator, returned by @ref begin().
187 */ 187 */
188 void removeAddressee( const Iterator & ); 188 void removeAddressee( const Iterator & );
189 189
190 /** 190 /**
191 Find the specified entry in address book. Returns end(), if the entry 191 Find the specified entry in address book. Returns end(), if the entry
192 couldn't be found. 192 couldn't be found.
193 */ 193 */
194 Iterator find( const Addressee & ); 194 Iterator find( const Addressee & );
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 19a1845..3f3d5c0 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -270,96 +270,113 @@ void Addressee::computeCsum(const QString &dev)
270 t.sort(); 270 t.sort();
271 for ( iii = 0; iii < t.count(); ++iii) 271 for ( iii = 0; iii < t.count(); ++iii)
272 l.append( t[iii] ); 272 l.append( t[iii] );
273 } 273 }
274 uint cs = getCsum4List(l); 274 uint cs = getCsum4List(l);
275 // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); 275 // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() );
276 setCsum( dev, QString::number (cs )); 276 setCsum( dev, QString::number (cs ));
277} 277}
278 278
279void Addressee::mergeContact( const Addressee& ad ) 279void Addressee::mergeContact( const Addressee& ad )
280{ 280{
281 281
282 detach(); 282 detach();
283 if ( mData->name.isEmpty() ) mData->name = ad.mData->name; 283 if ( mData->name.isEmpty() ) mData->name = ad.mData->name;
284 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; 284 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
285 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; 285 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName;
286 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; 286 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ;
287 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; 287 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName;
288 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; 288 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix;
289 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; 289 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix;
290 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; 290 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName;
291 if ( !mData->birthday.isValid() ) 291 if ( !mData->birthday.isValid() )
292 if ( ad.mData->birthday.isValid()) 292 if ( ad.mData->birthday.isValid())
293 mData->birthday = ad.mData->birthday; 293 mData->birthday = ad.mData->birthday;
294 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; 294 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
295 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; 295 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
296 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; 296 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
297 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; 297 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ;
298 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; 298 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ;
299 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; 299 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ;
300 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; 300 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ;
301 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; 301 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId;
302 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; 302 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString;
303 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; 303 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy;
304 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; 304 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ;
305 305
306 // pending: 306 // pending:
307 // merging phonenumbers 307 // merging phonenumbers
308 // merging addresses 308 // merging addresses
309 // merging emails; 309 // merging emails;
310 // merging categories; 310 // merging categories;
311 // merging custom; 311 // merging custom;
312 // merging keys 312 // merging keys
313 qDebug("merge contact %s ", ad.uid().latin1()); 313 qDebug("merge contact %s ", ad.uid().latin1());
314 setUid( ad.uid() ); 314 setUid( ad.uid() );
315 setRevision( ad.revision() ); 315 setRevision( ad.revision() );
316} 316}
317 317
318bool Addressee::removeVoice()
319{
320 PhoneNumber::List phoneN = phoneNumbers();
321 PhoneNumber::List::Iterator phoneIt;
322 bool found = false;
323 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) {
324 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
325 if ((*phoneIt).type() - PhoneNumber::Voice ) {
326 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
327 insertPhoneNumber( (*phoneIt) );
328 found = true;
329 }
330 }
331
332 }
333 return found;
334}
318void Addressee::simplifyAddresses() 335void Addressee::simplifyAddresses()
319{ 336{
320 if ( mData->addresses.count() < 3 ) return ; 337 if ( mData->addresses.count() < 3 ) return ;
321 int count = 0; 338 int count = 0;
322 Address::List list; 339 Address::List list;
323 Address::List::Iterator it; 340 Address::List::Iterator it;
324 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { 341 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
325 if ( count > 1 ) 342 if ( count > 1 )
326 list.append( *it ); 343 list.append( *it );
327 ++count; 344 ++count;
328 } 345 }
329 for( it = list.begin(); it != list.end(); ++it ) { 346 for( it = list.begin(); it != list.end(); ++it ) {
330 removeAddress( (*it) ); 347 removeAddress( (*it) );
331 } 348 }
332} 349}
333 350
334// removes all emails but the first 351// removes all emails but the first
335// needed by phone sync 352// needed by phone sync
336void Addressee::simplifyEmails() 353void Addressee::simplifyEmails()
337{ 354{
338 if ( mData->emails.count() == 0 ) return ; 355 if ( mData->emails.count() == 0 ) return ;
339 QString email = mData->emails.first(); 356 QString email = mData->emails.first();
340 detach(); 357 detach();
341 mData->emails.clear(); 358 mData->emails.clear();
342 mData->emails.append( email ); 359 mData->emails.append( email );
343} 360}
344 361
345void Addressee::simplifyPhoneNumbers() 362void Addressee::simplifyPhoneNumbers()
346{ 363{
347 KABC::PhoneNumber::List removeNumbers; 364 KABC::PhoneNumber::List removeNumbers;
348 KABC::PhoneNumber::List::Iterator phoneIter; 365 KABC::PhoneNumber::List::Iterator phoneIter;
349 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 366 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
350 ++phoneIter ) { 367 ++phoneIter ) {
351 if ( ! ( *phoneIter ).simplifyNumber() ) 368 if ( ! ( *phoneIter ).simplifyNumber() )
352 removeNumbers.append( ( *phoneIter ) ); 369 removeNumbers.append( ( *phoneIter ) );
353 } 370 }
354 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); 371 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end();
355 ++phoneIter ) { 372 ++phoneIter ) {
356 removePhoneNumber(( *phoneIter )); 373 removePhoneNumber(( *phoneIter ));
357 } 374 }
358} 375}
359void Addressee::simplifyPhoneNumberTypes() 376void Addressee::simplifyPhoneNumberTypes()
360{ 377{
361 KABC::PhoneNumber::List::Iterator phoneIter; 378 KABC::PhoneNumber::List::Iterator phoneIter;
362 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 379 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
363 ++phoneIter ) 380 ++phoneIter )
364 ( *phoneIter ).simplifyType(); 381 ( *phoneIter ).simplifyType();
365} 382}
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 44f0629..9336edc 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -76,96 +76,97 @@ class Resource;
76 76
77 name() is the NAME type of RFC2426. It can be used as internal name for the 77 name() is the NAME type of RFC2426. It can be used as internal name for the
78 data enty, but shouldn't be used for displaying the data to the user. 78 data enty, but shouldn't be used for displaying the data to the user.
79 */ 79 */
80class Addressee 80class Addressee
81{ 81{
82 friend QDataStream &operator<<( QDataStream &, const Addressee & ); 82 friend QDataStream &operator<<( QDataStream &, const Addressee & );
83 friend QDataStream &operator>>( QDataStream &, Addressee & ); 83 friend QDataStream &operator>>( QDataStream &, Addressee & );
84 84
85 public: 85 public:
86 typedef QValueList<Addressee> List; 86 typedef QValueList<Addressee> List;
87 87
88 /** 88 /**
89 Construct an empty address book entry. 89 Construct an empty address book entry.
90 */ 90 */
91 Addressee(); 91 Addressee();
92 ~Addressee(); 92 ~Addressee();
93 93
94 Addressee( const Addressee & ); 94 Addressee( const Addressee & );
95 Addressee &operator=( const Addressee & ); 95 Addressee &operator=( const Addressee & );
96 96
97 bool operator==( const Addressee & ) const; 97 bool operator==( const Addressee & ) const;
98 bool operator!=( const Addressee & ) const; 98 bool operator!=( const Addressee & ) const;
99 // sync stuff 99 // sync stuff
100 void setTempSyncStat(int id); 100 void setTempSyncStat(int id);
101 int tempSyncStat() const; 101 int tempSyncStat() const;
102 void setIDStr( const QString & ); 102 void setIDStr( const QString & );
103 QString IDStr() const; 103 QString IDStr() const;
104 void setID( const QString &, const QString & ); 104 void setID( const QString &, const QString & );
105 QString getID( const QString & ); 105 QString getID( const QString & );
106 void setCsum( const QString &, const QString & ); 106 void setCsum( const QString &, const QString & );
107 QString getCsum( const QString & ); 107 QString getCsum( const QString & );
108 void removeID(const QString &); 108 void removeID(const QString &);
109 void computeCsum(const QString &dev); 109 void computeCsum(const QString &dev);
110 ulong getCsum4List( const QStringList & attList); 110 ulong getCsum4List( const QStringList & attList);
111 /** 111 /**
112 Return, if the address book entry is empty. 112 Return, if the address book entry is empty.
113 */ 113 */
114 bool isEmpty() const; 114 bool isEmpty() const;
115 void setExternalUID( const QString &id ); 115 void setExternalUID( const QString &id );
116 QString externalUID() const; 116 QString externalUID() const;
117 void setOriginalExternalUID( const QString &id ); 117 void setOriginalExternalUID( const QString &id );
118 QString originalExternalUID() const; 118 QString originalExternalUID() const;
119 void mergeContact( const Addressee& ad ); 119 void mergeContact( const Addressee& ad );
120 void simplifyEmails(); 120 void simplifyEmails();
121 void simplifyAddresses(); 121 void simplifyAddresses();
122 void simplifyPhoneNumbers(); 122 void simplifyPhoneNumbers();
123 void simplifyPhoneNumberTypes(); 123 void simplifyPhoneNumberTypes();
124 bool removeVoice();
124 125
125 /** 126 /**
126 Set unique identifier. 127 Set unique identifier.
127 */ 128 */
128 void setUid( const QString &uid ); 129 void setUid( const QString &uid );
129 /** 130 /**
130 Return unique identifier. 131 Return unique identifier.
131 */ 132 */
132 QString uid() const; 133 QString uid() const;
133 /** 134 /**
134 Return translated label for uid field. 135 Return translated label for uid field.
135 */ 136 */
136 static QString uidLabel(); 137 static QString uidLabel();
137 138
138 /** 139 /**
139 Set name. 140 Set name.
140 */ 141 */
141 void setName( const QString &name ); 142 void setName( const QString &name );
142 /** 143 /**
143 Return name. 144 Return name.
144 */ 145 */
145 QString name() const; 146 QString name() const;
146 /** 147 /**
147 Return translated label for name field. 148 Return translated label for name field.
148 */ 149 */
149 static QString nameLabel(); 150 static QString nameLabel();
150 151
151 /** 152 /**
152 Set formatted name. 153 Set formatted name.
153 */ 154 */
154 void setFormattedName( const QString &formattedName ); 155 void setFormattedName( const QString &formattedName );
155 /** 156 /**
156 Return formatted name. 157 Return formatted name.
157 */ 158 */
158 QString formattedName() const; 159 QString formattedName() const;
159 /** 160 /**
160 Return translated label for formattedName field. 161 Return translated label for formattedName field.
161 */ 162 */
162 static QString formattedNameLabel(); 163 static QString formattedNameLabel();
163 164
164 /** 165 /**
165 Set family name. 166 Set family name.
166 */ 167 */
167 void setFamilyName( const QString &familyName ); 168 void setFamilyName( const QString &familyName );
168 /** 169 /**
169 Return family name. 170 Return family name.
170 */ 171 */
171 QString familyName() const; 172 QString familyName() const;
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 9b059d3..3a542ba 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -280,96 +280,102 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
280 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 280 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
281 281
282 connect( mXXPortManager, SIGNAL( modified() ), 282 connect( mXXPortManager, SIGNAL( modified() ),
283 SLOT( setModified() ) ); 283 SLOT( setModified() ) );
284 284
285 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 285 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
286 SLOT( incrementalSearch( const QString& ) ) ); 286 SLOT( incrementalSearch( const QString& ) ) );
287 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 287 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
288 mJumpButtonBar, SLOT( recreateButtons() ) ); 288 mJumpButtonBar, SLOT( recreateButtons() ) );
289 289
290 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 290 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
291 SLOT( sendMail( const QString& ) ) ); 291 SLOT( sendMail( const QString& ) ) );
292 292
293 293
294 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 294 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
295 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); 295 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)));
296 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 296 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
297 297
298 298
299#ifndef KAB_EMBEDDED 299#ifndef KAB_EMBEDDED
300 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 300 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
301 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 301 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
302 302
303 connect( mDetails, SIGNAL( browse( const QString& ) ), 303 connect( mDetails, SIGNAL( browse( const QString& ) ),
304 SLOT( browse( const QString& ) ) ); 304 SLOT( browse( const QString& ) ) );
305 305
306 306
307 mAddressBookService = new KAddressBookService( this ); 307 mAddressBookService = new KAddressBookService( this );
308 308
309#endif //KAB_EMBEDDED 309#endif //KAB_EMBEDDED
310 mEditorDialog = 0; 310 mEditorDialog = 0;
311 createAddresseeEditorDialog( this ); 311 createAddresseeEditorDialog( this );
312 setModified( false ); 312 setModified( false );
313} 313}
314 314
315KABCore::~KABCore() 315KABCore::~KABCore()
316{ 316{
317 // save(); 317 // save();
318 //saveSettings(); 318 //saveSettings();
319 //KABPrefs::instance()->writeConfig(); 319 //KABPrefs::instance()->writeConfig();
320 delete AddresseeConfig::instance(); 320 delete AddresseeConfig::instance();
321 mAddressBook = 0; 321 mAddressBook = 0;
322 KABC::StdAddressBook::close(); 322 KABC::StdAddressBook::close();
323 323
324 delete syncManager; 324 delete syncManager;
325 325
326} 326}
327 327
328void KABCore::recieve( QString fn )
329{
330 qDebug("KABCore::recieve ");
331 mAddressBook->importFromFile( fn, true );
332 topLevelWidget()->raise();
333}
328void KABCore::restoreSettings() 334void KABCore::restoreSettings()
329{ 335{
330 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 336 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
331 337
332 bool state; 338 bool state;
333 339
334 if (mMultipleViewsAtOnce) 340 if (mMultipleViewsAtOnce)
335 state = KABPrefs::instance()->mDetailsPageVisible; 341 state = KABPrefs::instance()->mDetailsPageVisible;
336 else 342 else
337 state = false; 343 state = false;
338 344
339 mActionDetails->setChecked( state ); 345 mActionDetails->setChecked( state );
340 setDetailsVisible( state ); 346 setDetailsVisible( state );
341 347
342 state = KABPrefs::instance()->mJumpButtonBarVisible; 348 state = KABPrefs::instance()->mJumpButtonBarVisible;
343 349
344 mActionJumpBar->setChecked( state ); 350 mActionJumpBar->setChecked( state );
345 setJumpButtonBarVisible( state ); 351 setJumpButtonBarVisible( state );
346/*US 352/*US
347 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 353 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
348 if ( splitterSize.count() == 0 ) { 354 if ( splitterSize.count() == 0 ) {
349 splitterSize.append( width() / 2 ); 355 splitterSize.append( width() / 2 );
350 splitterSize.append( width() / 2 ); 356 splitterSize.append( width() / 2 );
351 } 357 }
352 mMiniSplitter->setSizes( splitterSize ); 358 mMiniSplitter->setSizes( splitterSize );
353 if ( mExtensionBarSplitter ) { 359 if ( mExtensionBarSplitter ) {
354 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 360 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
355 if ( splitterSize.count() == 0 ) { 361 if ( splitterSize.count() == 0 ) {
356 splitterSize.append( width() / 2 ); 362 splitterSize.append( width() / 2 );
357 splitterSize.append( width() / 2 ); 363 splitterSize.append( width() / 2 );
358 } 364 }
359 mExtensionBarSplitter->setSizes( splitterSize ); 365 mExtensionBarSplitter->setSizes( splitterSize );
360 366
361 } 367 }
362*/ 368*/
363 mViewManager->restoreSettings(); 369 mViewManager->restoreSettings();
364 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 370 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
365 mExtensionManager->restoreSettings(); 371 mExtensionManager->restoreSettings();
366#ifdef DESKTOP_VERSION 372#ifdef DESKTOP_VERSION
367 int wid = width(); 373 int wid = width();
368 if ( wid < 10 ) 374 if ( wid < 10 )
369 wid = 400; 375 wid = 400;
370#else 376#else
371 int wid = QApplication::desktop()->width(); 377 int wid = QApplication::desktop()->width();
372 if ( wid < 640 ) 378 if ( wid < 640 )
373 wid = QApplication::desktop()->height(); 379 wid = QApplication::desktop()->height();
374#endif 380#endif
375 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 381 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
@@ -2041,110 +2047,98 @@ void KABCore::addActionsManually()
2041 mActionAboutKAddressbook->plug( helpMenu ); 2047 mActionAboutKAddressbook->plug( helpMenu );
2042 2048
2043 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2049 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2044 2050
2045 mActionSave->plug( tb ); 2051 mActionSave->plug( tb );
2046 mViewManager->getFilterAction()->plug ( tb); 2052 mViewManager->getFilterAction()->plug ( tb);
2047 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 2053 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
2048 mActionUndo->plug( tb ); 2054 mActionUndo->plug( tb );
2049 mActionDelete->plug( tb ); 2055 mActionDelete->plug( tb );
2050 mActionRedo->plug( tb ); 2056 mActionRedo->plug( tb );
2051 } 2057 }
2052 } 2058 }
2053 //mActionQuit->plug ( tb ); 2059 //mActionQuit->plug ( tb );
2054 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2060 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2055 2061
2056 //US link the searchwidget first to this. 2062 //US link the searchwidget first to this.
2057 // The real linkage to the toolbar happens later. 2063 // The real linkage to the toolbar happens later.
2058//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2064//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2059//US tb->insertItem( mIncSearchWidget ); 2065//US tb->insertItem( mIncSearchWidget );
2060/*US 2066/*US
2061 mIncSearchWidget = new IncSearchWidget( tb ); 2067 mIncSearchWidget = new IncSearchWidget( tb );
2062 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2068 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2063 SLOT( incrementalSearch( const QString& ) ) ); 2069 SLOT( incrementalSearch( const QString& ) ) );
2064 2070
2065 mJumpButtonBar = new JumpButtonBar( this, this ); 2071 mJumpButtonBar = new JumpButtonBar( this, this );
2066 2072
2067//US topLayout->addWidget( mJumpButtonBar ); 2073//US topLayout->addWidget( mJumpButtonBar );
2068 this->layout()->add( mJumpButtonBar ); 2074 this->layout()->add( mJumpButtonBar );
2069*/ 2075*/
2070 2076
2071#endif //KAB_EMBEDDED 2077#endif //KAB_EMBEDDED
2072 2078
2073 mActionExport2phone->plug( ExportMenu ); 2079 mActionExport2phone->plug( ExportMenu );
2074 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2080 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2075 syncManager->fillSyncMenu(); 2081 syncManager->fillSyncMenu();
2076 2082
2077} 2083}
2078void KABCore::showLicence() 2084void KABCore::showLicence()
2079{ 2085{
2080 KApplication::showLicence(); 2086 KApplication::showLicence();
2081} 2087}
2082void KABCore::removeVoice() 2088void KABCore::removeVoice()
2083{ 2089{
2084 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) 2090 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
2085 return; 2091 return;
2086 KABC::Addressee::List list = mViewManager->selectedAddressees(); 2092 KABC::Addressee::List list = mViewManager->selectedAddressees();
2087 KABC::Addressee::List::Iterator it; 2093 KABC::Addressee::List::Iterator it;
2088 for ( it = list.begin(); it != list.end(); ++it ) { 2094 for ( it = list.begin(); it != list.end(); ++it ) {
2089 PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); 2095
2090 PhoneNumber::List::Iterator phoneIt; 2096 if ( (*it).removeVoice() )
2091 bool found = false;
2092 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
2093 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
2094 if ((*phoneIt).type() - PhoneNumber::Voice ) {
2095 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
2096 (*it).insertPhoneNumber( (*phoneIt) );
2097 found = true;
2098 }
2099 }
2100
2101 }
2102 if ( found )
2103 contactModified((*it) ); 2097 contactModified((*it) );
2104 } 2098 }
2105} 2099}
2106 2100
2107 2101
2108 2102
2109void KABCore::clipboardDataChanged() 2103void KABCore::clipboardDataChanged()
2110{ 2104{
2111 2105
2112 if ( mReadWrite ) 2106 if ( mReadWrite )
2113 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2107 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2114 2108
2115} 2109}
2116 2110
2117void KABCore::updateActionMenu() 2111void KABCore::updateActionMenu()
2118{ 2112{
2119 UndoStack *undo = UndoStack::instance(); 2113 UndoStack *undo = UndoStack::instance();
2120 RedoStack *redo = RedoStack::instance(); 2114 RedoStack *redo = RedoStack::instance();
2121 2115
2122 if ( undo->isEmpty() ) 2116 if ( undo->isEmpty() )
2123 mActionUndo->setText( i18n( "Undo" ) ); 2117 mActionUndo->setText( i18n( "Undo" ) );
2124 else 2118 else
2125 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2119 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2126 2120
2127 mActionUndo->setEnabled( !undo->isEmpty() ); 2121 mActionUndo->setEnabled( !undo->isEmpty() );
2128 2122
2129 if ( !redo->top() ) 2123 if ( !redo->top() )
2130 mActionRedo->setText( i18n( "Redo" ) ); 2124 mActionRedo->setText( i18n( "Redo" ) );
2131 else 2125 else
2132 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2126 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2133 2127
2134 mActionRedo->setEnabled( !redo->isEmpty() ); 2128 mActionRedo->setEnabled( !redo->isEmpty() );
2135} 2129}
2136 2130
2137void KABCore::configureKeyBindings() 2131void KABCore::configureKeyBindings()
2138{ 2132{
2139#ifndef KAB_EMBEDDED 2133#ifndef KAB_EMBEDDED
2140 KKeyDialog::configure( actionCollection(), true ); 2134 KKeyDialog::configure( actionCollection(), true );
2141#else //KAB_EMBEDDED 2135#else //KAB_EMBEDDED
2142 qDebug("KABCore::configureKeyBindings() not implemented"); 2136 qDebug("KABCore::configureKeyBindings() not implemented");
2143#endif //KAB_EMBEDDED 2137#endif //KAB_EMBEDDED
2144} 2138}
2145 2139
2146#ifdef KAB_EMBEDDED 2140#ifdef KAB_EMBEDDED
2147void KABCore::configureResources() 2141void KABCore::configureResources()
2148{ 2142{
2149 KRES::KCMKResources dlg( this, "" , 0 ); 2143 KRES::KCMKResources dlg( this, "" , 0 );
2150 2144
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index c628399..43c5f99 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -297,96 +297,97 @@ class KABCore : public QWidget, public KSyncInterface
297 Redos the last command that was undone, using the redo stack. 297 Redos the last command that was undone, using the redo stack.
298 */ 298 */
299 void redo(); 299 void redo();
300 300
301 /** 301 /**
302 Shows the edit dialog for the given uid. If the uid is QString::null, 302 Shows the edit dialog for the given uid. If the uid is QString::null,
303 the method will try to find a selected addressee in the view. 303 the method will try to find a selected addressee in the view.
304 */ 304 */
305 void editContact( const QString &uid /*US = QString::null*/ ); 305 void editContact( const QString &uid /*US = QString::null*/ );
306//US added a second method without defaultparameter 306//US added a second method without defaultparameter
307 void editContact2(); 307 void editContact2();
308 308
309 /** 309 /**
310 Shows or edits the detail view for the given uid. If the uid is QString::null, 310 Shows or edits the detail view for the given uid. If the uid is QString::null,
311 the method will try to find a selected addressee in the view. 311 the method will try to find a selected addressee in the view.
312 */ 312 */
313 void executeContact( const QString &uid /*US = QString::null*/ ); 313 void executeContact( const QString &uid /*US = QString::null*/ );
314 314
315 /** 315 /**
316 Launches the configuration dialog. 316 Launches the configuration dialog.
317 */ 317 */
318 void openConfigDialog(); 318 void openConfigDialog();
319 319
320 /** 320 /**
321 Launches the ldap search dialog. 321 Launches the ldap search dialog.
322 */ 322 */
323 void openLDAPDialog(); 323 void openLDAPDialog();
324 324
325 /** 325 /**
326 Creates a KAddressBookPrinter, which will display the print 326 Creates a KAddressBookPrinter, which will display the print
327 dialog and do the printing. 327 dialog and do the printing.
328 */ 328 */
329 void print(); 329 void print();
330 330
331 /** 331 /**
332 Registers a new GUI client, so plugins can register its actions. 332 Registers a new GUI client, so plugins can register its actions.
333 */ 333 */
334 void addGUIClient( KXMLGUIClient *client ); 334 void addGUIClient( KXMLGUIClient *client );
335 335
336 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 336 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
337 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 337 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
338 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 338 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
339 339
340 340
341 signals: 341 signals:
342 void contactSelected( const QString &name ); 342 void contactSelected( const QString &name );
343 void contactSelected( const QPixmap &pixmap ); 343 void contactSelected( const QPixmap &pixmap );
344 public slots: 344 public slots:
345 void recieve(QString cmsg );
345 void getFile( bool success ); 346 void getFile( bool success );
346 void syncFileRequest(); 347 void syncFileRequest();
347 void setDetailsVisible( bool visible ); 348 void setDetailsVisible( bool visible );
348 void setDetailsToState(); 349 void setDetailsToState();
349 // void slotSyncMenu( int ); 350 // void slotSyncMenu( int );
350 private slots: 351 private slots:
351 void setJumpButtonBarVisible( bool visible ); 352 void setJumpButtonBarVisible( bool visible );
352 void setCaptionBack(); 353 void setCaptionBack();
353 void importFromOL(); 354 void importFromOL();
354 void extensionModified( const KABC::Addressee::List &list ); 355 void extensionModified( const KABC::Addressee::List &list );
355 void extensionChanged( int id ); 356 void extensionChanged( int id );
356 void clipboardDataChanged(); 357 void clipboardDataChanged();
357 void updateActionMenu(); 358 void updateActionMenu();
358 void configureKeyBindings(); 359 void configureKeyBindings();
359 void removeVoice(); 360 void removeVoice();
360#ifdef KAB_EMBEDDED 361#ifdef KAB_EMBEDDED
361 void configureResources(); 362 void configureResources();
362#endif //KAB_EMBEDDED 363#endif //KAB_EMBEDDED
363 364
364 void slotEditorDestroyed( const QString &uid ); 365 void slotEditorDestroyed( const QString &uid );
365 void configurationChanged(); 366 void configurationChanged();
366 void addressBookChanged(); 367 void addressBookChanged();
367 368
368 private: 369 private:
369 void initGUI(); 370 void initGUI();
370 void initActions(); 371 void initActions();
371 372
372 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 373 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
373 const char *name = 0 ); 374 const char *name = 0 );
374 375
375 KXMLGUIClient *mGUIClient; 376 KXMLGUIClient *mGUIClient;
376 377
377 KABC::AddressBook *mAddressBook; 378 KABC::AddressBook *mAddressBook;
378 379
379 ViewManager *mViewManager; 380 ViewManager *mViewManager;
380 // QSplitter *mDetailsSplitter; 381 // QSplitter *mDetailsSplitter;
381 KDGanttMinimizeSplitter *mExtensionBarSplitter; 382 KDGanttMinimizeSplitter *mExtensionBarSplitter;
382 ViewContainer *mDetails; 383 ViewContainer *mDetails;
383 KDGanttMinimizeSplitter* mMiniSplitter; 384 KDGanttMinimizeSplitter* mMiniSplitter;
384 XXPortManager *mXXPortManager; 385 XXPortManager *mXXPortManager;
385 JumpButtonBar *mJumpButtonBar; 386 JumpButtonBar *mJumpButtonBar;
386 IncSearchWidget *mIncSearchWidget; 387 IncSearchWidget *mIncSearchWidget;
387 ExtensionManager *mExtensionManager; 388 ExtensionManager *mExtensionManager;
388 389
389 KCMultiDialog *mConfigureDialog; 390 KCMultiDialog *mConfigureDialog;
390 391
391#ifndef KAB_EMBEDDED 392#ifndef KAB_EMBEDDED
392 LDAPSearchDialog *mLdapSearchDialog; 393 LDAPSearchDialog *mLdapSearchDialog;
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp
index f48f214..8c4ca09 100644
--- a/kaddressbook/kaddressbookmain.cpp
+++ b/kaddressbook/kaddressbookmain.cpp
@@ -47,97 +47,107 @@ KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainW
47//MOC_SKIP_END 47//MOC_SKIP_END
48#endif //KAB_EMBEDDED 48#endif //KAB_EMBEDDED
49{ 49{
50 50
51 setIcon(SmallIcon( "ka24" ) ); 51 setIcon(SmallIcon( "ka24" ) );
52#if 0 52#if 0
53 //US for embedded systems, create the toolbar before we initiate KABCore. 53 //US for embedded systems, create the toolbar before we initiate KABCore.
54 // KABCore will fill the toolbar with menues and icons 54 // KABCore will fill the toolbar with menues and icons
55 QMainWindow::ToolBarDock tbd; 55 QMainWindow::ToolBarDock tbd;
56 tbd = Top; 56 tbd = Top;
57 iconToolBar = new QToolBar( this ); 57 iconToolBar = new QToolBar( this );
58 addToolBar (iconToolBar , tbd ); 58 addToolBar (iconToolBar , tbd );
59 iconToolBar->setHorizontalStretchable(true); 59 iconToolBar->setHorizontalStretchable(true);
60//US iconToolBar->setWidth(300); 60//US iconToolBar->setWidth(300);
61#endif // 0 61#endif // 0
62 62
63 mCore = new KABCore( this, true, this ); 63 mCore = new KABCore( this, true, this );
64 64
65#ifdef KAB_EMBEDDED 65#ifdef KAB_EMBEDDED
66 setCaption( i18n( "KAddressbook/Pi" ) ); 66 setCaption( i18n( "KAddressbook/Pi" ) );
67#else //KAB_EMBEDDED 67#else //KAB_EMBEDDED
68 setCaption( i18n( "Address Book Browser" ) ); 68 setCaption( i18n( "Address Book Browser" ) );
69#endif //KAB_EMBEDDED 69#endif //KAB_EMBEDDED
70 70
71 //mCore->restoreSettings(); 71 //mCore->restoreSettings();
72 72
73 initActions(); 73 initActions();
74 74
75 setCentralWidget( mCore ); 75 setCentralWidget( mCore );
76 76
77//US statusBar()->show(); 77//US statusBar()->show();
78 78
79#ifndef KAB_EMBEDDED 79#ifndef KAB_EMBEDDED
80 setStandardToolBarMenuEnabled(true); 80 setStandardToolBarMenuEnabled(true);
81 81
82 createGUI( "kaddressbookui.rc", false ); 82 createGUI( "kaddressbookui.rc", false );
83 83
84 84
85#endif //KAB_EMBEDDED 85#endif //KAB_EMBEDDED
86 setAutoSaveSettings(); 86 setAutoSaveSettings();
87 qApp->processEvents(); 87 qApp->processEvents();
88 mCore->restoreSettings(); 88 mCore->restoreSettings();
89} 89}
90 90
91KAddressBookMain::~KAddressBookMain() 91KAddressBookMain::~KAddressBookMain()
92{ 92{
93 // mCore->saveSettings(); 93 // mCore->saveSettings();
94} 94}
95 95void KAddressBookMain::recieve( const QCString& cmsg, const QByteArray& data )
96{
97 qDebug("KA: QCOP message received: %s ", cmsg.data() );
98 if ( cmsg == "setDocument(QString)" ) {
99 QDataStream stream( data, IO_ReadOnly );
100 QString fileName;
101 stream >> fileName;
102 mCore->recieve( fileName );
103 return;
104 }
105}
96void KAddressBookMain::showMinimized () 106void KAddressBookMain::showMinimized ()
97{ 107{
98 QWidget::showMinimized () ; 108 QWidget::showMinimized () ;
99} 109}
100void KAddressBookMain::addEmail( QString addr ) 110void KAddressBookMain::addEmail( QString addr )
101{ 111{
102 mCore->addEmail( addr ); 112 mCore->addEmail( addr );
103} 113}
104 114
105#ifndef KAB_EMBEDDED 115#ifndef KAB_EMBEDDED
106ASYNC KAddressBookMain::showContactEditor( QString uid ) 116ASYNC KAddressBookMain::showContactEditor( QString uid )
107{ 117{
108 mCore->editContact( uid ); 118 mCore->editContact( uid );
109} 119}
110#endif //KAB_EMBEDDED 120#endif //KAB_EMBEDDED
111void KAddressBookMain::newContact() 121void KAddressBookMain::newContact()
112{ 122{
113 mCore->newContact(); 123 mCore->newContact();
114} 124}
115 125
116QString KAddressBookMain::getNameByPhone( QString phone ) 126QString KAddressBookMain::getNameByPhone( QString phone )
117{ 127{
118 return mCore->getNameByPhone( phone ); 128 return mCore->getNameByPhone( phone );
119} 129}
120 130
121void KAddressBookMain::save() 131void KAddressBookMain::save()
122{ 132{
123 mCore->save(); 133 mCore->save();
124} 134}
125 135
126void KAddressBookMain::exit() 136void KAddressBookMain::exit()
127{ 137{
128 close( ); 138 close( );
129} 139}
130 140
131void KAddressBookMain::saveProperties( KConfig* ) 141void KAddressBookMain::saveProperties( KConfig* )
132{ 142{
133} 143}
134 144
135void KAddressBookMain::readProperties( KConfig* ) 145void KAddressBookMain::readProperties( KConfig* )
136{ 146{
137} 147}
138 148
139void KAddressBookMain::initActions() 149void KAddressBookMain::initActions()
140{ 150{
141#ifndef KAB_EMBEDDED 151#ifndef KAB_EMBEDDED
142 KStdAction::quit( this, SLOT( close() ), actionCollection() ); 152 KStdAction::quit( this, SLOT( close() ), actionCollection() );
143 KStdAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() ); 153 KStdAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() );
diff --git a/kaddressbook/kaddressbookmain.h b/kaddressbook/kaddressbookmain.h
index cf6f899..40d2bdd 100644
--- a/kaddressbook/kaddressbookmain.h
+++ b/kaddressbook/kaddressbookmain.h
@@ -36,87 +36,87 @@ class QToolBar;
36#include <kapplication.h> 36#include <kapplication.h>
37#include <kmainwindow.h> 37#include <kmainwindow.h>
38#include "kaddressbookiface.h" 38#include "kaddressbookiface.h"
39#endif //KAB_EMBEDDED 39#endif //KAB_EMBEDDED
40 40
41class KABCore; 41class KABCore;
42class KConfig; 42class KConfig;
43 43
44/** 44/**
45 This class serves as the main window for KAddressBook. It handles the 45 This class serves as the main window for KAddressBook. It handles the
46 menus, toolbars, and status bars. 46 menus, toolbars, and status bars.
47 47
48 @short Main window class 48 @short Main window class
49 @author Don Sanders <dsanders@kde.org> 49 @author Don Sanders <dsanders@kde.org>
50 @version 0.1 50 @version 0.1
51 */ 51 */
52#ifdef KAB_EMBEDDED 52#ifdef KAB_EMBEDDED
53class KAddressBookMain : public KMainWindow 53class KAddressBookMain : public KMainWindow
54#else //KAB_EMBEDDED 54#else //KAB_EMBEDDED
55//MOC_SKIP_BEGIN 55//MOC_SKIP_BEGIN
56class KAddressBookMain : public KMainWindow, virtual public KAddressBookIface 56class KAddressBookMain : public KMainWindow, virtual public KAddressBookIface
57//MOC_SKIP_END 57//MOC_SKIP_END
58#endif //KAB_EMBEDDED 58#endif //KAB_EMBEDDED
59{ 59{
60 Q_OBJECT 60 Q_OBJECT
61 61
62 public: 62 public:
63 KAddressBookMain(); 63 KAddressBookMain();
64 virtual ~KAddressBookMain(); 64 virtual ~KAddressBookMain();
65 65
66#ifdef KAB_EMBEDDED 66#ifdef KAB_EMBEDDED
67// QPEToolBar * getIconToolBar(); 67// QPEToolBar * getIconToolBar();
68 // QToolBar * getIconToolBar(); 68 // QToolBar * getIconToolBar();
69#endif //KAB_EMBEDDED 69#endif //KAB_EMBEDDED
70 70
71 71
72 public slots: 72 public slots:
73 void showMinimized () ; 73 void showMinimized () ;
74 virtual void addEmail( QString addr ); 74 virtual void addEmail( QString addr );
75#ifndef KAB_EMBEDDED 75#ifndef KAB_EMBEDDED
76//MOC_SKIP_BEGIN 76//MOC_SKIP_BEGIN
77 virtual ASYNC showContactEditor( QString uid ); 77 virtual ASYNC showContactEditor( QString uid );
78//MOC_SKIP_END 78//MOC_SKIP_END
79#endif //KAB_EMBEDDED 79#endif //KAB_EMBEDDED
80 virtual void newContact(); 80 virtual void newContact();
81 virtual QString getNameByPhone( QString phone ); 81 virtual QString getNameByPhone( QString phone );
82 virtual void save(); 82 virtual void save();
83 virtual void exit(); 83 virtual void exit();
84 84 void recieve( const QCString& cmsg, const QByteArray& data );
85 protected: 85 protected:
86 void initActions(); 86 void initActions();
87#ifdef KAB_EMBEDDED 87#ifdef KAB_EMBEDDED
88 //US new method to setup menues and toolbars on embedded systems 88 //US new method to setup menues and toolbars on embedded systems
89 void createGUI(); 89 void createGUI();
90#endif //KAB_EMBEDDED 90#endif //KAB_EMBEDDED
91 91
92 /** 92 /**
93 This function is called when it is time for the app to save its 93 This function is called when it is time for the app to save its
94 properties for session management purposes. 94 properties for session management purposes.
95 */ 95 */
96 void saveProperties( KConfig* ); 96 void saveProperties( KConfig* );
97 97
98 /** 98 /**
99 This function is called when this app is restored. The KConfig 99 This function is called when this app is restored. The KConfig
100 object points to the session management config file that was saved 100 object points to the session management config file that was saved
101 with @ref saveProperties 101 with @ref saveProperties
102 */ 102 */
103 void readProperties( KConfig* ); 103 void readProperties( KConfig* );
104 104
105 void closeEvent( QCloseEvent* ce ); 105 void closeEvent( QCloseEvent* ce );
106 106
107 protected slots: 107 protected slots:
108 void configureToolbars(); 108 void configureToolbars();
109 void configureKeys(); 109 void configureKeys();
110 110
111 void slotNewToolbarConfig(); 111 void slotNewToolbarConfig();
112 112
113 private: 113 private:
114 KABCore *mCore; 114 KABCore *mCore;
115 115
116#ifdef KAB_EMBEDDED 116#ifdef KAB_EMBEDDED
117 // QToolBar *iconToolBar; 117 // QToolBar *iconToolBar;
118#endif //KAB_EMBEDDED 118#endif //KAB_EMBEDDED
119 119
120}; 120};
121 121
122#endif 122#endif
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index 965fb06..6dd97b8 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -1,134 +1,140 @@
1#ifndef DESKTOP_VERSION 1#ifndef DESKTOP_VERSION
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include <qcopchannel_qws.h>
3#include <stdlib.h> 4#include <stdlib.h>
4#else 5#else
5#include <qapplication.h> 6#include <qapplication.h>
6#include <qwindowsstyle.h> 7#include <qwindowsstyle.h>
7#include <qplatinumstyle.h> 8#include <qplatinumstyle.h>
8#include <qmainwindow.h> 9#include <qmainwindow.h>
9#endif 10#endif
10 11
11#include <kstandarddirs.h> 12#include <kstandarddirs.h>
12#include <qregexp.h> 13#include <qregexp.h>
13#include <kglobal.h> 14#include <kglobal.h>
14#include <stdio.h> 15#include <stdio.h>
15#include <qdir.h> 16#include <qdir.h>
16#include "kaddressbookmain.h" 17#include "kaddressbookmain.h"
17#include "externalapphandler.h" 18#include "externalapphandler.h"
18#include <libkdepim/kpimglobalprefs.h> 19#include <libkdepim/kpimglobalprefs.h>
19 20
20int main( int argc, char **argv ) 21int main( int argc, char **argv )
21{ 22{
22#ifndef DESKTOP_VERSION 23#ifndef DESKTOP_VERSION
23 QPEApplication a( argc, argv ); 24 QPEApplication a( argc, argv );
24 a.setKeepRunning (); 25 a.setKeepRunning ();
25#else 26#else
26 QApplication a( argc, argv ); 27 QApplication a( argc, argv );
27 QApplication::setStyle( new QPlatinumStyle ()); 28 QApplication::setStyle( new QPlatinumStyle ());
28 QString hdir = QDir::homeDirPath(); 29 QString hdir = QDir::homeDirPath();
29 // there is a bug when creating dirs for WIN 98 30 // there is a bug when creating dirs for WIN 98
30 // it is difficult to fix, because we have no WIN 98 runnung 31 // it is difficult to fix, because we have no WIN 98 runnung
31 // such that we try it to create the dirs at startup here 32 // such that we try it to create the dirs at startup here
32 if ( hdir == "C:\\" ) { // win 98 or ME 33 if ( hdir == "C:\\" ) { // win 98 or ME
33 QDir app_dir; 34 QDir app_dir;
34 if ( !app_dir.exists("C:\\kdepim") ) 35 if ( !app_dir.exists("C:\\kdepim") )
35 app_dir.mkdir ("C:\\kdepim"); 36 app_dir.mkdir ("C:\\kdepim");
36 if ( !app_dir.exists("C:\\kdepim\\apps") ) 37 if ( !app_dir.exists("C:\\kdepim\\apps") )
37 app_dir.mkdir ("C:\\kdepim\\apps"); 38 app_dir.mkdir ("C:\\kdepim\\apps");
38 if ( !app_dir.exists("C:\\kdepim\\config") ) 39 if ( !app_dir.exists("C:\\kdepim\\config") )
39 app_dir.mkdir ("C:\\kdepim\\config"); 40 app_dir.mkdir ("C:\\kdepim\\config");
40 if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) 41 if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") )
41 app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); 42 app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook");
42 } 43 }
43#endif 44#endif
44 45
45 bool exitHelp = false; 46 bool exitHelp = false;
46 if ( argc > 1 ) { 47 if ( argc > 1 ) {
47 QString command = argv[1]; 48 QString command = argv[1];
48 if ( command == "-help" ){ 49 if ( command == "-help" ){
49 printf("KA/E command line commands:\n"); 50 printf("KA/E command line commands:\n");
50 printf(" no command: Start KA/E in usual way\n"); 51 printf(" no command: Start KA/E in usual way\n");
51 printf(" -help: This output\n"); 52 printf(" -help: This output\n");
52 printf(" KA/E is exiting now. Bye!\n"); 53 printf(" KA/E is exiting now. Bye!\n");
53 exitHelp = true; 54 exitHelp = true;
54 } 55 }
55 } 56 }
56 if ( ! exitHelp ) { 57 if ( ! exitHelp ) {
57 58
58 KGlobal::setAppName( "kaddressbook" ); 59 KGlobal::setAppName( "kaddressbook" );
59#ifndef DESKTOP_VERSION 60#ifndef DESKTOP_VERSION
60 if ( QApplication::desktop()->width() > 320 ) 61 if ( QApplication::desktop()->width() > 320 )
61 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); 62 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/");
62 else 63 else
63 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); 64 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/");
64#else 65#else
65 QString fileName ; 66 QString fileName ;
66 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; 67 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/";
67 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 68 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
68 QApplication::addLibraryPath ( qApp->applicationDirPath () ); 69 QApplication::addLibraryPath ( qApp->applicationDirPath () );
69 70
70#endif 71#endif
71 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); 72 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook")));
72 KAddressBookMain m ; 73 KAddressBookMain m ;
73//US MainWindow m; 74//US MainWindow m;
74 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 75 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
75 76
76 { 77 {
77 KPimGlobalPrefs::instance()->setGlobalConfig(); 78 KPimGlobalPrefs::instance()->setGlobalConfig();
78 } 79 }
79#ifndef DESKTOP_VERSION 80#ifndef DESKTOP_VERSION
80 a.showMainWidget( &m ); 81 a.showMainWidget( &m );
82 QCopChannel* c1 = new QCopChannel("QPE/Application/addressbook",&m, "channelAB" ) ;
83 QObject::connect( c1, SIGNAL (received ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
81#else 84#else
82 a.setMainWidget( &m ); 85 a.setMainWidget( &m );
83 m.resize (640, 480 ); 86 m.resize (640, 480 );
84 m.show(); 87 m.show();
85#endif 88#endif
86 a.exec(); 89 a.exec();
90#ifndef DESKTOP_VERSION
91 delete c1;
92#endif
87 93
88 } 94 }
89 qDebug("KA: Bye! "); 95 qDebug("KA: Bye! ");
90} 96}
91 97
92/* 98/*
93#include <stdlib.h> 99#include <stdlib.h>
94 100
95#include <qstring.h> 101#include <qstring.h>
96 102
97#include <kabc/stdaddressbook.h> 103#include <kabc/stdaddressbook.h>
98#include <kaboutdata.h> 104#include <kaboutdata.h>
99#include <kcmdlineargs.h> 105#include <kcmdlineargs.h>
100#include <kcrash.h> 106#include <kcrash.h>
101#include <kdebug.h> 107#include <kdebug.h>
102#include <klocale.h> 108#include <klocale.h>
103#include <kstartupinfo.h> 109#include <kstartupinfo.h>
104#include <kuniqueapplication.h> 110#include <kuniqueapplication.h>
105#include <kwin.h> 111#include <kwin.h>
106 112
107#include "kaddressbookmain.h" 113#include "kaddressbookmain.h"
108#include "kabcore.h" 114#include "kabcore.h"
109 115
110extern "C" { 116extern "C" {
111 117
112void crashHandler( int ) 118void crashHandler( int )
113{ 119{
114 KABC::StdAddressBook::handleCrash(); 120 KABC::StdAddressBook::handleCrash();
115 ::exit( 0 ); 121 ::exit( 0 );
116} 122}
117 123
118} 124}
119 125
120class KAddressBookApp : public KUniqueApplication { 126class KAddressBookApp : public KUniqueApplication {
121 public: 127 public:
122 KAddressBookApp() : mMainWin( 0 ) {} 128 KAddressBookApp() : mMainWin( 0 ) {}
123 ~KAddressBookApp() {} 129 ~KAddressBookApp() {}
124 130
125 int newInstance(); 131 int newInstance();
126 132
127 private: 133 private:
128 KAddressBookMain *mMainWin; 134 KAddressBookMain *mMainWin;
129}; 135};
130 136
131int KAddressBookApp::newInstance() 137int KAddressBookApp::newInstance()
132{ 138{
133 if ( isRestored() ) { 139 if ( isRestored() ) {
134 // There can only be one main window 140 // There can only be one main window
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 3c16458..a69a0bd 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -289,103 +289,104 @@ void MainWindow::showMaximized ()
289 if ( ! globalFlagBlockStartup ) 289 if ( ! globalFlagBlockStartup )
290 if ( mClosed ) 290 if ( mClosed )
291 mView->goToday(); 291 mView->goToday();
292#endif 292#endif
293 QWidget::showMaximized () ; 293 QWidget::showMaximized () ;
294 mClosed = false; 294 mClosed = false;
295} 295}
296void MainWindow::closeEvent( QCloseEvent* ce ) 296void MainWindow::closeEvent( QCloseEvent* ce )
297{ 297{
298 298
299 299
300 300
301 if ( ! KOPrefs::instance()->mAskForQuit ) { 301 if ( ! KOPrefs::instance()->mAskForQuit ) {
302 saveOnClose(); 302 saveOnClose();
303 mClosed = true; 303 mClosed = true;
304 ce->accept(); 304 ce->accept();
305 return; 305 return;
306 306
307 } 307 }
308 308
309 switch( QMessageBox::information( this, "KO/Pi", 309 switch( QMessageBox::information( this, "KO/Pi",
310 i18n("Do you really want\nto close KO/Pi?"), 310 i18n("Do you really want\nto close KO/Pi?"),
311 i18n("Close"), i18n("No"), 311 i18n("Close"), i18n("No"),
312 0, 0 ) ) { 312 0, 0 ) ) {
313 case 0: 313 case 0:
314 saveOnClose(); 314 saveOnClose();
315 mClosed = true; 315 mClosed = true;
316 ce->accept(); 316 ce->accept();
317 break; 317 break;
318 case 1: 318 case 1:
319 ce->ignore(); 319 ce->ignore();
320 break; 320 break;
321 case 2: 321 case 2:
322 322
323 default: 323 default:
324 break; 324 break;
325 } 325 }
326 326
327 327
328} 328}
329 329
330void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 330void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
331{ 331{
332 QDataStream stream( data, IO_ReadOnly ); 332 QDataStream stream( data, IO_ReadOnly );
333 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 333 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
334 //QString datamess; 334 //QString datamess;
335 //qDebug("message "); 335 //qDebug("message ");
336 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 336 qDebug("KO: QCOP message received: %s ", cmsg.data() );
337 337
338 if ( cmsg == "-writeFile" ) { 338 if ( cmsg == "setDocument(QString)" ) {
339 // I made from the "-writeFile" an "-writeAlarm" 339 QDataStream stream( data, IO_ReadOnly );
340 mView->viewManager()->showWhatsNextView(); 340 QString fileName;
341 mCalendar->checkAlarmForIncidence( 0, true); 341 stream >> fileName;
342 showMaximized(); 342 qDebug("filename %s ", fileName.latin1());
343 raise(); 343 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
344 mSyncManager->slotSyncMenu( 1002 );
344 return; 345 return;
345 } 346 }
346 347
347 if ( cmsg == "-writeFile" ) { 348 if ( cmsg == "-writeFile" ) {
348 // I made from the "-writeFile" an "-writeAlarm" 349 // I made from the "-writeFile" an "-writeAlarm"
349 mView->viewManager()->showWhatsNextView(); 350 mView->viewManager()->showWhatsNextView();
350 mCalendar->checkAlarmForIncidence( 0, true); 351 mCalendar->checkAlarmForIncidence( 0, true);
351 showMaximized(); 352 showMaximized();
352 raise(); 353 raise();
353 return; 354 return;
354 355
355 } 356 }
356 if ( cmsg == "-writeFileSilent" ) { 357 if ( cmsg == "-writeFileSilent" ) {
357 // I made from the "-writeFile" an "-writeAlarm" 358 // I made from the "-writeFile" an "-writeAlarm"
358 // mView->viewManager()->showWhatsNextView(); 359 // mView->viewManager()->showWhatsNextView();
359 mCalendar->checkAlarmForIncidence( 0, true); 360 mCalendar->checkAlarmForIncidence( 0, true);
360 //showMaximized(); 361 //showMaximized();
361 //raise(); 362 //raise();
362 hide(); 363 hide();
363 return; 364 return;
364 } 365 }
365 if ( cmsg == "-newCountdown" ) { 366 if ( cmsg == "-newCountdown" ) {
366 qDebug("newCountdown "); 367 qDebug("newCountdown ");
367 368
368 } 369 }
369 QString msg ; 370 QString msg ;
370 QString allmsg = cmsg; 371 QString allmsg = cmsg;
371 while ( allmsg.length() > 0 ) { 372 while ( allmsg.length() > 0 ) {
372 int nextC = allmsg.find( "-", 1 ); 373 int nextC = allmsg.find( "-", 1 );
373 if ( nextC == -1 ) { 374 if ( nextC == -1 ) {
374 msg = allmsg; 375 msg = allmsg;
375 allmsg = ""; 376 allmsg = "";
376 } else{ 377 } else{
377 msg = allmsg.left( nextC ); 378 msg = allmsg.left( nextC );
378 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 379 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
379 } 380 }
380 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 381 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
381 if ( msg == "-newEvent" ) { 382 if ( msg == "-newEvent" ) {
382 mView->newEvent(); 383 mView->newEvent();
383 } 384 }
384 if ( msg == "-newTodo" ) { 385 if ( msg == "-newTodo" ) {
385 mView->newTodo(); 386 mView->newTodo();
386 387
387 } 388 }
388 if ( msg == "-showWN" ) { 389 if ( msg == "-showWN" ) {
389 mView->viewManager()->showWhatsNextView(); 390 mView->viewManager()->showWhatsNextView();
390 } 391 }
391 if ( msg == "-showTodo" ) { 392 if ( msg == "-showTodo" ) {
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 08b1a3d..80fb147 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -146,96 +146,100 @@ void KSyncManager::slotSyncMenu( int action )
146 QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); 146 QTimer::singleShot ( 1, this, SLOT ( confSync() ) );
147 //confSync(); 147 //confSync();
148 148
149 return; 149 return;
150 } 150 }
151 if ( action == 1 ) { 151 if ( action == 1 ) {
152 multiSync( true ); 152 multiSync( true );
153 return; 153 return;
154 } 154 }
155 if ( action == 2 ) { 155 if ( action == 2 ) {
156 enableQuick(); 156 enableQuick();
157 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 157 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
158 return; 158 return;
159 } 159 }
160 if ( action == 3 ) { 160 if ( action == 3 ) {
161 delete mServerSocket; 161 delete mServerSocket;
162 mServerSocket = 0; 162 mServerSocket = 0;
163 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 163 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
164 return; 164 return;
165 } 165 }
166 166
167 if (blockSave()) 167 if (blockSave())
168 return; 168 return;
169 169
170 setBlockSave(true); 170 setBlockSave(true);
171 171
172 mCurrentSyncProfile = action - 1000 ; 172 mCurrentSyncProfile = action - 1000 ;
173 mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ; 173 mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ;
174 mCurrentSyncName = mLocalMachineName ; 174 mCurrentSyncName = mLocalMachineName ;
175 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 175 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
176 KSyncProfile* temp = new KSyncProfile (); 176 KSyncProfile* temp = new KSyncProfile ();
177 temp->setName(mSyncProfileNames[mCurrentSyncProfile]); 177 temp->setName(mSyncProfileNames[mCurrentSyncProfile]);
178 temp->readConfig(&config); 178 temp->readConfig(&config);
179 mAskForPreferences = temp->getAskForPreferences(); 179 mAskForPreferences = temp->getAskForPreferences();
180 mSyncAlgoPrefs = temp->getSyncPrefs(); 180 mSyncAlgoPrefs = temp->getSyncPrefs();
181 mWriteBackFile = temp->getWriteBackFile(); 181 mWriteBackFile = temp->getWriteBackFile();
182 mWriteBackExistingOnly = temp->getWriteBackExisting(); 182 mWriteBackExistingOnly = temp->getWriteBackExisting();
183 mWriteBackInFuture = 0; 183 mWriteBackInFuture = 0;
184 if ( temp->getWriteBackFuture() ) 184 if ( temp->getWriteBackFuture() )
185 mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 185 mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
186 mShowSyncSummary = temp->getShowSummaryAfterSync(); 186 mShowSyncSummary = temp->getShowSummaryAfterSync();
187 if ( action == 1000 ) { 187 if ( action == 1000 ) {
188 syncSharp(); 188 syncSharp();
189 189
190 } else if ( action == 1001 ) { 190 } else if ( action == 1001 ) {
191 syncLocalFile(); 191 syncLocalFile();
192 192
193 } else if ( action == 1002 ) { 193 } else if ( action == 1002 ) {
194 mWriteBackFile = false;
195 mAskForPreferences = false;
196 mShowSyncSummary = false;
197 mSyncAlgoPrefs = 3;
194 quickSyncLocalFile(); 198 quickSyncLocalFile();
195 199
196 } else if ( action >= 1003 ) { 200 } else if ( action >= 1003 ) {
197 if ( temp->getIsLocalFileSync() ) { 201 if ( temp->getIsLocalFileSync() ) {
198 switch(mTargetApp) 202 switch(mTargetApp)
199 { 203 {
200 case (KAPI): 204 case (KAPI):
201 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) 205 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
202 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); 206 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
203 break; 207 break;
204 case (KOPI): 208 case (KOPI):
205 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 209 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
206 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); 210 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
207 break; 211 break;
208 case (PWMPI): 212 case (PWMPI):
209 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) 213 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
210 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); 214 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
211 break; 215 break;
212 default: 216 default:
213 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); 217 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
214 break; 218 break;
215 219
216 } 220 }
217 } else { 221 } else {
218 if ( temp->getIsPhoneSync() ) { 222 if ( temp->getIsPhoneSync() ) {
219 mPhoneDevice = temp->getPhoneDevice( ) ; 223 mPhoneDevice = temp->getPhoneDevice( ) ;
220 mPhoneConnection = temp->getPhoneConnection( ); 224 mPhoneConnection = temp->getPhoneConnection( );
221 mPhoneModel = temp->getPhoneModel( ); 225 mPhoneModel = temp->getPhoneModel( );
222 syncPhone(); 226 syncPhone();
223 } else if ( temp->getIsPiSync() ) { 227 } else if ( temp->getIsPiSync() ) {
224 if ( mTargetApp == KAPI ) { 228 if ( mTargetApp == KAPI ) {
225 mPassWordPiSync = temp->getRemotePwAB(); 229 mPassWordPiSync = temp->getRemotePwAB();
226 mActiveSyncPort = temp->getRemotePortAB(); 230 mActiveSyncPort = temp->getRemotePortAB();
227 mActiveSyncIP = temp->getRemoteIPAB(); 231 mActiveSyncIP = temp->getRemoteIPAB();
228 } else if ( mTargetApp == KOPI ) { 232 } else if ( mTargetApp == KOPI ) {
229 mPassWordPiSync = temp->getRemotePw(); 233 mPassWordPiSync = temp->getRemotePw();
230 mActiveSyncPort = temp->getRemotePort(); 234 mActiveSyncPort = temp->getRemotePort();
231 mActiveSyncIP = temp->getRemoteIP(); 235 mActiveSyncIP = temp->getRemoteIP();
232 } else { 236 } else {
233 mPassWordPiSync = temp->getRemotePwPWM(); 237 mPassWordPiSync = temp->getRemotePwPWM();
234 mActiveSyncPort = temp->getRemotePortPWM(); 238 mActiveSyncPort = temp->getRemotePortPWM();
235 mActiveSyncIP = temp->getRemoteIPPWM(); 239 mActiveSyncIP = temp->getRemoteIPPWM();
236 } 240 }
237 syncPi(); 241 syncPi();
238 } else 242 } else
239 syncRemote( temp ); 243 syncRemote( temp );
240 244
241 } 245 }
@@ -321,97 +325,97 @@ void KSyncManager::syncLocalFile()
321 if ( fn == "" ) 325 if ( fn == "" )
322 return; 326 return;
323 if ( syncWithFile( fn, false ) ) { 327 if ( syncWithFile( fn, false ) ) {
324 qDebug("syncLocalFile() successful "); 328 qDebug("syncLocalFile() successful ");
325 } 329 }
326 330
327} 331}
328 332
329bool KSyncManager::syncWithFile( QString fn , bool quick ) 333bool KSyncManager::syncWithFile( QString fn , bool quick )
330{ 334{
331 bool ret = false; 335 bool ret = false;
332 QFileInfo info; 336 QFileInfo info;
333 info.setFile( fn ); 337 info.setFile( fn );
334 QString mess; 338 QString mess;
335 bool loadbup = true; 339 bool loadbup = true;
336 if ( !info. exists() ) { 340 if ( !info. exists() ) {
337 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); 341 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) );
338 int result = QMessageBox::warning( mParent, i18n("Warning!"), 342 int result = QMessageBox::warning( mParent, i18n("Warning!"),
339 mess ); 343 mess );
340 return ret; 344 return ret;
341 } 345 }
342 int result = 0; 346 int result = 0;
343 if ( !quick ) { 347 if ( !quick ) {
344 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 348 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
345 result = QMessageBox::warning( mParent, i18n("Warning!"), 349 result = QMessageBox::warning( mParent, i18n("Warning!"),
346 mess, 350 mess,
347 i18n("Sync"), i18n("Cancel"), 0, 351 i18n("Sync"), i18n("Cancel"), 0,
348 0, 1 ); 352 0, 1 );
349 if ( result ) 353 if ( result )
350 return false; 354 return false;
351 } 355 }
352 if ( mAskForPreferences ) 356 if ( mAskForPreferences )
353 edit_sync_options(); 357 edit_sync_options();
354 if ( result == 0 ) { 358 if ( result == 0 ) {
355 //qDebug("Now sycing ... "); 359 //qDebug("Now sycing ... ");
356 if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) 360 if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) )
357 mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); 361 mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") );
358 else 362 else
359 mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); 363 mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed. Nothing synced.") );
360 if ( ! quick ) 364 if ( ! quick )
361 mPrefs->mLastSyncedLocalFile = fn; 365 mPrefs->mLastSyncedLocalFile = fn;
362 } 366 }
363 return ret; 367 return ret;
364} 368}
365 369
366void KSyncManager::quickSyncLocalFile() 370void KSyncManager::quickSyncLocalFile()
367{ 371{
368 372
369 if ( syncWithFile( mPrefs->mLastSyncedLocalFile, false ) ) { 373 if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) {
370 qDebug("quick syncLocalFile() successful "); 374 qDebug("quick syncLocalFile() successful ");
371 375
372 } 376 }
373} 377}
374 378
375void KSyncManager::multiSync( bool askforPrefs ) 379void KSyncManager::multiSync( bool askforPrefs )
376{ 380{
377 if (blockSave()) 381 if (blockSave())
378 return; 382 return;
379 setBlockSave(true); 383 setBlockSave(true);
380 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 384 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
381 if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), 385 if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"),
382 question, 386 question,
383 i18n("Yes"), i18n("No"), 387 i18n("Yes"), i18n("No"),
384 0, 0 ) != 0 ) { 388 0, 0 ) != 0 ) {
385 setBlockSave(false); 389 setBlockSave(false);
386 mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); 390 mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!"));
387 return; 391 return;
388 } 392 }
389 mCurrentSyncDevice = i18n("Multiple profiles") ; 393 mCurrentSyncDevice = i18n("Multiple profiles") ;
390 mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; 394 mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs;
391 if ( askforPrefs ) { 395 if ( askforPrefs ) {
392 edit_sync_options(); 396 edit_sync_options();
393 mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; 397 mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs;
394 } 398 }
395 mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); 399 mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") );
396 qApp->processEvents(); 400 qApp->processEvents();
397 int num = ringSync() ; 401 int num = ringSync() ;
398 if ( num > 1 ) 402 if ( num > 1 )
399 ringSync(); 403 ringSync();
400 setBlockSave(false); 404 setBlockSave(false);
401 if ( num ) 405 if ( num )
402 emit save(); 406 emit save();
403 if ( num ) 407 if ( num )
404 mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); 408 mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) );
405 else 409 else
406 mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); 410 mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
407 return; 411 return;
408} 412}
409 413
410int KSyncManager::ringSync() 414int KSyncManager::ringSync()
411{ 415{
412 int syncedProfiles = 0; 416 int syncedProfiles = 0;
413 unsigned int i; 417 unsigned int i;
414 QTime timer; 418 QTime timer;
415 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 419 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
416 QStringList syncProfileNames = mSyncProfileNames; 420 QStringList syncProfileNames = mSyncProfileNames;
417 KSyncProfile* temp = new KSyncProfile (); 421 KSyncProfile* temp = new KSyncProfile ();