author | zautrix <zautrix> | 2004-10-07 12:19:25 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-07 12:19:25 (UTC) |
commit | 826dc960353e47a60aba13916189c45ef3392c1e (patch) (side-by-side diff) | |
tree | 52ef4058d7a1fa8d77e678391ed9165009634182 | |
parent | 43c82cc5393522d2c34f34a4339cb6a1d1c6c555 (diff) | |
download | kdepimpi-826dc960353e47a60aba13916189c45ef3392c1e.zip kdepimpi-826dc960353e47a60aba13916189c45ef3392c1e.tar.gz kdepimpi-826dc960353e47a60aba13916189c45ef3392c1e.tar.bz2 |
sync fixes
-rw-r--r-- | kabc/addressbook.cpp | 1 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 2 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 2 |
3 files changed, 2 insertions, 3 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 295cf03..03a86f9 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp @@ -393,49 +393,48 @@ void AddressBook::export2File( QString fileName ) if ( !(*it).IDStr().isEmpty() ) { (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); } KABC::VCardConverter converter; QString vcard; //Resource *resource() const; converter.addresseeToVCard( *it, vcard, version ); t << vcard << "\r\n"; } outFile.close(); } void AddressBook::importFromFile( QString fileName ) { KABC::Addressee::List list; QFile file( fileName ); file.open( IO_ReadOnly ); QByteArray rawData = file.readAll(); file.close(); QString data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); KABC::VCardTool tool; list = tool.parseVCards( data ); - KABC::Addressee::List::Iterator it; for ( it = list.begin(); it != list.end(); ++it ) { (*it).setResource( 0 ); insertAddressee( (*it), false, true ); } } bool AddressBook::saveAB() { bool ok = true; deleteRemovedAddressees(); Iterator ait; for ( ait = begin(); ait != end(); ++ait ) { if ( !(*ait).IDStr().isEmpty() ) { (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() ); } } KRES::Manager<Resource>::ActiveIterator it; KRES::Manager<Resource> *manager = d->mManager; for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { if ( !(*it)->readOnly() && (*it)->isOpen() ) { Ticket *ticket = requestSaveTicket( *it ); diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index fa80f5c..12502b0 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -2837,51 +2837,51 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource) AddressBook abLocal( resource,"syncContact"); bool syncOK = false; if ( abLocal.load() ) { qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); mGlobalSyncMode = SYNC_MODE_EXTERNAL; abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice ); syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); if ( syncOK ) { if ( syncManager->mWriteBackFile ) { abLocal.saveAB(); abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); } } setModified(); } if ( syncOK ) mViewManager->refreshView(); return syncOK; } void KABCore::getFile( bool success ) { - qDebug("KABCore::getFile "); QTimer::singleShot( 15000, this , SLOT ( setCaptionBack())); if ( ! success ) { setCaption( i18n("Error receiving file. Nothing changed!") ); return; } mAddressBook->importFromFile( sentSyncFile() ); topLevelWidget()->setCaption( i18n("Pi-Sync successful!") ); + mViewManager->refreshView(); } void KABCore::syncFileRequest() { mAddressBook->export2File( sentSyncFile() ); } QString KABCore::sentSyncFile() { #ifdef _WIN32_ return locateLocal( "tmp", "copysyncab.vcf" ); #else return QString( "/tmp/copysyncab.vcf" ); #endif } void KABCore::setCaptionBack() { topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); } diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index aad48d9..32400af 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h @@ -101,84 +101,84 @@ private slots: QString mFileString; bool mFirst; }; class KSyncManager : public QObject { Q_OBJECT public: enum TargetApp { KOPI = 0, KAPI = 1, PWMPI = 2 }; KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); ~KSyncManager() ; bool blockSave() { return mBlockSaveFlag; } void setBlockSave(bool sa) { mBlockSaveFlag = sa; } void setDefaultFileName( QString s) { mDefFileName = s ;} QString defaultFileName() { return mDefFileName ;} QString syncFileName(); - void fillSyncMenu(); QString getCurrentSyncDevice() { return mCurrentSyncDevice; } QString getCurrentSyncName() { return mCurrentSyncName; } void showProgressBar(int percentage, QString caption = QString::null, int total=100); void hideProgressBar(); bool isProgressBarCanceled(); // sync stuff QString mLocalMachineName; QStringList mExternSyncProfiles; QStringList mSyncProfileNames; bool mAskForPreferences; bool mShowSyncSummary; bool mShowSyncEvents; bool mShowTodoInAgenda; bool mWriteBackExistingOnly; int mSyncAlgoPrefs; int mRingSyncAlgoPrefs; bool mWriteBackFile; int mWriteBackInFuture; QString mPhoneDevice; QString mPhoneConnection; QString mPhoneModel; QString mLastSyncedLocalFile; // save! QString mPassWordPiSync; QString mActiveSyncPort; QString mActiveSyncIP ; signals: void save(); void request_file(); void getFile( bool ); public slots: + void fillSyncMenu(); void slotSyncMenu( int ); void deleteCommandSocket(KCommandSocket*s, int state); void readFileFromSocket(); private: // LR ******************************* // sync stuff! void syncPi(); KServerSocket * mServerSocket; void enableQuick(); KPimPrefs* mPrefs; QString mDefFileName; QString mCurrentSyncDevice; QString mCurrentSyncName; void quickSyncLocalFile(); bool syncWithFile( QString fn , bool quick ); void syncLocalFile(); void syncPhone(); void syncSharp(); bool syncExternalApplication(QString); void multiSync( bool askforPrefs ); int mCurrentSyncProfile ; void syncRemote( KSyncProfile* prof, bool ask = true); void edit_sync_options(); |