author | zautrix <zautrix> | 2004-09-20 19:27:24 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-20 19:27:24 (UTC) |
commit | ed49c55dac215ac2ed9286ebfc36e5a19417f0bb (patch) (unidiff) | |
tree | 79f933ed5d4a9a9df524dbd71d41d12dde007401 | |
parent | 138be6cfa921cd8a07fa0b18046d955e7d2dbd6e (diff) | |
download | kdepimpi-ed49c55dac215ac2ed9286ebfc36e5a19417f0bb.zip kdepimpi-ed49c55dac215ac2ed9286ebfc36e5a19417f0bb.tar.gz kdepimpi-ed49c55dac215ac2ed9286ebfc36e5a19417f0bb.tar.bz2 |
more DTM sync
-rw-r--r-- | kabc/addressbook.cpp | 5 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 29 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 7 |
3 files changed, 34 insertions, 7 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 17b9ba2..adb451f 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -245,26 +245,29 @@ void AddressBook::init(const QString &config, const QString &family ) | |||
245 | fami = "contact"; | 245 | fami = "contact"; |
246 | KConfig* con = new KConfig( locateLocal("config", "syncContactrc") ); | 246 | KConfig* con = new KConfig( locateLocal("config", "syncContactrc") ); |
247 | con->setGroup( "General" ); | 247 | con->setGroup( "General" ); |
248 | con->writeEntry( "ResourceKeys", QString("sync") ); | 248 | con->writeEntry( "ResourceKeys", QString("sync") ); |
249 | con->writeEntry( "Standard", QString("sync") ); | 249 | con->writeEntry( "Standard", QString("sync") ); |
250 | con->setGroup( "Resource_sync" ); | 250 | con->setGroup( "Resource_sync" ); |
251 | con->writeEntry( "FileName", config ); | 251 | con->writeEntry( "FileName", config ); |
252 | con->writeEntry( "FileFormat", QString("vcard") ); | 252 | con->writeEntry( "FileFormat", QString("vcard") ); |
253 | con->writeEntry( "ResourceIdentifier", QString("sync") ); | 253 | con->writeEntry( "ResourceIdentifier", QString("sync") ); |
254 | con->writeEntry( "ResourceName", QString("sync_res") ); | 254 | con->writeEntry( "ResourceName", QString("sync_res") ); |
255 | if ( config.right(4) == ".xml" ) | 255 | if ( config.right(4) == ".xml" ) |
256 | con->writeEntry( "ResourceType", QString("qtopia") ); | 256 | con->writeEntry( "ResourceType", QString("qtopia") ); |
257 | else | 257 | else if ( config == "sharp" ) { |
258 | con->writeEntry( "ResourceType", QString("sharp") ); | ||
259 | } else { | ||
258 | con->writeEntry( "ResourceType", QString("file") ); | 260 | con->writeEntry( "ResourceType", QString("file") ); |
261 | } | ||
259 | //con->sync(); | 262 | //con->sync(); |
260 | d->mConfig = con; | 263 | d->mConfig = con; |
261 | } | 264 | } |
262 | else | 265 | else |
263 | d->mConfig = new KConfig( locateLocal("config", config) ); | 266 | d->mConfig = new KConfig( locateLocal("config", config) ); |
264 | // qDebug("AddressBook::init 1 config=%s",config.latin1() ); | 267 | // qDebug("AddressBook::init 1 config=%s",config.latin1() ); |
265 | } | 268 | } |
266 | else { | 269 | else { |
267 | d->mConfig = 0; | 270 | d->mConfig = 0; |
268 | // qDebug("AddressBook::init 1 config=0"); | 271 | // qDebug("AddressBook::init 1 config=0"); |
269 | } | 272 | } |
270 | 273 | ||
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index f8683e7..c1ead9d 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -3017,28 +3017,51 @@ void KABCore::confSync() | |||
3017 | #ifndef DESKTOP_VERSION | 3017 | #ifndef DESKTOP_VERSION |
3018 | sp->showMaximized(); | 3018 | sp->showMaximized(); |
3019 | #else | 3019 | #else |
3020 | sp->show(); | 3020 | sp->show(); |
3021 | #endif | 3021 | #endif |
3022 | sp->exec(); | 3022 | sp->exec(); |
3023 | KABPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); | 3023 | KABPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); |
3024 | KABPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); | 3024 | KABPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); |
3025 | fillSyncMenu(); | 3025 | fillSyncMenu(); |
3026 | } | 3026 | } |
3027 | void KABCore::syncSharp() | 3027 | void KABCore::syncSharp() |
3028 | { | 3028 | { |
3029 | if ( ! syncExternal("sharp") ) | ||
3030 | qDebug("ERROR sync sharp ");; | ||
3031 | } | ||
3032 | bool KABCore::syncExternal(QString resource) | ||
3033 | { | ||
3029 | if ( mModified ) | 3034 | if ( mModified ) |
3030 | save(); | 3035 | save(); |
3031 | qDebug("pending syncSharp() "); | 3036 | if ( KABPrefs::instance()->mAskForPreferences ) |
3032 | //mView->syncSharp(); | 3037 | edit_sync_options(); |
3033 | setModified(); | 3038 | qDebug("syncSharp() "); |
3039 | AddressBook abLocal( resource,"syncContact"); | ||
3040 | bool syncOK = false; | ||
3041 | if ( abLocal.load() ) { | ||
3042 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); | ||
3043 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | ||
3044 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice ); | ||
3045 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, KABPrefs::instance()->mSyncAlgoPrefs ); | ||
3046 | if ( syncOK ) { | ||
3047 | if ( KABPrefs::instance()->mWriteBackFile ) { | ||
3048 | abLocal.saveAB(); | ||
3049 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | ||
3050 | } | ||
3051 | } | ||
3052 | setModified(); | ||
3053 | } | ||
3054 | if ( syncOK ) | ||
3055 | mViewManager->refreshView(); | ||
3056 | return syncOK; | ||
3034 | 3057 | ||
3035 | } | 3058 | } |
3036 | void KABCore::syncPhone() | 3059 | void KABCore::syncPhone() |
3037 | { | 3060 | { |
3038 | if ( mModified ) | 3061 | if ( mModified ) |
3039 | save(); | 3062 | save(); |
3040 | qDebug("pending syncPhone(); "); | 3063 | qDebug("pending syncPhone(); "); |
3041 | //mView->syncPhone(); | 3064 | //mView->syncPhone(); |
3042 | setModified(); | 3065 | setModified(); |
3043 | 3066 | ||
3044 | } | 3067 | } |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index f01f306..e89bf41 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -451,27 +451,28 @@ class KABCore : public QWidget | |||
451 | 451 | ||
452 | #ifdef KAB_EMBEDDED | 452 | #ifdef KAB_EMBEDDED |
453 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 453 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
454 | #endif //KAB_EMBEDDED | 454 | #endif //KAB_EMBEDDED |
455 | // LR ******************************* | 455 | // LR ******************************* |
456 | // sync stuff! | 456 | // sync stuff! |
457 | QPopupMenu *syncMenu; | 457 | QPopupMenu *syncMenu; |
458 | void fillSyncMenu(); | 458 | void fillSyncMenu(); |
459 | QString mCurrentSyncDevice; | 459 | QString mCurrentSyncDevice; |
460 | QString mCurrentSyncName; | 460 | QString mCurrentSyncName; |
461 | void quickSyncLocalFile(); | 461 | void quickSyncLocalFile(); |
462 | bool syncWithFile( QString fn , bool quick ); | 462 | bool syncWithFile( QString fn , bool quick ); |
463 | void KABCore::syncLocalFile(); | 463 | void syncLocalFile(); |
464 | void KABCore::syncPhone(); | 464 | void syncPhone(); |
465 | void KABCore::syncSharp(); | 465 | void syncSharp(); |
466 | bool syncExternal(QString); | ||
466 | void multiSync( bool askforPrefs ); | 467 | void multiSync( bool askforPrefs ); |
467 | int mCurrentSyncProfile ; | 468 | int mCurrentSyncProfile ; |
468 | void syncRemote( KSyncProfile* prof, bool ask = true); | 469 | void syncRemote( KSyncProfile* prof, bool ask = true); |
469 | void edit_sync_options(); | 470 | void edit_sync_options(); |
470 | bool syncAB(QString filename, int mode); | 471 | bool syncAB(QString filename, int mode); |
471 | int ringSync(); | 472 | int ringSync(); |
472 | QString getPassword( ); | 473 | QString getPassword( ); |
473 | int mGlobalSyncMode; | 474 | int mGlobalSyncMode; |
474 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); | 475 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); |
475 | KABC::Addressee getLastSyncAddressee(); | 476 | KABC::Addressee getLastSyncAddressee(); |
476 | QDateTime mLastAddressbookSync; | 477 | QDateTime mLastAddressbookSync; |
477 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); | 478 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); |