author | zautrix <zautrix> | 2005-01-17 19:49:42 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-17 19:49:42 (UTC) |
commit | 522486966ecf041a6e49913b6e420d58d4284837 (patch) (unidiff) | |
tree | d15da3e6ef9ec4638eba4aaf9f14ef0c5eaecd04 | |
parent | 32479683283fc9f20d369ac9671ba0f8a33d3381 (diff) | |
download | kdepimpi-522486966ecf041a6e49913b6e420d58d4284837.zip kdepimpi-522486966ecf041a6e49913b6e420d58d4284837.tar.gz kdepimpi-522486966ecf041a6e49913b6e420d58d4284837.tar.bz2 |
const fixes
-rw-r--r-- | kabc/addressbook.cpp | 4 | ||||
-rw-r--r-- | kabc/addressbook.h | 2 | ||||
-rw-r--r-- | kabc/addressee.cpp | 10 | ||||
-rw-r--r-- | kabc/addressee.h | 10 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 33 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 2 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 5 | ||||
-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 2 | ||||
-rw-r--r-- | microkde/kidmanager.cpp | 10 | ||||
-rw-r--r-- | microkde/kidmanager.h | 10 |
10 files changed, 55 insertions, 33 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 4de7da2..9e61261 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -899,131 +899,131 @@ AddressBook::Iterator AddressBook::find( const Addressee &a ) | |||
899 | Addressee AddressBook::findByUid( const QString &uid ) | 899 | Addressee AddressBook::findByUid( const QString &uid ) |
900 | { | 900 | { |
901 | Iterator it; | 901 | Iterator it; |
902 | for ( it = begin(); it != end(); ++it ) { | 902 | for ( it = begin(); it != end(); ++it ) { |
903 | if ( uid == (*it).uid() ) { | 903 | if ( uid == (*it).uid() ) { |
904 | return *it; | 904 | return *it; |
905 | } | 905 | } |
906 | } | 906 | } |
907 | return Addressee(); | 907 | return Addressee(); |
908 | } | 908 | } |
909 | void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool isSubset ) | 909 | void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool isSubset ) |
910 | { | 910 | { |
911 | //qDebug("AddressBook::preExternSync "); | 911 | //qDebug("AddressBook::preExternSync "); |
912 | AddressBook::Iterator it; | 912 | AddressBook::Iterator it; |
913 | for ( it = begin(); it != end(); ++it ) { | 913 | for ( it = begin(); it != end(); ++it ) { |
914 | (*it).setID( csd, (*it).externalUID() ); | 914 | (*it).setID( csd, (*it).externalUID() ); |
915 | (*it).computeCsum( csd ); | 915 | (*it).computeCsum( csd ); |
916 | } | 916 | } |
917 | mergeAB( aBook ,csd, isSubset ); | 917 | mergeAB( aBook ,csd, isSubset ); |
918 | } | 918 | } |
919 | void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID) | 919 | void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID) |
920 | { | 920 | { |
921 | //qDebug("AddressBook::postExternSync "); | 921 | //qDebug("AddressBook::postExternSync "); |
922 | AddressBook::Iterator it; | 922 | AddressBook::Iterator it; |
923 | int foundEmpty = 0; | 923 | int foundEmpty = 0; |
924 | for ( it = begin(); it != end(); ++it ) { | 924 | for ( it = begin(); it != end(); ++it ) { |
925 | //qDebug("check uid %s ", (*it).uid().latin1() ); | 925 | //qDebug("check uid %s ", (*it).uid().latin1() ); |
926 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || | 926 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || |
927 | (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM || | 927 | (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM || |
928 | (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL) { | 928 | (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL) { |
929 | Addressee ad = aBook->findByUid( ( (*it).uid() )); | 929 | Addressee ad = aBook->findByUid( ( (*it).uid() )); |
930 | if ( ad.isEmpty() ) { | 930 | if ( ad.isEmpty() ) { |
931 | ++foundEmpty; | 931 | ++foundEmpty; |
932 | //qDebug("postExternSync:addressee is empty: %s ", (*it).uid().latin1()); | 932 | //qDebug("postExternSync:addressee is empty: %s ", (*it).uid().latin1()); |
933 | //qDebug("-- formatted name %s ",(*it).formattedName().latin1() ); | 933 | //qDebug("-- formatted name %s ",(*it).formattedName().latin1() ); |
934 | } else { | 934 | } else { |
935 | (*it).setIDStr(":"); | 935 | (*it).setIDStr(":"); |
936 | if ( setID ) { | 936 | if ( setID ) { |
937 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) | 937 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) |
938 | ad.setID( csd, (*it).externalUID() ); | 938 | ad.setID( csd, (*it).externalUID() ); |
939 | } else | 939 | } else |
940 | ad.setID( csd, (*it).uid() ); | 940 | ad.setID( csd, (*it).uid() ); |
941 | (*it).computeCsum( csd ); | 941 | (*it).computeCsum( csd ); |
942 | ad.setCsum( csd, (*it).getCsum( csd ) ); | 942 | ad.setCsum( csd, (*it).getCsum( csd ) ); |
943 | //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() ); | 943 | //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() ); |
944 | aBook->insertAddressee( ad , false); | 944 | aBook->insertAddressee( ad , false); |
945 | } | 945 | } |
946 | } | 946 | } |
947 | } | 947 | } |
948 | if ( foundEmpty ) { | 948 | if ( foundEmpty ) { |
949 | qDebug("postExternSync:%d empty addressees found:\n probably filtered out by incoming sync filter.",foundEmpty ); | 949 | qDebug("postExternSync:%d empty addressees found:\n probably filtered out by incoming sync filter.",foundEmpty ); |
950 | } | 950 | } |
951 | 951 | ||
952 | } | 952 | } |
953 | 953 | ||
954 | bool AddressBook::containsExternalUid( const QString& uid ) | 954 | bool AddressBook::containsExternalUid( const QString& uid ) |
955 | { | 955 | { |
956 | Iterator it; | 956 | Iterator it; |
957 | for ( it = begin(); it != end(); ++it ) { | 957 | for ( it = begin(); it != end(); ++it ) { |
958 | if ( uid == (*it).externalUID( ) ) | 958 | if ( uid == (*it).externalUID( ) ) |
959 | return true; | 959 | return true; |
960 | } | 960 | } |
961 | return false; | 961 | return false; |
962 | } | 962 | } |
963 | Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) | 963 | const Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) const |
964 | { | 964 | { |
965 | Iterator it; | 965 | ConstIterator it; |
966 | for ( it = begin(); it != end(); ++it ) { | 966 | for ( it = begin(); it != end(); ++it ) { |
967 | if ( uid == (*it).getID( profile ) ) | 967 | if ( uid == (*it).getID( profile ) ) |
968 | return (*it); | 968 | return (*it); |
969 | } | 969 | } |
970 | return Addressee(); | 970 | return Addressee(); |
971 | } | 971 | } |
972 | void AddressBook::mergeAB( AddressBook *aBook, const QString& profile , bool isSubset ) | 972 | void AddressBook::mergeAB( AddressBook *aBook, const QString& profile , bool isSubset ) |
973 | { | 973 | { |
974 | Iterator it; | 974 | Iterator it; |
975 | Addressee ad; | 975 | Addressee ad; |
976 | for ( it = begin(); it != end(); ++it ) { | 976 | for ( it = begin(); it != end(); ++it ) { |
977 | ad = aBook->findByExternUid( (*it).externalUID(), profile ); | 977 | ad = aBook->findByExternUid( (*it).externalUID(), profile ); |
978 | if ( !ad.isEmpty() ) { | 978 | if ( !ad.isEmpty() ) { |
979 | (*it).mergeContact( ad ,isSubset); | 979 | (*it).mergeContact( ad ,isSubset); |
980 | } | 980 | } |
981 | } | 981 | } |
982 | #if 0 | 982 | #if 0 |
983 | // test only | 983 | // test only |
984 | for ( it = begin(); it != end(); ++it ) { | 984 | for ( it = begin(); it != end(); ++it ) { |
985 | 985 | ||
986 | qDebug("uid %s ", (*it).uid().latin1()); | 986 | qDebug("uid %s ", (*it).uid().latin1()); |
987 | } | 987 | } |
988 | #endif | 988 | #endif |
989 | } | 989 | } |
990 | 990 | ||
991 | #if 0 | 991 | #if 0 |
992 | Addressee::List AddressBook::getExternLastSyncAddressees() | 992 | Addressee::List AddressBook::getExternLastSyncAddressees() |
993 | { | 993 | { |
994 | Addressee::List results; | 994 | Addressee::List results; |
995 | 995 | ||
996 | Iterator it; | 996 | Iterator it; |
997 | for ( it = begin(); it != end(); ++it ) { | 997 | for ( it = begin(); it != end(); ++it ) { |
998 | if ( (*it).uid().left( 19 ) == "last-syncAddressee-" ) { | 998 | if ( (*it).uid().left( 19 ) == "last-syncAddressee-" ) { |
999 | if ( (*it).familyName().left(4) == "!E: " ) | 999 | if ( (*it).familyName().left(4) == "!E: " ) |
1000 | results.append( *it ); | 1000 | results.append( *it ); |
1001 | } | 1001 | } |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | return results; | 1004 | return results; |
1005 | } | 1005 | } |
1006 | #endif | 1006 | #endif |
1007 | void AddressBook::resetTempSyncStat() | 1007 | void AddressBook::resetTempSyncStat() |
1008 | { | 1008 | { |
1009 | Iterator it; | 1009 | Iterator it; |
1010 | for ( it = begin(); it != end(); ++it ) { | 1010 | for ( it = begin(); it != end(); ++it ) { |
1011 | (*it).setTempSyncStat ( SYNC_TEMPSTATE_INITIAL ); | 1011 | (*it).setTempSyncStat ( SYNC_TEMPSTATE_INITIAL ); |
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | QStringList AddressBook:: uidList() | 1016 | QStringList AddressBook:: uidList() |
1017 | { | 1017 | { |
1018 | QStringList results; | 1018 | QStringList results; |
1019 | Iterator it; | 1019 | Iterator it; |
1020 | for ( it = begin(); it != end(); ++it ) { | 1020 | for ( it = begin(); it != end(); ++it ) { |
1021 | results.append( (*it).uid() ); | 1021 | results.append( (*it).uid() ); |
1022 | } | 1022 | } |
1023 | return results; | 1023 | return results; |
1024 | } | 1024 | } |
1025 | 1025 | ||
1026 | 1026 | ||
1027 | Addressee::List AddressBook::allAddressees() | 1027 | Addressee::List AddressBook::allAddressees() |
1028 | { | 1028 | { |
1029 | return d->mAddressees; | 1029 | return d->mAddressees; |
diff --git a/kabc/addressbook.h b/kabc/addressbook.h index 2351add..18c03b5 100644 --- a/kabc/addressbook.h +++ b/kabc/addressbook.h | |||
@@ -243,108 +243,108 @@ class AddressBook : public QObject | |||
243 | void dump() const; | 243 | void dump() const; |
244 | 244 | ||
245 | void emitAddressBookLocked() { emit addressBookLocked( this ); } | 245 | void emitAddressBookLocked() { emit addressBookLocked( this ); } |
246 | void emitAddressBookUnlocked() { emit addressBookUnlocked( this ); } | 246 | void emitAddressBookUnlocked() { emit addressBookUnlocked( this ); } |
247 | void emitAddressBookChanged() { emit addressBookChanged( this ); } | 247 | void emitAddressBookChanged() { emit addressBookChanged( this ); } |
248 | 248 | ||
249 | /** | 249 | /** |
250 | Return list of all Fields known to the address book which are associated | 250 | Return list of all Fields known to the address book which are associated |
251 | with the given field category. | 251 | with the given field category. |
252 | */ | 252 | */ |
253 | Field::List fields( int category = Field::All ); | 253 | Field::List fields( int category = Field::All ); |
254 | 254 | ||
255 | /** | 255 | /** |
256 | Add custom field to address book. | 256 | Add custom field to address book. |
257 | 257 | ||
258 | @param label User visible label of the field. | 258 | @param label User visible label of the field. |
259 | @param category Ored list of field categories. | 259 | @param category Ored list of field categories. |
260 | @param key Identifier used as key for reading and writing the field. | 260 | @param key Identifier used as key for reading and writing the field. |
261 | @param app String used as application key for reading and writing | 261 | @param app String used as application key for reading and writing |
262 | the field. | 262 | the field. |
263 | */ | 263 | */ |
264 | bool addCustomField( const QString &label, int category = Field::All, | 264 | bool addCustomField( const QString &label, int category = Field::All, |
265 | const QString &key = QString::null, | 265 | const QString &key = QString::null, |
266 | const QString &app = QString::null ); | 266 | const QString &app = QString::null ); |
267 | 267 | ||
268 | 268 | ||
269 | /** | 269 | /** |
270 | Add address book resource. | 270 | Add address book resource. |
271 | */ | 271 | */ |
272 | bool addResource( Resource * ); | 272 | bool addResource( Resource * ); |
273 | 273 | ||
274 | /** | 274 | /** |
275 | Remove address book resource. | 275 | Remove address book resource. |
276 | */ | 276 | */ |
277 | void removeResources(); | 277 | void removeResources(); |
278 | bool removeResource( Resource * ); | 278 | bool removeResource( Resource * ); |
279 | 279 | ||
280 | /** | 280 | /** |
281 | Return pointer list of all resources. | 281 | Return pointer list of all resources. |
282 | */ | 282 | */ |
283 | QPtrList<Resource> resources(); | 283 | QPtrList<Resource> resources(); |
284 | 284 | ||
285 | /** | 285 | /** |
286 | Set the @p ErrorHandler, that is used by @ref error() to | 286 | Set the @p ErrorHandler, that is used by @ref error() to |
287 | provide gui-independend error messages. | 287 | provide gui-independend error messages. |
288 | */ | 288 | */ |
289 | void setErrorHandler( ErrorHandler * ); | 289 | void setErrorHandler( ErrorHandler * ); |
290 | 290 | ||
291 | /** | 291 | /** |
292 | Shows gui independend error messages. | 292 | Shows gui independend error messages. |
293 | */ | 293 | */ |
294 | void error( const QString& ); | 294 | void error( const QString& ); |
295 | 295 | ||
296 | /** | 296 | /** |
297 | Query all resources to clean up their lock files | 297 | Query all resources to clean up their lock files |
298 | */ | 298 | */ |
299 | void cleanUp(); | 299 | void cleanUp(); |
300 | 300 | ||
301 | // sync stuff | 301 | // sync stuff |
302 | //Addressee::List getExternLastSyncAddressees(); | 302 | //Addressee::List getExternLastSyncAddressees(); |
303 | void resetTempSyncStat(); | 303 | void resetTempSyncStat(); |
304 | QStringList uidList(); | 304 | QStringList uidList(); |
305 | void removeSyncAddressees( bool removeDeleted = false ); | 305 | void removeSyncAddressees( bool removeDeleted = false ); |
306 | void mergeAB( AddressBook *aBook, const QString& profile, bool isSubset ); | 306 | void mergeAB( AddressBook *aBook, const QString& profile, bool isSubset ); |
307 | Addressee findByExternUid( const QString& uid , const QString& profile ); | 307 | const Addressee findByExternUid( const QString& uid , const QString& profile ) const; |
308 | bool containsExternalUid( const QString& uid ); | 308 | bool containsExternalUid( const QString& uid ); |
309 | 309 | ||
310 | void preExternSync( AddressBook* aBook, const QString& csd, bool isSubset ); | 310 | void preExternSync( AddressBook* aBook, const QString& csd, bool isSubset ); |
311 | void postExternSync( AddressBook* aBook, const QString& csd , bool setID ); | 311 | void postExternSync( AddressBook* aBook, const QString& csd , bool setID ); |
312 | signals: | 312 | signals: |
313 | /** | 313 | /** |
314 | Emitted, when the address book has changed on disk. | 314 | Emitted, when the address book has changed on disk. |
315 | */ | 315 | */ |
316 | void addressBookChanged( AddressBook * ); | 316 | void addressBookChanged( AddressBook * ); |
317 | 317 | ||
318 | /** | 318 | /** |
319 | Emitted, when the address book has been locked for writing. | 319 | Emitted, when the address book has been locked for writing. |
320 | */ | 320 | */ |
321 | void addressBookLocked( AddressBook * ); | 321 | void addressBookLocked( AddressBook * ); |
322 | 322 | ||
323 | /** | 323 | /** |
324 | Emitted, when the address book has been unlocked. | 324 | Emitted, when the address book has been unlocked. |
325 | */ | 325 | */ |
326 | void addressBookUnlocked( AddressBook * ); | 326 | void addressBookUnlocked( AddressBook * ); |
327 | 327 | ||
328 | protected: | 328 | protected: |
329 | void deleteRemovedAddressees(); | 329 | void deleteRemovedAddressees(); |
330 | void setStandardResource( Resource * ); | 330 | void setStandardResource( Resource * ); |
331 | Resource *standardResource(); | 331 | Resource *standardResource(); |
332 | KRES::Manager<Resource> *resourceManager(); | 332 | KRES::Manager<Resource> *resourceManager(); |
333 | 333 | ||
334 | void init(const QString &config, const QString &family); | 334 | void init(const QString &config, const QString &family); |
335 | 335 | ||
336 | private: | 336 | private: |
337 | //US QPtrList<Resource> mDummy; // Remove in KDE 4 | 337 | //US QPtrList<Resource> mDummy; // Remove in KDE 4 |
338 | 338 | ||
339 | 339 | ||
340 | struct AddressBookData; | 340 | struct AddressBookData; |
341 | AddressBookData *d; | 341 | AddressBookData *d; |
342 | bool blockLSEchange; | 342 | bool blockLSEchange; |
343 | }; | 343 | }; |
344 | 344 | ||
345 | QDataStream &operator<<( QDataStream &, const AddressBook & ); | 345 | QDataStream &operator<<( QDataStream &, const AddressBook & ); |
346 | QDataStream &operator>>( QDataStream &, AddressBook & ); | 346 | QDataStream &operator>>( QDataStream &, AddressBook & ); |
347 | 347 | ||
348 | } | 348 | } |
349 | 349 | ||
350 | #endif | 350 | #endif |
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index d60cd6b..3b238f5 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -528,193 +528,193 @@ void Addressee::simplifyPhoneNumbers() | |||
528 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 528 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
529 | ++phoneIter ) { | 529 | ++phoneIter ) { |
530 | removePhoneNumber(( *phoneIter )); | 530 | removePhoneNumber(( *phoneIter )); |
531 | } | 531 | } |
532 | // delete preferred numbers | 532 | // delete preferred numbers |
533 | if ( inList > max ) { | 533 | if ( inList > max ) { |
534 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 534 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
535 | ++phoneIter ) { | 535 | ++phoneIter ) { |
536 | if ( inList > max ) { | 536 | if ( inList > max ) { |
537 | removeNumbers.append( ( *phoneIter ) ); | 537 | removeNumbers.append( ( *phoneIter ) ); |
538 | --inList; | 538 | --inList; |
539 | } else | 539 | } else |
540 | break; | 540 | break; |
541 | } | 541 | } |
542 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 542 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
543 | ++phoneIter ) { | 543 | ++phoneIter ) { |
544 | removePhoneNumber(( *phoneIter )); | 544 | removePhoneNumber(( *phoneIter )); |
545 | } | 545 | } |
546 | } | 546 | } |
547 | } | 547 | } |
548 | // remove non-numeric characters | 548 | // remove non-numeric characters |
549 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 549 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
550 | ++phoneIter ) { | 550 | ++phoneIter ) { |
551 | if ( ! ( *phoneIter ).simplifyNumber() ) | 551 | if ( ! ( *phoneIter ).simplifyNumber() ) |
552 | removeNumbers.append( ( *phoneIter ) ); | 552 | removeNumbers.append( ( *phoneIter ) ); |
553 | } | 553 | } |
554 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 554 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
555 | ++phoneIter ) { | 555 | ++phoneIter ) { |
556 | removePhoneNumber(( *phoneIter )); | 556 | removePhoneNumber(( *phoneIter )); |
557 | } | 557 | } |
558 | } | 558 | } |
559 | void Addressee::simplifyPhoneNumberTypes() | 559 | void Addressee::simplifyPhoneNumberTypes() |
560 | { | 560 | { |
561 | KABC::PhoneNumber::List::Iterator phoneIter; | 561 | KABC::PhoneNumber::List::Iterator phoneIter; |
562 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 562 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
563 | ++phoneIter ) | 563 | ++phoneIter ) |
564 | ( *phoneIter ).simplifyType(); | 564 | ( *phoneIter ).simplifyType(); |
565 | } | 565 | } |
566 | void Addressee::removeID(const QString &prof) | 566 | void Addressee::removeID(const QString &prof) |
567 | { | 567 | { |
568 | detach(); | 568 | detach(); |
569 | if ( prof.isEmpty() ) | 569 | if ( prof.isEmpty() ) |
570 | mData->mExternalId = ":"; | 570 | mData->mExternalId = ":"; |
571 | else | 571 | else |
572 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | 572 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); |
573 | 573 | ||
574 | } | 574 | } |
575 | void Addressee::setID( const QString & prof , const QString & id ) | 575 | void Addressee::setID( const QString & prof , const QString & id ) |
576 | { | 576 | { |
577 | detach(); | 577 | detach(); |
578 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); | 578 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); |
579 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 579 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
580 | } | 580 | } |
581 | void Addressee::setTempSyncStat( int id ) | 581 | void Addressee::setTempSyncStat( int id ) |
582 | { | 582 | { |
583 | if ( mData->mTempSyncStat == id ) return; | 583 | if ( mData->mTempSyncStat == id ) return; |
584 | detach(); | 584 | detach(); |
585 | mData->mTempSyncStat = id; | 585 | mData->mTempSyncStat = id; |
586 | } | 586 | } |
587 | int Addressee::tempSyncStat() const | 587 | int Addressee::tempSyncStat() const |
588 | { | 588 | { |
589 | return mData->mTempSyncStat; | 589 | return mData->mTempSyncStat; |
590 | } | 590 | } |
591 | 591 | ||
592 | QString Addressee::getID( const QString & prof) | 592 | const QString Addressee::getID( const QString & prof) const |
593 | { | 593 | { |
594 | return KIdManager::getId ( mData->mExternalId, prof ); | 594 | return KIdManager::getId ( mData->mExternalId, prof ); |
595 | } | 595 | } |
596 | 596 | ||
597 | void Addressee::setCsum( const QString & prof , const QString & id ) | 597 | void Addressee::setCsum( const QString & prof , const QString & id ) |
598 | { | 598 | { |
599 | detach(); | 599 | detach(); |
600 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 600 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
601 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); | 601 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); |
602 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); | 602 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); |
603 | } | 603 | } |
604 | 604 | ||
605 | QString Addressee::getCsum( const QString & prof) | 605 | const QString Addressee::getCsum( const QString & prof) const |
606 | { | 606 | { |
607 | return KIdManager::getCsum ( mData->mExternalId, prof ); | 607 | return KIdManager::getCsum ( mData->mExternalId, prof ); |
608 | } | 608 | } |
609 | 609 | ||
610 | void Addressee::setIDStr( const QString & s ) | 610 | void Addressee::setIDStr( const QString & s ) |
611 | { | 611 | { |
612 | detach(); | 612 | detach(); |
613 | mData->mExternalId = s; | 613 | mData->mExternalId = s; |
614 | } | 614 | } |
615 | 615 | ||
616 | QString Addressee::IDStr() const | 616 | const QString Addressee::IDStr() const |
617 | { | 617 | { |
618 | return mData->mExternalId; | 618 | return mData->mExternalId; |
619 | } | 619 | } |
620 | 620 | ||
621 | void Addressee::setExternalUID( const QString &id ) | 621 | void Addressee::setExternalUID( const QString &id ) |
622 | { | 622 | { |
623 | if ( id == mData->externalUID ) return; | 623 | if ( id == mData->externalUID ) return; |
624 | detach(); | 624 | detach(); |
625 | mData->empty = false; | 625 | mData->empty = false; |
626 | mData->externalUID = id; | 626 | mData->externalUID = id; |
627 | } | 627 | } |
628 | 628 | ||
629 | QString Addressee::externalUID() const | 629 | const QString Addressee::externalUID() const |
630 | { | 630 | { |
631 | return mData->externalUID; | 631 | return mData->externalUID; |
632 | } | 632 | } |
633 | void Addressee::setOriginalExternalUID( const QString &id ) | 633 | void Addressee::setOriginalExternalUID( const QString &id ) |
634 | { | 634 | { |
635 | if ( id == mData->originalExternalUID ) return; | 635 | if ( id == mData->originalExternalUID ) return; |
636 | detach(); | 636 | detach(); |
637 | mData->empty = false; | 637 | mData->empty = false; |
638 | //qDebug("*******Set orig uid %s ", id.latin1()); | 638 | //qDebug("*******Set orig uid %s ", id.latin1()); |
639 | mData->originalExternalUID = id; | 639 | mData->originalExternalUID = id; |
640 | } | 640 | } |
641 | 641 | ||
642 | QString Addressee::originalExternalUID() const | 642 | QString Addressee::originalExternalUID() const |
643 | { | 643 | { |
644 | return mData->originalExternalUID; | 644 | return mData->originalExternalUID; |
645 | } | 645 | } |
646 | 646 | ||
647 | void Addressee::setUid( const QString &id ) | 647 | void Addressee::setUid( const QString &id ) |
648 | { | 648 | { |
649 | if ( id == mData->uid ) return; | 649 | if ( id == mData->uid ) return; |
650 | detach(); | 650 | detach(); |
651 | //qDebug("****setuid %s ", id.latin1()); | 651 | //qDebug("****setuid %s ", id.latin1()); |
652 | mData->empty = false; | 652 | mData->empty = false; |
653 | mData->uid = id; | 653 | mData->uid = id; |
654 | } | 654 | } |
655 | 655 | ||
656 | QString Addressee::uid() const | 656 | const QString Addressee::uid() const |
657 | { | 657 | { |
658 | if ( mData->uid.isEmpty() ) | 658 | if ( mData->uid.isEmpty() ) |
659 | mData->uid = KApplication::randomString( 10 ); | 659 | mData->uid = KApplication::randomString( 10 ); |
660 | 660 | ||
661 | return mData->uid; | 661 | return mData->uid; |
662 | } | 662 | } |
663 | 663 | ||
664 | QString Addressee::uidLabel() | 664 | QString Addressee::uidLabel() |
665 | { | 665 | { |
666 | return i18n("Unique Identifier"); | 666 | return i18n("Unique Identifier"); |
667 | } | 667 | } |
668 | 668 | ||
669 | void Addressee::setName( const QString &name ) | 669 | void Addressee::setName( const QString &name ) |
670 | { | 670 | { |
671 | if ( name == mData->name ) return; | 671 | if ( name == mData->name ) return; |
672 | detach(); | 672 | detach(); |
673 | mData->empty = false; | 673 | mData->empty = false; |
674 | mData->name = name; | 674 | mData->name = name; |
675 | } | 675 | } |
676 | 676 | ||
677 | QString Addressee::name() const | 677 | QString Addressee::name() const |
678 | { | 678 | { |
679 | return mData->name; | 679 | return mData->name; |
680 | } | 680 | } |
681 | 681 | ||
682 | QString Addressee::nameLabel() | 682 | QString Addressee::nameLabel() |
683 | { | 683 | { |
684 | return i18n("Name"); | 684 | return i18n("Name"); |
685 | } | 685 | } |
686 | 686 | ||
687 | 687 | ||
688 | void Addressee::setFormattedName( const QString &formattedName ) | 688 | void Addressee::setFormattedName( const QString &formattedName ) |
689 | { | 689 | { |
690 | if ( formattedName == mData->formattedName ) return; | 690 | if ( formattedName == mData->formattedName ) return; |
691 | detach(); | 691 | detach(); |
692 | mData->empty = false; | 692 | mData->empty = false; |
693 | mData->formattedName = formattedName; | 693 | mData->formattedName = formattedName; |
694 | } | 694 | } |
695 | 695 | ||
696 | QString Addressee::formattedName() const | 696 | QString Addressee::formattedName() const |
697 | { | 697 | { |
698 | return mData->formattedName; | 698 | return mData->formattedName; |
699 | } | 699 | } |
700 | 700 | ||
701 | QString Addressee::formattedNameLabel() | 701 | QString Addressee::formattedNameLabel() |
702 | { | 702 | { |
703 | return i18n("Formatted Name"); | 703 | return i18n("Formatted Name"); |
704 | } | 704 | } |
705 | 705 | ||
706 | 706 | ||
707 | void Addressee::setFamilyName( const QString &familyName ) | 707 | void Addressee::setFamilyName( const QString &familyName ) |
708 | { | 708 | { |
709 | if ( familyName == mData->familyName ) return; | 709 | if ( familyName == mData->familyName ) return; |
710 | detach(); | 710 | detach(); |
711 | mData->empty = false; | 711 | mData->empty = false; |
712 | mData->familyName = familyName; | 712 | mData->familyName = familyName; |
713 | } | 713 | } |
714 | 714 | ||
715 | QString Addressee::familyName() const | 715 | QString Addressee::familyName() const |
716 | { | 716 | { |
717 | return mData->familyName; | 717 | return mData->familyName; |
718 | } | 718 | } |
719 | 719 | ||
720 | QString Addressee::familyNameLabel() | 720 | QString Addressee::familyNameLabel() |
diff --git a/kabc/addressee.h b/kabc/addressee.h index 08d2f56..8051fec 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h | |||
@@ -39,160 +39,160 @@ $Id$ | |||
39 | 39 | ||
40 | #include "address.h" | 40 | #include "address.h" |
41 | #include "agent.h" | 41 | #include "agent.h" |
42 | #include "geo.h" | 42 | #include "geo.h" |
43 | #include "key.h" | 43 | #include "key.h" |
44 | #include "phonenumber.h" | 44 | #include "phonenumber.h" |
45 | #include "picture.h" | 45 | #include "picture.h" |
46 | #include "secrecy.h" | 46 | #include "secrecy.h" |
47 | #include "sound.h" | 47 | #include "sound.h" |
48 | #include "timezone.h" | 48 | #include "timezone.h" |
49 | 49 | ||
50 | namespace KABC { | 50 | namespace KABC { |
51 | 51 | ||
52 | class Resource; | 52 | class Resource; |
53 | 53 | ||
54 | /** | 54 | /** |
55 | @short address book entry | 55 | @short address book entry |
56 | 56 | ||
57 | This class represents an entry in the address book. | 57 | This class represents an entry in the address book. |
58 | 58 | ||
59 | The data of this class is implicitly shared. You can pass this class by value. | 59 | The data of this class is implicitly shared. You can pass this class by value. |
60 | 60 | ||
61 | If you need the name of a field for presenting it to the user you should use | 61 | If you need the name of a field for presenting it to the user you should use |
62 | the functions ending in Label(). They return a translated string which can be | 62 | the functions ending in Label(). They return a translated string which can be |
63 | used as label for the corresponding field. | 63 | used as label for the corresponding field. |
64 | 64 | ||
65 | About the name fields: | 65 | About the name fields: |
66 | 66 | ||
67 | givenName() is the first name and familyName() the last name. In some | 67 | givenName() is the first name and familyName() the last name. In some |
68 | countries the family name comes first, that's the reason for the | 68 | countries the family name comes first, that's the reason for the |
69 | naming. formattedName() is the full name with the correct formatting. | 69 | naming. formattedName() is the full name with the correct formatting. |
70 | It is used as an override, when the correct formatting can't be generated | 70 | It is used as an override, when the correct formatting can't be generated |
71 | from the other name fields automatically. | 71 | from the other name fields automatically. |
72 | 72 | ||
73 | realName() returns a fully formatted name(). It uses formattedName, if set, | 73 | realName() returns a fully formatted name(). It uses formattedName, if set, |
74 | otherwise it constucts the name from the name fields. As fallback, if | 74 | otherwise it constucts the name from the name fields. As fallback, if |
75 | nothing else is set it uses name(). | 75 | nothing else is set it uses name(). |
76 | 76 | ||
77 | name() is the NAME type of RFC2426. It can be used as internal name for the | 77 | name() is the NAME type of RFC2426. It can be used as internal name for the |
78 | data enty, but shouldn't be used for displaying the data to the user. | 78 | data enty, but shouldn't be used for displaying the data to the user. |
79 | */ | 79 | */ |
80 | class Addressee | 80 | class Addressee |
81 | { | 81 | { |
82 | friend QDataStream &operator<<( QDataStream &, const Addressee & ); | 82 | friend QDataStream &operator<<( QDataStream &, const Addressee & ); |
83 | friend QDataStream &operator>>( QDataStream &, Addressee & ); | 83 | friend QDataStream &operator>>( QDataStream &, Addressee & ); |
84 | 84 | ||
85 | public: | 85 | public: |
86 | typedef QValueList<Addressee> List; | 86 | typedef QValueList<Addressee> List; |
87 | 87 | ||
88 | /** | 88 | /** |
89 | Construct an empty address book entry. | 89 | Construct an empty address book entry. |
90 | */ | 90 | */ |
91 | Addressee(); | 91 | Addressee(); |
92 | ~Addressee(); | 92 | ~Addressee(); |
93 | 93 | ||
94 | Addressee( const Addressee & ); | 94 | Addressee( const Addressee & ); |
95 | Addressee &operator=( const Addressee & ); | 95 | Addressee &operator=( const Addressee & ); |
96 | 96 | ||
97 | bool operator==( const Addressee & ) const; | 97 | bool operator==( const Addressee & ) const; |
98 | bool operator!=( const Addressee & ) const; | 98 | bool operator!=( const Addressee & ) const; |
99 | // sync stuff | 99 | // sync stuff |
100 | void setTempSyncStat(int id); | 100 | void setTempSyncStat(int id); |
101 | int tempSyncStat() const; | 101 | int tempSyncStat() const; |
102 | void setIDStr( const QString & ); | 102 | void setIDStr( const QString & ); |
103 | QString IDStr() const; | 103 | const QString IDStr() const; |
104 | void setID( const QString &, const QString & ); | 104 | void setID( const QString &, const QString & ); |
105 | QString getID( const QString & ); | 105 | const QString getID( const QString & ) const; |
106 | void setCsum( const QString &, const QString & ); | 106 | void setCsum( const QString &, const QString & ); |
107 | QString getCsum( const QString & ); | 107 | const QString getCsum( const QString & ) const ; |
108 | void removeID(const QString &); | 108 | void removeID(const QString &); |
109 | void computeCsum(const QString &dev); | 109 | void computeCsum(const QString &dev); |
110 | ulong getCsum4List( const QStringList & attList); | 110 | ulong getCsum4List( const QStringList & attList); |
111 | /** | 111 | /** |
112 | Return, if the address book entry is empty. | 112 | Return, if the address book entry is empty. |
113 | */ | 113 | */ |
114 | bool isEmpty() const; | 114 | bool isEmpty() const; |
115 | void setExternalUID( const QString &id ); | 115 | void setExternalUID( const QString &id ); |
116 | QString externalUID() const; | 116 | const QString externalUID() const; |
117 | void setOriginalExternalUID( const QString &id ); | 117 | void setOriginalExternalUID( const QString &id ); |
118 | QString originalExternalUID() const; | 118 | QString originalExternalUID() const; |
119 | void mergeContact( const Addressee& ad, bool isSubSet ); | 119 | void mergeContact( const Addressee& ad, bool isSubSet ); |
120 | void simplifyEmails(); | 120 | void simplifyEmails(); |
121 | void simplifyAddresses(); | 121 | void simplifyAddresses(); |
122 | void simplifyPhoneNumbers(); | 122 | void simplifyPhoneNumbers(); |
123 | void simplifyPhoneNumberTypes(); | 123 | void simplifyPhoneNumberTypes(); |
124 | bool removeVoice(); | 124 | bool removeVoice(); |
125 | bool containsAdr(const Addressee& addr ); | 125 | bool containsAdr(const Addressee& addr ); |
126 | 126 | ||
127 | /** | 127 | /** |
128 | Set unique identifier. | 128 | Set unique identifier. |
129 | */ | 129 | */ |
130 | void setUid( const QString &uid ); | 130 | void setUid( const QString &uid ); |
131 | /** | 131 | /** |
132 | Return unique identifier. | 132 | Return unique identifier. |
133 | */ | 133 | */ |
134 | QString uid() const; | 134 | const QString uid() const; |
135 | /** | 135 | /** |
136 | Return translated label for uid field. | 136 | Return translated label for uid field. |
137 | */ | 137 | */ |
138 | static QString uidLabel(); | 138 | static QString uidLabel(); |
139 | 139 | ||
140 | /** | 140 | /** |
141 | Set name. | 141 | Set name. |
142 | */ | 142 | */ |
143 | void setName( const QString &name ); | 143 | void setName( const QString &name ); |
144 | /** | 144 | /** |
145 | Return name. | 145 | Return name. |
146 | */ | 146 | */ |
147 | QString name() const; | 147 | QString name() const; |
148 | /** | 148 | /** |
149 | Return translated label for name field. | 149 | Return translated label for name field. |
150 | */ | 150 | */ |
151 | static QString nameLabel(); | 151 | static QString nameLabel(); |
152 | 152 | ||
153 | /** | 153 | /** |
154 | Set formatted name. | 154 | Set formatted name. |
155 | */ | 155 | */ |
156 | void setFormattedName( const QString &formattedName ); | 156 | void setFormattedName( const QString &formattedName ); |
157 | /** | 157 | /** |
158 | Return formatted name. | 158 | Return formatted name. |
159 | */ | 159 | */ |
160 | QString formattedName() const; | 160 | QString formattedName() const; |
161 | /** | 161 | /** |
162 | Return translated label for formattedName field. | 162 | Return translated label for formattedName field. |
163 | */ | 163 | */ |
164 | static QString formattedNameLabel(); | 164 | static QString formattedNameLabel(); |
165 | 165 | ||
166 | /** | 166 | /** |
167 | Set family name. | 167 | Set family name. |
168 | */ | 168 | */ |
169 | void setFamilyName( const QString &familyName ); | 169 | void setFamilyName( const QString &familyName ); |
170 | /** | 170 | /** |
171 | Return family name. | 171 | Return family name. |
172 | */ | 172 | */ |
173 | QString familyName() const; | 173 | QString familyName() const; |
174 | /** | 174 | /** |
175 | Return translated label for familyName field. | 175 | Return translated label for familyName field. |
176 | */ | 176 | */ |
177 | static QString familyNameLabel(); | 177 | static QString familyNameLabel(); |
178 | 178 | ||
179 | /** | 179 | /** |
180 | Set given name. | 180 | Set given name. |
181 | */ | 181 | */ |
182 | void setGivenName( const QString &givenName ); | 182 | void setGivenName( const QString &givenName ); |
183 | /** | 183 | /** |
184 | Return given name. | 184 | Return given name. |
185 | */ | 185 | */ |
186 | QString givenName() const; | 186 | QString givenName() const; |
187 | /** | 187 | /** |
188 | Return translated label for givenName field. | 188 | Return translated label for givenName field. |
189 | */ | 189 | */ |
190 | static QString givenNameLabel(); | 190 | static QString givenNameLabel(); |
191 | 191 | ||
192 | /** | 192 | /** |
193 | Set additional names. | 193 | Set additional names. |
194 | */ | 194 | */ |
195 | void setAdditionalName( const QString &additionalName ); | 195 | void setAdditionalName( const QString &additionalName ); |
196 | /** | 196 | /** |
197 | Return additional names. | 197 | Return additional names. |
198 | */ | 198 | */ |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index d393660..42e147f 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1313,130 +1313,130 @@ void KABCore::importFromOL() | |||
1313 | delete idgl; | 1313 | delete idgl; |
1314 | #endif | 1314 | #endif |
1315 | } | 1315 | } |
1316 | 1316 | ||
1317 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 1317 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
1318 | { | 1318 | { |
1319 | mXXPortManager->importVCard( vCard, showPreview ); | 1319 | mXXPortManager->importVCard( vCard, showPreview ); |
1320 | } | 1320 | } |
1321 | 1321 | ||
1322 | //US added a second method without defaultparameter | 1322 | //US added a second method without defaultparameter |
1323 | void KABCore::editContact2() { | 1323 | void KABCore::editContact2() { |
1324 | editContact( QString::null ); | 1324 | editContact( QString::null ); |
1325 | } | 1325 | } |
1326 | 1326 | ||
1327 | void KABCore::editContact( const QString &uid ) | 1327 | void KABCore::editContact( const QString &uid ) |
1328 | { | 1328 | { |
1329 | 1329 | ||
1330 | if ( mExtensionManager->isQuickEditVisible() ) | 1330 | if ( mExtensionManager->isQuickEditVisible() ) |
1331 | return; | 1331 | return; |
1332 | 1332 | ||
1333 | // First, locate the contact entry | 1333 | // First, locate the contact entry |
1334 | QString localUID = uid; | 1334 | QString localUID = uid; |
1335 | if ( localUID.isNull() ) { | 1335 | if ( localUID.isNull() ) { |
1336 | QStringList uidList = mViewManager->selectedUids(); | 1336 | QStringList uidList = mViewManager->selectedUids(); |
1337 | if ( uidList.count() > 0 ) | 1337 | if ( uidList.count() > 0 ) |
1338 | localUID = *( uidList.at( 0 ) ); | 1338 | localUID = *( uidList.at( 0 ) ); |
1339 | } | 1339 | } |
1340 | 1340 | ||
1341 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); | 1341 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); |
1342 | if ( !addr.isEmpty() ) { | 1342 | if ( !addr.isEmpty() ) { |
1343 | mEditorDialog->setAddressee( addr ); | 1343 | mEditorDialog->setAddressee( addr ); |
1344 | KApplication::execDialog ( mEditorDialog ); | 1344 | KApplication::execDialog ( mEditorDialog ); |
1345 | } | 1345 | } |
1346 | } | 1346 | } |
1347 | 1347 | ||
1348 | /** | 1348 | /** |
1349 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 1349 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
1350 | the method will try to find a selected addressee in the view. | 1350 | the method will try to find a selected addressee in the view. |
1351 | */ | 1351 | */ |
1352 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) | 1352 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) |
1353 | { | 1353 | { |
1354 | if ( mMultipleViewsAtOnce ) | 1354 | if ( mMultipleViewsAtOnce ) |
1355 | { | 1355 | { |
1356 | editContact( uid ); | 1356 | editContact( uid ); |
1357 | } | 1357 | } |
1358 | else | 1358 | else |
1359 | { | 1359 | { |
1360 | setDetailsVisible( true ); | 1360 | setDetailsVisible( true ); |
1361 | mActionDetails->setChecked(true); | 1361 | mActionDetails->setChecked(true); |
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | } | 1364 | } |
1365 | 1365 | ||
1366 | void KABCore::save() | 1366 | void KABCore::save() |
1367 | { | 1367 | { |
1368 | if (syncManager->blockSave()) | 1368 | if (syncManager->blockSave()) |
1369 | return; | 1369 | return; |
1370 | if ( !mModified ) | 1370 | if ( !mModified ) |
1371 | return; | 1371 | return; |
1372 | 1372 | ||
1373 | syncManager->setBlockSave(true); | 1373 | syncManager->setBlockSave(true); |
1374 | QString text = i18n( "There was an error while attempting to save\n the " | 1374 | QString text = i18n( "There was an error while attempting to save\n the " |
1375 | "address book. Please check that some \nother application is " | 1375 | "address book. Please check that some \nother application is " |
1376 | "not using it. " ); | 1376 | "not using it. " ); |
1377 | message(i18n("Saving ... please wait! ")); | 1377 | message(i18n("Saving ... please wait! "), false); |
1378 | qApp->processEvents(); | 1378 | //qApp->processEvents(); |
1379 | #ifndef KAB_EMBEDDED | 1379 | #ifndef KAB_EMBEDDED |
1380 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); | 1380 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); |
1381 | if ( !b || !b->save() ) { | 1381 | if ( !b || !b->save() ) { |
1382 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); | 1382 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); |
1383 | } | 1383 | } |
1384 | #else //KAB_EMBEDDED | 1384 | #else //KAB_EMBEDDED |
1385 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); | 1385 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); |
1386 | if ( !b || !b->save() ) { | 1386 | if ( !b || !b->save() ) { |
1387 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); | 1387 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); |
1388 | } | 1388 | } |
1389 | #endif //KAB_EMBEDDED | 1389 | #endif //KAB_EMBEDDED |
1390 | 1390 | ||
1391 | message(i18n("Addressbook saved!")); | 1391 | message(i18n("Addressbook saved!")); |
1392 | setModified( false ); | 1392 | setModified( false ); |
1393 | syncManager->setBlockSave(false); | 1393 | syncManager->setBlockSave(false); |
1394 | } | 1394 | } |
1395 | 1395 | ||
1396 | 1396 | ||
1397 | void KABCore::undo() | 1397 | void KABCore::undo() |
1398 | { | 1398 | { |
1399 | UndoStack::instance()->undo(); | 1399 | UndoStack::instance()->undo(); |
1400 | 1400 | ||
1401 | // Refresh the view | 1401 | // Refresh the view |
1402 | mViewManager->refreshView(); | 1402 | mViewManager->refreshView(); |
1403 | } | 1403 | } |
1404 | 1404 | ||
1405 | void KABCore::redo() | 1405 | void KABCore::redo() |
1406 | { | 1406 | { |
1407 | RedoStack::instance()->redo(); | 1407 | RedoStack::instance()->redo(); |
1408 | 1408 | ||
1409 | // Refresh the view | 1409 | // Refresh the view |
1410 | mViewManager->refreshView(); | 1410 | mViewManager->refreshView(); |
1411 | } | 1411 | } |
1412 | 1412 | ||
1413 | void KABCore::setJumpButtonBarVisible( bool visible ) | 1413 | void KABCore::setJumpButtonBarVisible( bool visible ) |
1414 | { | 1414 | { |
1415 | if (mMultipleViewsAtOnce) | 1415 | if (mMultipleViewsAtOnce) |
1416 | { | 1416 | { |
1417 | if ( visible ) | 1417 | if ( visible ) |
1418 | mJumpButtonBar->show(); | 1418 | mJumpButtonBar->show(); |
1419 | else | 1419 | else |
1420 | mJumpButtonBar->hide(); | 1420 | mJumpButtonBar->hide(); |
1421 | } | 1421 | } |
1422 | else | 1422 | else |
1423 | { | 1423 | { |
1424 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" | 1424 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" |
1425 | if (mViewManager->isVisible()) | 1425 | if (mViewManager->isVisible()) |
1426 | { | 1426 | { |
1427 | if ( visible ) | 1427 | if ( visible ) |
1428 | mJumpButtonBar->show(); | 1428 | mJumpButtonBar->show(); |
1429 | else | 1429 | else |
1430 | mJumpButtonBar->hide(); | 1430 | mJumpButtonBar->hide(); |
1431 | } | 1431 | } |
1432 | else | 1432 | else |
1433 | { | 1433 | { |
1434 | mJumpButtonBar->hide(); | 1434 | mJumpButtonBar->hide(); |
1435 | } | 1435 | } |
1436 | } | 1436 | } |
1437 | } | 1437 | } |
1438 | 1438 | ||
1439 | 1439 | ||
1440 | void KABCore::setDetailsToState() | 1440 | void KABCore::setDetailsToState() |
1441 | { | 1441 | { |
1442 | setDetailsVisible( mActionDetails->isChecked() ); | 1442 | setDetailsVisible( mActionDetails->isChecked() ); |
@@ -2236,223 +2236,233 @@ void KABCore::addActionsManually() | |||
2236 | mActionMultiSyncHowto->plug( helpMenu ); | 2236 | mActionMultiSyncHowto->plug( helpMenu ); |
2237 | mActionFaq->plug( helpMenu ); | 2237 | mActionFaq->plug( helpMenu ); |
2238 | mActionLicence->plug( helpMenu ); | 2238 | mActionLicence->plug( helpMenu ); |
2239 | mActionAboutKAddressbook->plug( helpMenu ); | 2239 | mActionAboutKAddressbook->plug( helpMenu ); |
2240 | 2240 | ||
2241 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2241 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
2242 | 2242 | ||
2243 | mActionSave->plug( tb ); | 2243 | mActionSave->plug( tb ); |
2244 | mViewManager->getFilterAction()->plug ( tb); | 2244 | mViewManager->getFilterAction()->plug ( tb); |
2245 | //LR hide filteraction on started in 480x640 | 2245 | //LR hide filteraction on started in 480x640 |
2246 | if (QApplication::desktop()->width() == 480 ) { | 2246 | if (QApplication::desktop()->width() == 480 ) { |
2247 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 2247 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
2248 | } | 2248 | } |
2249 | mActionUndo->plug( tb ); | 2249 | mActionUndo->plug( tb ); |
2250 | mActionDelete->plug( tb ); | 2250 | mActionDelete->plug( tb ); |
2251 | mActionRedo->plug( tb ); | 2251 | mActionRedo->plug( tb ); |
2252 | } else { | 2252 | } else { |
2253 | mActionSave->plug( tb ); | 2253 | mActionSave->plug( tb ); |
2254 | tb->enableMoving(false); | 2254 | tb->enableMoving(false); |
2255 | } | 2255 | } |
2256 | //mActionQuit->plug ( tb ); | 2256 | //mActionQuit->plug ( tb ); |
2257 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2257 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
2258 | 2258 | ||
2259 | //US link the searchwidget first to this. | 2259 | //US link the searchwidget first to this. |
2260 | // The real linkage to the toolbar happens later. | 2260 | // The real linkage to the toolbar happens later. |
2261 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2261 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
2262 | //US tb->insertItem( mIncSearchWidget ); | 2262 | //US tb->insertItem( mIncSearchWidget ); |
2263 | /*US | 2263 | /*US |
2264 | mIncSearchWidget = new IncSearchWidget( tb ); | 2264 | mIncSearchWidget = new IncSearchWidget( tb ); |
2265 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2265 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
2266 | SLOT( incrementalSearch( const QString& ) ) ); | 2266 | SLOT( incrementalSearch( const QString& ) ) ); |
2267 | 2267 | ||
2268 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2268 | mJumpButtonBar = new JumpButtonBar( this, this ); |
2269 | 2269 | ||
2270 | //US topLayout->addWidget( mJumpButtonBar ); | 2270 | //US topLayout->addWidget( mJumpButtonBar ); |
2271 | this->layout()->add( mJumpButtonBar ); | 2271 | this->layout()->add( mJumpButtonBar ); |
2272 | */ | 2272 | */ |
2273 | 2273 | ||
2274 | #endif //KAB_EMBEDDED | 2274 | #endif //KAB_EMBEDDED |
2275 | 2275 | ||
2276 | mActionExport2phone->plug( ExportMenu ); | 2276 | mActionExport2phone->plug( ExportMenu ); |
2277 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2277 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2278 | syncManager->fillSyncMenu(); | 2278 | syncManager->fillSyncMenu(); |
2279 | 2279 | ||
2280 | } | 2280 | } |
2281 | void KABCore::showLicence() | 2281 | void KABCore::showLicence() |
2282 | { | 2282 | { |
2283 | KApplication::showLicence(); | 2283 | KApplication::showLicence(); |
2284 | } | 2284 | } |
2285 | 2285 | ||
2286 | void KABCore::manageCategories( ) | 2286 | void KABCore::manageCategories( ) |
2287 | { | 2287 | { |
2288 | KABCatPrefs* cp = new KABCatPrefs(); | 2288 | KABCatPrefs* cp = new KABCatPrefs(); |
2289 | cp->show(); | 2289 | cp->show(); |
2290 | int w =cp->sizeHint().width() ; | 2290 | int w =cp->sizeHint().width() ; |
2291 | int h = cp->sizeHint().height() ; | 2291 | int h = cp->sizeHint().height() ; |
2292 | int dw = QApplication::desktop()->width(); | 2292 | int dw = QApplication::desktop()->width(); |
2293 | int dh = QApplication::desktop()->height(); | 2293 | int dh = QApplication::desktop()->height(); |
2294 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2294 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2295 | if ( !cp->exec() ) { | 2295 | if ( !cp->exec() ) { |
2296 | delete cp; | 2296 | delete cp; |
2297 | return; | 2297 | return; |
2298 | } | 2298 | } |
2299 | int count = 0; | 2299 | int count = 0; |
2300 | int cc = 0; | ||
2300 | message( i18n("Please wait, processing categories...")); | 2301 | message( i18n("Please wait, processing categories...")); |
2301 | if ( cp->addCat() ) { | 2302 | if ( cp->addCat() ) { |
2302 | KABC::AddressBook::Iterator it; | 2303 | KABC::AddressBook::Iterator it; |
2303 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2304 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2304 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2305 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2306 | ++cc; | ||
2307 | if ( cc %10 == 0) | ||
2308 | message(i18n("Processing contact #%1").arg(cc)); | ||
2305 | QStringList catIncList = (*it).categories(); | 2309 | QStringList catIncList = (*it).categories(); |
2306 | int i; | 2310 | int i; |
2307 | for( i = 0; i< catIncList.count(); ++i ) { | 2311 | for( i = 0; i< catIncList.count(); ++i ) { |
2308 | if ( !catList.contains (catIncList[i])) { | 2312 | if ( !catList.contains (catIncList[i])) { |
2309 | catList.append( catIncList[i] ); | 2313 | catList.append( catIncList[i] ); |
2310 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2314 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2311 | ++count; | 2315 | ++count; |
2312 | } | 2316 | } |
2313 | } | 2317 | } |
2314 | } | 2318 | } |
2315 | catList.sort(); | 2319 | catList.sort(); |
2316 | KABPrefs::instance()->mCustomCategories = catList; | 2320 | KABPrefs::instance()->mCustomCategories = catList; |
2317 | KABPrefs::instance()->writeConfig(); | 2321 | KABPrefs::instance()->writeConfig(); |
2318 | message(QString::number( count )+ i18n(" categories added to list! ")); | 2322 | message(QString::number( count )+ i18n(" categories added to list! ")); |
2319 | } else { | 2323 | } else { |
2320 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2324 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2321 | QStringList catIncList; | 2325 | QStringList catIncList; |
2322 | QStringList newCatList; | 2326 | QStringList newCatList; |
2323 | KABC::AddressBook::Iterator it; | 2327 | KABC::AddressBook::Iterator it; |
2324 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2328 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2329 | ++cc; | ||
2330 | if ( cc %10 == 0) | ||
2331 | message(i18n("Processing contact #%1").arg(cc)); | ||
2325 | QStringList catIncList = (*it).categories(); | 2332 | QStringList catIncList = (*it).categories(); |
2326 | int i; | 2333 | int i; |
2327 | if ( catIncList.count() ) { | 2334 | if ( catIncList.count() ) { |
2328 | newCatList.clear(); | 2335 | newCatList.clear(); |
2329 | for( i = 0; i< catIncList.count(); ++i ) { | 2336 | for( i = 0; i< catIncList.count(); ++i ) { |
2330 | if ( catList.contains (catIncList[i])) { | 2337 | if ( catList.contains (catIncList[i])) { |
2331 | newCatList.append( catIncList[i] ); | 2338 | newCatList.append( catIncList[i] ); |
2332 | } | 2339 | } |
2333 | } | 2340 | } |
2334 | newCatList.sort(); | 2341 | newCatList.sort(); |
2335 | (*it).setCategories( newCatList ); | 2342 | (*it).setCategories( newCatList ); |
2336 | mAddressBook->insertAddressee( (*it) ); | 2343 | mAddressBook->insertAddressee( (*it) ); |
2337 | } | 2344 | } |
2338 | } | 2345 | } |
2339 | setModified( true ); | 2346 | setModified( true ); |
2340 | mViewManager->refreshView(); | 2347 | mViewManager->refreshView(); |
2341 | message( i18n("Removing categories done!")); | 2348 | message( i18n("Removing categories done!")); |
2342 | } | 2349 | } |
2343 | delete cp; | 2350 | delete cp; |
2344 | } | 2351 | } |
2345 | void KABCore::removeVoice() | 2352 | void KABCore::removeVoice() |
2346 | { | 2353 | { |
2347 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) | 2354 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) |
2348 | return; | 2355 | return; |
2349 | KABC::Addressee::List list; | 2356 | KABC::Addressee::List list; |
2350 | XXPortSelectDialog dlg( this, false, this ); | 2357 | XXPortSelectDialog dlg( this, false, this ); |
2351 | if ( dlg.exec() ) | 2358 | if ( dlg.exec() ) |
2352 | list = dlg.contacts(); | 2359 | list = dlg.contacts(); |
2353 | else | 2360 | else |
2354 | return; | 2361 | return; |
2355 | KABC::Addressee::List::Iterator it; | 2362 | KABC::Addressee::List::Iterator it; |
2356 | for ( it = list.begin(); it != list.end(); ++it ) { | 2363 | for ( it = list.begin(); it != list.end(); ++it ) { |
2357 | if ( (*it).removeVoice() ) | 2364 | if ( (*it).removeVoice() ) |
2358 | addrModified((*it), false ); | 2365 | addrModified((*it), false ); |
2359 | } | 2366 | } |
2360 | } | 2367 | } |
2361 | 2368 | ||
2362 | void KABCore::setFormattedName() | 2369 | void KABCore::setFormattedName() |
2363 | { | 2370 | { |
2364 | KABFormatPrefs setpref; | 2371 | KABFormatPrefs setpref; |
2365 | if ( !setpref.exec() ) { | 2372 | if ( !setpref.exec() ) { |
2366 | return; | 2373 | return; |
2367 | } | 2374 | } |
2368 | XXPortSelectDialog dlg( this, false, this ); | 2375 | XXPortSelectDialog dlg( this, false, this ); |
2369 | if ( !dlg.exec() ) | 2376 | if ( !dlg.exec() ) |
2370 | return; | 2377 | return; |
2371 | mAddressBook->setUntagged(); | 2378 | mAddressBook->setUntagged(); |
2372 | dlg.tagSelected(); | 2379 | dlg.tagSelected(); |
2373 | int count = 0; | 2380 | int count = 0; |
2374 | KABC::AddressBook::Iterator it; | 2381 | KABC::AddressBook::Iterator it; |
2375 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2382 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2376 | if ( (*it).tagged() ) { | 2383 | if ( (*it).tagged() ) { |
2377 | message(i18n("Changing contact #%1").arg( ++count ) ); | 2384 | ++count; |
2385 | if ( count %10 == 0 ) | ||
2386 | message(i18n("Changing contact #%1").arg( count ) ); | ||
2378 | qApp->processEvents(); | 2387 | qApp->processEvents(); |
2379 | QString fName; | 2388 | QString fName; |
2380 | if ( setpref.simple->isChecked() ) | 2389 | if ( setpref.simple->isChecked() ) |
2381 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); | 2390 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); |
2382 | else if ( setpref.full->isChecked() ) | 2391 | else if ( setpref.full->isChecked() ) |
2383 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); | 2392 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); |
2384 | else if ( setpref.reverse->isChecked() ) | 2393 | else if ( setpref.reverse->isChecked() ) |
2385 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); | 2394 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); |
2386 | else | 2395 | else |
2387 | fName = (*it).organization(); | 2396 | fName = (*it).organization(); |
2388 | if ( setpref.setCompany->isChecked() ) | 2397 | if ( setpref.setCompany->isChecked() ) |
2389 | if ( fName.isEmpty() || fName =="," ) | 2398 | if ( fName.isEmpty() || fName =="," ) |
2390 | fName = (*it).organization(); | 2399 | fName = (*it).organization(); |
2391 | (*it).setFormattedName( fName ); | 2400 | (*it).setFormattedName( fName ); |
2392 | } | 2401 | } |
2393 | } | 2402 | } |
2394 | message(i18n("Refreshing view...") ); | 2403 | message(i18n("Refreshing view...") ); |
2404 | qApp->processEvents(); | ||
2395 | mViewManager->refreshView( "" ); | 2405 | mViewManager->refreshView( "" ); |
2396 | Addressee add; | 2406 | Addressee add; |
2397 | mDetails->setAddressee( add ); | 2407 | mDetails->setAddressee( add ); |
2398 | message(i18n("Setting formatted name completed!") ); | 2408 | message(i18n("Setting formatted name completed!") ); |
2399 | } | 2409 | } |
2400 | 2410 | ||
2401 | void KABCore::clipboardDataChanged() | 2411 | void KABCore::clipboardDataChanged() |
2402 | { | 2412 | { |
2403 | 2413 | ||
2404 | if ( mReadWrite ) | 2414 | if ( mReadWrite ) |
2405 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2415 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2406 | 2416 | ||
2407 | } | 2417 | } |
2408 | 2418 | ||
2409 | void KABCore::updateActionMenu() | 2419 | void KABCore::updateActionMenu() |
2410 | { | 2420 | { |
2411 | UndoStack *undo = UndoStack::instance(); | 2421 | UndoStack *undo = UndoStack::instance(); |
2412 | RedoStack *redo = RedoStack::instance(); | 2422 | RedoStack *redo = RedoStack::instance(); |
2413 | 2423 | ||
2414 | if ( undo->isEmpty() ) | 2424 | if ( undo->isEmpty() ) |
2415 | mActionUndo->setText( i18n( "Undo" ) ); | 2425 | mActionUndo->setText( i18n( "Undo" ) ); |
2416 | else | 2426 | else |
2417 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2427 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2418 | 2428 | ||
2419 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2429 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2420 | 2430 | ||
2421 | if ( !redo->top() ) | 2431 | if ( !redo->top() ) |
2422 | mActionRedo->setText( i18n( "Redo" ) ); | 2432 | mActionRedo->setText( i18n( "Redo" ) ); |
2423 | else | 2433 | else |
2424 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2434 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2425 | 2435 | ||
2426 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2436 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2427 | } | 2437 | } |
2428 | 2438 | ||
2429 | void KABCore::configureKeyBindings() | 2439 | void KABCore::configureKeyBindings() |
2430 | { | 2440 | { |
2431 | #ifndef KAB_EMBEDDED | 2441 | #ifndef KAB_EMBEDDED |
2432 | KKeyDialog::configure( actionCollection(), true ); | 2442 | KKeyDialog::configure( actionCollection(), true ); |
2433 | #else //KAB_EMBEDDED | 2443 | #else //KAB_EMBEDDED |
2434 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2444 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2435 | #endif //KAB_EMBEDDED | 2445 | #endif //KAB_EMBEDDED |
2436 | } | 2446 | } |
2437 | 2447 | ||
2438 | #ifdef KAB_EMBEDDED | 2448 | #ifdef KAB_EMBEDDED |
2439 | void KABCore::configureResources() | 2449 | void KABCore::configureResources() |
2440 | { | 2450 | { |
2441 | KRES::KCMKResources dlg( this, "" , 0 ); | 2451 | KRES::KCMKResources dlg( this, "" , 0 ); |
2442 | 2452 | ||
2443 | if ( !dlg.exec() ) | 2453 | if ( !dlg.exec() ) |
2444 | return; | 2454 | return; |
2445 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2455 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2446 | } | 2456 | } |
2447 | #endif //KAB_EMBEDDED | 2457 | #endif //KAB_EMBEDDED |
2448 | 2458 | ||
2449 | 2459 | ||
2450 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2460 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2451 | * for the attendees list of an event. | 2461 | * for the attendees list of an event. |
2452 | */ | 2462 | */ |
2453 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2463 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2454 | { | 2464 | { |
2455 | QStringList nameList; | 2465 | QStringList nameList; |
2456 | QStringList emailList; | 2466 | QStringList emailList; |
2457 | QStringList uidList; | 2467 | QStringList uidList; |
2458 | 2468 | ||
@@ -3128,154 +3138,165 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | |||
3128 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3138 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3129 | isXML = true; | 3139 | isXML = true; |
3130 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 3140 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
3131 | } else { | 3141 | } else { |
3132 | external = !manager->mIsKapiFile; | 3142 | external = !manager->mIsKapiFile; |
3133 | if ( external ) { | 3143 | if ( external ) { |
3134 | qDebug("Setting vcf mode to external "); | 3144 | qDebug("Setting vcf mode to external "); |
3135 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3145 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3136 | AddressBook::Iterator it; | 3146 | AddressBook::Iterator it; |
3137 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 3147 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
3138 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); | 3148 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); |
3139 | (*it).computeCsum( mCurrentSyncDevice ); | 3149 | (*it).computeCsum( mCurrentSyncDevice ); |
3140 | } | 3150 | } |
3141 | } | 3151 | } |
3142 | } | 3152 | } |
3143 | //AddressBook::Iterator it; | 3153 | //AddressBook::Iterator it; |
3144 | //QStringList vcards; | 3154 | //QStringList vcards; |
3145 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 3155 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
3146 | // qDebug("Name %s ", (*it).familyName().latin1()); | 3156 | // qDebug("Name %s ", (*it).familyName().latin1()); |
3147 | //} | 3157 | //} |
3148 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); | 3158 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); |
3149 | if ( syncOK ) { | 3159 | if ( syncOK ) { |
3150 | if ( syncManager->mWriteBackFile ) | 3160 | if ( syncManager->mWriteBackFile ) |
3151 | { | 3161 | { |
3152 | if ( external ) | 3162 | if ( external ) |
3153 | abLocal.removeSyncAddressees( !isXML); | 3163 | abLocal.removeSyncAddressees( !isXML); |
3154 | qDebug("Saving remote AB "); | 3164 | qDebug("Saving remote AB "); |
3155 | if ( ! abLocal.saveAB()) | 3165 | if ( ! abLocal.saveAB()) |
3156 | qDebug("Error writing back AB to file "); | 3166 | qDebug("Error writing back AB to file "); |
3157 | if ( external ) { | 3167 | if ( external ) { |
3158 | // afterwrite processing | 3168 | // afterwrite processing |
3159 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); | 3169 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); |
3160 | } | 3170 | } |
3161 | } | 3171 | } |
3162 | } | 3172 | } |
3163 | setModified(); | 3173 | setModified(); |
3164 | 3174 | ||
3165 | } | 3175 | } |
3166 | abLocal.removeResources(); | 3176 | abLocal.removeResources(); |
3167 | if ( syncOK ) | 3177 | if ( syncOK ) |
3168 | mViewManager->refreshView(); | 3178 | mViewManager->refreshView(); |
3169 | return syncOK; | 3179 | return syncOK; |
3170 | 3180 | ||
3171 | } | 3181 | } |
3172 | void KABCore::removeSyncInfo( QString syncProfile) | 3182 | void KABCore::removeSyncInfo( QString syncProfile) |
3173 | { | 3183 | { |
3174 | qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); | 3184 | qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); |
3175 | mAddressBook->removeSyncInfo( syncProfile ); | 3185 | mAddressBook->removeSyncInfo( syncProfile ); |
3176 | setModified(); | 3186 | setModified(); |
3177 | } | 3187 | } |
3178 | 3188 | ||
3179 | 3189 | ||
3180 | //this is a overwritten callbackmethods from the syncinterface | 3190 | //this is a overwritten callbackmethods from the syncinterface |
3181 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) | 3191 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) |
3182 | { | 3192 | { |
3183 | if ( resource == "phone" ) | 3193 | if ( resource == "phone" ) |
3184 | return syncPhone(); | 3194 | return syncPhone(); |
3185 | disableBR( true ); | 3195 | disableBR( true ); |
3186 | if ( manager != syncManager ) | 3196 | if ( manager != syncManager ) |
3187 | qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager "); | 3197 | qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager "); |
3188 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 3198 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
3189 | 3199 | ||
3190 | AddressBook abLocal( resource,"syncContact"); | 3200 | AddressBook abLocal( resource,"syncContact"); |
3191 | bool syncOK = false; | 3201 | bool syncOK = false; |
3202 | message(i18n("Loading DTM address data..."), false); | ||
3192 | if ( abLocal.load() ) { | 3203 | if ( abLocal.load() ) { |
3193 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 3204 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
3194 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3205 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3206 | message(i18n("Sync preprocessing..."),false); | ||
3195 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); | 3207 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); |
3208 | message(i18n("Synchronizing..."),false); | ||
3196 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 3209 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
3197 | if ( syncOK ) { | 3210 | if ( syncOK ) { |
3198 | if ( syncManager->mWriteBackFile ) { | 3211 | if ( syncManager->mWriteBackFile ) { |
3199 | abLocal.removeSyncAddressees( false ); | 3212 | abLocal.removeSyncAddressees( false ); |
3213 | message(i18n("Saving DTM address data..."),false); | ||
3200 | abLocal.saveAB(); | 3214 | abLocal.saveAB(); |
3215 | message(i18n("Sync postprocessing..."),false); | ||
3201 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); | 3216 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); |
3202 | } | 3217 | } |
3203 | } else | 3218 | } else |
3204 | message( i18n("Sync cancelled or failed.") ); | 3219 | message( i18n("Sync cancelled or failed.") ); |
3205 | setModified(); | 3220 | setModified(); |
3206 | } | 3221 | } |
3207 | abLocal.removeResources(); | 3222 | abLocal.removeResources(); |
3208 | if ( syncOK ) | 3223 | if ( syncOK ) { |
3209 | mViewManager->refreshView(); | 3224 | mViewManager->refreshView(); |
3225 | message(i18n("DTM syncing finished.")); | ||
3226 | } | ||
3210 | disableBR( false ); | 3227 | disableBR( false ); |
3211 | return syncOK; | 3228 | return syncOK; |
3212 | 3229 | ||
3213 | } | 3230 | } |
3214 | void KABCore::message( QString m ) | 3231 | void KABCore::message( QString m, bool startTimer) |
3215 | { | 3232 | { |
3216 | topLevelWidget()->setCaption( m ); | 3233 | topLevelWidget()->setCaption( m ); |
3217 | mMessageTimer->start( 20000, true ); | 3234 | qApp->processEvents(); |
3235 | if ( startTimer ) | ||
3236 | mMessageTimer->start( 15000, true ); | ||
3237 | else | ||
3238 | mMessageTimer->stop(); | ||
3218 | } | 3239 | } |
3219 | bool KABCore::syncPhone() | 3240 | bool KABCore::syncPhone() |
3220 | { | 3241 | { |
3221 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 3242 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
3222 | QString fileName = getPhoneFile(); | 3243 | QString fileName = getPhoneFile(); |
3223 | if ( !PhoneAccess::readFromPhone( fileName) ) { | 3244 | if ( !PhoneAccess::readFromPhone( fileName) ) { |
3224 | message(i18n("Phone access failed!")); | 3245 | message(i18n("Phone access failed!")); |
3225 | return false; | 3246 | return false; |
3226 | } | 3247 | } |
3227 | AddressBook abLocal( fileName,"syncContact"); | 3248 | AddressBook abLocal( fileName,"syncContact"); |
3228 | bool syncOK = false; | 3249 | bool syncOK = false; |
3229 | { | 3250 | { |
3230 | abLocal.importFromFile( fileName ); | 3251 | abLocal.importFromFile( fileName ); |
3231 | qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 3252 | qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
3232 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3253 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3233 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); | 3254 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); |
3234 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 3255 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
3235 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 3256 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
3236 | if ( syncOK ) { | 3257 | if ( syncOK ) { |
3237 | if ( syncManager->mWriteBackFile ) { | 3258 | if ( syncManager->mWriteBackFile ) { |
3238 | abLocal.removeSyncAddressees( true ); | 3259 | abLocal.removeSyncAddressees( true ); |
3239 | abLocal.saveABphone( fileName ); | 3260 | abLocal.saveABphone( fileName ); |
3240 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); | 3261 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); |
3241 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); | 3262 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); |
3242 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); | 3263 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); |
3243 | } | 3264 | } |
3244 | } | 3265 | } |
3245 | setModified(); | 3266 | setModified(); |
3246 | } | 3267 | } |
3247 | abLocal.removeResources(); | 3268 | abLocal.removeResources(); |
3248 | if ( syncOK ) | 3269 | if ( syncOK ) |
3249 | mViewManager->refreshView(); | 3270 | mViewManager->refreshView(); |
3250 | return syncOK; | 3271 | return syncOK; |
3251 | } | 3272 | } |
3252 | void KABCore::getFile( bool success ) | 3273 | void KABCore::getFile( bool success ) |
3253 | { | 3274 | { |
3254 | if ( ! success ) { | 3275 | if ( ! success ) { |
3255 | message( i18n("Error receiving file. Nothing changed!") ); | 3276 | message( i18n("Error receiving file. Nothing changed!") ); |
3256 | return; | 3277 | return; |
3257 | } | 3278 | } |
3258 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); | 3279 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); |
3259 | if ( count ) | 3280 | if ( count ) |
3260 | setModified( true ); | 3281 | setModified( true ); |
3261 | message( i18n("Pi-Sync successful!") ); | 3282 | message( i18n("Pi-Sync successful!") ); |
3262 | mViewManager->refreshView(); | 3283 | mViewManager->refreshView(); |
3263 | } | 3284 | } |
3264 | void KABCore::syncFileRequest() | 3285 | void KABCore::syncFileRequest() |
3265 | { | 3286 | { |
3266 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { | 3287 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { |
3267 | syncManager->slotSyncMenu( 999 ); | 3288 | syncManager->slotSyncMenu( 999 ); |
3268 | } | 3289 | } |
3269 | mAddressBook->export2File( sentSyncFile() ); | 3290 | mAddressBook->export2File( sentSyncFile() ); |
3270 | } | 3291 | } |
3271 | QString KABCore::sentSyncFile() | 3292 | QString KABCore::sentSyncFile() |
3272 | { | 3293 | { |
3273 | #ifdef DESKTOP_VERSION | 3294 | #ifdef DESKTOP_VERSION |
3274 | return locateLocal( "tmp", "copysyncab.vcf" ); | 3295 | return locateLocal( "tmp", "copysyncab.vcf" ); |
3275 | #else | 3296 | #else |
3276 | return QString( "/tmp/copysyncab.vcf" ); | 3297 | return QString( "/tmp/copysyncab.vcf" ); |
3277 | #endif | 3298 | #endif |
3278 | } | 3299 | } |
3279 | 3300 | ||
3280 | void KABCore::setCaptionBack() | 3301 | void KABCore::setCaptionBack() |
3281 | { | 3302 | { |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index ecfe6e9..786549a 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -439,81 +439,81 @@ class KABCore : public QWidget, public KSyncInterface | |||
439 | 439 | ||
440 | KAction *mActionQuit; | 440 | KAction *mActionQuit; |
441 | 441 | ||
442 | //US edit menu | 442 | //US edit menu |
443 | KAction *mActionCopy; | 443 | KAction *mActionCopy; |
444 | KAction *mActionCut; | 444 | KAction *mActionCut; |
445 | KAction *mActionPaste; | 445 | KAction *mActionPaste; |
446 | KAction *mActionSelectAll; | 446 | KAction *mActionSelectAll; |
447 | KAction *mActionUndo; | 447 | KAction *mActionUndo; |
448 | KAction *mActionRedo; | 448 | KAction *mActionRedo; |
449 | KAction *mActionDelete; | 449 | KAction *mActionDelete; |
450 | 450 | ||
451 | //US settings menu | 451 | //US settings menu |
452 | KAction *mActionConfigResources; | 452 | KAction *mActionConfigResources; |
453 | KAction *mActionConfigKAddressbook; | 453 | KAction *mActionConfigKAddressbook; |
454 | KAction *mActionConfigShortcuts; | 454 | KAction *mActionConfigShortcuts; |
455 | KAction *mActionConfigureToolbars; | 455 | KAction *mActionConfigureToolbars; |
456 | KAction *mActionKeyBindings; | 456 | KAction *mActionKeyBindings; |
457 | KToggleAction *mActionJumpBar; | 457 | KToggleAction *mActionJumpBar; |
458 | KToggleAction *mActionDetails; | 458 | KToggleAction *mActionDetails; |
459 | KAction *mActionWhoAmI; | 459 | KAction *mActionWhoAmI; |
460 | KAction *mActionCategories; | 460 | KAction *mActionCategories; |
461 | KAction *mActionEditCategories; | 461 | KAction *mActionEditCategories; |
462 | KAction *mActionManageCategories; | 462 | KAction *mActionManageCategories; |
463 | KAction *mActionAboutKAddressbook; | 463 | KAction *mActionAboutKAddressbook; |
464 | KAction *mActionLicence; | 464 | KAction *mActionLicence; |
465 | KAction *mActionFaq; | 465 | KAction *mActionFaq; |
466 | KAction *mActionWN; | 466 | KAction *mActionWN; |
467 | KAction *mActionSyncHowto; | 467 | KAction *mActionSyncHowto; |
468 | KAction *mActionKdeSyncHowto; | 468 | KAction *mActionKdeSyncHowto; |
469 | KAction *mActionMultiSyncHowto; | 469 | KAction *mActionMultiSyncHowto; |
470 | 470 | ||
471 | KAction *mActionDeleteView; | 471 | KAction *mActionDeleteView; |
472 | 472 | ||
473 | QPopupMenu *viewMenu; | 473 | QPopupMenu *viewMenu; |
474 | QPopupMenu *filterMenu; | 474 | QPopupMenu *filterMenu; |
475 | QPopupMenu *settingsMenu; | 475 | QPopupMenu *settingsMenu; |
476 | QPopupMenu *changeMenu; | 476 | QPopupMenu *changeMenu; |
477 | QPopupMenu *beamMenu; | 477 | QPopupMenu *beamMenu; |
478 | //US QAction *mActionSave; | 478 | //US QAction *mActionSave; |
479 | QPopupMenu *ImportMenu; | 479 | QPopupMenu *ImportMenu; |
480 | QPopupMenu *ExportMenu; | 480 | QPopupMenu *ExportMenu; |
481 | //LR additional methods | 481 | //LR additional methods |
482 | KAction *mActionRemoveVoice; | 482 | KAction *mActionRemoveVoice; |
483 | KAction *mActionSetFormattedName; | 483 | KAction *mActionSetFormattedName; |
484 | KAction * mActionImportOL; | 484 | KAction * mActionImportOL; |
485 | 485 | ||
486 | #ifndef KAB_EMBEDDED | 486 | #ifndef KAB_EMBEDDED |
487 | KAddressBookService *mAddressBookService; | 487 | KAddressBookService *mAddressBookService; |
488 | #endif //KAB_EMBEDDED | 488 | #endif //KAB_EMBEDDED |
489 | 489 | ||
490 | class KABCorePrivate; | 490 | class KABCorePrivate; |
491 | KABCorePrivate *d; | 491 | KABCorePrivate *d; |
492 | //US bool mBlockSaveFlag; | 492 | //US bool mBlockSaveFlag; |
493 | 493 | ||
494 | #ifdef KAB_EMBEDDED | 494 | #ifdef KAB_EMBEDDED |
495 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 495 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
496 | #endif //KAB_EMBEDDED | 496 | #endif //KAB_EMBEDDED |
497 | 497 | ||
498 | //this are the overwritten callbackmethods from the syncinterface | 498 | //this are the overwritten callbackmethods from the syncinterface |
499 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 499 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
500 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 500 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
501 | virtual void removeSyncInfo( QString syncProfile); | 501 | virtual void removeSyncInfo( QString syncProfile); |
502 | bool syncPhone(); | 502 | bool syncPhone(); |
503 | void message( QString m ); | 503 | void message( QString m , bool startTimer = true); |
504 | 504 | ||
505 | // LR ******************************* | 505 | // LR ******************************* |
506 | // sync stuff! | 506 | // sync stuff! |
507 | QString sentSyncFile(); | 507 | QString sentSyncFile(); |
508 | QPopupMenu *syncMenu; | 508 | QPopupMenu *syncMenu; |
509 | KSyncManager* syncManager; | 509 | KSyncManager* syncManager; |
510 | int mGlobalSyncMode; | 510 | int mGlobalSyncMode; |
511 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); | 511 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); |
512 | KABC::Addressee getLastSyncAddressee(); | 512 | KABC::Addressee getLastSyncAddressee(); |
513 | QDateTime mLastAddressbookSync; | 513 | QDateTime mLastAddressbookSync; |
514 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); | 514 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); |
515 | // ********************* | 515 | // ********************* |
516 | 516 | ||
517 | }; | 517 | }; |
518 | 518 | ||
519 | #endif | 519 | #endif |
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 6c1f444..f488a07 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -933,138 +933,139 @@ void KSyncManager::syncKDE() | |||
933 | QString command = "kdecaldump"; | 933 | QString command = "kdecaldump"; |
934 | #endif | 934 | #endif |
935 | if ( ! QFile::exists ( command ) ) | 935 | if ( ! QFile::exists ( command ) ) |
936 | command = "kdecaldump"; | 936 | command = "kdecaldump"; |
937 | QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; | 937 | QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; |
938 | system ( command.latin1()); | 938 | system ( command.latin1()); |
939 | if ( syncWithFile( fileName,true ) ) { | 939 | if ( syncWithFile( fileName,true ) ) { |
940 | if ( mWriteBackFile ) { | 940 | if ( mWriteBackFile ) { |
941 | command += " --read"; | 941 | command += " --read"; |
942 | system ( command.latin1()); | 942 | system ( command.latin1()); |
943 | } | 943 | } |
944 | } | 944 | } |
945 | 945 | ||
946 | } | 946 | } |
947 | break; | 947 | break; |
948 | case (PWMPI): | 948 | case (PWMPI): |
949 | 949 | ||
950 | break; | 950 | break; |
951 | default: | 951 | default: |
952 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); | 952 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); |
953 | break; | 953 | break; |
954 | 954 | ||
955 | } | 955 | } |
956 | } | 956 | } |
957 | 957 | ||
958 | void KSyncManager::syncSharp() | 958 | void KSyncManager::syncSharp() |
959 | { | 959 | { |
960 | 960 | ||
961 | if ( ! syncExternalApplication("sharp") ) | 961 | if ( ! syncExternalApplication("sharp") ) |
962 | qDebug("ERROR sync sharp "); | 962 | qDebug("ERROR sync sharp "); |
963 | } | 963 | } |
964 | 964 | ||
965 | bool KSyncManager::syncExternalApplication(QString resource) | 965 | bool KSyncManager::syncExternalApplication(QString resource) |
966 | { | 966 | { |
967 | 967 | ||
968 | emit save(); | 968 | emit save(); |
969 | 969 | ||
970 | if ( mAskForPreferences ) | 970 | if ( mAskForPreferences ) |
971 | if ( !edit_sync_options()) { | 971 | if ( !edit_sync_options()) { |
972 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 972 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); |
973 | return false; | 973 | return false; |
974 | } | 974 | } |
975 | 975 | ||
976 | qDebug("Sync extern %s", resource.latin1()); | 976 | qDebug("Sync extern %s", resource.latin1()); |
977 | 977 | ||
978 | bool syncOK = mImplementation->syncExternal(this, resource); | 978 | bool syncOK = mImplementation->syncExternal(this, resource); |
979 | 979 | ||
980 | return syncOK; | 980 | return syncOK; |
981 | 981 | ||
982 | } | 982 | } |
983 | 983 | ||
984 | void KSyncManager::syncPhone() | 984 | void KSyncManager::syncPhone() |
985 | { | 985 | { |
986 | 986 | ||
987 | syncExternalApplication("phone"); | 987 | syncExternalApplication("phone"); |
988 | 988 | ||
989 | } | 989 | } |
990 | 990 | ||
991 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) | 991 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) |
992 | { | 992 | { |
993 | if (!bar->isVisible()) | 993 | if (!bar->isVisible()) |
994 | { | 994 | { |
995 | bar->setCaption (caption); | 995 | bar->setCaption (caption); |
996 | bar->setTotalSteps ( total ) ; | 996 | bar->setTotalSteps ( total ) ; |
997 | |||
998 | bar->show(); | 997 | bar->show(); |
999 | } | 998 | } |
1000 | 999 | bar->raise(); | |
1001 | bar->setProgress( percentage ); | 1000 | bar->setProgress( percentage ); |
1001 | qApp->processEvents(); | ||
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | void KSyncManager::hideProgressBar() | 1004 | void KSyncManager::hideProgressBar() |
1005 | { | 1005 | { |
1006 | bar->hide(); | 1006 | bar->hide(); |
1007 | qApp->processEvents(); | ||
1007 | } | 1008 | } |
1008 | 1009 | ||
1009 | bool KSyncManager::isProgressBarCanceled() | 1010 | bool KSyncManager::isProgressBarCanceled() |
1010 | { | 1011 | { |
1011 | return !bar->isVisible(); | 1012 | return !bar->isVisible(); |
1012 | } | 1013 | } |
1013 | 1014 | ||
1014 | QString KSyncManager::syncFileName() | 1015 | QString KSyncManager::syncFileName() |
1015 | { | 1016 | { |
1016 | 1017 | ||
1017 | QString fn = "tempfile"; | 1018 | QString fn = "tempfile"; |
1018 | switch(mTargetApp) | 1019 | switch(mTargetApp) |
1019 | { | 1020 | { |
1020 | case (KAPI): | 1021 | case (KAPI): |
1021 | fn = "tempsyncab.vcf"; | 1022 | fn = "tempsyncab.vcf"; |
1022 | break; | 1023 | break; |
1023 | case (KOPI): | 1024 | case (KOPI): |
1024 | fn = "tempsynccal.ics"; | 1025 | fn = "tempsynccal.ics"; |
1025 | break; | 1026 | break; |
1026 | case (PWMPI): | 1027 | case (PWMPI): |
1027 | fn = "tempsyncpw.pwm"; | 1028 | fn = "tempsyncpw.pwm"; |
1028 | break; | 1029 | break; |
1029 | default: | 1030 | default: |
1030 | break; | 1031 | break; |
1031 | } | 1032 | } |
1032 | #ifdef _WIN32_ | 1033 | #ifdef _WIN32_ |
1033 | return locateLocal( "tmp", fn ); | 1034 | return locateLocal( "tmp", fn ); |
1034 | #else | 1035 | #else |
1035 | return (QString( "/tmp/" )+ fn ); | 1036 | return (QString( "/tmp/" )+ fn ); |
1036 | #endif | 1037 | #endif |
1037 | } | 1038 | } |
1038 | 1039 | ||
1039 | void KSyncManager::syncPi() | 1040 | void KSyncManager::syncPi() |
1040 | { | 1041 | { |
1041 | mIsKapiFile = true; | 1042 | mIsKapiFile = true; |
1042 | mPisyncFinished = false; | 1043 | mPisyncFinished = false; |
1043 | qApp->processEvents(); | 1044 | qApp->processEvents(); |
1044 | if ( mAskForPreferences ) | 1045 | if ( mAskForPreferences ) |
1045 | if ( !edit_pisync_options()) { | 1046 | if ( !edit_pisync_options()) { |
1046 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 1047 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); |
1047 | return; | 1048 | return; |
1048 | } | 1049 | } |
1049 | bool ok; | 1050 | bool ok; |
1050 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); | 1051 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); |
1051 | if ( ! ok ) { | 1052 | if ( ! ok ) { |
1052 | mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); | 1053 | mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); |
1053 | return; | 1054 | return; |
1054 | } | 1055 | } |
1055 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this ); | 1056 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this ); |
1056 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | 1057 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); |
1057 | mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") ); | 1058 | mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") ); |
1058 | commandSocket->readFile( syncFileName() ); | 1059 | commandSocket->readFile( syncFileName() ); |
1059 | } | 1060 | } |
1060 | 1061 | ||
1061 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) | 1062 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) |
1062 | { | 1063 | { |
1063 | //enum { success, errorW, errorR, quiet }; | 1064 | //enum { success, errorW, errorR, quiet }; |
1064 | if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) { | 1065 | if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) { |
1065 | mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); | 1066 | mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); |
1066 | delete s; | 1067 | delete s; |
1067 | if ( state == KCommandSocket::errorR ) { | 1068 | if ( state == KCommandSocket::errorR ) { |
1068 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); | 1069 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); |
1069 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 1070 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
1070 | commandSocket->sendStop(); | 1071 | commandSocket->sendStop(); |
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 2101bbb..3db58ec 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp | |||
@@ -124,129 +124,129 @@ void KSyncPrefsDialog::setupSyncAlgTab() | |||
124 | topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); | 124 | topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); |
125 | ++iii; | 125 | ++iii; |
126 | button = new QPushButton( i18n("New profile"), buttonbox ); | 126 | button = new QPushButton( i18n("New profile"), buttonbox ); |
127 | connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); | 127 | connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); |
128 | 128 | ||
129 | button = new QPushButton( i18n("Clone profile"), buttonbox ); | 129 | button = new QPushButton( i18n("Clone profile"), buttonbox ); |
130 | connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); | 130 | connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); |
131 | 131 | ||
132 | button = new QPushButton( i18n("Delete profile"), buttonbox ); | 132 | button = new QPushButton( i18n("Delete profile"), buttonbox ); |
133 | connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); | 133 | connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); |
134 | 134 | ||
135 | mProfileBox = new QComboBox(topFrame); | 135 | mProfileBox = new QComboBox(topFrame); |
136 | mProfileBox->setEditable ( true ); | 136 | mProfileBox->setEditable ( true ); |
137 | mProfileBox->setInsertionPolicy(QComboBox::NoInsertion); | 137 | mProfileBox->setInsertionPolicy(QComboBox::NoInsertion); |
138 | connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); | 138 | connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); |
139 | connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); | 139 | connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); |
140 | 140 | ||
141 | lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); | 141 | lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); |
142 | topLayout->addWidget(lab ,iii,0); | 142 | topLayout->addWidget(lab ,iii,0); |
143 | topLayout->addWidget(mProfileBox, iii,1); | 143 | topLayout->addWidget(mProfileBox, iii,1); |
144 | ++iii; | 144 | ++iii; |
145 | 145 | ||
146 | 146 | ||
147 | 147 | ||
148 | QHGroupBox *iims = new QHGroupBox( i18n("Multiple Sync options"), topFrame); | 148 | QHGroupBox *iims = new QHGroupBox( i18n("Multiple Sync options"), topFrame); |
149 | new QLabel( i18n("Include in multiple "), iims ); | 149 | new QLabel( i18n("Include in multiple "), iims ); |
150 | mIncludeInRing = new QCheckBox( i18n("calendar "), iims ); | 150 | mIncludeInRing = new QCheckBox( i18n("calendar "), iims ); |
151 | mIncludeInRingAB = new QCheckBox( i18n("addressbook "), iims ); | 151 | mIncludeInRingAB = new QCheckBox( i18n("addressbook "), iims ); |
152 | mIncludeInRingPWM = new QCheckBox( i18n("pwmanager"), iims ); | 152 | mIncludeInRingPWM = new QCheckBox( i18n("pwmanager"), iims ); |
153 | new QLabel( i18n(" sync"), iims ); | 153 | new QLabel( i18n(" sync"), iims ); |
154 | topLayout->addMultiCellWidget(iims, iii,iii,0,1); | 154 | topLayout->addMultiCellWidget(iims, iii,iii,0,1); |
155 | ++iii; | 155 | ++iii; |
156 | QVGroupBox* gb0 = new QVGroupBox( i18n("Sync algo options"), topFrame); | 156 | QVGroupBox* gb0 = new QVGroupBox( i18n("Sync algo options"), topFrame); |
157 | topLayout->addMultiCellWidget(gb0, iii,iii,0,1); | 157 | topLayout->addMultiCellWidget(gb0, iii,iii,0,1); |
158 | ++iii; | 158 | ++iii; |
159 | QButtonGroup* gr; | 159 | QButtonGroup* gr; |
160 | { | 160 | { |
161 | QVGroupBox* topFrame = gb0; | 161 | QVGroupBox* topFrame = gb0; |
162 | 162 | ||
163 | 163 | ||
164 | 164 | ||
165 | mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); | 165 | mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); |
166 | //topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); | 166 | //topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); |
167 | //++iii; | 167 | //++iii; |
168 | gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); | 168 | gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); |
169 | //topLayout->addMultiCellWidget(gr, iii,iii,0,1); | 169 | //topLayout->addMultiCellWidget(gr, iii,iii,0,1); |
170 | //++iii; | 170 | //++iii; |
171 | loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); | 171 | loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); |
172 | rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); | 172 | rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); |
173 | newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); | 173 | newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); |
174 | ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); | 174 | ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); |
175 | f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); | 175 | f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); |
176 | f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); | 176 | f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); |
177 | // both = new QRadioButton ( i18n("Take both on conflict"), gr ); | 177 | // both = new QRadioButton ( i18n("Take both on conflict"), gr ); |
178 | 178 | ||
179 | mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); | 179 | mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); |
180 | //topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); | 180 | //topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); |
181 | //++iii; | 181 | //++iii; |
182 | 182 | ||
183 | QHGroupBox* gb5 = new QHGroupBox( i18n("Apply filter when adding data to local:"), topFrame); | 183 | QHGroupBox* gb5 = new QHGroupBox( i18n("Apply filter when adding data to local:"), topFrame); |
184 | QVBox * fibo2 = new QVBox ( gb5 ); | 184 | QVBox * fibo2 = new QVBox ( gb5 ); |
185 | new QLabel ( i18n("Incoming calendar filter:"), fibo2 ); | 185 | new QLabel ( i18n("Incoming calendar filter:"), fibo2 ); |
186 | mFilterInCal = new QComboBox( fibo2 ); | 186 | mFilterInCal = new QComboBox( fibo2 ); |
187 | fibo2 = new QVBox ( gb5 ); | 187 | fibo2 = new QVBox ( gb5 ); |
188 | new QLabel ( i18n("Incoming adressbook filter:"), fibo2 ); | 188 | new QLabel ( i18n("Incoming addressbook filter:"), fibo2 ); |
189 | mFilterInAB = new QComboBox( fibo2 ); | 189 | mFilterInAB = new QComboBox( fibo2 ); |
190 | 190 | ||
191 | mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); | 191 | mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); |
192 | // topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); | 192 | // topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); |
193 | // ++iii; | 193 | // ++iii; |
194 | 194 | ||
195 | QVGroupBox* gb2 = new QVGroupBox( i18n("Write back options"), topFrame); | 195 | QVGroupBox* gb2 = new QVGroupBox( i18n("Write back options"), topFrame); |
196 | //topLayout->addMultiCellWidget(gb2, iii,iii,0,1); | 196 | //topLayout->addMultiCellWidget(gb2, iii,iii,0,1); |
197 | //++iii; | 197 | //++iii; |
198 | { | 198 | { |
199 | QVGroupBox*topFrame = gb2; | 199 | QVGroupBox*topFrame = gb2; |
200 | mWriteBackExisting= new QCheckBox( i18n("Write back (on remote) existing entries only"), topFrame ); | 200 | mWriteBackExisting= new QCheckBox( i18n("Write back (on remote) existing entries only"), topFrame ); |
201 | QHGroupBox* gb4 = new QHGroupBox( i18n("Apply filter when adding data to remote:"), topFrame); | 201 | QHGroupBox* gb4 = new QHGroupBox( i18n("Apply filter when adding data to remote:"), topFrame); |
202 | QVBox * fibo = new QVBox ( gb4 ); | 202 | QVBox * fibo = new QVBox ( gb4 ); |
203 | new QLabel ( i18n("Outgoing calendar filter:"), fibo ); | 203 | new QLabel ( i18n("Outgoing calendar filter:"), fibo ); |
204 | mFilterOutCal = new QComboBox( fibo ); | 204 | mFilterOutCal = new QComboBox( fibo ); |
205 | fibo = new QVBox ( gb4 ); | 205 | fibo = new QVBox ( gb4 ); |
206 | new QLabel ( i18n("Outgoing addressbook filter:"), fibo ); | 206 | new QLabel ( i18n("Outgoing addressbook filter:"), fibo ); |
207 | mFilterOutAB = new QComboBox( fibo ); | 207 | mFilterOutAB = new QComboBox( fibo ); |
208 | //topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); | 208 | //topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); |
209 | //++iii; | 209 | //++iii; |
210 | mWriteBackFuture= new QCheckBox( i18n("Write back (calendar) entries for time period only"), topFrame ); | 210 | mWriteBackFuture= new QCheckBox( i18n("Write back (calendar) entries for time period only"), topFrame ); |
211 | //topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); | 211 | //topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); |
212 | //++iii; | 212 | //++iii; |
213 | QHGroupBox* gb3 = new QHGroupBox( i18n("Time period"), topFrame); | 213 | QHGroupBox* gb3 = new QHGroupBox( i18n("Time period"), topFrame); |
214 | connect ( mWriteBackFuture, SIGNAL( toggled ( bool ) ), gb3, SLOT ( setEnabled ( bool ) ) ); | 214 | connect ( mWriteBackFuture, SIGNAL( toggled ( bool ) ), gb3, SLOT ( setEnabled ( bool ) ) ); |
215 | new QLabel( i18n("From ") , gb3 ); | 215 | new QLabel( i18n("From ") , gb3 ); |
216 | mWriteBackPastWeeks= new QSpinBox(1,104, 1, gb3); | 216 | mWriteBackPastWeeks= new QSpinBox(1,104, 1, gb3); |
217 | new QLabel( i18n(" weeks in the past to ") , gb3 ); | 217 | new QLabel( i18n(" weeks in the past to ") , gb3 ); |
218 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, gb3); | 218 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, gb3); |
219 | new QLabel( i18n(" weeks in the future ") , gb3 ); | 219 | new QLabel( i18n(" weeks in the future ") , gb3 ); |
220 | //topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); | 220 | //topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); |
221 | //++iii; | 221 | //++iii; |
222 | gb3->setEnabled( false ); | 222 | gb3->setEnabled( false ); |
223 | connect ( mWriteBackExisting, SIGNAL( toggled ( bool ) ), gb4, SLOT ( setDisabled ( bool ) ) ); | 223 | connect ( mWriteBackExisting, SIGNAL( toggled ( bool ) ), gb4, SLOT ( setDisabled ( bool ) ) ); |
224 | } | 224 | } |
225 | connect ( mWriteBackFile, SIGNAL( toggled ( bool ) ), gb2, SLOT ( setEnabled ( bool ) ) ); | 225 | connect ( mWriteBackFile, SIGNAL( toggled ( bool ) ), gb2, SLOT ( setEnabled ( bool ) ) ); |
226 | 226 | ||
227 | } | 227 | } |
228 | proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); | 228 | proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); |
229 | gr = proGr; | 229 | gr = proGr; |
230 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); | 230 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); |
231 | ++iii; | 231 | ++iii; |
232 | mIsLocal = new QRadioButton ( i18n("Local file"), gr ); | 232 | mIsLocal = new QRadioButton ( i18n("Local file"), gr ); |
233 | mIsPi = new QRadioButton ( i18n("Pi-Sync ( direct Kx/Pi to Kx/Pi sync )"), gr ); | 233 | mIsPi = new QRadioButton ( i18n("Pi-Sync ( direct Kx/Pi to Kx/Pi sync )"), gr ); |
234 | connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | 234 | connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); |
235 | mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); | 235 | mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); |
236 | connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | 236 | connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); |
237 | mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); | 237 | mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); |
238 | connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | 238 | connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); |
239 | 239 | ||
240 | QVGroupBox* gb1 = new QVGroupBox( i18n("Profile kind specific settings"), topFrame); | 240 | QVGroupBox* gb1 = new QVGroupBox( i18n("Profile kind specific settings"), topFrame); |
241 | topLayout->addMultiCellWidget(gb1, iii,iii,0,1); | 241 | topLayout->addMultiCellWidget(gb1, iii,iii,0,1); |
242 | ++iii; | 242 | ++iii; |
243 | 243 | ||
244 | // ****************************************** | 244 | // ****************************************** |
245 | // Profile kind specific settings | 245 | // Profile kind specific settings |
246 | { | 246 | { |
247 | // *** phone ******************************* | 247 | // *** phone ******************************* |
248 | QVGroupBox* topFrame = gb1; | 248 | QVGroupBox* topFrame = gb1; |
249 | phoneWidget = new QVBox( topFrame); | 249 | phoneWidget = new QVBox( topFrame); |
250 | //topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1); | 250 | //topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1); |
251 | //++iii; | 251 | //++iii; |
252 | mWriteContactToSIM = 0;//new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget ); | 252 | mWriteContactToSIM = 0;//new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget ); |
diff --git a/microkde/kidmanager.cpp b/microkde/kidmanager.cpp index e687e5d..d712771 100644 --- a/microkde/kidmanager.cpp +++ b/microkde/kidmanager.cpp | |||
@@ -1,136 +1,136 @@ | |||
1 | #include "kidmanager.h" | 1 | #include "kidmanager.h" |
2 | 2 | ||
3 | KIdManager::KIdManager() | 3 | KIdManager::KIdManager() |
4 | { | 4 | { |
5 | 5 | ||
6 | } | 6 | } |
7 | // :profilename;12;id_withLen12;123456: | 7 | // :profilename;12;id_withLen12;123456: |
8 | // 123456 is the csum | 8 | // 123456 is the csum |
9 | QString KIdManager::setId (const QString& idString,const QString& prof,const QString& idvalue ) | 9 | const QString KIdManager::setId (const QString& idString,const QString& prof,const QString& idvalue ) |
10 | { | 10 | { |
11 | int startProf; | 11 | int startProf; |
12 | int startIDnum; | 12 | int startIDnum; |
13 | int startIDnumlen; | 13 | int startIDnumlen; |
14 | int startID; | 14 | int startID; |
15 | int lenID; | 15 | int lenID; |
16 | int startCsum; | 16 | int startCsum; |
17 | int lenCsum; | 17 | int lenCsum; |
18 | int endall; | 18 | int endall; |
19 | QString newIDString; | 19 | QString newIDString; |
20 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) { | 20 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) { |
21 | newIDString = idString.left(startIDnum ) + QString::number( idvalue.length() ) +";"+idvalue+ ";"+idString.mid( startCsum ); | 21 | newIDString = idString.left(startIDnum ) + QString::number( idvalue.length() ) +";"+idvalue+ ";"+idString.mid( startCsum ); |
22 | } else { | 22 | } else { |
23 | newIDString = idString + prof+";"+ QString::number( idvalue.length() ) +";"+idvalue +";0:"; | 23 | newIDString = idString + prof+";"+ QString::number( idvalue.length() ) +";"+idvalue +";0:"; |
24 | } | 24 | } |
25 | //qDebug("setID:profile:%s*retval:%s*idvalue:%s* ", prof.latin1(), newIDString.latin1() ,idvalue.latin1() ); | 25 | //qDebug("setID:profile:%s*retval:%s*idvalue:%s* ", prof.latin1(), newIDString.latin1() ,idvalue.latin1() ); |
26 | return newIDString; | 26 | return newIDString; |
27 | } | 27 | } |
28 | QString KIdManager::getId (const QString& idString,const QString& prof ) | 28 | const QString KIdManager::getId (const QString& idString,const QString& prof ) |
29 | { | 29 | { |
30 | int startProf; | 30 | int startProf; |
31 | int startIDnum; | 31 | int startIDnum; |
32 | int startIDnumlen; | 32 | int startIDnumlen; |
33 | int startID; | 33 | int startID; |
34 | int lenID; | 34 | int lenID; |
35 | int startCsum; | 35 | int startCsum; |
36 | int lenCsum; | 36 | int lenCsum; |
37 | int endall; | 37 | int endall; |
38 | QString idval = ""; | 38 | QString idval = ""; |
39 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) | 39 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) |
40 | idval = idString.mid( startID, lenID ); | 40 | idval = idString.mid( startID, lenID ); |
41 | 41 | ||
42 | //qDebug("getID:profile:%s*retval:%s*idstring:%s* ", prof.latin1(), idval.latin1() ,idString.latin1() ); | 42 | //qDebug("getID:profile:%s*retval:%s*idstring:%s* ", prof.latin1(), idval.latin1() ,idString.latin1() ); |
43 | return idval; | 43 | return idval; |
44 | 44 | ||
45 | } | 45 | } |
46 | 46 | ||
47 | QString KIdManager::removeId (const QString& idString,const QString& prof ) | 47 | const QString KIdManager::removeId (const QString& idString,const QString& prof ) |
48 | { | 48 | { |
49 | int startProf; | 49 | int startProf; |
50 | int startIDnum; | 50 | int startIDnum; |
51 | int startIDnumlen; | 51 | int startIDnumlen; |
52 | int startID; | 52 | int startID; |
53 | int lenID; | 53 | int lenID; |
54 | int startCsum; | 54 | int startCsum; |
55 | int lenCsum; | 55 | int lenCsum; |
56 | int endall; | 56 | int endall; |
57 | QString newIDString; | 57 | QString newIDString; |
58 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) { | 58 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) { |
59 | newIDString = idString.left(startProf) + idString.mid( endall+1 ); | 59 | newIDString = idString.left(startProf) + idString.mid( endall+1 ); |
60 | } else { | 60 | } else { |
61 | newIDString = idString; | 61 | newIDString = idString; |
62 | } | 62 | } |
63 | //qDebug("removeID:profile:%s*retval:%s*oldidstring:%s* ", prof.latin1(), newIDString.latin1() ,idString.latin1() ); | 63 | //qDebug("removeID:profile:%s*retval:%s*oldidstring:%s* ", prof.latin1(), newIDString.latin1() ,idString.latin1() ); |
64 | return newIDString; | 64 | return newIDString; |
65 | } | 65 | } |
66 | 66 | ||
67 | QString KIdManager::setCsum (const QString& idString,const QString& prof,const QString& idCsum ) | 67 | const QString KIdManager::setCsum (const QString& idString,const QString& prof,const QString& idCsum ) |
68 | { | 68 | { |
69 | int startProf; | 69 | int startProf; |
70 | int startIDnum; | 70 | int startIDnum; |
71 | int startIDnumlen; | 71 | int startIDnumlen; |
72 | int startID; | 72 | int startID; |
73 | int lenID; | 73 | int lenID; |
74 | int startCsum; | 74 | int startCsum; |
75 | int lenCsum; | 75 | int lenCsum; |
76 | int endall; | 76 | int endall; |
77 | QString newIDString; | 77 | QString newIDString; |
78 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) { | 78 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) { |
79 | newIDString = idString.left(startCsum) + idCsum+ idString.mid( endall +1); | 79 | newIDString = idString.left(startCsum) + idCsum+ idString.mid( endall +1); |
80 | } else { | 80 | } else { |
81 | newIDString = idString + prof + ";3;_u_;"+ idCsum + ":"; | 81 | newIDString = idString + prof + ";3;_u_;"+ idCsum + ":"; |
82 | } | 82 | } |
83 | //qDebug("setCsum:profile:%s*retval:%s*idCsum:%s* ", prof.latin1(), newIDString.latin1() ,idCsum.latin1() ); | 83 | //qDebug("setCsum:profile:%s*retval:%s*idCsum:%s* ", prof.latin1(), newIDString.latin1() ,idCsum.latin1() ); |
84 | return newIDString; | 84 | return newIDString; |
85 | } | 85 | } |
86 | QString KIdManager::getCsum (const QString& idString,const QString& prof ) | 86 | const QString KIdManager::getCsum (const QString& idString,const QString& prof ) |
87 | { | 87 | { |
88 | int startProf; | 88 | int startProf; |
89 | int startIDnum; | 89 | int startIDnum; |
90 | int startIDnumlen; | 90 | int startIDnumlen; |
91 | int startID; | 91 | int startID; |
92 | int lenID; | 92 | int lenID; |
93 | int startCsum; | 93 | int startCsum; |
94 | int lenCsum; | 94 | int lenCsum; |
95 | int endall; | 95 | int endall; |
96 | QString idval = ""; | 96 | QString idval = ""; |
97 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) | 97 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) |
98 | idval = idString.mid( startCsum, lenCsum ); | 98 | idval = idString.mid( startCsum, lenCsum ); |
99 | 99 | ||
100 | //qDebug("getCsum:profile:%s*retval:%s*idstring:%s* ", prof.latin1(), idval.latin1() ,idString.latin1() ); | 100 | //qDebug("getCsum:profile:%s*retval:%s*idstring:%s* ", prof.latin1(), idval.latin1() ,idString.latin1() ); |
101 | return idval; | 101 | return idval; |
102 | } | 102 | } |
103 | // :profilename;12;id_withLen12;123456: | 103 | // :profilename;12;id_withLen12;123456: |
104 | bool KIdManager::getNumbers (const QString& idString,const QString& prof, int &startProf, int &startIDnum, int &startIDnumlen,int &startID, int& lenID, int &startCsum, int &lenCsum, int & endall) | 104 | bool KIdManager::getNumbers (const QString& idString,const QString& prof, int &startProf, int &startIDnum, int &startIDnumlen,int &startID, int& lenID, int &startCsum, int &lenCsum, int & endall) |
105 | { | 105 | { |
106 | startProf = idString.find( ":"+prof+";" ); | 106 | startProf = idString.find( ":"+prof+";" ); |
107 | if ( startProf >= 0 ) { | 107 | if ( startProf >= 0 ) { |
108 | startIDnum = prof.length()+2+startProf; | 108 | startIDnum = prof.length()+2+startProf; |
109 | startID = idString.find( ";", startIDnum ) +1; | 109 | startID = idString.find( ";", startIDnum ) +1; |
110 | startIDnumlen = startID - startIDnum - 1; | 110 | startIDnumlen = startID - startIDnum - 1; |
111 | if ( startIDnum > 0 ) { | 111 | if ( startIDnum > 0 ) { |
112 | bool ok; | 112 | bool ok; |
113 | lenID = idString.mid ( startIDnum,startIDnumlen).toInt( &ok ); | 113 | lenID = idString.mid ( startIDnum,startIDnumlen).toInt( &ok ); |
114 | if (ok) { | 114 | if (ok) { |
115 | startCsum = startID+lenID+1; | 115 | startCsum = startID+lenID+1; |
116 | endall = idString.find( ":", startCsum )-1; | 116 | endall = idString.find( ":", startCsum )-1; |
117 | if ( endall < 0 ) { | 117 | if ( endall < 0 ) { |
118 | qDebug("Error getNumbers: andall not found "); | 118 | qDebug("Error getNumbers: andall not found "); |
119 | return false; | 119 | return false; |
120 | } | 120 | } |
121 | lenCsum = endall-startCsum+1; | 121 | lenCsum = endall-startCsum+1; |
122 | } | 122 | } |
123 | else { | 123 | else { |
124 | qDebug("Error getNumbers:length is no number:*%s* ", idString.mid ( startIDnum,startIDnumlen).latin1()); | 124 | qDebug("Error getNumbers:length is no number:*%s* ", idString.mid ( startIDnum,startIDnumlen).latin1()); |
125 | return false; | 125 | return false; |
126 | } | 126 | } |
127 | } else { | 127 | } else { |
128 | qDebug("Error in KIdManager::getNumbers.startIDnum <= 0"); | 128 | qDebug("Error in KIdManager::getNumbers.startIDnum <= 0"); |
129 | return false; | 129 | return false; |
130 | } | 130 | } |
131 | } else { | 131 | } else { |
132 | //qDebug("getnumbers: profile not found *%s* ",prof.latin1() ); | 132 | //qDebug("getnumbers: profile not found *%s* ",prof.latin1() ); |
133 | return false; | 133 | return false; |
134 | } | 134 | } |
135 | return true; | 135 | return true; |
136 | } | 136 | } |
diff --git a/microkde/kidmanager.h b/microkde/kidmanager.h index 00580a0..9786c9f 100644 --- a/microkde/kidmanager.h +++ b/microkde/kidmanager.h | |||
@@ -1,24 +1,24 @@ | |||
1 | #ifndef MINIKDE_KIDMANAGER_H | 1 | #ifndef MINIKDE_KIDMANAGER_H |
2 | #define MINIKDE_KIDMANAGER_H | 2 | #define MINIKDE_KIDMANAGER_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | 5 | ||
6 | #include <qobject.h> | 6 | #include <qobject.h> |
7 | class KIdManager : public QObject | 7 | class KIdManager : public QObject |
8 | { | 8 | { |
9 | Q_OBJECT | 9 | Q_OBJECT |
10 | public: | 10 | public: |
11 | KIdManager( ); | 11 | KIdManager( ); |
12 | static QString setId (const QString& idString,const QString& id,const QString& idvalue ) ; | 12 | static const QString setId (const QString& idString,const QString& id,const QString& idvalue ) ; |
13 | static QString getId (const QString& idString,const QString& id ) ; | 13 | static const QString getId (const QString& idString,const QString& id ) ; |
14 | static QString removeId (const QString& idString,const QString& id ) ; | 14 | static const QString removeId (const QString& idString,const QString& id ) ; |
15 | static QString setCsum (const QString& idString,const QString& id,const QString& idvalue ) ; | 15 | static const QString setCsum (const QString& idString,const QString& id,const QString& idvalue ) ; |
16 | static QString getCsum (const QString& idString,const QString& id ) ; | 16 | static const QString getCsum (const QString& idString,const QString& id ) ; |
17 | static bool getNumbers (const QString& idString,const QString& id, int &startProf, int &startIDnum, int &startIDnumlen,int &startID, int& lenID, int &startCsum, int &lenCsum, int & endall) ; | 17 | static bool getNumbers (const QString& idString,const QString& id, int &startProf, int &startIDnum, int &startIDnumlen,int &startID, int& lenID, int &startCsum, int &lenCsum, int & endall) ; |
18 | private: | 18 | private: |
19 | 19 | ||
20 | private slots: | 20 | private slots: |
21 | }; | 21 | }; |
22 | 22 | ||
23 | 23 | ||
24 | #endif | 24 | #endif |