author | zautrix <zautrix> | 2005-12-02 09:42:53 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-12-02 09:42:53 (UTC) |
commit | a75d2c26aba6cffae8c3f61e173940240042427b (patch) (unidiff) | |
tree | 68f4b61c150bc263a98c78fdf8671bbbc17cdaf8 | |
parent | 64be8d64fc26d1025a24150d065197ba5d608f3d (diff) | |
download | kdepimpi-a75d2c26aba6cffae8c3f61e173940240042427b.zip kdepimpi-a75d2c26aba6cffae8c3f61e173940240042427b.tar.gz kdepimpi-a75d2c26aba6cffae8c3f61e173940240042427b.tar.bz2 |
more sync
-rw-r--r-- | kabc/addressbook.cpp | 42 | ||||
-rw-r--r-- | kabc/addressbook.h | 4 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 6 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 2 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 4 |
5 files changed, 41 insertions, 17 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index e04f4b1..bdc2762 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -462,94 +462,118 @@ bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName ) | |||
462 | } | 462 | } |
463 | vcard += vcardnew.mid( start,vcardnew.length() ); | 463 | vcard += vcardnew.mid( start,vcardnew.length() ); |
464 | vcard.replace ( QRegExp(";;;") , "" ); | 464 | vcard.replace ( QRegExp(";;;") , "" ); |
465 | vcard.replace ( QRegExp(";;") , "" ); | 465 | vcard.replace ( QRegExp(";;") , "" ); |
466 | datastream += vcard; | 466 | datastream += vcard; |
467 | 467 | ||
468 | } | 468 | } |
469 | 469 | ||
470 | QFile outFile(fileName); | 470 | QFile outFile(fileName); |
471 | if ( outFile.open(IO_WriteOnly) ) { | 471 | if ( outFile.open(IO_WriteOnly) ) { |
472 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 472 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
473 | QTextStream t( &outFile ); // use a text stream | 473 | QTextStream t( &outFile ); // use a text stream |
474 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 474 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
475 | t <<datastream; | 475 | t <<datastream; |
476 | t << "\r\n\r\n"; | 476 | t << "\r\n\r\n"; |
477 | outFile.close(); | 477 | outFile.close(); |
478 | 478 | ||
479 | } else { | 479 | } else { |
480 | qDebug("Error open temp file "); | 480 | qDebug("Error open temp file "); |
481 | return false; | 481 | return false; |
482 | } | 482 | } |
483 | return true; | 483 | return true; |
484 | 484 | ||
485 | } | 485 | } |
486 | int AddressBook::importFromFile( QString fileName, bool replaceLabel, bool removeOld ) | 486 | int AddressBook::importFromFile( QString fileName, bool replaceLabel, bool removeOld, QString resource ) |
487 | { | 487 | { |
488 | 488 | ||
489 | if ( removeOld ) | 489 | if ( removeOld ) |
490 | setUntagged( true ); | 490 | setUntagged( true, resource ); |
491 | KABC::Addressee::List list; | 491 | KABC::Addressee::List list; |
492 | QFile file( fileName ); | 492 | QFile file( fileName ); |
493 | file.open( IO_ReadOnly ); | 493 | file.open( IO_ReadOnly ); |
494 | QByteArray rawData = file.readAll(); | 494 | QByteArray rawData = file.readAll(); |
495 | file.close(); | 495 | file.close(); |
496 | QString data; | 496 | QString data; |
497 | if ( replaceLabel ) { | 497 | if ( replaceLabel ) { |
498 | data = QString::fromLatin1( rawData.data(), rawData.size() + 1 ); | 498 | data = QString::fromLatin1( rawData.data(), rawData.size() + 1 ); |
499 | data.replace ( QRegExp("LABEL") , "ADR" ); | 499 | data.replace ( QRegExp("LABEL") , "ADR" ); |
500 | data.replace ( QRegExp("CHARSET=ISO-8859-1") , "" ); | 500 | data.replace ( QRegExp("CHARSET=ISO-8859-1") , "" ); |
501 | } else | 501 | } else |
502 | data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); | 502 | data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); |
503 | KABC::VCardTool tool; | 503 | KABC::VCardTool tool; |
504 | list = tool.parseVCards( data ); | 504 | list = tool.parseVCards( data ); |
505 | KABC::Addressee::List::Iterator it; | 505 | KABC::Addressee::List::Iterator it; |
506 | |||
507 | Resource * setRes = 0; | ||
508 | if ( !resource.isEmpty() ) { | ||
509 | KRES::Manager<Resource>::ActiveIterator it; | ||
510 | KRES::Manager<Resource> *manager = d->mManager; | ||
511 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { | ||
512 | qDebug("SaveAB::checking resource..." ); | ||
513 | if ( (*it)->name() == resource ) { | ||
514 | setRes = (*it); | ||
515 | qDebug("Inserting imported contacs to resource %s", resource.latin1()); | ||
516 | break; | ||
517 | } | ||
518 | } | ||
519 | } | ||
506 | for ( it = list.begin(); it != list.end(); ++it ) { | 520 | for ( it = list.begin(); it != list.end(); ++it ) { |
507 | QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" ); | 521 | QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" ); |
508 | if ( !id.isEmpty() ) | 522 | if ( !id.isEmpty() ) |
509 | (*it).setIDStr(id ); | 523 | (*it).setIDStr(id ); |
510 | (*it).setResource( 0 ); | 524 | (*it).setResource( setRes ); |
511 | if ( replaceLabel ) | 525 | if ( replaceLabel ) |
512 | (*it).removeVoice(); | 526 | (*it).removeVoice(); |
513 | if ( removeOld ) | 527 | if ( removeOld ) |
514 | (*it).setTagged( true ); | 528 | (*it).setTagged( true ); |
515 | insertAddressee( (*it), false, true ); | 529 | insertAddressee( (*it), false, true ); |
516 | } | 530 | } |
517 | if ( removeOld ) | 531 | if ( removeOld ) |
518 | removeUntagged(); | 532 | removeUntagged(); |
519 | return list.count(); | 533 | return list.count(); |
520 | } | 534 | } |
521 | void AddressBook::setUntagged(bool setNonSyncTagged) // = false) | 535 | void AddressBook::setUntagged(bool setNonSyncTagged, QString resource) // = false , "") |
522 | { | 536 | { |
523 | Iterator ait; | 537 | Iterator ait; |
524 | for ( ait = begin(); ait != end(); ++ait ) { | 538 | if ( !resource.isEmpty() ) { |
525 | if ( setNonSyncTagged ) { | 539 | for ( ait = begin(); ait != end(); ++ait ) { |
526 | if ( (*ait).resource() && ! (*ait).resource()->includeInSync() ) { | 540 | if ( (*ait).resource() && (*ait).resource()->name() == resource ) { |
541 | (*ait).setTagged( false ); | ||
542 | } | ||
543 | else | ||
527 | (*ait).setTagged( true ); | 544 | (*ait).setTagged( true ); |
545 | } | ||
546 | } else { | ||
547 | for ( ait = begin(); ait != end(); ++ait ) { | ||
548 | if ( setNonSyncTagged ) { | ||
549 | if ( (*ait).resource() && ! (*ait).resource()->includeInSync() ) { | ||
550 | (*ait).setTagged( true ); | ||
551 | } else | ||
552 | (*ait).setTagged( false ); | ||
528 | } else | 553 | } else |
529 | (*ait).setTagged( false ); | 554 | (*ait).setTagged( false ); |
530 | } else | 555 | } |
531 | (*ait).setTagged( false ); | ||
532 | } | 556 | } |
533 | } | 557 | } |
534 | void AddressBook::removeUntagged() | 558 | void AddressBook::removeUntagged() |
535 | { | 559 | { |
536 | Iterator ait; | 560 | Iterator ait; |
537 | bool todelete = false; | 561 | bool todelete = false; |
538 | Iterator todel; | 562 | Iterator todel; |
539 | for ( ait = begin(); ait != end(); ++ait ) { | 563 | for ( ait = begin(); ait != end(); ++ait ) { |
540 | if ( todelete ) | 564 | if ( todelete ) |
541 | removeAddressee( todel ); | 565 | removeAddressee( todel ); |
542 | if (!(*ait).tagged()) { | 566 | if (!(*ait).tagged()) { |
543 | todelete = true; | 567 | todelete = true; |
544 | todel = ait; | 568 | todel = ait; |
545 | } else | 569 | } else |
546 | todelete = false; | 570 | todelete = false; |
547 | } | 571 | } |
548 | if ( todelete ) | 572 | if ( todelete ) |
549 | removeAddressee( todel ); | 573 | removeAddressee( todel ); |
550 | deleteRemovedAddressees(); | 574 | deleteRemovedAddressees(); |
551 | } | 575 | } |
552 | void AddressBook::smplifyAddressees() | 576 | void AddressBook::smplifyAddressees() |
553 | { | 577 | { |
554 | Iterator ait; | 578 | Iterator ait; |
555 | for ( ait = begin(); ait != end(); ++ait ) { | 579 | for ( ait = begin(); ait != end(); ++ait ) { |
diff --git a/kabc/addressbook.h b/kabc/addressbook.h index 4a0d0a3..e6daa5e 100644 --- a/kabc/addressbook.h +++ b/kabc/addressbook.h | |||
@@ -127,50 +127,50 @@ class AddressBook : public QObject | |||
127 | 127 | ||
128 | @see save() | 128 | @see save() |
129 | */ | 129 | */ |
130 | Ticket *requestSaveTicket( Resource *resource=0 ); | 130 | Ticket *requestSaveTicket( Resource *resource=0 ); |
131 | 131 | ||
132 | /** | 132 | /** |
133 | Load address book from file. | 133 | Load address book from file. |
134 | */ | 134 | */ |
135 | bool load(); | 135 | bool load(); |
136 | 136 | ||
137 | /** | 137 | /** |
138 | Save address book. The address book is saved to the file, the Ticket | 138 | Save address book. The address book is saved to the file, the Ticket |
139 | object has been requested for by @ref requestSaveTicket(). | 139 | object has been requested for by @ref requestSaveTicket(). |
140 | 140 | ||
141 | @param ticket a ticket object returned by @ref requestSaveTicket() | 141 | @param ticket a ticket object returned by @ref requestSaveTicket() |
142 | */ | 142 | */ |
143 | bool save( Ticket *ticket ); | 143 | bool save( Ticket *ticket ); |
144 | bool saveAB( ); | 144 | bool saveAB( ); |
145 | bool saveABphone( QString fileName ); | 145 | bool saveABphone( QString fileName ); |
146 | void smplifyAddressees(); | 146 | void smplifyAddressees(); |
147 | void removeSyncInfo( QString syncProfile); | 147 | void removeSyncInfo( QString syncProfile); |
148 | void preparePhoneSync( QString currentSyncDevice, bool isPreSync ); | 148 | void preparePhoneSync( QString currentSyncDevice, bool isPreSync ); |
149 | void export2File( QString fileName, QString resourceName = "" ); | 149 | void export2File( QString fileName, QString resourceName = "" ); |
150 | bool export2PhoneFormat( QStringList uids ,QString fileName ); | 150 | bool export2PhoneFormat( QStringList uids ,QString fileName ); |
151 | int importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false ); | 151 | int importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false, QString resource = "" ); |
152 | void setUntagged( bool setNonSyncTagged = false ); | 152 | void setUntagged( bool setNonSyncTagged = false, QString resource = "" ); |
153 | void removeUntagged(); | 153 | void removeUntagged(); |
154 | void findNewExtIds( QString fileName, QString currentSyncDevice ); | 154 | void findNewExtIds( QString fileName, QString currentSyncDevice ); |
155 | /** | 155 | /** |
156 | Returns a iterator for first entry of address book. | 156 | Returns a iterator for first entry of address book. |
157 | */ | 157 | */ |
158 | Iterator begin(); | 158 | Iterator begin(); |
159 | 159 | ||
160 | /** | 160 | /** |
161 | Returns a const iterator for first entry of address book. | 161 | Returns a const iterator for first entry of address book. |
162 | */ | 162 | */ |
163 | ConstIterator begin() const; | 163 | ConstIterator begin() const; |
164 | 164 | ||
165 | /** | 165 | /** |
166 | Returns a iterator for first entry of address book. | 166 | Returns a iterator for first entry of address book. |
167 | */ | 167 | */ |
168 | Iterator end(); | 168 | Iterator end(); |
169 | 169 | ||
170 | /** | 170 | /** |
171 | Returns a const iterator for first entry of address book. | 171 | Returns a const iterator for first entry of address book. |
172 | */ | 172 | */ |
173 | ConstIterator end() const; | 173 | ConstIterator end() const; |
174 | 174 | ||
175 | /** | 175 | /** |
176 | Removes all entries from address book. | 176 | Removes all entries from address book. |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 5d377bf..7d8586a 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1916,49 +1916,49 @@ void KABCore::initGUI() | |||
1916 | #else //KAB_NOSPLITTER | 1916 | #else //KAB_NOSPLITTER |
1917 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1917 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1918 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1918 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1919 | topLayout->setSpacing( 10 ); | 1919 | topLayout->setSpacing( 10 ); |
1920 | 1920 | ||
1921 | // mDetailsSplitter = new QSplitter( this ); | 1921 | // mDetailsSplitter = new QSplitter( this ); |
1922 | 1922 | ||
1923 | QVBox *viewSpace = new QVBox( this ); | 1923 | QVBox *viewSpace = new QVBox( this ); |
1924 | 1924 | ||
1925 | mViewManager = new ViewManager( this, viewSpace ); | 1925 | mViewManager = new ViewManager( this, viewSpace ); |
1926 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1926 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1927 | 1927 | ||
1928 | mDetails = new ViewContainer( this ); | 1928 | mDetails = new ViewContainer( this ); |
1929 | 1929 | ||
1930 | topLayout->addWidget( viewSpace ); | 1930 | topLayout->addWidget( viewSpace ); |
1931 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1931 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1932 | topLayout->addWidget( mDetails ); | 1932 | topLayout->addWidget( mDetails ); |
1933 | #endif //KAB_NOSPLITTER | 1933 | #endif //KAB_NOSPLITTER |
1934 | */ | 1934 | */ |
1935 | 1935 | ||
1936 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 1936 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
1937 | syncManager->setBlockSave(false); | 1937 | syncManager->setBlockSave(false); |
1938 | 1938 | ||
1939 | connect(syncManager , SIGNAL( request_file(const QString &) ), this, SLOT( syncFileRequest(const QString &) ) ); | 1939 | connect(syncManager , SIGNAL( request_file(const QString &) ), this, SLOT( syncFileRequest(const QString &) ) ); |
1940 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 1940 | connect(syncManager , SIGNAL( getFile( bool ,const QString &)), this, SLOT(getFile( bool ,const QString &) ) ); |
1941 | QString sync_file = sentSyncFile(); | 1941 | QString sync_file = sentSyncFile(); |
1942 | //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); | 1942 | //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); |
1943 | syncManager->setDefaultFileName( sync_file ); | 1943 | syncManager->setDefaultFileName( sync_file ); |
1944 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); | 1944 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); |
1945 | 1945 | ||
1946 | #endif //KAB_EMBEDDED | 1946 | #endif //KAB_EMBEDDED |
1947 | initActions(); | 1947 | initActions(); |
1948 | 1948 | ||
1949 | #ifdef KAB_EMBEDDED | 1949 | #ifdef KAB_EMBEDDED |
1950 | addActionsManually(); | 1950 | addActionsManually(); |
1951 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1951 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1952 | mXXPortManager = new XXPortManager( this, this ); | 1952 | mXXPortManager = new XXPortManager( this, this ); |
1953 | 1953 | ||
1954 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1954 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1955 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1955 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1956 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1956 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1957 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1957 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1958 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1958 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1959 | // mIncSearchWidget->hide(); | 1959 | // mIncSearchWidget->hide(); |
1960 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1960 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1961 | SLOT( incrementalSearch( const QString& ) ) ); | 1961 | SLOT( incrementalSearch( const QString& ) ) ); |
1962 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); | 1962 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); |
1963 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); | 1963 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); |
1964 | 1964 | ||
@@ -3439,55 +3439,55 @@ bool KABCore::syncPhone() | |||
3439 | { | 3439 | { |
3440 | abLocal.importFromFile( fileName ); | 3440 | abLocal.importFromFile( fileName ); |
3441 | qDebug("KA: AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 3441 | qDebug("KA: AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
3442 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3442 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3443 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); | 3443 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); |
3444 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 3444 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
3445 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 3445 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
3446 | syncManager->hideProgressBar(); | 3446 | syncManager->hideProgressBar(); |
3447 | if ( syncOK ) { | 3447 | if ( syncOK ) { |
3448 | if ( syncManager->mWriteBackFile ) { | 3448 | if ( syncManager->mWriteBackFile ) { |
3449 | abLocal.removeSyncAddressees( true ); | 3449 | abLocal.removeSyncAddressees( true ); |
3450 | abLocal.saveABphone( fileName ); | 3450 | abLocal.saveABphone( fileName ); |
3451 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); | 3451 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); |
3452 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); | 3452 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); |
3453 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); | 3453 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); |
3454 | } | 3454 | } |
3455 | } | 3455 | } |
3456 | setModified(); | 3456 | setModified(); |
3457 | } | 3457 | } |
3458 | abLocal.removeResources(); | 3458 | abLocal.removeResources(); |
3459 | if ( syncOK ) | 3459 | if ( syncOK ) |
3460 | mViewManager->refreshView(); | 3460 | mViewManager->refreshView(); |
3461 | return syncOK; | 3461 | return syncOK; |
3462 | } | 3462 | } |
3463 | void KABCore::getFile( bool success ) | 3463 | void KABCore::getFile( bool success ,const QString & resource) |
3464 | { | 3464 | { |
3465 | if ( ! success ) { | 3465 | if ( ! success ) { |
3466 | message( i18n("Error receiving file. Nothing changed!") ); | 3466 | message( i18n("Error receiving file. Nothing changed!") ); |
3467 | return; | 3467 | return; |
3468 | } | 3468 | } |
3469 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); | 3469 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ,resource); |
3470 | if ( count ) | 3470 | if ( count ) |
3471 | setModified( true ); | 3471 | setModified( true ); |
3472 | message( i18n("Pi-Sync successful!") ); | 3472 | message( i18n("Pi-Sync successful!") ); |
3473 | mViewManager->refreshView(); | 3473 | mViewManager->refreshView(); |
3474 | } | 3474 | } |
3475 | void KABCore::syncFileRequest(const QString & resource) | 3475 | void KABCore::syncFileRequest(const QString & resource) |
3476 | { | 3476 | { |
3477 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { | 3477 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { |
3478 | syncManager->slotSyncMenu( 999 ); | 3478 | syncManager->slotSyncMenu( 999 ); |
3479 | } | 3479 | } |
3480 | 3480 | ||
3481 | if ( resource == "ALL" ) { | 3481 | if ( resource == "ALL" ) { |
3482 | mAddressBook->export2File( sentSyncFile() ); | 3482 | mAddressBook->export2File( sentSyncFile() ); |
3483 | } | 3483 | } |
3484 | else | 3484 | else |
3485 | mAddressBook->export2File( sentSyncFile(), resource); | 3485 | mAddressBook->export2File( sentSyncFile(), resource); |
3486 | } | 3486 | } |
3487 | QString KABCore::sentSyncFile() | 3487 | QString KABCore::sentSyncFile() |
3488 | { | 3488 | { |
3489 | #ifdef DESKTOP_VERSION | 3489 | #ifdef DESKTOP_VERSION |
3490 | return locateLocal( "tmp", "copysyncab.vcf" ); | 3490 | return locateLocal( "tmp", "copysyncab.vcf" ); |
3491 | #else | 3491 | #else |
3492 | return QString( "/tmp/copysyncab.vcf" ); | 3492 | return QString( "/tmp/copysyncab.vcf" ); |
3493 | #endif | 3493 | #endif |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 2d1505f..e69cb60 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -335,49 +335,49 @@ class KABCore : public QWidget, public KSyncInterface | |||
335 | void openLDAPDialog(); | 335 | void openLDAPDialog(); |
336 | 336 | ||
337 | /** | 337 | /** |
338 | Creates a KAddressBookPrinter, which will display the print | 338 | Creates a KAddressBookPrinter, which will display the print |
339 | dialog and do the printing. | 339 | dialog and do the printing. |
340 | */ | 340 | */ |
341 | void print(); | 341 | void print(); |
342 | 342 | ||
343 | /** | 343 | /** |
344 | Registers a new GUI client, so plugins can register its actions. | 344 | Registers a new GUI client, so plugins can register its actions. |
345 | */ | 345 | */ |
346 | void addGUIClient( KXMLGUIClient *client ); | 346 | void addGUIClient( KXMLGUIClient *client ); |
347 | 347 | ||
348 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); | 348 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); |
349 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 349 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
350 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); | 350 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); |
351 | 351 | ||
352 | 352 | ||
353 | signals: | 353 | signals: |
354 | void contactSelected( const QString &name ); | 354 | void contactSelected( const QString &name ); |
355 | void contactSelected( const QPixmap &pixmap ); | 355 | void contactSelected( const QPixmap &pixmap ); |
356 | public slots: | 356 | public slots: |
357 | void loadDataAfterStart(); | 357 | void loadDataAfterStart(); |
358 | void recieve(QString cmsg ); | 358 | void recieve(QString cmsg ); |
359 | void getFile( bool success ); | 359 | void getFile( bool success,const QString & ); |
360 | void syncFileRequest(const QString &); | 360 | void syncFileRequest(const QString &); |
361 | void setDetailsVisible( bool visible ); | 361 | void setDetailsVisible( bool visible ); |
362 | void setDetailsToState(); | 362 | void setDetailsToState(); |
363 | 363 | ||
364 | void saveSettings(); | 364 | void saveSettings(); |
365 | 365 | ||
366 | private slots: | 366 | private slots: |
367 | void updateToolBar(); | 367 | void updateToolBar(); |
368 | void updateMainWindow(); | 368 | void updateMainWindow(); |
369 | void receive( const QCString& cmsg, const QByteArray& data ); | 369 | void receive( const QCString& cmsg, const QByteArray& data ); |
370 | void receiveStart( const QCString& cmsg, const QByteArray& data ); | 370 | void receiveStart( const QCString& cmsg, const QByteArray& data ); |
371 | void toggleBeamReceive( ); | 371 | void toggleBeamReceive( ); |
372 | void disableBR(bool); | 372 | void disableBR(bool); |
373 | void setJumpButtonBarVisible( bool visible ); | 373 | void setJumpButtonBarVisible( bool visible ); |
374 | void setJumpButtonBar( bool visible ); | 374 | void setJumpButtonBar( bool visible ); |
375 | void setCaptionBack(); | 375 | void setCaptionBack(); |
376 | void resizeAndCallContactdialog(); | 376 | void resizeAndCallContactdialog(); |
377 | void callContactdialog(); | 377 | void callContactdialog(); |
378 | void doRingSync(); | 378 | void doRingSync(); |
379 | 379 | ||
380 | void importFromOL(); | 380 | void importFromOL(); |
381 | void extensionModified( const KABC::Addressee::List &list ); | 381 | void extensionModified( const KABC::Addressee::List &list ); |
382 | void extensionChanged( int id ); | 382 | void extensionChanged( int id ); |
383 | void clipboardDataChanged(); | 383 | void clipboardDataChanged(); |
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index e615cbe..7197b30 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -420,50 +420,50 @@ void KSyncManager::enableQuick( bool ask ) | |||
420 | autoStart = mPrefs->mPassiveSyncAutoStart; | 420 | autoStart = mPrefs->mPassiveSyncAutoStart; |
421 | if ( autoStart != mPrefs->mPassiveSyncAutoStart ) | 421 | if ( autoStart != mPrefs->mPassiveSyncAutoStart ) |
422 | changed = true; | 422 | changed = true; |
423 | bool ok; | 423 | bool ok; |
424 | mPrefs->mPassiveSyncAutoStart = false; | 424 | mPrefs->mPassiveSyncAutoStart = false; |
425 | Q_UINT32 port_t = mPrefs->mPassiveSyncPort.toUInt(&ok); | 425 | Q_UINT32 port_t = mPrefs->mPassiveSyncPort.toUInt(&ok); |
426 | if ( ! ok || port_t > 65535 ) { | 426 | if ( ! ok || port_t > 65535 ) { |
427 | KMessageBox::information( 0, i18n("No valid port number:\n%1").arg ( mPrefs->mPassiveSyncPort ), i18n("Pi-Sync Port Error")); | 427 | KMessageBox::information( 0, i18n("No valid port number:\n%1").arg ( mPrefs->mPassiveSyncPort ), i18n("Pi-Sync Port Error")); |
428 | return; | 428 | return; |
429 | } | 429 | } |
430 | Q_UINT16 port = port_t; | 430 | Q_UINT16 port = port_t; |
431 | //qDebug("port %d ", port); | 431 | //qDebug("port %d ", port); |
432 | mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); | 432 | mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); |
433 | mServerSocket->setFileName( defaultFileName() );//bbb | 433 | mServerSocket->setFileName( defaultFileName() );//bbb |
434 | if ( !mServerSocket->ok() ) { | 434 | if ( !mServerSocket->ok() ) { |
435 | QTimer::singleShot( 2000, this, SLOT ( displayErrorPort() ) ); | 435 | QTimer::singleShot( 2000, this, SLOT ( displayErrorPort() ) ); |
436 | delete mServerSocket; | 436 | delete mServerSocket; |
437 | mServerSocket = 0; | 437 | mServerSocket = 0; |
438 | return; | 438 | return; |
439 | } | 439 | } |
440 | mPrefs->mPassiveSyncAutoStart = autoStart; | 440 | mPrefs->mPassiveSyncAutoStart = autoStart; |
441 | if ( changed ) { | 441 | if ( changed ) { |
442 | mPrefs->writeConfig(); | 442 | mPrefs->writeConfig(); |
443 | } | 443 | } |
444 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); | 444 | //connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); |
445 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); | 445 | //connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); |
446 | connect( mServerSocket, SIGNAL ( request_file(const QString &) ),this, SIGNAL ( request_file(const QString &) ) ); | 446 | connect( mServerSocket, SIGNAL ( request_file(const QString &) ),this, SIGNAL ( request_file(const QString &) ) ); |
447 | connect( mServerSocket, SIGNAL ( file_received( bool ,const QString &) ), this, SIGNAL ( getFile( bool,const QString & ) ) ); | 447 | connect( mServerSocket, SIGNAL ( file_received( bool ,const QString &) ), this, SIGNAL ( getFile( bool,const QString & ) ) ); |
448 | } | 448 | } |
449 | void KSyncManager::displayErrorPort() | 449 | void KSyncManager::displayErrorPort() |
450 | { | 450 | { |
451 | KMessageBox::information( 0, i18n("<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?").arg( mPrefs->mPassiveSyncPort) , i18n("Pi-Sync Port Error")); | 451 | KMessageBox::information( 0, i18n("<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?").arg( mPrefs->mPassiveSyncPort) , i18n("Pi-Sync Port Error")); |
452 | } | 452 | } |
453 | void KSyncManager::syncLocalFile() | 453 | void KSyncManager::syncLocalFile() |
454 | { | 454 | { |
455 | 455 | ||
456 | QString fn =mPrefs->mLastSyncedLocalFile; | 456 | QString fn =mPrefs->mLastSyncedLocalFile; |
457 | QString ext; | 457 | QString ext; |
458 | 458 | ||
459 | switch(mTargetApp) | 459 | switch(mTargetApp) |
460 | { | 460 | { |
461 | case (KAPI): | 461 | case (KAPI): |
462 | ext = "(*.vcf)"; | 462 | ext = "(*.vcf)"; |
463 | break; | 463 | break; |
464 | case (KOPI): | 464 | case (KOPI): |
465 | ext = "(*.ics/*.vcs)"; | 465 | ext = "(*.ics/*.vcs)"; |
466 | break; | 466 | break; |
467 | case (PWMPI): | 467 | case (PWMPI): |
468 | ext = "(*.pwm)"; | 468 | ext = "(*.pwm)"; |
469 | break; | 469 | break; |