summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/service/gsmmisc.c5
-rw-r--r--kabc/addressbook.cpp3
-rw-r--r--kabc/addressbook.h2
-rw-r--r--kabc/plugins/sharpdtm/resourcesharpdtm.cpp4
-rw-r--r--kaddressbook/kabcore.cpp31
-rw-r--r--kaddressbook/kabcore.h3
6 files changed, 27 insertions, 21 deletions
diff --git a/gammu/emb/common/service/gsmmisc.c b/gammu/emb/common/service/gsmmisc.c
index 1c6ec8b..486d136 100644
--- a/gammu/emb/common/service/gsmmisc.c
+++ b/gammu/emb/common/service/gsmmisc.c
@@ -160,103 +160,106 @@ void GSM_IdentifyFileFormat(GSM_File *File)
160 } else if (File->Buffer[0] == 0x00 && File->Buffer[1] == 0x02) { 160 } else if (File->Buffer[0] == 0x00 && File->Buffer[1] == 0x02) {
161 File->Type = GSM_File_Sound_NRT; 161 File->Type = GSM_File_Sound_NRT;
162 } 162 }
163 } 163 }
164} 164}
165 165
166void SaveVCALDateTime(char *Buffer, int *Length, GSM_DateTime *Date, char *Start) 166void SaveVCALDateTime(char *Buffer, int *Length, GSM_DateTime *Date, char *Start)
167{ 167{
168 if (Start != NULL) { 168 if (Start != NULL) {
169 *Length+=sprintf(Buffer+(*Length), "%s:",Start); 169 *Length+=sprintf(Buffer+(*Length), "%s:",Start);
170 } 170 }
171 *Length+=sprintf(Buffer+(*Length), "%04d%02d%02dT%02d%02d%02d%c%c", 171 *Length+=sprintf(Buffer+(*Length), "%04d%02d%02dT%02d%02d%02d%c%c",
172 Date->Year, Date->Month, Date->Day, 172 Date->Year, Date->Month, Date->Day,
173 Date->Hour, Date->Minute, Date->Second,13,10); 173 Date->Hour, Date->Minute, Date->Second,13,10);
174} 174}
175 175
176void ReadVCALDateTime(char *Buffer, GSM_DateTime *dt) 176void ReadVCALDateTime(char *Buffer, GSM_DateTime *dt)
177{ 177{
178 char year[5]="", month[3]="", day[3]="", hour[3]="", minute[3]="", second[3]=""; 178 char year[5]="", month[3]="", day[3]="", hour[3]="", minute[3]="", second[3]="";
179 179
180 memset(dt,0,sizeof(dt)); 180 memset(dt,0,sizeof(dt));
181 181
182 strncpy(year, Buffer, 4); 182 strncpy(year, Buffer, 4);
183 strncpy(month, Buffer+4, 2); 183 strncpy(month, Buffer+4, 2);
184 strncpy(day, Buffer+6, 2); 184 strncpy(day, Buffer+6, 2);
185 strncpy(hour, Buffer+9,2); 185 strncpy(hour, Buffer+9,2);
186 strncpy(minute, Buffer+11,2); 186 strncpy(minute, Buffer+11,2);
187 strncpy(second, Buffer+13,2); 187 strncpy(second, Buffer+13,2);
188 188
189 /* FIXME: Should check ranges... */ 189 /* FIXME: Should check ranges... */
190 dt->Year= atoi(year); 190 dt->Year= atoi(year);
191 dt->Month= atoi(month); 191 dt->Month= atoi(month);
192 dt->Day = atoi(day); 192 dt->Day = atoi(day);
193 dt->Hour= atoi(hour); 193 dt->Hour= atoi(hour);
194 dt->Minute= atoi(minute); 194 dt->Minute= atoi(minute);
195 dt->Second= atoi(second); 195 dt->Second= atoi(second);
196 /* FIXME */ 196 /* FIXME */
197 dt->Timezone= 0; 197 dt->Timezone= 0;
198} 198}
199 199
200void SaveVCALText(char *Buffer, int *Length, char *Text, char *Start) 200void SaveVCALText(char *Buffer, int *Length, char *Text, char *Start)
201{ 201{
202 char buffer[1000]; 202 char buffer[1000];
203 203
204 if (UnicodeLength(Text) != 0) { 204 if (UnicodeLength(Text) != 0) {
205 EncodeUTF8(buffer,Text); 205 EncodeUTF8(buffer,Text);
206 if (UnicodeLength(Text)==strlen(buffer)) { 206 if (UnicodeLength(Text)==strlen(buffer)) {
207 *Length+=sprintf(Buffer+(*Length), "%s:%s%c%c",Start,DecodeUnicodeString(Text),13,10); 207 *Length+=sprintf(Buffer+(*Length), "%s:%s%c%c",Start,DecodeUnicodeString(Text),13,10);
208 } else { 208 } else {
209 *Length+=sprintf(Buffer+(*Length), "%s:%s%c%c",Start,buffer,13,10); 209 *Length+=sprintf(Buffer+(*Length), "%s:%s%c%c",Start,buffer,13,10);
210 } 210 }
211 } 211 }
212} 212}
213 213
214bool ReadVCALText(char *Buffer, char *Start, char *Value) 214bool ReadVCALText(char *Buffer, char *Start, char *Value)
215{ 215{
216 unsigned char buff[200]; 216 unsigned char buff[200];
217 217
218 Value[0] = 0x00; 218 Value[0] = 0x00;
219 Value[1] = 0x00; 219 Value[1] = 0x00;
220 220
221 strcpy(buff,Start); 221 strcpy(buff,Start);
222 strcat(buff,":"); 222 strcat(buff,":");
223 if (!strncmp(Buffer,buff,strlen(buff))) { 223 if (!strncmp(Buffer,buff,strlen(buff))) {
224 EncodeUnicode(Value,Buffer+strlen(Start)+1,strlen(Buffer)-(strlen(Start)+1)); 224
225 // LR original :EncodeUnicode(Value,Buffer+strlen(Start)+1,strlen(Buffer)-(strlen(Start)+1));
226 // LR we have utf8 as default
227 DecodeUTF8(Value,Buffer+strlen(Start)+1,strlen(Buffer)-(strlen(Start)+1));
225 dbgprintf("ReadVCalText is \"%s\"\n",DecodeUnicodeConsole(Value)); 228 dbgprintf("ReadVCalText is \"%s\"\n",DecodeUnicodeConsole(Value));
226 return true; 229 return true;
227 } 230 }
228 /* SE T68i */ 231 /* SE T68i */
229 strcpy(buff,Start); 232 strcpy(buff,Start);
230 strcat(buff,";ENCODING=QUOTED-PRINTABLE:"); 233 strcat(buff,";ENCODING=QUOTED-PRINTABLE:");
231 if (!strncmp(Buffer,buff,strlen(buff))) { 234 if (!strncmp(Buffer,buff,strlen(buff))) {
232 DecodeUTF8QuotedPrintable(Value,Buffer+strlen(Start)+27,strlen(Buffer)-(strlen(Start)+27)); 235 DecodeUTF8QuotedPrintable(Value,Buffer+strlen(Start)+27,strlen(Buffer)-(strlen(Start)+27));
233 dbgprintf("ReadVCalText is \"%s\"\n",DecodeUnicodeConsole(Value)); 236 dbgprintf("ReadVCalText is \"%s\"\n",DecodeUnicodeConsole(Value));
234 return true; 237 return true;
235 } 238 }
236 strcpy(buff,Start); 239 strcpy(buff,Start);
237 strcat(buff,";CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:"); 240 strcat(buff,";CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:");
238 if (!strncmp(Buffer,buff,strlen(buff))) { 241 if (!strncmp(Buffer,buff,strlen(buff))) {
239 DecodeUTF8QuotedPrintable(Value,Buffer+strlen(Start)+41,strlen(Buffer)-(strlen(Start)+41)); 242 DecodeUTF8QuotedPrintable(Value,Buffer+strlen(Start)+41,strlen(Buffer)-(strlen(Start)+41));
240 dbgprintf("ReadVCalText is \"%s\"\n",DecodeUnicodeConsole(Value)); 243 dbgprintf("ReadVCalText is \"%s\"\n",DecodeUnicodeConsole(Value));
241 return true; 244 return true;
242 } 245 }
243 strcpy(buff,Start); 246 strcpy(buff,Start);
244 strcat(buff,";CHARSET=UTF-8:"); 247 strcat(buff,";CHARSET=UTF-8:");
245 if (!strncmp(Buffer,buff,strlen(buff))) { 248 if (!strncmp(Buffer,buff,strlen(buff))) {
246 DecodeUTF8(Value,Buffer+strlen(Start)+15,strlen(Buffer)-(strlen(Start)+15)); 249 DecodeUTF8(Value,Buffer+strlen(Start)+15,strlen(Buffer)-(strlen(Start)+15));
247 dbgprintf("ReadVCalText is \"%s\"\n",DecodeUnicodeConsole(Value)); 250 dbgprintf("ReadVCalText is \"%s\"\n",DecodeUnicodeConsole(Value));
248 return true; 251 return true;
249 } 252 }
250 strcpy(buff,Start); 253 strcpy(buff,Start);
251 strcat(buff,";CHARSET=UTF-7:"); 254 strcat(buff,";CHARSET=UTF-7:");
252 if (!strncmp(Buffer,buff,strlen(buff))) { 255 if (!strncmp(Buffer,buff,strlen(buff))) {
253 DecodeUTF7(Value,Buffer+strlen(Start)+15,strlen(Buffer)-(strlen(Start)+15)); 256 DecodeUTF7(Value,Buffer+strlen(Start)+15,strlen(Buffer)-(strlen(Start)+15));
254 dbgprintf("ReadVCalText is \"%s\"\n",DecodeUnicodeConsole(Value)); 257 dbgprintf("ReadVCalText is \"%s\"\n",DecodeUnicodeConsole(Value));
255 return true; 258 return true;
256 } 259 }
257 return false; 260 return false;
258} 261}
259 262
260/* How should editor hadle tabs in this file? Add editor commands here. 263/* How should editor hadle tabs in this file? Add editor commands here.
261 * vim: noexpandtab sw=8 ts=8 sts=8: 264 * vim: noexpandtab sw=8 ts=8 sts=8:
262 */ 265 */
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index c584c35..3641c0c 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -416,161 +416,162 @@ bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName )
416 for ( it = begin(); it != end(); ++it ) { 416 for ( it = begin(); it != end(); ++it ) {
417 // for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 417 // for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
418 if ( ! all ) { 418 if ( ! all ) {
419 if ( ! ( uids.contains((*it).uid() ) )) 419 if ( ! ( uids.contains((*it).uid() ) ))
420 continue; 420 continue;
421 } 421 }
422 KABC::Addressee a = ( *it ); 422 KABC::Addressee a = ( *it );
423 if ( a.isEmpty() ) 423 if ( a.isEmpty() )
424 continue; 424 continue;
425 if ( all && a.resource() && !a.resource()->includeInSync() ) 425 if ( all && a.resource() && !a.resource()->includeInSync() )
426 continue; 426 continue;
427 a.simplifyEmails(); 427 a.simplifyEmails();
428 a.simplifyPhoneNumbers(); 428 a.simplifyPhoneNumbers();
429 a.simplifyPhoneNumberTypes(); 429 a.simplifyPhoneNumberTypes();
430 a.simplifyAddresses(); 430 a.simplifyAddresses();
431 431
432 QString vcard; 432 QString vcard;
433 QString vcardnew; 433 QString vcardnew;
434 converter.addresseeToVCard( a, vcard ); 434 converter.addresseeToVCard( a, vcard );
435 int start = 0; 435 int start = 0;
436 int next; 436 int next;
437 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 437 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
438 int semi = vcard.find(";", next); 438 int semi = vcard.find(";", next);
439 int dopp = vcard.find(":", next); 439 int dopp = vcard.find(":", next);
440 int sep; 440 int sep;
441 if ( semi < dopp && semi >= 0 ) 441 if ( semi < dopp && semi >= 0 )
442 sep = semi ; 442 sep = semi ;
443 else 443 else
444 sep = dopp; 444 sep = dopp;
445 vcardnew +=vcard.mid( start, next - start); 445 vcardnew +=vcard.mid( start, next - start);
446 vcardnew +=vcard.mid( next+5,sep -next -5 ).upper(); 446 vcardnew +=vcard.mid( next+5,sep -next -5 ).upper();
447 start = sep; 447 start = sep;
448 } 448 }
449 vcardnew += vcard.mid( start,vcard.length() ); 449 vcardnew += vcard.mid( start,vcard.length() );
450 vcard = ""; 450 vcard = "";
451 start = 0; 451 start = 0;
452 while ( (next = vcardnew.find("ADR", start) )>= 0 ) { 452 while ( (next = vcardnew.find("ADR", start) )>= 0 ) {
453 int sep = vcardnew.find(":", next); 453 int sep = vcardnew.find(":", next);
454 vcard +=vcardnew.mid( start, next - start+3); 454 vcard +=vcardnew.mid( start, next - start+3);
455 start = sep; 455 start = sep;
456 } 456 }
457 vcard += vcardnew.mid( start,vcardnew.length() ); 457 vcard += vcardnew.mid( start,vcardnew.length() );
458 vcard.replace ( QRegExp(";;;") , "" ); 458 vcard.replace ( QRegExp(";;;") , "" );
459 vcard.replace ( QRegExp(";;") , "" ); 459 vcard.replace ( QRegExp(";;") , "" );
460 datastream += vcard; 460 datastream += vcard;
461 461
462 } 462 }
463 463
464 QFile outFile(fileName); 464 QFile outFile(fileName);
465 if ( outFile.open(IO_WriteOnly) ) { 465 if ( outFile.open(IO_WriteOnly) ) {
466 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 466 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
467 QTextStream t( &outFile ); // use a text stream 467 QTextStream t( &outFile ); // use a text stream
468 t.setEncoding( QTextStream::UnicodeUTF8 ); 468 t.setEncoding( QTextStream::UnicodeUTF8 );
469 t <<datastream; 469 t <<datastream;
470 t << "\r\n\r\n"; 470 t << "\r\n\r\n";
471 outFile.close(); 471 outFile.close();
472 472
473 } else { 473 } else {
474 qDebug("Error open temp file "); 474 qDebug("Error open temp file ");
475 return false; 475 return false;
476 } 476 }
477 return true; 477 return true;
478 478
479} 479}
480void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool removeOld ) 480int AddressBook::importFromFile( QString fileName, bool replaceLabel, bool removeOld )
481{ 481{
482 482
483 if ( removeOld ) 483 if ( removeOld )
484 setUntagged( true ); 484 setUntagged( true );
485 KABC::Addressee::List list; 485 KABC::Addressee::List list;
486 QFile file( fileName ); 486 QFile file( fileName );
487 file.open( IO_ReadOnly ); 487 file.open( IO_ReadOnly );
488 QByteArray rawData = file.readAll(); 488 QByteArray rawData = file.readAll();
489 file.close(); 489 file.close();
490 QString data; 490 QString data;
491 if ( replaceLabel ) { 491 if ( replaceLabel ) {
492 data = QString::fromLatin1( rawData.data(), rawData.size() + 1 ); 492 data = QString::fromLatin1( rawData.data(), rawData.size() + 1 );
493 data.replace ( QRegExp("LABEL") , "ADR" ); 493 data.replace ( QRegExp("LABEL") , "ADR" );
494 data.replace ( QRegExp("CHARSET=ISO-8859-1") , "" ); 494 data.replace ( QRegExp("CHARSET=ISO-8859-1") , "" );
495 } else 495 } else
496 data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); 496 data = QString::fromUtf8( rawData.data(), rawData.size() + 1 );
497 KABC::VCardTool tool; 497 KABC::VCardTool tool;
498 list = tool.parseVCards( data ); 498 list = tool.parseVCards( data );
499 KABC::Addressee::List::Iterator it; 499 KABC::Addressee::List::Iterator it;
500 for ( it = list.begin(); it != list.end(); ++it ) { 500 for ( it = list.begin(); it != list.end(); ++it ) {
501 QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" ); 501 QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" );
502 if ( !id.isEmpty() ) 502 if ( !id.isEmpty() )
503 (*it).setIDStr(id ); 503 (*it).setIDStr(id );
504 (*it).setResource( 0 ); 504 (*it).setResource( 0 );
505 if ( replaceLabel ) 505 if ( replaceLabel )
506 (*it).removeVoice(); 506 (*it).removeVoice();
507 if ( removeOld ) 507 if ( removeOld )
508 (*it).setTagged( true ); 508 (*it).setTagged( true );
509 insertAddressee( (*it), false, true ); 509 insertAddressee( (*it), false, true );
510 } 510 }
511 if ( removeOld ) 511 if ( removeOld )
512 removeUntagged(); 512 removeUntagged();
513 return list.count();
513} 514}
514void AddressBook::setUntagged(bool setNonSyncTagged) // = false) 515void AddressBook::setUntagged(bool setNonSyncTagged) // = false)
515{ 516{
516 Iterator ait; 517 Iterator ait;
517 for ( ait = begin(); ait != end(); ++ait ) { 518 for ( ait = begin(); ait != end(); ++ait ) {
518 if ( setNonSyncTagged ) { 519 if ( setNonSyncTagged ) {
519 if ( (*ait).resource() && ! (*ait).resource()->includeInSync() ) { 520 if ( (*ait).resource() && ! (*ait).resource()->includeInSync() ) {
520 (*ait).setTagged( true ); 521 (*ait).setTagged( true );
521 } else 522 } else
522 (*ait).setTagged( false ); 523 (*ait).setTagged( false );
523 } else 524 } else
524 (*ait).setTagged( false ); 525 (*ait).setTagged( false );
525 } 526 }
526} 527}
527void AddressBook::removeUntagged() 528void AddressBook::removeUntagged()
528{ 529{
529 Iterator ait; 530 Iterator ait;
530 bool todelete = false; 531 bool todelete = false;
531 Iterator todel; 532 Iterator todel;
532 for ( ait = begin(); ait != end(); ++ait ) { 533 for ( ait = begin(); ait != end(); ++ait ) {
533 if ( todelete ) 534 if ( todelete )
534 removeAddressee( todel ); 535 removeAddressee( todel );
535 if (!(*ait).tagged()) { 536 if (!(*ait).tagged()) {
536 todelete = true; 537 todelete = true;
537 todel = ait; 538 todel = ait;
538 } else 539 } else
539 todelete = false; 540 todelete = false;
540 } 541 }
541 if ( todelete ) 542 if ( todelete )
542 removeAddressee( todel ); 543 removeAddressee( todel );
543 deleteRemovedAddressees(); 544 deleteRemovedAddressees();
544} 545}
545void AddressBook::smplifyAddressees() 546void AddressBook::smplifyAddressees()
546{ 547{
547 Iterator ait; 548 Iterator ait;
548 for ( ait = begin(); ait != end(); ++ait ) { 549 for ( ait = begin(); ait != end(); ++ait ) {
549 (*ait).simplifyEmails(); 550 (*ait).simplifyEmails();
550 (*ait).simplifyPhoneNumbers(); 551 (*ait).simplifyPhoneNumbers();
551 (*ait).simplifyPhoneNumberTypes(); 552 (*ait).simplifyPhoneNumberTypes();
552 (*ait).simplifyAddresses(); 553 (*ait).simplifyAddresses();
553 } 554 }
554} 555}
555void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync ) 556void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync )
556{ 557{
557 Iterator ait; 558 Iterator ait;
558 for ( ait = begin(); ait != end(); ++ait ) { 559 for ( ait = begin(); ait != end(); ++ait ) {
559 QString id = (*ait).IDStr(); 560 QString id = (*ait).IDStr();
560 (*ait).setIDStr( ":"); 561 (*ait).setIDStr( ":");
561 (*ait).setExternalUID( id ); 562 (*ait).setExternalUID( id );
562 (*ait).setOriginalExternalUID( id ); 563 (*ait).setOriginalExternalUID( id );
563 if ( isPreSync ) 564 if ( isPreSync )
564 (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); 565 (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
565 else { 566 else {
566 (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); 567 (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
567 (*ait).setID( currentSyncDevice,id ); 568 (*ait).setID( currentSyncDevice,id );
568 569
569 } 570 }
570 } 571 }
571} 572}
572void AddressBook::findNewExtIds( QString fileName, QString currentSyncDevice ) 573void AddressBook::findNewExtIds( QString fileName, QString currentSyncDevice )
573{ 574{
574 575
575 setUntagged(); 576 setUntagged();
576 KABC::Addressee::List list; 577 KABC::Addressee::List list;
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index 23bba02..5edca06 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -86,129 +86,129 @@ class AddressBook : public QObject
86 /** 86 /**
87 @short Address Book Const Iterator 87 @short Address Book Const Iterator
88 88
89 This class provides a const iterator for address book entries. 89 This class provides a const iterator for address book entries.
90 */ 90 */
91 class ConstIterator 91 class ConstIterator
92 { 92 {
93 public: 93 public:
94 ConstIterator(); 94 ConstIterator();
95 ConstIterator( const ConstIterator & ); 95 ConstIterator( const ConstIterator & );
96 ~ConstIterator(); 96 ~ConstIterator();
97 97
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 bool saveABphone( QString fileName ); 145 bool saveABphone( QString fileName );
146 void smplifyAddressees(); 146 void smplifyAddressees();
147 void preparePhoneSync( QString currentSyncDevice, bool isPreSync ); 147 void preparePhoneSync( QString currentSyncDevice, bool isPreSync );
148 void export2File( QString fileName ); 148 void export2File( QString fileName );
149 bool export2PhoneFormat( QStringList uids ,QString fileName ); 149 bool export2PhoneFormat( QStringList uids ,QString fileName );
150 void importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false ); 150 int importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false );
151 void setUntagged( bool setNonSyncTagged = false ); 151 void setUntagged( bool setNonSyncTagged = false );
152 void removeUntagged(); 152 void removeUntagged();
153 void findNewExtIds( QString fileName, QString currentSyncDevice ); 153 void findNewExtIds( QString fileName, QString currentSyncDevice );
154 /** 154 /**
155 Returns a iterator for first entry of address book. 155 Returns a iterator for first entry of address book.
156 */ 156 */
157 Iterator begin(); 157 Iterator begin();
158 158
159 /** 159 /**
160 Returns a const iterator for first entry of address book. 160 Returns a const iterator for first entry of address book.
161 */ 161 */
162 ConstIterator begin() const; 162 ConstIterator begin() const;
163 163
164 /** 164 /**
165 Returns a iterator for first entry of address book. 165 Returns a iterator for first entry of address book.
166 */ 166 */
167 Iterator end(); 167 Iterator end();
168 168
169 /** 169 /**
170 Returns a const iterator for first entry of address book. 170 Returns a const iterator for first entry of address book.
171 */ 171 */
172 ConstIterator end() const; 172 ConstIterator end() const;
173 173
174 /** 174 /**
175 Removes all entries from address book. 175 Removes all entries from address book.
176 */ 176 */
177 void clear(); 177 void clear();
178 178
179 /** 179 /**
180 Insert an Addressee object into address book. If an object with the same 180 Insert an Addressee object into address book. If an object with the same
181 unique id already exists in the address book it it replaced by the new 181 unique id already exists in the address book it it replaced by the new
182 one. If not the new object is appended to the address book. 182 one. If not the new object is appended to the address book.
183 */ 183 */
184 void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false); 184 void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false);
185 185
186 /** 186 /**
187 Removes entry from the address book. 187 Removes entry from the address book.
188 */ 188 */
189 void removeAddressee( const Addressee & ); 189 void removeAddressee( const Addressee & );
190 190
191 /** 191 /**
192 This is like @ref removeAddressee() just above, with the difference that 192 This is like @ref removeAddressee() just above, with the difference that
193 the first element is a iterator, returned by @ref begin(). 193 the first element is a iterator, returned by @ref begin().
194 */ 194 */
195 void removeAddressee( const Iterator & ); 195 void removeAddressee( const Iterator & );
196 196
197 /** 197 /**
198 Find the specified entry in address book. Returns end(), if the entry 198 Find the specified entry in address book. Returns end(), if the entry
199 couldn't be found. 199 couldn't be found.
200 */ 200 */
201 Iterator find( const Addressee & ); 201 Iterator find( const Addressee & );
202 202
203 /** 203 /**
204 Find the entry specified by an unique id. Returns an empty Addressee 204 Find the entry specified by an unique id. Returns an empty Addressee
205 object, if the address book does not contain an entry with this id. 205 object, if the address book does not contain an entry with this id.
206 */ 206 */
207 Addressee findByUid( const QString & ); 207 Addressee findByUid( const QString & );
208 208
209 209
210 /** 210 /**
211 Returns a list of all addressees in the address book. This list can 211 Returns a list of all addressees in the address book. This list can
212 be sorted with @ref KABC::AddresseeList for example. 212 be sorted with @ref KABC::AddresseeList for example.
213 */ 213 */
214 Addressee::List allAddressees(); 214 Addressee::List allAddressees();
diff --git a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
index 2cdf4bf..ba17c50 100644
--- a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
+++ b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
@@ -11,130 +11,130 @@
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/* 21/*
22Enhanced Version of the file for platform independent KDE tools. 22Enhanced Version of the file for platform independent KDE tools.
23Copyright (c) 2004 Ulf Schenk 23Copyright (c) 2004 Ulf Schenk
24 24
25$Id$ 25$Id$
26*/ 26*/
27 27
28#include <sys/types.h> 28#include <sys/types.h>
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <unistd.h> 30#include <unistd.h>
31 31
32#include <qdir.h> 32#include <qdir.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qfileinfo.h> 34#include <qfileinfo.h>
35#include <qregexp.h> 35#include <qregexp.h>
36//US #include <qtimer.h> 36//US #include <qtimer.h>
37 37
38#include <kapplication.h> 38#include <kapplication.h>
39#include <kconfig.h> 39#include <kconfig.h>
40#include <kdebug.h> 40#include <kdebug.h>
41#include <klocale.h> 41#include <klocale.h>
42//US #include <ksavefile.h> 42//US #include <ksavefile.h>
43#include <kstandarddirs.h> 43#include <kstandarddirs.h>
44#include <kmessagebox.h> 44#include <kmessagebox.h>
45 45
46#include <sl/slzdb.h> 46#include <sl/slzdb.h>
47 47
48#include <libkdepim/ksyncprofile.h> 48#include <libkdepim/ksyncprofile.h>
49 49
50#include "resourcesharpdtmconfig.h" 50#include "resourcesharpdtmconfig.h"
51#include "resourcesharpdtm.h" 51#include "resourcesharpdtm.h"
52 52
53#include "stdaddressbook.h" 53#include "stdaddressbook.h"
54 54
55#include "sharpdtmconverter.h" 55#include "sharpdtmconverter.h"
56//#define ALLOW_LOCKING 56//#define ALLOW_LOCKING
57using namespace KABC; 57using namespace KABC;
58extern "C" 58extern "C"
59{ 59{
60 void *init_microkabc_sharpdtm() 60 void *init_microkabc_sharpdtm()
61 { 61 {
62 return new KRES::PluginFactory<ResourceSharpDTM,ResourceSharpDTMConfig>(); 62 return new KRES::PluginFactory<ResourceSharpDTM,ResourceSharpDTMConfig>();
63 } 63 }
64} 64}
65 65
66ResourceSharpDTM::ResourceSharpDTM( const KConfig *config ) 66ResourceSharpDTM::ResourceSharpDTM( const KConfig *config )
67 : Resource( config ), mConverter (0) 67 : Resource( config ), mConverter (0)
68{ 68{
69 // we can not choose the filename. Therefore use the default to display 69 // we can not choose the filename. Therefore use the default to display
70 70
71 QString fileName = SlZDataBase::addressbookFileName(); 71 QString fileName = SlZDataBase::addressbookFileName();
72 init( fileName ); 72 init( fileName );
73} 73}
74 74
75ResourceSharpDTM::ResourceSharpDTM( const QString &fileName, bool syncable ) 75ResourceSharpDTM::ResourceSharpDTM( const QString &fileName )
76 : Resource( 0, syncable ) 76 : Resource( 0 )
77{ 77{
78 init( fileName ); 78 init( fileName );
79} 79}
80 80
81void ResourceSharpDTM::init( const QString &fileName ) 81void ResourceSharpDTM::init( const QString &fileName )
82{ 82{
83 83
84 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); 84 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) );
85 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); 85 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) );
86 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); 86 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
87 87
88 setFileName( fileName ); 88 setFileName( fileName );
89} 89}
90 90
91ResourceSharpDTM::~ResourceSharpDTM() 91ResourceSharpDTM::~ResourceSharpDTM()
92{ 92{
93 if (mConverter != 0) 93 if (mConverter != 0)
94 delete mConverter; 94 delete mConverter;
95 95
96 if(mAccess != 0) 96 if(mAccess != 0)
97 delete mAccess; 97 delete mAccess;
98} 98}
99 99
100void ResourceSharpDTM::writeConfig( KConfig *config ) 100void ResourceSharpDTM::writeConfig( KConfig *config )
101{ 101{
102 Resource::writeConfig( config ); 102 Resource::writeConfig( config );
103} 103}
104 104
105Ticket *ResourceSharpDTM::requestSaveTicket() 105Ticket *ResourceSharpDTM::requestSaveTicket()
106{ 106{
107 107
108 108
109 qDebug("ResourceSharpDTM::requestSaveTicket: %s", fileName().latin1()); 109 qDebug("ResourceSharpDTM::requestSaveTicket: %s", fileName().latin1());
110 110
111 if ( !addressBook() ) return 0; 111 if ( !addressBook() ) return 0;
112 112
113#ifdef ALLOW_LOCKING 113#ifdef ALLOW_LOCKING
114 if ( !lock( fileName() ) ) { 114 if ( !lock( fileName() ) ) {
115 qDebug("ResourceSharpDTM::requestSaveTicket(): Unable to lock file "); 115 qDebug("ResourceSharpDTM::requestSaveTicket(): Unable to lock file ");
116 return 0; 116 return 0;
117 } 117 }
118#endif 118#endif
119 return createTicket( this ); 119 return createTicket( this );
120} 120}
121 121
122 122
123bool ResourceSharpDTM::doOpen() 123bool ResourceSharpDTM::doOpen()
124{ 124{
125 qDebug("ResourceSharpDTM::doOpen: %s", fileName().latin1()); 125 qDebug("ResourceSharpDTM::doOpen: %s", fileName().latin1());
126 126
127 // the last parameter in the SlZDataBase constructor means "readonly" 127 // the last parameter in the SlZDataBase constructor means "readonly"
128 mAccess = new SlZDataBase(fileName(), 128 mAccess = new SlZDataBase(fileName(),
129 SlZDataBase::addressbookItems(), 129 SlZDataBase::addressbookItems(),
130 NULL, false); 130 NULL, false);
131 131
132 if ( !mAccess ) { 132 if ( !mAccess ) {
133 qDebug("Unable to load file() %s", fileName().latin1()); 133 qDebug("Unable to load file() %s", fileName().latin1());
134 return false; 134 return false;
135 } 135 }
136 136
137 if (mConverter == 0) 137 if (mConverter == 0)
138 { 138 {
139 mConverter = new SharpDTMConverter(); 139 mConverter = new SharpDTMConverter();
140 bool res = mConverter->init(); 140 bool res = mConverter->init();
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 087e9e3..3ab06c4 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -143,254 +143,258 @@ $Id$
143#include "details/detailsviewcontainer.h" 143#include "details/detailsviewcontainer.h"
144#include "kabprefs.h" 144#include "kabprefs.h"
145#include "xxportmanager.h" 145#include "xxportmanager.h"
146#include "incsearchwidget.h" 146#include "incsearchwidget.h"
147#include "jumpbuttonbar.h" 147#include "jumpbuttonbar.h"
148#include "extensionmanager.h" 148#include "extensionmanager.h"
149#include "addresseeconfig.h" 149#include "addresseeconfig.h"
150#include <kcmultidialog.h> 150#include <kcmultidialog.h>
151 151
152#ifdef _WIN32_ 152#ifdef _WIN32_
153 153
154#include "kaimportoldialog.h" 154#include "kaimportoldialog.h"
155#else 155#else
156#include <unistd.h> 156#include <unistd.h>
157#endif 157#endif
158// sync includes 158// sync includes
159#include <libkdepim/ksyncprofile.h> 159#include <libkdepim/ksyncprofile.h>
160#include <libkdepim/ksyncprefsdialog.h> 160#include <libkdepim/ksyncprefsdialog.h>
161 161
162class KAex2phonePrefs : public QDialog 162class KAex2phonePrefs : public QDialog
163{ 163{
164 public: 164 public:
165 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 165 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
166 QDialog( parent, name, true ) 166 QDialog( parent, name, true )
167 { 167 {
168 setCaption( i18n("Export to phone options") ); 168 setCaption( i18n("Export to phone options") );
169 QVBoxLayout* lay = new QVBoxLayout( this ); 169 QVBoxLayout* lay = new QVBoxLayout( this );
170 lay->setSpacing( 3 ); 170 lay->setSpacing( 3 );
171 lay->setMargin( 3 ); 171 lay->setMargin( 3 );
172 QLabel *lab; 172 QLabel *lab;
173 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 173 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
174 lab->setAlignment (AlignHCenter ); 174 lab->setAlignment (AlignHCenter );
175 QHBox* temphb; 175 QHBox* temphb;
176 temphb = new QHBox( this ); 176 temphb = new QHBox( this );
177 new QLabel( i18n("I/O device: "), temphb ); 177 new QLabel( i18n("I/O device: "), temphb );
178 mPhoneDevice = new QLineEdit( temphb); 178 mPhoneDevice = new QLineEdit( temphb);
179 lay->addWidget( temphb ); 179 lay->addWidget( temphb );
180 temphb = new QHBox( this ); 180 temphb = new QHBox( this );
181 new QLabel( i18n("Connection: "), temphb ); 181 new QLabel( i18n("Connection: "), temphb );
182 mPhoneConnection = new QLineEdit( temphb); 182 mPhoneConnection = new QLineEdit( temphb);
183 lay->addWidget( temphb ); 183 lay->addWidget( temphb );
184 temphb = new QHBox( this ); 184 temphb = new QHBox( this );
185 new QLabel( i18n("Model(opt.): "), temphb ); 185 new QLabel( i18n("Model(opt.): "), temphb );
186 mPhoneModel = new QLineEdit( temphb); 186 mPhoneModel = new QLineEdit( temphb);
187 lay->addWidget( temphb ); 187 lay->addWidget( temphb );
188 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 188 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
189 // lay->addWidget( mWriteToSim ); 189 // lay->addWidget( mWriteToSim );
190 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 190 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
191 lab->setAlignment (AlignHCenter ); 191 lab->setAlignment (AlignHCenter );
192 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 192 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
193 lay->addWidget( ok ); 193 lay->addWidget( ok );
194 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 194 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
195 lay->addWidget( cancel ); 195 lay->addWidget( cancel );
196 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 196 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
197 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 197 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
198 resize( 220, 240 ); 198 resize( 220, 240 );
199 199
200 } 200 }
201 201
202public: 202public:
203 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 203 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
204 QCheckBox* mWriteToSim; 204 QCheckBox* mWriteToSim;
205}; 205};
206 206
207
207bool pasteWithNewUid = true; 208bool pasteWithNewUid = true;
208 209
209#ifdef KAB_EMBEDDED 210#ifdef KAB_EMBEDDED
210KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 211KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
211 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 212 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
212 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 213 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
213 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 214 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
214#else //KAB_EMBEDDED 215#else //KAB_EMBEDDED
215KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 216KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
216 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 217 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
217 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 218 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
218 mReadWrite( readWrite ), mModified( false ) 219 mReadWrite( readWrite ), mModified( false )
219#endif //KAB_EMBEDDED 220#endif //KAB_EMBEDDED
220{ 221{
221 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 222 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
222 // syncManager->setBlockSave(false); 223 // syncManager->setBlockSave(false);
223 mExtensionBarSplitter = 0; 224 mExtensionBarSplitter = 0;
224 mIsPart = !parent->inherits( "KAddressBookMain" ); 225 mIsPart = !parent->inherits( "KAddressBookMain" );
225
226 mAddressBook = KABC::StdAddressBook::self(); 226 mAddressBook = KABC::StdAddressBook::self();
227 KABC::StdAddressBook::setAutomaticSave( false ); 227 KABC::StdAddressBook::setAutomaticSave( false );
228 228
229#ifndef KAB_EMBEDDED 229#ifndef KAB_EMBEDDED
230 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 230 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
231#endif //KAB_EMBEDDED 231#endif //KAB_EMBEDDED
232 232
233 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 233 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
234 SLOT( addressBookChanged() ) ); 234 SLOT( addressBookChanged() ) );
235 235
236#if 0 236#if 0
237 // LP moved to addressbook init method 237 // LP moved to addressbook init method
238 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 238 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
239 "X-Department", "KADDRESSBOOK" ); 239 "X-Department", "KADDRESSBOOK" );
240 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 240 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
241 "X-Profession", "KADDRESSBOOK" ); 241 "X-Profession", "KADDRESSBOOK" );
242 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 242 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
243 "X-AssistantsName", "KADDRESSBOOK" ); 243 "X-AssistantsName", "KADDRESSBOOK" );
244 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 244 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
245 "X-ManagersName", "KADDRESSBOOK" ); 245 "X-ManagersName", "KADDRESSBOOK" );
246 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 246 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
247 "X-SpousesName", "KADDRESSBOOK" ); 247 "X-SpousesName", "KADDRESSBOOK" );
248 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 248 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
249 "X-Office", "KADDRESSBOOK" ); 249 "X-Office", "KADDRESSBOOK" );
250 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 250 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
251 "X-IMAddress", "KADDRESSBOOK" ); 251 "X-IMAddress", "KADDRESSBOOK" );
252 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 252 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
253 "X-Anniversary", "KADDRESSBOOK" ); 253 "X-Anniversary", "KADDRESSBOOK" );
254 254
255 //US added this field to become compatible with Opie/qtopia addressbook 255 //US added this field to become compatible with Opie/qtopia addressbook
256 // values can be "female" or "male" or "". An empty field represents undefined. 256 // values can be "female" or "male" or "". An empty field represents undefined.
257 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 257 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
258 "X-Gender", "KADDRESSBOOK" ); 258 "X-Gender", "KADDRESSBOOK" );
259 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 259 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
260 "X-Children", "KADDRESSBOOK" ); 260 "X-Children", "KADDRESSBOOK" );
261 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 261 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
262 "X-FreeBusyUrl", "KADDRESSBOOK" ); 262 "X-FreeBusyUrl", "KADDRESSBOOK" );
263#endif 263#endif
264 initGUI(); 264 initGUI();
265 265
266 mIncSearchWidget->setFocus(); 266 mIncSearchWidget->setFocus();
267 267
268 268
269 connect( mViewManager, SIGNAL( selected( const QString& ) ), 269 connect( mViewManager, SIGNAL( selected( const QString& ) ),
270 SLOT( setContactSelected( const QString& ) ) ); 270 SLOT( setContactSelected( const QString& ) ) );
271 connect( mViewManager, SIGNAL( executed( const QString& ) ), 271 connect( mViewManager, SIGNAL( executed( const QString& ) ),
272 SLOT( executeContact( const QString& ) ) ); 272 SLOT( executeContact( const QString& ) ) );
273 273
274 connect( mViewManager, SIGNAL( deleteRequest( ) ), 274 connect( mViewManager, SIGNAL( deleteRequest( ) ),
275 SLOT( deleteContacts( ) ) ); 275 SLOT( deleteContacts( ) ) );
276 connect( mViewManager, SIGNAL( modified() ), 276 connect( mViewManager, SIGNAL( modified() ),
277 SLOT( setModified() ) ); 277 SLOT( setModified() ) );
278 278
279 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 279 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
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
311 mMessageTimer = new QTimer( this );
312 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
310 mEditorDialog = 0; 313 mEditorDialog = 0;
311 createAddresseeEditorDialog( this ); 314 createAddresseeEditorDialog( this );
312 setModified( false ); 315 setModified( false );
313} 316}
314 317
315KABCore::~KABCore() 318KABCore::~KABCore()
316{ 319{
317 // save(); 320 // save();
318 //saveSettings(); 321 //saveSettings();
319 //KABPrefs::instance()->writeConfig(); 322 //KABPrefs::instance()->writeConfig();
320 delete AddresseeConfig::instance(); 323 delete AddresseeConfig::instance();
321 mAddressBook = 0; 324 mAddressBook = 0;
322 KABC::StdAddressBook::close(); 325 KABC::StdAddressBook::close();
323 326
324 delete syncManager; 327 delete syncManager;
325 328
326} 329}
327 330
328void KABCore::recieve( QString fn ) 331void KABCore::recieve( QString fn )
329{ 332{
330 //qDebug("KABCore::recieve "); 333 //qDebug("KABCore::recieve ");
331 mAddressBook->importFromFile( fn, true ); 334 int count = mAddressBook->importFromFile( fn, true );
332 mViewManager->refreshView(); 335 mViewManager->refreshView();
336 message(i18n("%1 contact(s) received!").arg( count ));
333 topLevelWidget()->raise(); 337 topLevelWidget()->raise();
334} 338}
335void KABCore::restoreSettings() 339void KABCore::restoreSettings()
336{ 340{
337 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 341 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
338 342
339 bool state; 343 bool state;
340 344
341 if (mMultipleViewsAtOnce) 345 if (mMultipleViewsAtOnce)
342 state = KABPrefs::instance()->mDetailsPageVisible; 346 state = KABPrefs::instance()->mDetailsPageVisible;
343 else 347 else
344 state = false; 348 state = false;
345 349
346 mActionDetails->setChecked( state ); 350 mActionDetails->setChecked( state );
347 setDetailsVisible( state ); 351 setDetailsVisible( state );
348 352
349 state = KABPrefs::instance()->mJumpButtonBarVisible; 353 state = KABPrefs::instance()->mJumpButtonBarVisible;
350 354
351 mActionJumpBar->setChecked( state ); 355 mActionJumpBar->setChecked( state );
352 setJumpButtonBarVisible( state ); 356 setJumpButtonBarVisible( state );
353/*US 357/*US
354 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 358 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
355 if ( splitterSize.count() == 0 ) { 359 if ( splitterSize.count() == 0 ) {
356 splitterSize.append( width() / 2 ); 360 splitterSize.append( width() / 2 );
357 splitterSize.append( width() / 2 ); 361 splitterSize.append( width() / 2 );
358 } 362 }
359 mMiniSplitter->setSizes( splitterSize ); 363 mMiniSplitter->setSizes( splitterSize );
360 if ( mExtensionBarSplitter ) { 364 if ( mExtensionBarSplitter ) {
361 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 365 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
362 if ( splitterSize.count() == 0 ) { 366 if ( splitterSize.count() == 0 ) {
363 splitterSize.append( width() / 2 ); 367 splitterSize.append( width() / 2 );
364 splitterSize.append( width() / 2 ); 368 splitterSize.append( width() / 2 );
365 } 369 }
366 mExtensionBarSplitter->setSizes( splitterSize ); 370 mExtensionBarSplitter->setSizes( splitterSize );
367 371
368 } 372 }
369*/ 373*/
370 mViewManager->restoreSettings(); 374 mViewManager->restoreSettings();
371 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 375 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
372 mExtensionManager->restoreSettings(); 376 mExtensionManager->restoreSettings();
373#ifdef DESKTOP_VERSION 377#ifdef DESKTOP_VERSION
374 int wid = width(); 378 int wid = width();
375 if ( wid < 10 ) 379 if ( wid < 10 )
376 wid = 400; 380 wid = 400;
377#else 381#else
378 int wid = QApplication::desktop()->width(); 382 int wid = QApplication::desktop()->width();
379 if ( wid < 640 ) 383 if ( wid < 640 )
380 wid = QApplication::desktop()->height(); 384 wid = QApplication::desktop()->height();
381#endif 385#endif
382 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 386 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
383 if ( true /*splitterSize.count() == 0*/ ) { 387 if ( true /*splitterSize.count() == 0*/ ) {
384 splitterSize.append( wid / 2 ); 388 splitterSize.append( wid / 2 );
385 splitterSize.append( wid / 2 ); 389 splitterSize.append( wid / 2 );
386 } 390 }
387 mMiniSplitter->setSizes( splitterSize ); 391 mMiniSplitter->setSizes( splitterSize );
388 if ( mExtensionBarSplitter ) { 392 if ( mExtensionBarSplitter ) {
389 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 393 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
390 if ( true /*splitterSize.count() == 0*/ ) { 394 if ( true /*splitterSize.count() == 0*/ ) {
391 splitterSize.append( wid / 2 ); 395 splitterSize.append( wid / 2 );
392 splitterSize.append( wid / 2 ); 396 splitterSize.append( wid / 2 );
393 } 397 }
394 mExtensionBarSplitter->setSizes( splitterSize ); 398 mExtensionBarSplitter->setSizes( splitterSize );
395 399
396 } 400 }
@@ -636,263 +640,264 @@ void KABCore::mailVCard( const QStringList& uids )
636 urls.append( fileName ); 640 urls.append( fileName );
637 } 641 }
638 } 642 }
639 643
640 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 644 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
641 645
642 646
643/*US 647/*US
644 kapp->invokeMailer( QString::null, QString::null, QString::null, 648 kapp->invokeMailer( QString::null, QString::null, QString::null,
645 QString::null, // subject 649 QString::null, // subject
646 QString::null, // body 650 QString::null, // body
647 QString::null, 651 QString::null,
648 urls ); // attachments 652 urls ); // attachments
649*/ 653*/
650 654
651} 655}
652 656
653/** 657/**
654 Beams the "WhoAmI contact. 658 Beams the "WhoAmI contact.
655*/ 659*/
656void KABCore::beamMySelf() 660void KABCore::beamMySelf()
657{ 661{
658 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 662 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
659 if (!a.isEmpty()) 663 if (!a.isEmpty())
660 { 664 {
661 QStringList uids; 665 QStringList uids;
662 uids << a.uid(); 666 uids << a.uid();
663 667
664 beamVCard(uids); 668 beamVCard(uids);
665 } else { 669 } else {
666 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 670 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
667 671
668 672
669 } 673 }
670} 674}
671 675
672void KABCore::export2phone() 676void KABCore::export2phone()
673{ 677{
674 678
675 KAex2phonePrefs ex2phone; 679 KAex2phonePrefs ex2phone;
676 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 680 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
677 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 681 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
678 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 682 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
679 683
680 if ( !ex2phone.exec() ) { 684 if ( !ex2phone.exec() ) {
681 return; 685 return;
682 } 686 }
683 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 687 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
684 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 688 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
685 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 689 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
686 690
687 691
688 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 692 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
689 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 693 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
690 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 694 KPimGlobalPrefs::instance()->mEx2PhoneModel );
691 695
692 QStringList uids = mViewManager->selectedUids(); 696 QStringList uids = mViewManager->selectedUids();
693 if ( uids.isEmpty() ) 697 if ( uids.isEmpty() )
694 return; 698 return;
695 699
696 QString fileName = getPhoneFile(); 700 QString fileName = getPhoneFile();
697 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 701 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
698 return; 702 return;
699 703
704 message(i18n("Exporting to phone..."));
700 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 705 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
701 706
702} 707}
703QString KABCore::getPhoneFile() 708QString KABCore::getPhoneFile()
704{ 709{
705#ifdef _WIN32_ 710#ifdef _WIN32_
706 return locateLocal("tmp", "phonefile.vcf"); 711 return locateLocal("tmp", "phonefile.vcf");
707#else 712#else
708 return "/tmp/phonefile.vcf"; 713 return "/tmp/phonefile.vcf";
709#endif 714#endif
710 715
711} 716}
712void KABCore::writeToPhone( ) 717void KABCore::writeToPhone( )
713{ 718{
714 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 719 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
715 qDebug("Export okay "); 720 message(i18n("Export to phone finished!"));
716 else 721 else
717 qDebug("Error export contacts "); 722 qDebug(i18n("Error exporting to phone"));
718} 723}
719void KABCore::beamVCard() 724void KABCore::beamVCard()
720{ 725{
721 QStringList uids = mViewManager->selectedUids(); 726 QStringList uids = mViewManager->selectedUids();
722 if ( !uids.isEmpty() ) 727 if ( !uids.isEmpty() )
723 beamVCard( uids ); 728 beamVCard( uids );
724} 729}
725 730
726 731
727void KABCore::beamVCard(const QStringList& uids) 732void KABCore::beamVCard(const QStringList& uids)
728{ 733{
729/*US 734/*US
730 QString beamFilename; 735 QString beamFilename;
731 Opie::OPimContact c; 736 Opie::OPimContact c;
732 if ( actionPersonal->isOn() ) { 737 if ( actionPersonal->isOn() ) {
733 beamFilename = addressbookPersonalVCardName(); 738 beamFilename = addressbookPersonalVCardName();
734 if ( !QFile::exists( beamFilename ) ) 739 if ( !QFile::exists( beamFilename ) )
735 return; // can't beam a non-existent file 740 return; // can't beam a non-existent file
736 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 741 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
737 beamFilename ); 742 beamFilename );
738 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 743 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
739 Opie::OPimContactAccess::List allList = access->allRecords(); 744 Opie::OPimContactAccess::List allList = access->allRecords();
740 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first 745 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first
741 c = *it; 746 c = *it;
742 747
743 delete access; 748 delete access;
744 } else { 749 } else {
745 unlink( beamfile ); // delete if exists 750 unlink( beamfile ); // delete if exists
746 mkdir("/tmp/obex/", 0755); 751 mkdir("/tmp/obex/", 0755);
747 c = m_abView -> currentEntry(); 752 c = m_abView -> currentEntry();
748 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 753 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
749 beamfile ); 754 beamfile );
750 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 755 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
751 access->add( c ); 756 access->add( c );
752 access->save(); 757 access->save();
753 delete access; 758 delete access;
754 759
755 beamFilename = beamfile; 760 beamFilename = beamfile;
756 } 761 }
757 762
758 owarn << "Beaming: " << beamFilename << oendl; 763 owarn << "Beaming: " << beamFilename << oendl;
759*/ 764*/
760 765
761#if 0 766#if 0
762 QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 767 QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
763 768
764 QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); 769 QString dirName = tmpdir + "/" + KApplication::randomString( 8 );
765 770
766 QString name = "contact.vcf"; 771 QString name = "contact.vcf";
767 772
768 QString fileName = dirName + "/" + name; 773 QString fileName = dirName + "/" + name;
769#endif 774#endif
770 // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory 775 // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory
771 // 776 //
772 QString fileName = "/tmp/kapibeamfile.vcf"; 777 QString fileName = "/tmp/kapibeamfile.vcf";
773 778
774 779
775 //QDir().mkdir( dirName, true ); 780 //QDir().mkdir( dirName, true );
776 781
777 782
778 KABC::VCardConverter converter; 783 KABC::VCardConverter converter;
779 QString description; 784 QString description;
780 QString datastream; 785 QString datastream;
781 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 786 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
782 KABC::Addressee a = mAddressBook->findByUid( *it ); 787 KABC::Addressee a = mAddressBook->findByUid( *it );
783 788
784 if ( a.isEmpty() ) 789 if ( a.isEmpty() )
785 continue; 790 continue;
786 791
787 if (description.isEmpty()) 792 if (description.isEmpty())
788 description = a.formattedName(); 793 description = a.formattedName();
789 794
790 QString vcard; 795 QString vcard;
791 converter.addresseeToVCard( a, vcard ); 796 converter.addresseeToVCard( a, vcard );
792 int start = 0; 797 int start = 0;
793 int next; 798 int next;
794 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 799 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
795 int semi = vcard.find(";", next); 800 int semi = vcard.find(";", next);
796 int dopp = vcard.find(":", next); 801 int dopp = vcard.find(":", next);
797 int sep; 802 int sep;
798 if ( semi < dopp && semi >= 0 ) 803 if ( semi < dopp && semi >= 0 )
799 sep = semi ; 804 sep = semi ;
800 else 805 else
801 sep = dopp; 806 sep = dopp;
802 datastream +=vcard.mid( start, next - start); 807 datastream +=vcard.mid( start, next - start);
803 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 808 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
804 start = sep; 809 start = sep;
805 } 810 }
806 datastream += vcard.mid( start,vcard.length() ); 811 datastream += vcard.mid( start,vcard.length() );
807 } 812 }
808#ifndef DESKTOP_VERSION 813#ifndef DESKTOP_VERSION
809 QFile outFile(fileName); 814 QFile outFile(fileName);
810 if ( outFile.open(IO_WriteOnly) ) { 815 if ( outFile.open(IO_WriteOnly) ) {
811 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 816 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
812 QTextStream t( &outFile ); // use a text stream 817 QTextStream t( &outFile ); // use a text stream
813 //t.setEncoding( QTextStream::UnicodeUTF8 ); 818 //t.setEncoding( QTextStream::UnicodeUTF8 );
814 t.setEncoding( QTextStream::Latin1 ); 819 t.setEncoding( QTextStream::Latin1 );
815 t <<datastream.latin1(); 820 t <<datastream.latin1();
816 outFile.close(); 821 outFile.close();
817 Ir *ir = new Ir( this ); 822 Ir *ir = new Ir( this );
818 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 823 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
819 ir->send( fileName, description, "text/x-vCard" ); 824 ir->send( fileName, description, "text/x-vCard" );
820 } else { 825 } else {
821 qDebug("Error open temp beam file "); 826 qDebug("Error open temp beam file ");
822 return; 827 return;
823 } 828 }
824#endif 829#endif
825 830
826} 831}
827 832
828void KABCore::beamDone( Ir *ir ) 833void KABCore::beamDone( Ir *ir )
829{ 834{
830#ifndef DESKTOP_VERSION 835#ifndef DESKTOP_VERSION
831 delete ir; 836 delete ir;
832#endif 837#endif
833 topLevelWidget()->raise(); 838 topLevelWidget()->raise();
834 message( i18n("Beaming successful!") ); 839 message( i18n("Beaming finished!") );
835} 840}
836 841
837 842
838void KABCore::browse( const QString& url ) 843void KABCore::browse( const QString& url )
839{ 844{
840#ifndef KAB_EMBEDDED 845#ifndef KAB_EMBEDDED
841 kapp->invokeBrowser( url ); 846 kapp->invokeBrowser( url );
842#else //KAB_EMBEDDED 847#else //KAB_EMBEDDED
843 qDebug("KABCore::browse must be fixed"); 848 qDebug("KABCore::browse must be fixed");
844#endif //KAB_EMBEDDED 849#endif //KAB_EMBEDDED
845} 850}
846 851
847void KABCore::selectAllContacts() 852void KABCore::selectAllContacts()
848{ 853{
849 mViewManager->setSelected( QString::null, true ); 854 mViewManager->setSelected( QString::null, true );
850} 855}
851 856
852void KABCore::deleteContacts() 857void KABCore::deleteContacts()
853{ 858{
854 QStringList uidList = mViewManager->selectedUids(); 859 QStringList uidList = mViewManager->selectedUids();
855 deleteContacts( uidList ); 860 deleteContacts( uidList );
856} 861}
857 862
858void KABCore::deleteContacts( const QStringList &uids ) 863void KABCore::deleteContacts( const QStringList &uids )
859{ 864{
860 if ( uids.count() > 0 ) { 865 if ( uids.count() > 0 ) {
861 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 866 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
862 UndoStack::instance()->push( command ); 867 UndoStack::instance()->push( command );
863 RedoStack::instance()->clear(); 868 RedoStack::instance()->clear();
864 869
865 // now if we deleted anything, refresh 870 // now if we deleted anything, refresh
866 setContactSelected( QString::null ); 871 setContactSelected( QString::null );
867 setModified( true ); 872 setModified( true );
868 } 873 }
869} 874}
870 875
871void KABCore::copyContacts() 876void KABCore::copyContacts()
872{ 877{
873 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 878 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
874 879
875 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 880 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
876 881
877 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 882 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
878 883
879 QClipboard *cb = QApplication::clipboard(); 884 QClipboard *cb = QApplication::clipboard();
880 cb->setText( clipText ); 885 cb->setText( clipText );
881} 886}
882 887
883void KABCore::cutContacts() 888void KABCore::cutContacts()
884{ 889{
885 QStringList uidList = mViewManager->selectedUids(); 890 QStringList uidList = mViewManager->selectedUids();
886 891
887//US if ( uidList.size() > 0 ) { 892//US if ( uidList.size() > 0 ) {
888 if ( uidList.count() > 0 ) { 893 if ( uidList.count() > 0 ) {
889 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 894 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
890 UndoStack::instance()->push( command ); 895 UndoStack::instance()->push( command );
891 RedoStack::instance()->clear(); 896 RedoStack::instance()->clear();
892 897
893 setModified( true ); 898 setModified( true );
894 } 899 }
895} 900}
896 901
897void KABCore::pasteContacts() 902void KABCore::pasteContacts()
898{ 903{
@@ -1134,151 +1139,147 @@ void KABCore::importFromOL()
1134 delete idgl; 1139 delete idgl;
1135#endif 1140#endif
1136} 1141}
1137 1142
1138void KABCore::importVCard( const QString &vCard, bool showPreview ) 1143void KABCore::importVCard( const QString &vCard, bool showPreview )
1139{ 1144{
1140 mXXPortManager->importVCard( vCard, showPreview ); 1145 mXXPortManager->importVCard( vCard, showPreview );
1141} 1146}
1142 1147
1143//US added a second method without defaultparameter 1148//US added a second method without defaultparameter
1144void KABCore::editContact2() { 1149void KABCore::editContact2() {
1145 editContact( QString::null ); 1150 editContact( QString::null );
1146} 1151}
1147 1152
1148void KABCore::editContact( const QString &uid ) 1153void KABCore::editContact( const QString &uid )
1149{ 1154{
1150 1155
1151 if ( mExtensionManager->isQuickEditVisible() ) 1156 if ( mExtensionManager->isQuickEditVisible() )
1152 return; 1157 return;
1153 1158
1154 // First, locate the contact entry 1159 // First, locate the contact entry
1155 QString localUID = uid; 1160 QString localUID = uid;
1156 if ( localUID.isNull() ) { 1161 if ( localUID.isNull() ) {
1157 QStringList uidList = mViewManager->selectedUids(); 1162 QStringList uidList = mViewManager->selectedUids();
1158 if ( uidList.count() > 0 ) 1163 if ( uidList.count() > 0 )
1159 localUID = *( uidList.at( 0 ) ); 1164 localUID = *( uidList.at( 0 ) );
1160 } 1165 }
1161 1166
1162 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1167 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1163 if ( !addr.isEmpty() ) { 1168 if ( !addr.isEmpty() ) {
1164 mEditorDialog->setAddressee( addr ); 1169 mEditorDialog->setAddressee( addr );
1165 KApplication::execDialog ( mEditorDialog ); 1170 KApplication::execDialog ( mEditorDialog );
1166 } 1171 }
1167} 1172}
1168 1173
1169/** 1174/**
1170 Shows or edits the detail view for the given uid. If the uid is QString::null, 1175 Shows or edits the detail view for the given uid. If the uid is QString::null,
1171 the method will try to find a selected addressee in the view. 1176 the method will try to find a selected addressee in the view.
1172 */ 1177 */
1173void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) 1178void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1174{ 1179{
1175 if ( mMultipleViewsAtOnce ) 1180 if ( mMultipleViewsAtOnce )
1176 { 1181 {
1177 editContact( uid ); 1182 editContact( uid );
1178 } 1183 }
1179 else 1184 else
1180 { 1185 {
1181 setDetailsVisible( true ); 1186 setDetailsVisible( true );
1182 mActionDetails->setChecked(true); 1187 mActionDetails->setChecked(true);
1183 } 1188 }
1184 1189
1185} 1190}
1186 1191
1187void KABCore::save() 1192void KABCore::save()
1188{ 1193{
1189 if (syncManager->blockSave()) 1194 if (syncManager->blockSave())
1190 return; 1195 return;
1191 if ( !mModified ) 1196 if ( !mModified )
1192 return; 1197 return;
1193 1198
1194 syncManager->setBlockSave(true); 1199 syncManager->setBlockSave(true);
1195 QString text = i18n( "There was an error while attempting to save\n the " 1200 QString text = i18n( "There was an error while attempting to save\n the "
1196 "address book. Please check that some \nother application is " 1201 "address book. Please check that some \nother application is "
1197 "not using it. " ); 1202 "not using it. " );
1198 statusMessage(i18n("Saving addressbook ... ")); 1203 message(i18n("Saving addressbook ... "));
1199#ifndef KAB_EMBEDDED 1204#ifndef KAB_EMBEDDED
1200 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1205 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1201 if ( !b || !b->save() ) { 1206 if ( !b || !b->save() ) {
1202 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1207 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1203 } 1208 }
1204#else //KAB_EMBEDDED 1209#else //KAB_EMBEDDED
1205 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1210 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1206 if ( !b || !b->save() ) { 1211 if ( !b || !b->save() ) {
1207 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1212 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1208 } 1213 }
1209#endif //KAB_EMBEDDED 1214#endif //KAB_EMBEDDED
1210 1215
1211 statusMessage(i18n("Addressbook saved!")); 1216 message(i18n("Addressbook saved!"));
1212 setModified( false ); 1217 setModified( false );
1213 syncManager->setBlockSave(false); 1218 syncManager->setBlockSave(false);
1214} 1219}
1215 1220
1216void KABCore::statusMessage(QString mess , int time ) 1221
1217{
1218 //topLevelWidget()->setCaption( mess );
1219 // pending setting timer to revome message
1220}
1221void KABCore::undo() 1222void KABCore::undo()
1222{ 1223{
1223 UndoStack::instance()->undo(); 1224 UndoStack::instance()->undo();
1224 1225
1225 // Refresh the view 1226 // Refresh the view
1226 mViewManager->refreshView(); 1227 mViewManager->refreshView();
1227} 1228}
1228 1229
1229void KABCore::redo() 1230void KABCore::redo()
1230{ 1231{
1231 RedoStack::instance()->redo(); 1232 RedoStack::instance()->redo();
1232 1233
1233 // Refresh the view 1234 // Refresh the view
1234 mViewManager->refreshView(); 1235 mViewManager->refreshView();
1235} 1236}
1236 1237
1237void KABCore::setJumpButtonBarVisible( bool visible ) 1238void KABCore::setJumpButtonBarVisible( bool visible )
1238{ 1239{
1239 if (mMultipleViewsAtOnce) 1240 if (mMultipleViewsAtOnce)
1240 { 1241 {
1241 if ( visible ) 1242 if ( visible )
1242 mJumpButtonBar->show(); 1243 mJumpButtonBar->show();
1243 else 1244 else
1244 mJumpButtonBar->hide(); 1245 mJumpButtonBar->hide();
1245 } 1246 }
1246 else 1247 else
1247 { 1248 {
1248 // show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1249 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1249 if (mViewManager->isVisible()) 1250 if (mViewManager->isVisible())
1250 { 1251 {
1251 if ( visible ) 1252 if ( visible )
1252 mJumpButtonBar->show(); 1253 mJumpButtonBar->show();
1253 else 1254 else
1254 mJumpButtonBar->hide(); 1255 mJumpButtonBar->hide();
1255 } 1256 }
1256 else 1257 else
1257 { 1258 {
1258 mJumpButtonBar->hide(); 1259 mJumpButtonBar->hide();
1259 } 1260 }
1260 } 1261 }
1261} 1262}
1262 1263
1263 1264
1264void KABCore::setDetailsToState() 1265void KABCore::setDetailsToState()
1265{ 1266{
1266 setDetailsVisible( mActionDetails->isChecked() ); 1267 setDetailsVisible( mActionDetails->isChecked() );
1267} 1268}
1268 1269
1269 1270
1270 1271
1271void KABCore::setDetailsVisible( bool visible ) 1272void KABCore::setDetailsVisible( bool visible )
1272{ 1273{
1273 if (visible && mDetails->isHidden()) 1274 if (visible && mDetails->isHidden())
1274 { 1275 {
1275 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1276 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1276 if ( addrList.count() > 0 ) 1277 if ( addrList.count() > 0 )
1277 mDetails->setAddressee( addrList[ 0 ] ); 1278 mDetails->setAddressee( addrList[ 0 ] );
1278 } 1279 }
1279 1280
1280 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between 1281 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1281 // the listview and the detailview. We do that by changing the splitbar size. 1282 // the listview and the detailview. We do that by changing the splitbar size.
1282 if (mMultipleViewsAtOnce) 1283 if (mMultipleViewsAtOnce)
1283 { 1284 {
1284 if ( visible ) 1285 if ( visible )
@@ -2094,129 +2095,129 @@ void KABCore::configureKeyBindings()
2094} 2095}
2095 2096
2096#ifdef KAB_EMBEDDED 2097#ifdef KAB_EMBEDDED
2097void KABCore::configureResources() 2098void KABCore::configureResources()
2098{ 2099{
2099 KRES::KCMKResources dlg( this, "" , 0 ); 2100 KRES::KCMKResources dlg( this, "" , 0 );
2100 2101
2101 if ( !dlg.exec() ) 2102 if ( !dlg.exec() )
2102 return; 2103 return;
2103 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2104 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2104} 2105}
2105#endif //KAB_EMBEDDED 2106#endif //KAB_EMBEDDED
2106 2107
2107 2108
2108/* this method will be called through the QCop interface from Ko/Pi to select addresses 2109/* this method will be called through the QCop interface from Ko/Pi to select addresses
2109 * for the attendees list of an event. 2110 * for the attendees list of an event.
2110 */ 2111 */
2111void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2112void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2112{ 2113{
2113 QStringList nameList; 2114 QStringList nameList;
2114 QStringList emailList; 2115 QStringList emailList;
2115 QStringList uidList; 2116 QStringList uidList;
2116 2117
2117 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2118 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2118 uint i=0; 2119 uint i=0;
2119 for (i=0; i < list.count(); i++) 2120 for (i=0; i < list.count(); i++)
2120 { 2121 {
2121 nameList.append(list[i].realName()); 2122 nameList.append(list[i].realName());
2122 emailList.append(list[i].preferredEmail()); 2123 emailList.append(list[i].preferredEmail());
2123 uidList.append(list[i].uid()); 2124 uidList.append(list[i].uid());
2124 } 2125 }
2125 2126
2126 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2127 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2127 2128
2128} 2129}
2129 2130
2130/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2131/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2131 * to put them into the calendar. 2132 * to put them into the calendar.
2132 */ 2133 */
2133void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2134void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2134{ 2135{
2135 // qDebug("KABCore::requestForBirthdayList"); 2136 // qDebug("KABCore::requestForBirthdayList");
2136 QStringList birthdayList; 2137 QStringList birthdayList;
2137 QStringList anniversaryList; 2138 QStringList anniversaryList;
2138 QStringList realNameList; 2139 QStringList realNameList;
2139 QStringList preferredEmailList; 2140 QStringList preferredEmailList;
2140 QStringList assembledNameList; 2141 QStringList assembledNameList;
2141 QStringList uidList; 2142 QStringList uidList;
2142 2143
2143 KABC::AddressBook::Iterator it; 2144 KABC::AddressBook::Iterator it;
2144 2145
2145 int count = 0; 2146 int count = 0;
2146 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2147 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2147 ++count; 2148 ++count;
2148 } 2149 }
2149 QProgressBar bar(count,0 ); 2150 QProgressBar bar(count,0 );
2150 int w = 300; 2151 int w = 300;
2151 if ( QApplication::desktop()->width() < 320 ) 2152 if ( QApplication::desktop()->width() < 320 )
2152 w = 220; 2153 w = 220;
2153 int h = bar.sizeHint().height() ; 2154 int h = bar.sizeHint().height() ;
2154 int dw = QApplication::desktop()->width(); 2155 int dw = QApplication::desktop()->width();
2155 int dh = QApplication::desktop()->height(); 2156 int dh = QApplication::desktop()->height();
2156 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2157 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2157 bar.show(); 2158 bar.show();
2158 bar.setCaption (i18n("collecting birthdays - close to abort!") ); 2159 bar.setCaption (i18n("Collecting birthdays - close to abort!") );
2159 qApp->processEvents(); 2160 qApp->processEvents();
2160 2161
2161 QDate bday; 2162 QDate bday;
2162 QString anni; 2163 QString anni;
2163 QString formattedbday; 2164 QString formattedbday;
2164 2165
2165 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) 2166 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2166 { 2167 {
2167 if ( ! bar.isVisible() ) 2168 if ( ! bar.isVisible() )
2168 return; 2169 return;
2169 bar.setProgress( count++ ); 2170 bar.setProgress( count++ );
2170 qApp->processEvents(); 2171 qApp->processEvents();
2171 bday = (*it).birthday().date(); 2172 bday = (*it).birthday().date();
2172 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2173 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2173 2174
2174 if ( bday.isValid() || !anni.isEmpty()) 2175 if ( bday.isValid() || !anni.isEmpty())
2175 { 2176 {
2176 if (bday.isValid()) 2177 if (bday.isValid())
2177 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2178 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2178 else 2179 else
2179 formattedbday = "NOTVALID"; 2180 formattedbday = "NOTVALID";
2180 if (anni.isEmpty()) 2181 if (anni.isEmpty())
2181 anni = "INVALID"; 2182 anni = "INVALID";
2182 2183
2183 birthdayList.append(formattedbday); 2184 birthdayList.append(formattedbday);
2184 anniversaryList.append(anni); //should be ISODate 2185 anniversaryList.append(anni); //should be ISODate
2185 realNameList.append((*it).realName()); 2186 realNameList.append((*it).realName());
2186 preferredEmailList.append((*it).preferredEmail()); 2187 preferredEmailList.append((*it).preferredEmail());
2187 assembledNameList.append((*it).assembledName()); 2188 assembledNameList.append((*it).assembledName());
2188 uidList.append((*it).uid()); 2189 uidList.append((*it).uid());
2189 2190
2190 qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); 2191 qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() );
2191 } 2192 }
2192 } 2193 }
2193 2194
2194 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2195 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2195 2196
2196} 2197}
2197 2198
2198/* this method will be called through the QCop interface from other apps to show details of a contact. 2199/* this method will be called through the QCop interface from other apps to show details of a contact.
2199 */ 2200 */
2200void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2201void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2201{ 2202{
2202 qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2203 qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2203 2204
2204 QString foundUid = QString::null; 2205 QString foundUid = QString::null;
2205 if ( ! uid.isEmpty() ) { 2206 if ( ! uid.isEmpty() ) {
2206 Addressee adrr = mAddressBook->findByUid( uid ); 2207 Addressee adrr = mAddressBook->findByUid( uid );
2207 if ( !adrr.isEmpty() ) { 2208 if ( !adrr.isEmpty() ) {
2208 foundUid = uid; 2209 foundUid = uid;
2209 } 2210 }
2210 if ( email == "sendbacklist" ) { 2211 if ( email == "sendbacklist" ) {
2211 //qDebug("ssssssssssssssssssssssend "); 2212 //qDebug("ssssssssssssssssssssssend ");
2212 QStringList nameList; 2213 QStringList nameList;
2213 QStringList emailList; 2214 QStringList emailList;
2214 QStringList uidList; 2215 QStringList uidList;
2215 nameList.append(adrr.realName()); 2216 nameList.append(adrr.realName());
2216 emailList = adrr.emails(); 2217 emailList = adrr.emails();
2217 uidList.append( adrr.preferredEmail()); 2218 uidList.append( adrr.preferredEmail());
2218 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2219 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2219 return; 2220 return;
2220 } 2221 }
2221 2222
2222 } 2223 }
@@ -2748,127 +2749,127 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
2748 (*it).computeCsum( mCurrentSyncDevice ); 2749 (*it).computeCsum( mCurrentSyncDevice );
2749 } 2750 }
2750 } 2751 }
2751 } 2752 }
2752 //AddressBook::Iterator it; 2753 //AddressBook::Iterator it;
2753 //QStringList vcards; 2754 //QStringList vcards;
2754 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2755 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2755 // qDebug("Name %s ", (*it).familyName().latin1()); 2756 // qDebug("Name %s ", (*it).familyName().latin1());
2756 //} 2757 //}
2757 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); 2758 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
2758 if ( syncOK ) { 2759 if ( syncOK ) {
2759 if ( syncManager->mWriteBackFile ) 2760 if ( syncManager->mWriteBackFile )
2760 { 2761 {
2761 if ( external ) 2762 if ( external )
2762 abLocal.removeSyncAddressees( !isXML); 2763 abLocal.removeSyncAddressees( !isXML);
2763 qDebug("Saving remote AB "); 2764 qDebug("Saving remote AB ");
2764 if ( ! abLocal.saveAB()) 2765 if ( ! abLocal.saveAB())
2765 qDebug("Error writing back AB to file "); 2766 qDebug("Error writing back AB to file ");
2766 if ( isXML ) { 2767 if ( isXML ) {
2767 // afterwrite processing 2768 // afterwrite processing
2768 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); 2769 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2769 } 2770 }
2770 } 2771 }
2771 } 2772 }
2772 setModified(); 2773 setModified();
2773 2774
2774 } 2775 }
2775 if ( syncOK ) 2776 if ( syncOK )
2776 mViewManager->refreshView(); 2777 mViewManager->refreshView();
2777 return syncOK; 2778 return syncOK;
2778 2779
2779} 2780}
2780 2781
2781 2782
2782//this is a overwritten callbackmethods from the syncinterface 2783//this is a overwritten callbackmethods from the syncinterface
2783bool KABCore::syncExternal(KSyncManager* manager, QString resource) 2784bool KABCore::syncExternal(KSyncManager* manager, QString resource)
2784{ 2785{
2785 if ( resource == "phone" ) 2786 if ( resource == "phone" )
2786 return syncPhone(); 2787 return syncPhone();
2787 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2788 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2788 2789
2789 AddressBook abLocal( resource,"syncContact"); 2790 AddressBook abLocal( resource,"syncContact");
2790 bool syncOK = false; 2791 bool syncOK = false;
2791 if ( abLocal.load() ) { 2792 if ( abLocal.load() ) {
2792 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); 2793 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
2793 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2794 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2794 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); 2795 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false );
2795 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 2796 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2796 if ( syncOK ) { 2797 if ( syncOK ) {
2797 if ( syncManager->mWriteBackFile ) { 2798 if ( syncManager->mWriteBackFile ) {
2798 abLocal.removeSyncAddressees( false ); 2799 abLocal.removeSyncAddressees( false );
2799 abLocal.saveAB(); 2800 abLocal.saveAB();
2800 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); 2801 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2801 } 2802 }
2802 } 2803 }
2803 setModified(); 2804 setModified();
2804 } 2805 }
2805 if ( syncOK ) 2806 if ( syncOK )
2806 mViewManager->refreshView(); 2807 mViewManager->refreshView();
2807 return syncOK; 2808 return syncOK;
2808 2809
2809} 2810}
2810void KABCore::message( QString m ) 2811void KABCore::message( QString m )
2811{ 2812{
2812
2813 topLevelWidget()->setCaption( m ); 2813 topLevelWidget()->setCaption( m );
2814 QTimer::singleShot( 15000, this , SLOT ( setCaptionBack())); 2814 mMessageTimer->start( 15000, true );
2815} 2815}
2816bool KABCore::syncPhone() 2816bool KABCore::syncPhone()
2817{ 2817{
2818 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2818 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2819 QString fileName = getPhoneFile(); 2819 QString fileName = getPhoneFile();
2820 if ( !PhoneAccess::readFromPhone( fileName) ) { 2820 if ( !PhoneAccess::readFromPhone( fileName) ) {
2821 message(i18n("Phone access failed!")); 2821 message(i18n("Phone access failed!"));
2822 return false; 2822 return false;
2823 } 2823 }
2824 AddressBook abLocal( fileName,"syncContact"); 2824 AddressBook abLocal( fileName,"syncContact");
2825 bool syncOK = false; 2825 bool syncOK = false;
2826 { 2826 {
2827 abLocal.importFromFile( fileName ); 2827 abLocal.importFromFile( fileName );
2828 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); 2828 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
2829 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2829 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2830 abLocal.preparePhoneSync( mCurrentSyncDevice, true ); 2830 abLocal.preparePhoneSync( mCurrentSyncDevice, true );
2831 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 2831 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
2832 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 2832 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2833 if ( syncOK ) { 2833 if ( syncOK ) {
2834 if ( syncManager->mWriteBackFile ) { 2834 if ( syncManager->mWriteBackFile ) {
2835 abLocal.removeSyncAddressees( true ); 2835 abLocal.removeSyncAddressees( true );
2836 abLocal.saveABphone( fileName ); 2836 abLocal.saveABphone( fileName );
2837 abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); 2837 abLocal.findNewExtIds( fileName, mCurrentSyncDevice );
2838 //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); 2838 //abLocal.preparePhoneSync( mCurrentSyncDevice, false );
2839 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); 2839 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2840 } 2840 }
2841 } 2841 }
2842 setModified(); 2842 setModified();
2843 } 2843 }
2844 if ( syncOK ) 2844 if ( syncOK )
2845 mViewManager->refreshView(); 2845 mViewManager->refreshView();
2846 return syncOK; 2846 return syncOK;
2847} 2847}
2848void KABCore::getFile( bool success ) 2848void KABCore::getFile( bool success )
2849{ 2849{
2850 if ( ! success ) { 2850 if ( ! success ) {
2851 message( i18n("Error receiving file. Nothing changed!") ); 2851 message( i18n("Error receiving file. Nothing changed!") );
2852 return; 2852 return;
2853 } 2853 }
2854 mAddressBook->importFromFile( sentSyncFile() , false, true ); 2854 mAddressBook->importFromFile( sentSyncFile() , false, true );
2855 message( i18n("Pi-Sync successful!") ); 2855 message( i18n("Pi-Sync successful!") );
2856 mViewManager->refreshView(); 2856 mViewManager->refreshView();
2857} 2857}
2858void KABCore::syncFileRequest() 2858void KABCore::syncFileRequest()
2859{ 2859{
2860 mAddressBook->export2File( sentSyncFile() ); 2860 mAddressBook->export2File( sentSyncFile() );
2861} 2861}
2862QString KABCore::sentSyncFile() 2862QString KABCore::sentSyncFile()
2863{ 2863{
2864#ifdef _WIN32_ 2864#ifdef _WIN32_
2865 return locateLocal( "tmp", "copysyncab.vcf" ); 2865 return locateLocal( "tmp", "copysyncab.vcf" );
2866#else 2866#else
2867 return QString( "/tmp/copysyncab.vcf" ); 2867 return QString( "/tmp/copysyncab.vcf" );
2868#endif 2868#endif
2869} 2869}
2870 2870
2871void KABCore::setCaptionBack() 2871void KABCore::setCaptionBack()
2872{ 2872{
2873 mMessageTimer->stop();
2873 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); 2874 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") );
2874} 2875}
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 5871d39..c7be343 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -1,210 +1,210 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef KABCORE_H 24#ifndef KABCORE_H
25#define KABCORE_H 25#define KABCORE_H
26 26
27#include <kabc/field.h> 27#include <kabc/field.h>
28 28
29#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
30#endif //KAB_EMBEDDED 30#endif //KAB_EMBEDDED
31#include <qdict.h> 31#include <qdict.h>
32#include <qtimer.h>
32 33
33#include <qwidget.h> 34#include <qwidget.h>
34#include <qpopupmenu.h> 35#include <qpopupmenu.h>
35#include <ksyncmanager.h> 36#include <ksyncmanager.h>
36 37
37namespace KABC { 38namespace KABC {
38class AddressBook; 39class AddressBook;
39} 40}
40 41
41#ifndef KAB_EMBEDDED 42#ifndef KAB_EMBEDDED
42class KAboutData; 43class KAboutData;
43class KConfig; 44class KConfig;
44 45
45class KAddressBookService; 46class KAddressBookService;
46class LDAPSearchDialog; 47class LDAPSearchDialog;
47#else //KAB_EMBEDDED 48#else //KAB_EMBEDDED
48class KAddressBookMain; 49class KAddressBookMain;
49//US class QAction; 50//US class QAction;
50#endif //KAB_EMBEDDED 51#endif //KAB_EMBEDDED
51class KCMultiDialog; 52class KCMultiDialog;
52class KXMLGUIClient; 53class KXMLGUIClient;
53class ExtensionManager; 54class ExtensionManager;
54class XXPortManager; 55class XXPortManager;
55class JumpButtonBar; 56class JumpButtonBar;
56class IncSearchWidget; 57class IncSearchWidget;
57class KDGanttMinimizeSplitter; 58class KDGanttMinimizeSplitter;
58class KAction; 59class KAction;
59class KActionCollection; 60class KActionCollection;
60class KToggleAction; 61class KToggleAction;
61class KSyncProfile; 62class KSyncProfile;
62 63
63class QAction; 64class QAction;
64class QMenuBar; 65class QMenuBar;
65class QSplitter; 66class QSplitter;
66class ViewContainer; 67class ViewContainer;
67class ViewManager; 68class ViewManager;
68class AddresseeEditorDialog; 69class AddresseeEditorDialog;
69class Ir; 70class Ir;
70 71
71class KABCore : public QWidget, public KSyncInterface 72class KABCore : public QWidget, public KSyncInterface
72{ 73{
73 Q_OBJECT 74 Q_OBJECT
74 75
75 public: 76 public:
76 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); 77 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 );
77 78
78 79
79 ~KABCore(); 80 ~KABCore();
80 81
81 82
82#ifdef KAB_EMBEDDED 83#ifdef KAB_EMBEDDED
83 //US added functionality 84 //US added functionality
84 QPopupMenu* getViewMenu() {return viewMenu;} 85 QPopupMenu* getViewMenu() {return viewMenu;}
85 QPopupMenu* getFilterMenu() {return filterMenu;} 86 QPopupMenu* getFilterMenu() {return filterMenu;}
86 QPopupMenu* getSettingsMenu() {return settingsMenu;} 87 QPopupMenu* getSettingsMenu() {return settingsMenu;}
87 void addActionsManually(); 88 void addActionsManually();
88#endif //KAB_EMBEDDED 89#endif //KAB_EMBEDDED
89 /** 90 /**
90 Restores the global settings. 91 Restores the global settings.
91 */ 92 */
92 void restoreSettings(); 93 void restoreSettings();
93 94
94 /** 95 /**
95 Saves the global settings. 96 Saves the global settings.
96 */ 97 */
97 void saveSettings(); 98 void saveSettings();
98 99
99 /** 100 /**
100 Returns a pointer to the StdAddressBook of the application. 101 Returns a pointer to the StdAddressBook of the application.
101 */ 102 */
102 KABC::AddressBook *addressBook() const; 103 KABC::AddressBook *addressBook() const;
103 104
104 /** 105 /**
105 Returns a pointer to the KConfig object of the application. 106 Returns a pointer to the KConfig object of the application.
106 */ 107 */
107 static KConfig *config(); 108 static KConfig *config();
108 109
109 /** 110 /**
110 Returns a pointer to the global KActionCollection object. So 111 Returns a pointer to the global KActionCollection object. So
111 other classes can register their actions easily. 112 other classes can register their actions easily.
112 */ 113 */
113 KActionCollection *actionCollection() const; 114 KActionCollection *actionCollection() const;
114 115
115 /** 116 /**
116 Returns the current search field of the Incremental Search Widget. 117 Returns the current search field of the Incremental Search Widget.
117 */ 118 */
118 KABC::Field *currentSearchField() const; 119 KABC::Field *currentSearchField() const;
119 120
120 /** 121 /**
121 Returns the uid list of the currently selected contacts. 122 Returns the uid list of the currently selected contacts.
122 */ 123 */
123 QStringList selectedUIDs() const; 124 QStringList selectedUIDs() const;
124 125
125 /** 126 /**
126 Displays the ResourceSelectDialog and returns the selected 127 Displays the ResourceSelectDialog and returns the selected
127 resource or a null pointer if no resource was selected by 128 resource or a null pointer if no resource was selected by
128 the user. 129 the user.
129 */ 130 */
130 KABC::Resource *requestResource( QWidget *parent ); 131 KABC::Resource *requestResource( QWidget *parent );
131 132
132#ifndef KAB_EMBEDDED 133#ifndef KAB_EMBEDDED
133 static KAboutData *createAboutData(); 134 static KAboutData *createAboutData();
134#endif //KAB_EMBEDDED 135#endif //KAB_EMBEDDED
135 136
136#ifdef KAB_EMBEDDED 137#ifdef KAB_EMBEDDED
137 inline QPopupMenu* getImportMenu() { return ImportMenu;} 138 inline QPopupMenu* getImportMenu() { return ImportMenu;}
138 inline QPopupMenu* getExportMenu() { return ExportMenu;} 139 inline QPopupMenu* getExportMenu() { return ExportMenu;}
139#endif //KAB_EMBEDDED 140#endif //KAB_EMBEDDED
140 141
141 public slots: 142 public slots:
142#ifdef KAB_EMBEDDED 143#ifdef KAB_EMBEDDED
143 void createAboutData(); 144 void createAboutData();
144#endif //KAB_EMBEDDED 145#endif //KAB_EMBEDDED
145 146
146 void statusMessage(QString, int time = 0 );
147 void showLicence(); 147 void showLicence();
148 void faq(); 148 void faq();
149 void whatsnew() ; 149 void whatsnew() ;
150 void synchowto() ; 150 void synchowto() ;
151 void writeToPhone(); 151 void writeToPhone();
152 152
153 /** 153 /**
154 Is called whenever a contact is selected in the view. 154 Is called whenever a contact is selected in the view.
155 */ 155 */
156 void setContactSelected( const QString &uid ); 156 void setContactSelected( const QString &uid );
157 157
158 /** 158 /**
159 Opens the preferred mail composer with all selected contacts as 159 Opens the preferred mail composer with all selected contacts as
160 arguments. 160 arguments.
161 */ 161 */
162 void sendMail(); 162 void sendMail();
163 163
164 /** 164 /**
165 Opens the preferred mail composer with the given contacts as 165 Opens the preferred mail composer with the given contacts as
166 arguments. 166 arguments.
167 */ 167 */
168 void sendMail( const QString& email ); 168 void sendMail( const QString& email );
169 169
170 170
171 void mailVCard(); 171 void mailVCard();
172 void mailVCard(const QStringList& uids); 172 void mailVCard(const QStringList& uids);
173 173
174 /** 174 /**
175 Beams the "WhoAmI contact. 175 Beams the "WhoAmI contact.
176 */ 176 */
177 void beamMySelf(); 177 void beamMySelf();
178 178
179 void beamVCard(); 179 void beamVCard();
180 void export2phone(); 180 void export2phone();
181 void beamVCard(const QStringList& uids); 181 void beamVCard(const QStringList& uids);
182 void beamDone( Ir *ir ); 182 void beamDone( Ir *ir );
183 183
184 184
185 /** 185 /**
186 Starts the preferred web browser with the given URL as argument. 186 Starts the preferred web browser with the given URL as argument.
187 */ 187 */
188 void browse( const QString& url ); 188 void browse( const QString& url );
189 189
190 /** 190 /**
191 Select all contacts in the view. 191 Select all contacts in the view.
192 */ 192 */
193 void selectAllContacts(); 193 void selectAllContacts();
194 194
195 /** 195 /**
196 Deletes all selected contacts from the address book. 196 Deletes all selected contacts from the address book.
197 */ 197 */
198 void deleteContacts(); 198 void deleteContacts();
199 199
200 /** 200 /**
201 Deletes given contacts from the address book. 201 Deletes given contacts from the address book.
202 202
203 @param uids The uids of the contacts, which shall be deleted. 203 @param uids The uids of the contacts, which shall be deleted.
204 */ 204 */
205 void deleteContacts( const QStringList &uids ); 205 void deleteContacts( const QStringList &uids );
206 206
207 /** 207 /**
208 Copys the selected contacts into clipboard for later pasting. 208 Copys the selected contacts into clipboard for later pasting.
209 */ 209 */
210 void copyContacts(); 210 void copyContacts();
@@ -309,128 +309,129 @@ class KABCore : public QWidget, public KSyncInterface
309//US added a second method without defaultparameter 309//US added a second method without defaultparameter
310 void editContact2(); 310 void editContact2();
311 311
312 /** 312 /**
313 Shows or edits the detail view for the given uid. If the uid is QString::null, 313 Shows or edits the detail view for the given uid. If the uid is QString::null,
314 the method will try to find a selected addressee in the view. 314 the method will try to find a selected addressee in the view.
315 */ 315 */
316 void executeContact( const QString &uid /*US = QString::null*/ ); 316 void executeContact( const QString &uid /*US = QString::null*/ );
317 317
318 /** 318 /**
319 Launches the configuration dialog. 319 Launches the configuration dialog.
320 */ 320 */
321 void openConfigDialog(); 321 void openConfigDialog();
322 322
323 /** 323 /**
324 Launches the ldap search dialog. 324 Launches the ldap search dialog.
325 */ 325 */
326 void openLDAPDialog(); 326 void openLDAPDialog();
327 327
328 /** 328 /**
329 Creates a KAddressBookPrinter, which will display the print 329 Creates a KAddressBookPrinter, which will display the print
330 dialog and do the printing. 330 dialog and do the printing.
331 */ 331 */
332 void print(); 332 void print();
333 333
334 /** 334 /**
335 Registers a new GUI client, so plugins can register its actions. 335 Registers a new GUI client, so plugins can register its actions.
336 */ 336 */
337 void addGUIClient( KXMLGUIClient *client ); 337 void addGUIClient( KXMLGUIClient *client );
338 338
339 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 339 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
340 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 340 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
341 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 341 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
342 342
343 343
344 signals: 344 signals:
345 void contactSelected( const QString &name ); 345 void contactSelected( const QString &name );
346 void contactSelected( const QPixmap &pixmap ); 346 void contactSelected( const QPixmap &pixmap );
347 public slots: 347 public slots:
348 void recieve(QString cmsg ); 348 void recieve(QString cmsg );
349 void getFile( bool success ); 349 void getFile( bool success );
350 void syncFileRequest(); 350 void syncFileRequest();
351 void setDetailsVisible( bool visible ); 351 void setDetailsVisible( bool visible );
352 void setDetailsToState(); 352 void setDetailsToState();
353 // void slotSyncMenu( int ); 353 // void slotSyncMenu( int );
354 private slots: 354 private slots:
355 void setJumpButtonBarVisible( bool visible ); 355 void setJumpButtonBarVisible( bool visible );
356 void setCaptionBack(); 356 void setCaptionBack();
357 void importFromOL(); 357 void importFromOL();
358 void extensionModified( const KABC::Addressee::List &list ); 358 void extensionModified( const KABC::Addressee::List &list );
359 void extensionChanged( int id ); 359 void extensionChanged( int id );
360 void clipboardDataChanged(); 360 void clipboardDataChanged();
361 void updateActionMenu(); 361 void updateActionMenu();
362 void configureKeyBindings(); 362 void configureKeyBindings();
363 void removeVoice(); 363 void removeVoice();
364#ifdef KAB_EMBEDDED 364#ifdef KAB_EMBEDDED
365 void configureResources(); 365 void configureResources();
366#endif //KAB_EMBEDDED 366#endif //KAB_EMBEDDED
367 367
368 void slotEditorDestroyed( const QString &uid ); 368 void slotEditorDestroyed( const QString &uid );
369 void configurationChanged(); 369 void configurationChanged();
370 void addressBookChanged(); 370 void addressBookChanged();
371 371
372 private: 372 private:
373 QTimer *mMessageTimer;
373 void initGUI(); 374 void initGUI();
374 void initActions(); 375 void initActions();
375 QString getPhoneFile(); 376 QString getPhoneFile();
376 377
377 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 378 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
378 const char *name = 0 ); 379 const char *name = 0 );
379 380
380 KXMLGUIClient *mGUIClient; 381 KXMLGUIClient *mGUIClient;
381 382
382 KABC::AddressBook *mAddressBook; 383 KABC::AddressBook *mAddressBook;
383 384
384 ViewManager *mViewManager; 385 ViewManager *mViewManager;
385 // QSplitter *mDetailsSplitter; 386 // QSplitter *mDetailsSplitter;
386 KDGanttMinimizeSplitter *mExtensionBarSplitter; 387 KDGanttMinimizeSplitter *mExtensionBarSplitter;
387 ViewContainer *mDetails; 388 ViewContainer *mDetails;
388 KDGanttMinimizeSplitter* mMiniSplitter; 389 KDGanttMinimizeSplitter* mMiniSplitter;
389 XXPortManager *mXXPortManager; 390 XXPortManager *mXXPortManager;
390 JumpButtonBar *mJumpButtonBar; 391 JumpButtonBar *mJumpButtonBar;
391 IncSearchWidget *mIncSearchWidget; 392 IncSearchWidget *mIncSearchWidget;
392 ExtensionManager *mExtensionManager; 393 ExtensionManager *mExtensionManager;
393 394
394 KCMultiDialog *mConfigureDialog; 395 KCMultiDialog *mConfigureDialog;
395 396
396#ifndef KAB_EMBEDDED 397#ifndef KAB_EMBEDDED
397 LDAPSearchDialog *mLdapSearchDialog; 398 LDAPSearchDialog *mLdapSearchDialog;
398#endif //KAB_EMBEDDED 399#endif //KAB_EMBEDDED
399 // QDict<AddresseeEditorDialog> mEditorDict; 400 // QDict<AddresseeEditorDialog> mEditorDict;
400 AddresseeEditorDialog *mEditorDialog; 401 AddresseeEditorDialog *mEditorDialog;
401 bool mReadWrite; 402 bool mReadWrite;
402 bool mModified; 403 bool mModified;
403 bool mIsPart; 404 bool mIsPart;
404 bool mMultipleViewsAtOnce; 405 bool mMultipleViewsAtOnce;
405 406
406 407
407 //US file menu 408 //US file menu
408 KAction *mActionMail; 409 KAction *mActionMail;
409 KAction *mActionBeam; 410 KAction *mActionBeam;
410 KAction *mActionExport2phone; 411 KAction *mActionExport2phone;
411 KAction* mActionPrint; 412 KAction* mActionPrint;
412 KAction* mActionNewContact; 413 KAction* mActionNewContact;
413 KAction *mActionSave; 414 KAction *mActionSave;
414 KAction *mActionEditAddressee; 415 KAction *mActionEditAddressee;
415 KAction *mActionMailVCard; 416 KAction *mActionMailVCard;
416 KAction *mActionBeamVCard; 417 KAction *mActionBeamVCard;
417 418
418 KAction *mActionQuit; 419 KAction *mActionQuit;
419 420
420 //US edit menu 421 //US edit menu
421 KAction *mActionCopy; 422 KAction *mActionCopy;
422 KAction *mActionCut; 423 KAction *mActionCut;
423 KAction *mActionPaste; 424 KAction *mActionPaste;
424 KAction *mActionSelectAll; 425 KAction *mActionSelectAll;
425 KAction *mActionUndo; 426 KAction *mActionUndo;
426 KAction *mActionRedo; 427 KAction *mActionRedo;
427 KAction *mActionDelete; 428 KAction *mActionDelete;
428 429
429 //US settings menu 430 //US settings menu
430 KAction *mActionConfigResources; 431 KAction *mActionConfigResources;
431 KAction *mActionConfigKAddressbook; 432 KAction *mActionConfigKAddressbook;
432 KAction *mActionConfigShortcuts; 433 KAction *mActionConfigShortcuts;
433 KAction *mActionConfigureToolbars; 434 KAction *mActionConfigureToolbars;
434 KAction *mActionKeyBindings; 435 KAction *mActionKeyBindings;
435 KToggleAction *mActionJumpBar; 436 KToggleAction *mActionJumpBar;
436 KToggleAction *mActionDetails; 437 KToggleAction *mActionDetails;