-rw-r--r-- | kabc/addressbook.cpp | 24 | ||||
-rw-r--r-- | kabc/addressbook.h | 2 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 11 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 2 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 2 |
5 files changed, 26 insertions, 15 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index f3744bc..e04f4b1 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -316,152 +316,158 @@ void AddressBook::init(const QString &config, const QString &family ) | |||
316 | addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 316 | addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
317 | "X-IMAddress", "KADDRESSBOOK" ); | 317 | "X-IMAddress", "KADDRESSBOOK" ); |
318 | addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 318 | addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
319 | "X-Anniversary", "KADDRESSBOOK" ); | 319 | "X-Anniversary", "KADDRESSBOOK" ); |
320 | 320 | ||
321 | //US added this field to become compatible with Opie/qtopia addressbook | 321 | //US added this field to become compatible with Opie/qtopia addressbook |
322 | // values can be "female" or "male" or "". An empty field represents undefined. | 322 | // values can be "female" or "male" or "". An empty field represents undefined. |
323 | addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 323 | addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
324 | "X-Gender", "KADDRESSBOOK" ); | 324 | "X-Gender", "KADDRESSBOOK" ); |
325 | addCustomField( i18n( "Children" ), KABC::Field::Personal, | 325 | addCustomField( i18n( "Children" ), KABC::Field::Personal, |
326 | "X-Children", "KADDRESSBOOK" ); | 326 | "X-Children", "KADDRESSBOOK" ); |
327 | addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 327 | addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
328 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 328 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
329 | addCustomField( i18n( "ExternalID" ), KABC::Field::Personal, | 329 | addCustomField( i18n( "ExternalID" ), KABC::Field::Personal, |
330 | "X-ExternalID", "KADDRESSBOOK" ); | 330 | "X-ExternalID", "KADDRESSBOOK" ); |
331 | } | 331 | } |
332 | 332 | ||
333 | AddressBook::~AddressBook() | 333 | AddressBook::~AddressBook() |
334 | { | 334 | { |
335 | delete d->mConfig; d->mConfig = 0; | 335 | delete d->mConfig; d->mConfig = 0; |
336 | delete d->mManager; d->mManager = 0; | 336 | delete d->mManager; d->mManager = 0; |
337 | //US delete d->mErrorHandler; d->mErrorHandler = 0; | 337 | //US delete d->mErrorHandler; d->mErrorHandler = 0; |
338 | delete d; d = 0; | 338 | delete d; d = 0; |
339 | } | 339 | } |
340 | 340 | ||
341 | bool AddressBook::load() | 341 | bool AddressBook::load() |
342 | { | 342 | { |
343 | 343 | ||
344 | clear(); | 344 | clear(); |
345 | KRES::Manager<Resource>::ActiveIterator it; | 345 | KRES::Manager<Resource>::ActiveIterator it; |
346 | bool ok = true; | 346 | bool ok = true; |
347 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) | 347 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) |
348 | if ( !(*it)->load() ) { | 348 | if ( !(*it)->load() ) { |
349 | qDebug( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) ); | 349 | qDebug( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) ); |
350 | ok = false; | 350 | ok = false; |
351 | } else { | 351 | } else { |
352 | qDebug( i18n("Resource loaded: '%1'").arg( (*it)->resourceName() ) ); | 352 | qDebug( i18n("Resource loaded: '%1'").arg( (*it)->resourceName() ) ); |
353 | } | 353 | } |
354 | // mark all addressees as unchanged | 354 | // mark all addressees as unchanged |
355 | Addressee::List::Iterator addrIt; | 355 | Addressee::List::Iterator addrIt; |
356 | for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) { | 356 | for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) { |
357 | (*addrIt).setChanged( false ); | 357 | (*addrIt).setChanged( false ); |
358 | QString id = (*addrIt).custom( "KADDRESSBOOK", "X-ExternalID" ); | 358 | QString id = (*addrIt).custom( "KADDRESSBOOK", "X-ExternalID" ); |
359 | if ( !id.isEmpty() ) { | 359 | if ( !id.isEmpty() ) { |
360 | //qDebug("setId aa %s ", id.latin1()); | 360 | //qDebug("setId aa %s ", id.latin1()); |
361 | (*addrIt).setIDStr(id ); | 361 | (*addrIt).setIDStr(id ); |
362 | } | 362 | } |
363 | } | 363 | } |
364 | blockLSEchange = true; | 364 | blockLSEchange = true; |
365 | return ok; | 365 | return ok; |
366 | } | 366 | } |
367 | 367 | ||
368 | bool AddressBook::save( Ticket *ticket ) | 368 | bool AddressBook::save( Ticket *ticket ) |
369 | { | 369 | { |
370 | kdDebug(5700) << "AddressBook::save()"<< endl; | 370 | kdDebug(5700) << "AddressBook::save()"<< endl; |
371 | 371 | ||
372 | if ( ticket->resource() ) { | 372 | if ( ticket->resource() ) { |
373 | deleteRemovedAddressees(); | 373 | deleteRemovedAddressees(); |
374 | return ticket->resource()->save( ticket ); | 374 | return ticket->resource()->save( ticket ); |
375 | } | 375 | } |
376 | 376 | ||
377 | return false; | 377 | return false; |
378 | } | 378 | } |
379 | // exports all Addressees, which are syncable | 379 | // exports all Addressees, which are syncable |
380 | void AddressBook::export2File( QString fileName ) | 380 | void AddressBook::export2File( QString fileName, QString resourceName ) |
381 | { | 381 | { |
382 | 382 | ||
383 | QFile outFile( fileName ); | 383 | QFile outFile( fileName ); |
384 | if ( !outFile.open( IO_WriteOnly ) ) { | 384 | if ( !outFile.open( IO_WriteOnly ) ) { |
385 | QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" ); | 385 | QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" ); |
386 | KMessageBox::error( 0, text.arg( fileName ) ); | 386 | KMessageBox::error( 0, text.arg( fileName ) ); |
387 | return ; | 387 | return ; |
388 | } | 388 | } |
389 | QTextStream t( &outFile ); | 389 | QTextStream t( &outFile ); |
390 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 390 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
391 | Iterator it; | 391 | Iterator it; |
392 | KABC::VCardConverter::Version version; | 392 | KABC::VCardConverter::Version version; |
393 | version = KABC::VCardConverter::v3_0; | 393 | version = KABC::VCardConverter::v3_0; |
394 | for ( it = begin(); it != end(); ++it ) { | 394 | for ( it = begin(); it != end(); ++it ) { |
395 | if ( (*it).resource() && (*it).resource()->includeInSync() ) { | 395 | if ( (*it).resource() ) { |
396 | if ( !(*it).IDStr().isEmpty() ) { | 396 | bool include = (*it).resource()->includeInSync(); |
397 | (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); | 397 | if ( !resourceName.isEmpty() ) |
398 | include = (resourceName == (*it).resource()->name() ); | ||
399 | if ( include ) { | ||
400 | qDebug(QString ("Exporting resource %1 to file %2").arg( (*it).resource()->name() ).arg( fileName ) ); | ||
401 | if ( !(*it).IDStr().isEmpty() ) { | ||
402 | (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); | ||
403 | } | ||
404 | KABC::VCardConverter converter; | ||
405 | QString vcard; | ||
406 | //Resource *resource() const; | ||
407 | converter.addresseeToVCard( *it, vcard, version ); | ||
408 | t << vcard << "\r\n"; | ||
398 | } | 409 | } |
399 | KABC::VCardConverter converter; | ||
400 | QString vcard; | ||
401 | //Resource *resource() const; | ||
402 | converter.addresseeToVCard( *it, vcard, version ); | ||
403 | t << vcard << "\r\n"; | ||
404 | } | 410 | } |
405 | } | 411 | } |
406 | t << "\r\n\r\n"; | 412 | t << "\r\n\r\n"; |
407 | outFile.close(); | 413 | outFile.close(); |
408 | } | 414 | } |
409 | // if QStringList uids is empty, all are exported | 415 | // if QStringList uids is empty, all are exported |
410 | bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName ) | 416 | bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName ) |
411 | { | 417 | { |
412 | KABC::VCardConverter converter; | 418 | KABC::VCardConverter converter; |
413 | QString datastream; | 419 | QString datastream; |
414 | Iterator it; | 420 | Iterator it; |
415 | bool all = uids.isEmpty(); | 421 | bool all = uids.isEmpty(); |
416 | for ( it = begin(); it != end(); ++it ) { | 422 | for ( it = begin(); it != end(); ++it ) { |
417 | // for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 423 | // for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
418 | if ( ! all ) { | 424 | if ( ! all ) { |
419 | if ( ! ( uids.contains((*it).uid() ) )) | 425 | if ( ! ( uids.contains((*it).uid() ) )) |
420 | continue; | 426 | continue; |
421 | } | 427 | } |
422 | KABC::Addressee a = ( *it ); | 428 | KABC::Addressee a = ( *it ); |
423 | if ( a.isEmpty() ) | 429 | if ( a.isEmpty() ) |
424 | continue; | 430 | continue; |
425 | if ( all && a.resource() && !a.resource()->includeInSync() ) | 431 | if ( all && a.resource() && !a.resource()->includeInSync() ) |
426 | continue; | 432 | continue; |
427 | a.simplifyEmails(); | 433 | a.simplifyEmails(); |
428 | a.simplifyPhoneNumbers(); | 434 | a.simplifyPhoneNumbers(); |
429 | a.simplifyPhoneNumberTypes(); | 435 | a.simplifyPhoneNumberTypes(); |
430 | a.simplifyAddresses(); | 436 | a.simplifyAddresses(); |
431 | 437 | ||
432 | QString vcard; | 438 | QString vcard; |
433 | QString vcardnew; | 439 | QString vcardnew; |
434 | converter.addresseeToVCard( a, vcard ); | 440 | converter.addresseeToVCard( a, vcard ); |
435 | int start = 0; | 441 | int start = 0; |
436 | int next; | 442 | int next; |
437 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | 443 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { |
438 | int semi = vcard.find(";", next); | 444 | int semi = vcard.find(";", next); |
439 | int dopp = vcard.find(":", next); | 445 | int dopp = vcard.find(":", next); |
440 | int sep; | 446 | int sep; |
441 | if ( semi < dopp && semi >= 0 ) | 447 | if ( semi < dopp && semi >= 0 ) |
442 | sep = semi ; | 448 | sep = semi ; |
443 | else | 449 | else |
444 | sep = dopp; | 450 | sep = dopp; |
445 | vcardnew +=vcard.mid( start, next - start); | 451 | vcardnew +=vcard.mid( start, next - start); |
446 | vcardnew +=vcard.mid( next+5,sep -next -5 ).upper(); | 452 | vcardnew +=vcard.mid( next+5,sep -next -5 ).upper(); |
447 | start = sep; | 453 | start = sep; |
448 | } | 454 | } |
449 | vcardnew += vcard.mid( start,vcard.length() ); | 455 | vcardnew += vcard.mid( start,vcard.length() ); |
450 | vcard = ""; | 456 | vcard = ""; |
451 | start = 0; | 457 | start = 0; |
452 | while ( (next = vcardnew.find("ADR", start) )>= 0 ) { | 458 | while ( (next = vcardnew.find("ADR", start) )>= 0 ) { |
453 | int sep = vcardnew.find(":", next); | 459 | int sep = vcardnew.find(":", next); |
454 | vcard +=vcardnew.mid( start, next - start+3); | 460 | vcard +=vcardnew.mid( start, next - start+3); |
455 | start = sep; | 461 | start = sep; |
456 | } | 462 | } |
457 | vcard += vcardnew.mid( start,vcardnew.length() ); | 463 | vcard += vcardnew.mid( start,vcardnew.length() ); |
458 | vcard.replace ( QRegExp(";;;") , "" ); | 464 | vcard.replace ( QRegExp(";;;") , "" ); |
459 | vcard.replace ( QRegExp(";;") , "" ); | 465 | vcard.replace ( QRegExp(";;") , "" ); |
460 | datastream += vcard; | 466 | datastream += vcard; |
461 | 467 | ||
462 | } | 468 | } |
463 | 469 | ||
464 | QFile outFile(fileName); | 470 | QFile outFile(fileName); |
465 | if ( outFile.open(IO_WriteOnly) ) { | 471 | if ( outFile.open(IO_WriteOnly) ) { |
466 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 472 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
467 | QTextStream t( &outFile ); // use a text stream | 473 | QTextStream t( &outFile ); // use a text stream |
diff --git a/kabc/addressbook.h b/kabc/addressbook.h index 18c03b5..4a0d0a3 100644 --- a/kabc/addressbook.h +++ b/kabc/addressbook.h | |||
@@ -85,129 +85,129 @@ class AddressBook : public QObject | |||
85 | 85 | ||
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 removeSyncInfo( QString syncProfile); | 147 | void removeSyncInfo( QString syncProfile); |
148 | void preparePhoneSync( QString currentSyncDevice, bool isPreSync ); | 148 | void preparePhoneSync( QString currentSyncDevice, bool isPreSync ); |
149 | void export2File( QString fileName ); | 149 | void export2File( QString fileName, QString resourceName = "" ); |
150 | bool export2PhoneFormat( QStringList uids ,QString fileName ); | 150 | bool export2PhoneFormat( QStringList uids ,QString fileName ); |
151 | int importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false ); | 151 | int importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false ); |
152 | void setUntagged( bool setNonSyncTagged = false ); | 152 | void setUntagged( bool setNonSyncTagged = false ); |
153 | void removeUntagged(); | 153 | void removeUntagged(); |
154 | void findNewExtIds( QString fileName, QString currentSyncDevice ); | 154 | void findNewExtIds( QString fileName, QString currentSyncDevice ); |
155 | /** | 155 | /** |
156 | Returns a iterator for first entry of address book. | 156 | Returns a iterator for first entry of address book. |
157 | */ | 157 | */ |
158 | Iterator begin(); | 158 | Iterator begin(); |
159 | 159 | ||
160 | /** | 160 | /** |
161 | Returns a const iterator for first entry of address book. | 161 | Returns a const iterator for first entry of address book. |
162 | */ | 162 | */ |
163 | ConstIterator begin() const; | 163 | ConstIterator begin() const; |
164 | 164 | ||
165 | /** | 165 | /** |
166 | Returns a iterator for first entry of address book. | 166 | Returns a iterator for first entry of address book. |
167 | */ | 167 | */ |
168 | Iterator end(); | 168 | Iterator end(); |
169 | 169 | ||
170 | /** | 170 | /** |
171 | Returns a const iterator for first entry of address book. | 171 | Returns a const iterator for first entry of address book. |
172 | */ | 172 | */ |
173 | ConstIterator end() const; | 173 | ConstIterator end() const; |
174 | 174 | ||
175 | /** | 175 | /** |
176 | Removes all entries from address book. | 176 | Removes all entries from address book. |
177 | */ | 177 | */ |
178 | void clear(); | 178 | void clear(); |
179 | 179 | ||
180 | /** | 180 | /** |
181 | Insert an Addressee object into address book. If an object with the same | 181 | Insert an Addressee object into address book. If an object with the same |
182 | unique id already exists in the address book it it replaced by the new | 182 | unique id already exists in the address book it it replaced by the new |
183 | one. If not the new object is appended to the address book. | 183 | one. If not the new object is appended to the address book. |
184 | */ | 184 | */ |
185 | void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false); | 185 | void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false); |
186 | 186 | ||
187 | /** | 187 | /** |
188 | Removes entry from the address book. | 188 | Removes entry from the address book. |
189 | */ | 189 | */ |
190 | void removeAddressee( const Addressee & ); | 190 | void removeAddressee( const Addressee & ); |
191 | 191 | ||
192 | /** | 192 | /** |
193 | This is like @ref removeAddressee() just above, with the difference that | 193 | This is like @ref removeAddressee() just above, with the difference that |
194 | the first element is a iterator, returned by @ref begin(). | 194 | the first element is a iterator, returned by @ref begin(). |
195 | */ | 195 | */ |
196 | void removeAddressee( const Iterator & ); | 196 | void removeAddressee( const Iterator & ); |
197 | 197 | ||
198 | /** | 198 | /** |
199 | Find the specified entry in address book. Returns end(), if the entry | 199 | Find the specified entry in address book. Returns end(), if the entry |
200 | couldn't be found. | 200 | couldn't be found. |
201 | */ | 201 | */ |
202 | Iterator find( const Addressee & ); | 202 | Iterator find( const Addressee & ); |
203 | 203 | ||
204 | /** | 204 | /** |
205 | Find the entry specified by an unique id. Returns an empty Addressee | 205 | Find the entry specified by an unique id. Returns an empty Addressee |
206 | object, if the address book does not contain an entry with this id. | 206 | object, if the address book does not contain an entry with this id. |
207 | */ | 207 | */ |
208 | Addressee findByUid( const QString & ); | 208 | Addressee findByUid( const QString & ); |
209 | 209 | ||
210 | 210 | ||
211 | /** | 211 | /** |
212 | Returns a list of all addressees in the address book. This list can | 212 | Returns a list of all addressees in the address book. This list can |
213 | be sorted with @ref KABC::AddresseeList for example. | 213 | be sorted with @ref KABC::AddresseeList for example. |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 2dea619..5d377bf 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1875,129 +1875,129 @@ void KABCore::initGUI() | |||
1875 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1875 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1876 | #else | 1876 | #else |
1877 | if ( QApplication::desktop()->width() > 480 ) { | 1877 | if ( QApplication::desktop()->width() > 480 ) { |
1878 | topLayout = new QHBoxLayout( this ); | 1878 | topLayout = new QHBoxLayout( this ); |
1879 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1879 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1880 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1880 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1881 | } else { | 1881 | } else { |
1882 | 1882 | ||
1883 | topLayout = new QHBoxLayout( this ); | 1883 | topLayout = new QHBoxLayout( this ); |
1884 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1884 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1885 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1885 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1886 | } | 1886 | } |
1887 | 1887 | ||
1888 | topLayout->addWidget(mMiniSplitter ); | 1888 | topLayout->addWidget(mMiniSplitter ); |
1889 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1889 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1890 | mDetails = new ViewContainer( mMiniSplitter ); | 1890 | mDetails = new ViewContainer( mMiniSplitter ); |
1891 | 1891 | ||
1892 | 1892 | ||
1893 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1893 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1894 | #endif | 1894 | #endif |
1895 | //eh->hide(); | 1895 | //eh->hide(); |
1896 | // topLayout->addWidget(mExtensionManager ); | 1896 | // topLayout->addWidget(mExtensionManager ); |
1897 | 1897 | ||
1898 | 1898 | ||
1899 | /*US | 1899 | /*US |
1900 | #ifndef KAB_NOSPLITTER | 1900 | #ifndef KAB_NOSPLITTER |
1901 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1901 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1902 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1902 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1903 | topLayout->setSpacing( 10 ); | 1903 | topLayout->setSpacing( 10 ); |
1904 | 1904 | ||
1905 | mDetailsSplitter = new QSplitter( this ); | 1905 | mDetailsSplitter = new QSplitter( this ); |
1906 | 1906 | ||
1907 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1907 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1908 | 1908 | ||
1909 | mViewManager = new ViewManager( this, viewSpace ); | 1909 | mViewManager = new ViewManager( this, viewSpace ); |
1910 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1910 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1911 | 1911 | ||
1912 | mDetails = new ViewContainer( mDetailsSplitter ); | 1912 | mDetails = new ViewContainer( mDetailsSplitter ); |
1913 | 1913 | ||
1914 | topLayout->addWidget( mDetailsSplitter ); | 1914 | topLayout->addWidget( mDetailsSplitter ); |
1915 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1915 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1916 | #else //KAB_NOSPLITTER | 1916 | #else //KAB_NOSPLITTER |
1917 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1917 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1918 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1918 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1919 | topLayout->setSpacing( 10 ); | 1919 | topLayout->setSpacing( 10 ); |
1920 | 1920 | ||
1921 | // mDetailsSplitter = new QSplitter( this ); | 1921 | // mDetailsSplitter = new QSplitter( this ); |
1922 | 1922 | ||
1923 | QVBox *viewSpace = new QVBox( this ); | 1923 | QVBox *viewSpace = new QVBox( this ); |
1924 | 1924 | ||
1925 | mViewManager = new ViewManager( this, viewSpace ); | 1925 | mViewManager = new ViewManager( this, viewSpace ); |
1926 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1926 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1927 | 1927 | ||
1928 | mDetails = new ViewContainer( this ); | 1928 | mDetails = new ViewContainer( this ); |
1929 | 1929 | ||
1930 | topLayout->addWidget( viewSpace ); | 1930 | topLayout->addWidget( viewSpace ); |
1931 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1931 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1932 | topLayout->addWidget( mDetails ); | 1932 | topLayout->addWidget( mDetails ); |
1933 | #endif //KAB_NOSPLITTER | 1933 | #endif //KAB_NOSPLITTER |
1934 | */ | 1934 | */ |
1935 | 1935 | ||
1936 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 1936 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
1937 | syncManager->setBlockSave(false); | 1937 | syncManager->setBlockSave(false); |
1938 | 1938 | ||
1939 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 1939 | connect(syncManager , SIGNAL( request_file(const QString &) ), this, SLOT( syncFileRequest(const QString &) ) ); |
1940 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 1940 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
1941 | QString sync_file = sentSyncFile(); | 1941 | QString sync_file = sentSyncFile(); |
1942 | //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); | 1942 | //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); |
1943 | syncManager->setDefaultFileName( sync_file ); | 1943 | syncManager->setDefaultFileName( sync_file ); |
1944 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); | 1944 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); |
1945 | 1945 | ||
1946 | #endif //KAB_EMBEDDED | 1946 | #endif //KAB_EMBEDDED |
1947 | initActions(); | 1947 | initActions(); |
1948 | 1948 | ||
1949 | #ifdef KAB_EMBEDDED | 1949 | #ifdef KAB_EMBEDDED |
1950 | addActionsManually(); | 1950 | addActionsManually(); |
1951 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1951 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1952 | mXXPortManager = new XXPortManager( this, this ); | 1952 | mXXPortManager = new XXPortManager( this, this ); |
1953 | 1953 | ||
1954 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1954 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1955 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1955 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1956 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1956 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1957 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1957 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1958 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1958 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1959 | // mIncSearchWidget->hide(); | 1959 | // mIncSearchWidget->hide(); |
1960 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1960 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1961 | SLOT( incrementalSearch( const QString& ) ) ); | 1961 | SLOT( incrementalSearch( const QString& ) ) ); |
1962 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); | 1962 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); |
1963 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); | 1963 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); |
1964 | 1964 | ||
1965 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1965 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1966 | 1966 | ||
1967 | topLayout->addWidget( mJumpButtonBar ); | 1967 | topLayout->addWidget( mJumpButtonBar ); |
1968 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1968 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1969 | 1969 | ||
1970 | // mMainWindow->getIconToolBar()->raise(); | 1970 | // mMainWindow->getIconToolBar()->raise(); |
1971 | 1971 | ||
1972 | #endif //KAB_EMBEDDED | 1972 | #endif //KAB_EMBEDDED |
1973 | 1973 | ||
1974 | } | 1974 | } |
1975 | void KABCore::initActions() | 1975 | void KABCore::initActions() |
1976 | { | 1976 | { |
1977 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1977 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1978 | 1978 | ||
1979 | #ifndef KAB_EMBEDDED | 1979 | #ifndef KAB_EMBEDDED |
1980 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1980 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1981 | SLOT( clipboardDataChanged() ) ); | 1981 | SLOT( clipboardDataChanged() ) ); |
1982 | #endif //KAB_EMBEDDED | 1982 | #endif //KAB_EMBEDDED |
1983 | 1983 | ||
1984 | // file menu | 1984 | // file menu |
1985 | 1985 | ||
1986 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1986 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1987 | //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1987 | //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1988 | mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, | 1988 | mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, |
1989 | SLOT( printView() ), actionCollection(), "kaddressbook_print" ); | 1989 | SLOT( printView() ), actionCollection(), "kaddressbook_print" ); |
1990 | 1990 | ||
1991 | 1991 | ||
1992 | mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, | 1992 | mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, |
1993 | SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); | 1993 | SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); |
1994 | 1994 | ||
1995 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1995 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1996 | SLOT( save() ), actionCollection(), "file_sync" ); | 1996 | SLOT( save() ), actionCollection(), "file_sync" ); |
1997 | 1997 | ||
1998 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1998 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1999 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1999 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
2000 | 2000 | ||
2001 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 2001 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
2002 | this, SLOT( mailVCard() ), | 2002 | this, SLOT( mailVCard() ), |
2003 | actionCollection(), "file_mail_vcard"); | 2003 | actionCollection(), "file_mail_vcard"); |
@@ -3411,85 +3411,90 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource) | |||
3411 | abLocal.removeResources(); | 3411 | abLocal.removeResources(); |
3412 | if ( syncOK ) { | 3412 | if ( syncOK ) { |
3413 | mViewManager->refreshView(); | 3413 | mViewManager->refreshView(); |
3414 | message(i18n("DTM syncing finished.")); | 3414 | message(i18n("DTM syncing finished.")); |
3415 | } | 3415 | } |
3416 | disableBR( false ); | 3416 | disableBR( false ); |
3417 | return syncOK; | 3417 | return syncOK; |
3418 | 3418 | ||
3419 | } | 3419 | } |
3420 | void KABCore::message( QString m, bool startTimer) | 3420 | void KABCore::message( QString m, bool startTimer) |
3421 | { | 3421 | { |
3422 | topLevelWidget()->setCaption( m ); | 3422 | topLevelWidget()->setCaption( m ); |
3423 | qApp->processEvents(); | 3423 | qApp->processEvents(); |
3424 | if ( startTimer ) | 3424 | if ( startTimer ) |
3425 | mMessageTimer->start( 15000, true ); | 3425 | mMessageTimer->start( 15000, true ); |
3426 | else | 3426 | else |
3427 | mMessageTimer->stop(); | 3427 | mMessageTimer->stop(); |
3428 | } | 3428 | } |
3429 | bool KABCore::syncPhone() | 3429 | bool KABCore::syncPhone() |
3430 | { | 3430 | { |
3431 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 3431 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
3432 | QString fileName = getPhoneFile(); | 3432 | QString fileName = getPhoneFile(); |
3433 | if ( !PhoneAccess::readFromPhone( fileName) ) { | 3433 | if ( !PhoneAccess::readFromPhone( fileName) ) { |
3434 | message(i18n("Phone access failed!")); | 3434 | message(i18n("Phone access failed!")); |
3435 | return false; | 3435 | return false; |
3436 | } | 3436 | } |
3437 | AddressBook abLocal( fileName,"syncContact"); | 3437 | AddressBook abLocal( fileName,"syncContact"); |
3438 | bool syncOK = false; | 3438 | bool syncOK = false; |
3439 | { | 3439 | { |
3440 | abLocal.importFromFile( fileName ); | 3440 | abLocal.importFromFile( fileName ); |
3441 | qDebug("KA: AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 3441 | qDebug("KA: AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
3442 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3442 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3443 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); | 3443 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); |
3444 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 3444 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
3445 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 3445 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
3446 | syncManager->hideProgressBar(); | 3446 | syncManager->hideProgressBar(); |
3447 | if ( syncOK ) { | 3447 | if ( syncOK ) { |
3448 | if ( syncManager->mWriteBackFile ) { | 3448 | if ( syncManager->mWriteBackFile ) { |
3449 | abLocal.removeSyncAddressees( true ); | 3449 | abLocal.removeSyncAddressees( true ); |
3450 | abLocal.saveABphone( fileName ); | 3450 | abLocal.saveABphone( fileName ); |
3451 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); | 3451 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); |
3452 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); | 3452 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); |
3453 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); | 3453 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); |
3454 | } | 3454 | } |
3455 | } | 3455 | } |
3456 | setModified(); | 3456 | setModified(); |
3457 | } | 3457 | } |
3458 | abLocal.removeResources(); | 3458 | abLocal.removeResources(); |
3459 | if ( syncOK ) | 3459 | if ( syncOK ) |
3460 | mViewManager->refreshView(); | 3460 | mViewManager->refreshView(); |
3461 | return syncOK; | 3461 | return syncOK; |
3462 | } | 3462 | } |
3463 | void KABCore::getFile( bool success ) | 3463 | void KABCore::getFile( bool success ) |
3464 | { | 3464 | { |
3465 | if ( ! success ) { | 3465 | if ( ! success ) { |
3466 | message( i18n("Error receiving file. Nothing changed!") ); | 3466 | message( i18n("Error receiving file. Nothing changed!") ); |
3467 | return; | 3467 | return; |
3468 | } | 3468 | } |
3469 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); | 3469 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); |
3470 | if ( count ) | 3470 | if ( count ) |
3471 | setModified( true ); | 3471 | setModified( true ); |
3472 | message( i18n("Pi-Sync successful!") ); | 3472 | message( i18n("Pi-Sync successful!") ); |
3473 | mViewManager->refreshView(); | 3473 | mViewManager->refreshView(); |
3474 | } | 3474 | } |
3475 | void KABCore::syncFileRequest() | 3475 | void KABCore::syncFileRequest(const QString & resource) |
3476 | { | 3476 | { |
3477 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { | 3477 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { |
3478 | syncManager->slotSyncMenu( 999 ); | 3478 | syncManager->slotSyncMenu( 999 ); |
3479 | } | 3479 | } |
3480 | mAddressBook->export2File( sentSyncFile() ); | 3480 | |
3481 | if ( resource == "ALL" ) { | ||
3482 | mAddressBook->export2File( sentSyncFile() ); | ||
3483 | } | ||
3484 | else | ||
3485 | mAddressBook->export2File( sentSyncFile(), resource); | ||
3481 | } | 3486 | } |
3482 | QString KABCore::sentSyncFile() | 3487 | QString KABCore::sentSyncFile() |
3483 | { | 3488 | { |
3484 | #ifdef DESKTOP_VERSION | 3489 | #ifdef DESKTOP_VERSION |
3485 | return locateLocal( "tmp", "copysyncab.vcf" ); | 3490 | return locateLocal( "tmp", "copysyncab.vcf" ); |
3486 | #else | 3491 | #else |
3487 | return QString( "/tmp/copysyncab.vcf" ); | 3492 | return QString( "/tmp/copysyncab.vcf" ); |
3488 | #endif | 3493 | #endif |
3489 | } | 3494 | } |
3490 | 3495 | ||
3491 | void KABCore::setCaptionBack() | 3496 | void KABCore::setCaptionBack() |
3492 | { | 3497 | { |
3493 | mMessageTimer->stop(); | 3498 | mMessageTimer->stop(); |
3494 | topLevelWidget()->setCaption( i18n("KA/Pi") ); | 3499 | topLevelWidget()->setCaption( i18n("KA/Pi") ); |
3495 | } | 3500 | } |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index c4a0b3b..2d1505f 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -296,129 +296,129 @@ class KABCore : public QWidget, public KSyncInterface | |||
296 | 296 | ||
297 | /** | 297 | /** |
298 | Saves the contents of the AddressBook back to disk. | 298 | Saves the contents of the AddressBook back to disk. |
299 | */ | 299 | */ |
300 | void save(); | 300 | void save(); |
301 | 301 | ||
302 | /** | 302 | /** |
303 | Undos the last command using the undo stack. | 303 | Undos the last command using the undo stack. |
304 | */ | 304 | */ |
305 | void undo(); | 305 | void undo(); |
306 | 306 | ||
307 | /** | 307 | /** |
308 | Redos the last command that was undone, using the redo stack. | 308 | Redos the last command that was undone, using the redo stack. |
309 | */ | 309 | */ |
310 | void redo(); | 310 | void redo(); |
311 | 311 | ||
312 | /** | 312 | /** |
313 | Shows the edit dialog for the given uid. If the uid is QString::null, | 313 | Shows the edit dialog 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 editContact( const QString &uid /*US = QString::null*/ ); | 316 | void editContact( const QString &uid /*US = QString::null*/ ); |
317 | //US added a second method without defaultparameter | 317 | //US added a second method without defaultparameter |
318 | void editContact2(); | 318 | void editContact2(); |
319 | 319 | ||
320 | /** | 320 | /** |
321 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 321 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
322 | the method will try to find a selected addressee in the view. | 322 | the method will try to find a selected addressee in the view. |
323 | */ | 323 | */ |
324 | void executeContact( const QString &uid /*US = QString::null*/ ); | 324 | void executeContact( const QString &uid /*US = QString::null*/ ); |
325 | 325 | ||
326 | /** | 326 | /** |
327 | Launches the configuration dialog. | 327 | Launches the configuration dialog. |
328 | */ | 328 | */ |
329 | void openConfigDialog(); | 329 | void openConfigDialog(); |
330 | void openConfigGlobalDialog(); | 330 | void openConfigGlobalDialog(); |
331 | 331 | ||
332 | /** | 332 | /** |
333 | Launches the ldap search dialog. | 333 | Launches the ldap search dialog. |
334 | */ | 334 | */ |
335 | void openLDAPDialog(); | 335 | void openLDAPDialog(); |
336 | 336 | ||
337 | /** | 337 | /** |
338 | Creates a KAddressBookPrinter, which will display the print | 338 | Creates a KAddressBookPrinter, which will display the print |
339 | dialog and do the printing. | 339 | dialog and do the printing. |
340 | */ | 340 | */ |
341 | void print(); | 341 | void print(); |
342 | 342 | ||
343 | /** | 343 | /** |
344 | Registers a new GUI client, so plugins can register its actions. | 344 | Registers a new GUI client, so plugins can register its actions. |
345 | */ | 345 | */ |
346 | void addGUIClient( KXMLGUIClient *client ); | 346 | void addGUIClient( KXMLGUIClient *client ); |
347 | 347 | ||
348 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); | 348 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); |
349 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 349 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
350 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); | 350 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); |
351 | 351 | ||
352 | 352 | ||
353 | signals: | 353 | signals: |
354 | void contactSelected( const QString &name ); | 354 | void contactSelected( const QString &name ); |
355 | void contactSelected( const QPixmap &pixmap ); | 355 | void contactSelected( const QPixmap &pixmap ); |
356 | public slots: | 356 | public slots: |
357 | void loadDataAfterStart(); | 357 | void loadDataAfterStart(); |
358 | void recieve(QString cmsg ); | 358 | void recieve(QString cmsg ); |
359 | void getFile( bool success ); | 359 | void getFile( bool success ); |
360 | void syncFileRequest(); | 360 | void syncFileRequest(const QString &); |
361 | void setDetailsVisible( bool visible ); | 361 | void setDetailsVisible( bool visible ); |
362 | void setDetailsToState(); | 362 | void setDetailsToState(); |
363 | 363 | ||
364 | void saveSettings(); | 364 | void saveSettings(); |
365 | 365 | ||
366 | private slots: | 366 | private slots: |
367 | void updateToolBar(); | 367 | void updateToolBar(); |
368 | void updateMainWindow(); | 368 | void updateMainWindow(); |
369 | void receive( const QCString& cmsg, const QByteArray& data ); | 369 | void receive( const QCString& cmsg, const QByteArray& data ); |
370 | void receiveStart( const QCString& cmsg, const QByteArray& data ); | 370 | void receiveStart( const QCString& cmsg, const QByteArray& data ); |
371 | void toggleBeamReceive( ); | 371 | void toggleBeamReceive( ); |
372 | void disableBR(bool); | 372 | void disableBR(bool); |
373 | void setJumpButtonBarVisible( bool visible ); | 373 | void setJumpButtonBarVisible( bool visible ); |
374 | void setJumpButtonBar( bool visible ); | 374 | void setJumpButtonBar( bool visible ); |
375 | void setCaptionBack(); | 375 | void setCaptionBack(); |
376 | void resizeAndCallContactdialog(); | 376 | void resizeAndCallContactdialog(); |
377 | void callContactdialog(); | 377 | void callContactdialog(); |
378 | void doRingSync(); | 378 | void doRingSync(); |
379 | 379 | ||
380 | void importFromOL(); | 380 | void importFromOL(); |
381 | void extensionModified( const KABC::Addressee::List &list ); | 381 | void extensionModified( const KABC::Addressee::List &list ); |
382 | void extensionChanged( int id ); | 382 | void extensionChanged( int id ); |
383 | void clipboardDataChanged(); | 383 | void clipboardDataChanged(); |
384 | void updateActionMenu(); | 384 | void updateActionMenu(); |
385 | void configureKeyBindings(); | 385 | void configureKeyBindings(); |
386 | void removeVoice(); | 386 | void removeVoice(); |
387 | void setFormattedName(); | 387 | void setFormattedName(); |
388 | #ifdef KAB_EMBEDDED | 388 | #ifdef KAB_EMBEDDED |
389 | void configureResources(); | 389 | void configureResources(); |
390 | #endif //KAB_EMBEDDED | 390 | #endif //KAB_EMBEDDED |
391 | 391 | ||
392 | void slotEditorDestroyed( const QString &uid ); | 392 | void slotEditorDestroyed( const QString &uid ); |
393 | void configurationChanged(); | 393 | void configurationChanged(); |
394 | void addressBookChanged(); | 394 | void addressBookChanged(); |
395 | 395 | ||
396 | private: | 396 | private: |
397 | QCString mCStringMess; | 397 | QCString mCStringMess; |
398 | QByteArray mByteData; | 398 | QByteArray mByteData; |
399 | QString mEmailSourceChannel; | 399 | QString mEmailSourceChannel; |
400 | QString mEmailSourceUID; | 400 | QString mEmailSourceUID; |
401 | void resizeEvent(QResizeEvent* e ); | 401 | void resizeEvent(QResizeEvent* e ); |
402 | bool mBRdisabled; | 402 | bool mBRdisabled; |
403 | #ifndef DESKTOP_VERSION | 403 | #ifndef DESKTOP_VERSION |
404 | QCopChannel* infrared; | 404 | QCopChannel* infrared; |
405 | #endif | 405 | #endif |
406 | QTimer *mMessageTimer; | 406 | QTimer *mMessageTimer; |
407 | void initGUI(); | 407 | void initGUI(); |
408 | void initActions(); | 408 | void initActions(); |
409 | QString getPhoneFile(); | 409 | QString getPhoneFile(); |
410 | 410 | ||
411 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 411 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
412 | const char *name = 0 ); | 412 | const char *name = 0 ); |
413 | 413 | ||
414 | KXMLGUIClient *mGUIClient; | 414 | KXMLGUIClient *mGUIClient; |
415 | 415 | ||
416 | KABC::AddressBook *mAddressBook; | 416 | KABC::AddressBook *mAddressBook; |
417 | 417 | ||
418 | ViewManager *mViewManager; | 418 | ViewManager *mViewManager; |
419 | // QSplitter *mDetailsSplitter; | 419 | // QSplitter *mDetailsSplitter; |
420 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 420 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
421 | ViewContainer *mDetails; | 421 | ViewContainer *mDetails; |
422 | KDGanttMinimizeSplitter* mMiniSplitter; | 422 | KDGanttMinimizeSplitter* mMiniSplitter; |
423 | XXPortManager *mXXPortManager; | 423 | XXPortManager *mXXPortManager; |
424 | JumpButtonBar *mJumpButtonBar; | 424 | JumpButtonBar *mJumpButtonBar; |
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index f80c2a6..e615cbe 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -1403,129 +1403,129 @@ void KServerSocket::error_connect( QString errmess ) | |||
1403 | } | 1403 | } |
1404 | } | 1404 | } |
1405 | void KServerSocket::end_connect() | 1405 | void KServerSocket::end_connect() |
1406 | { | 1406 | { |
1407 | delete mSyncActionDialog; | 1407 | delete mSyncActionDialog; |
1408 | mSyncActionDialog = 0; | 1408 | mSyncActionDialog = 0; |
1409 | } | 1409 | } |
1410 | void KServerSocket::send_file() | 1410 | void KServerSocket::send_file() |
1411 | { | 1411 | { |
1412 | //qDebug("MainWindow::sendFile(QSocket* s) "); | 1412 | //qDebug("MainWindow::sendFile(QSocket* s) "); |
1413 | if ( mSyncActionDialog ) | 1413 | if ( mSyncActionDialog ) |
1414 | delete mSyncActionDialog; | 1414 | delete mSyncActionDialog; |
1415 | mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); | 1415 | mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); |
1416 | mSyncActionDialog->setCaption(i18n("Received sync request")); | 1416 | mSyncActionDialog->setCaption(i18n("Received sync request")); |
1417 | QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); | 1417 | QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); |
1418 | label->setAlignment ( Qt::AlignHCenter ); | 1418 | label->setAlignment ( Qt::AlignHCenter ); |
1419 | QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); | 1419 | QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); |
1420 | lay->addWidget( label); | 1420 | lay->addWidget( label); |
1421 | lay->setMargin(7); | 1421 | lay->setMargin(7); |
1422 | lay->setSpacing(7); | 1422 | lay->setSpacing(7); |
1423 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 1423 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
1424 | int secs = QDateTime::currentDateTime().secsTo( KSyncManager::mRequestedSyncEvent ); | 1424 | int secs = QDateTime::currentDateTime().secsTo( KSyncManager::mRequestedSyncEvent ); |
1425 | //secs = 333; | 1425 | //secs = 333; |
1426 | if ( secs < 0 ) | 1426 | if ( secs < 0 ) |
1427 | secs = secs * (-1); | 1427 | secs = secs * (-1); |
1428 | if ( secs > 30 ) | 1428 | if ( secs > 30 ) |
1429 | //if ( true ) | 1429 | //if ( true ) |
1430 | { | 1430 | { |
1431 | QString warning = i18n("Clock skew of\nsyncing devices\nis %1 seconds!").arg( secs ); | 1431 | QString warning = i18n("Clock skew of\nsyncing devices\nis %1 seconds!").arg( secs ); |
1432 | QLabel* label = new QLabel( warning, mSyncActionDialog ); | 1432 | QLabel* label = new QLabel( warning, mSyncActionDialog ); |
1433 | label->setAlignment ( Qt::AlignHCenter ); | 1433 | label->setAlignment ( Qt::AlignHCenter ); |
1434 | lay->addWidget( label); | 1434 | lay->addWidget( label); |
1435 | if ( secs > 180 ) | 1435 | if ( secs > 180 ) |
1436 | { | 1436 | { |
1437 | if ( secs > 300 ) { | 1437 | if ( secs > 300 ) { |
1438 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(0, i18n("The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!"), i18n("High clock skew!"),i18n("Synchronize!"))) { | 1438 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(0, i18n("The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!"), i18n("High clock skew!"),i18n("Synchronize!"))) { |
1439 | qDebug("KSS::Sync cancelled ,cs"); | 1439 | qDebug("KSS::Sync cancelled ,cs"); |
1440 | mErrorMessage = 0; | 1440 | mErrorMessage = 0; |
1441 | end_connect(); | 1441 | end_connect(); |
1442 | error_connect("ERROR_CA\r\n\r\n"); | 1442 | error_connect("ERROR_CA\r\n\r\n"); |
1443 | return ; | 1443 | return ; |
1444 | } | 1444 | } |
1445 | } | 1445 | } |
1446 | QFont f = label->font(); | 1446 | QFont f = label->font(); |
1447 | f.setPointSize ( f.pointSize() *2 ); | 1447 | f.setPointSize ( f.pointSize() *2 ); |
1448 | f. setBold (true ); | 1448 | f. setBold (true ); |
1449 | QLabel* label = new QLabel( warning, mSyncActionDialog ); | 1449 | QLabel* label = new QLabel( warning, mSyncActionDialog ); |
1450 | label->setFont( f ); | 1450 | label->setFont( f ); |
1451 | warning = i18n("ADJUST\nYOUR\nCLOCKS!"); | 1451 | warning = i18n("ADJUST\nYOUR\nCLOCKS!"); |
1452 | label->setText( warning ); | 1452 | label->setText( warning ); |
1453 | label->setAlignment ( Qt::AlignHCenter ); | 1453 | label->setAlignment ( Qt::AlignHCenter ); |
1454 | lay->addWidget( label); | 1454 | lay->addWidget( label); |
1455 | mSyncActionDialog->setFixedSize( 230, 300); | 1455 | mSyncActionDialog->setFixedSize( 230, 300); |
1456 | } else { | 1456 | } else { |
1457 | mSyncActionDialog->setFixedSize( 230, 200); | 1457 | mSyncActionDialog->setFixedSize( 230, 200); |
1458 | } | 1458 | } |
1459 | } else { | 1459 | } else { |
1460 | mSyncActionDialog->setFixedSize( 230, 120); | 1460 | mSyncActionDialog->setFixedSize( 230, 120); |
1461 | } | 1461 | } |
1462 | } else | 1462 | } else |
1463 | mSyncActionDialog->setFixedSize( 230, 120); | 1463 | mSyncActionDialog->setFixedSize( 230, 120); |
1464 | mSyncActionDialog->show(); | 1464 | mSyncActionDialog->show(); |
1465 | mSyncActionDialog->raise(); | 1465 | mSyncActionDialog->raise(); |
1466 | emit request_file(mResource); | 1466 | emit request_file(mResource); |
1467 | emit request_file(); | 1467 | //emit request_file(); |
1468 | qApp->processEvents(); | 1468 | qApp->processEvents(); |
1469 | QString fileName = mFileName; | 1469 | QString fileName = mFileName; |
1470 | QFile file( fileName ); | 1470 | QFile file( fileName ); |
1471 | if (!file.open( IO_ReadOnly ) ) { | 1471 | if (!file.open( IO_ReadOnly ) ) { |
1472 | mErrorMessage = 0; | 1472 | mErrorMessage = 0; |
1473 | end_connect(); | 1473 | end_connect(); |
1474 | error_connect("ERROR_FI\r\n\r\n"); | 1474 | error_connect("ERROR_FI\r\n\r\n"); |
1475 | return ; | 1475 | return ; |
1476 | } | 1476 | } |
1477 | mSyncActionDialog->setCaption( i18n("Sending file...") ); | 1477 | mSyncActionDialog->setCaption( i18n("Sending file...") ); |
1478 | QTextStream ts( &file ); | 1478 | QTextStream ts( &file ); |
1479 | ts.setEncoding( QTextStream::Latin1 ); | 1479 | ts.setEncoding( QTextStream::Latin1 ); |
1480 | 1480 | ||
1481 | QTextStream os( mSocket ); | 1481 | QTextStream os( mSocket ); |
1482 | os.setEncoding( QTextStream::Latin1 ); | 1482 | os.setEncoding( QTextStream::Latin1 ); |
1483 | while ( ! ts.atEnd() ) { | 1483 | while ( ! ts.atEnd() ) { |
1484 | os << ts.readLine() << "\r\n"; | 1484 | os << ts.readLine() << "\r\n"; |
1485 | } | 1485 | } |
1486 | os << "\r\n"; | 1486 | os << "\r\n"; |
1487 | //os << ts.read(); | 1487 | //os << ts.read(); |
1488 | file.close(); | 1488 | file.close(); |
1489 | mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); | 1489 | mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); |
1490 | mSocket->close(); | 1490 | mSocket->close(); |
1491 | if ( mSocket->state() == QSocket::Idle ) | 1491 | if ( mSocket->state() == QSocket::Idle ) |
1492 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 1492 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
1493 | } | 1493 | } |
1494 | void KServerSocket::get_file() | 1494 | void KServerSocket::get_file() |
1495 | { | 1495 | { |
1496 | mSyncActionDialog->setCaption( i18n("Receiving synced file...") ); | 1496 | mSyncActionDialog->setCaption( i18n("Receiving synced file...") ); |
1497 | 1497 | ||
1498 | piTime.start(); | 1498 | piTime.start(); |
1499 | piFileString = ""; | 1499 | piFileString = ""; |
1500 | QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) )); | 1500 | QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) )); |
1501 | } | 1501 | } |
1502 | 1502 | ||
1503 | 1503 | ||
1504 | void KServerSocket::readBackFileFromSocket() | 1504 | void KServerSocket::readBackFileFromSocket() |
1505 | { | 1505 | { |
1506 | //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); | 1506 | //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); |
1507 | while ( mSocket->canReadLine () ) { | 1507 | while ( mSocket->canReadLine () ) { |
1508 | piTime.restart(); | 1508 | piTime.restart(); |
1509 | QString line = mSocket->readLine (); | 1509 | QString line = mSocket->readLine (); |
1510 | piFileString += line; | 1510 | piFileString += line; |
1511 | //qDebug("readline: %s ", line.latin1()); | 1511 | //qDebug("readline: %s ", line.latin1()); |
1512 | mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); | 1512 | mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); |
1513 | 1513 | ||
1514 | } | 1514 | } |
1515 | if ( piTime.elapsed () < 3000 ) { | 1515 | if ( piTime.elapsed () < 3000 ) { |
1516 | // wait for more | 1516 | // wait for more |
1517 | //qDebug("waitformore "); | 1517 | //qDebug("waitformore "); |
1518 | QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); | 1518 | QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); |
1519 | return; | 1519 | return; |
1520 | } | 1520 | } |
1521 | QString fileName = mFileName; | 1521 | QString fileName = mFileName; |
1522 | QFile file ( fileName ); | 1522 | QFile file ( fileName ); |
1523 | if (!file.open( IO_WriteOnly ) ) { | 1523 | if (!file.open( IO_WriteOnly ) ) { |
1524 | delete mSyncActionDialog; | 1524 | delete mSyncActionDialog; |
1525 | mSyncActionDialog = 0; | 1525 | mSyncActionDialog = 0; |
1526 | qDebug("KSS:Error open read back file "); | 1526 | qDebug("KSS:Error open read back file "); |
1527 | piFileString = ""; | 1527 | piFileString = ""; |
1528 | emit file_received( false, mResource); | 1528 | emit file_received( false, mResource); |
1529 | emit file_received( false); | 1529 | emit file_received( false); |
1530 | blockRC = false; | 1530 | blockRC = false; |
1531 | return ; | 1531 | return ; |