author | ulf69 <ulf69> | 2004-10-29 01:27:31 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-10-29 01:27:31 (UTC) |
commit | f8dd437160acec2959c462dd43d87f2a0920c0b9 (patch) (side-by-side diff) | |
tree | ddd271930f54adc1b7220d534f682f616efeb20a /pwmanager | |
parent | 1b8d173d880e8f681bca88220bdd806a95d3c2a0 (diff) | |
download | kdepimpi-f8dd437160acec2959c462dd43d87f2a0920c0b9.zip kdepimpi-f8dd437160acec2959c462dd43d87f2a0920c0b9.tar.gz kdepimpi-f8dd437160acec2959c462dd43d87f2a0920c0b9.tar.bz2 |
enabling/disabling syncing of launcher
-rw-r--r-- | pwmanager/pwmanager/pwmdoc.cpp | 10 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmdoc.h | 20 |
2 files changed, 24 insertions, 6 deletions
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp index fd17ce5..9043acc 100644 --- a/pwmanager/pwmanager/pwmdoc.cpp +++ b/pwmanager/pwmanager/pwmdoc.cpp @@ -3015,16 +3015,18 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s int changedRemote = 0; PwMSyncItem* syncItemLocal; PwMSyncItem* syncItemRemote; QString mCurrentSyncName = manager->getCurrentSyncName(); QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); + bool mSyncLauncher = true; + bool fullDateRange = false; int take; // local->resetTempSyncStat(); QDateTime mLastSync = QDateTime::currentDateTime(); QDateTime modifiedSync = mLastSync; unsigned int index; //Step 1. Find syncinfo in Local file and create if not existent. @@ -3115,24 +3117,20 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s inRemote = syncRemote->findEntryByID( uid, &catRemote, &indexRemote ); PWM_ASSERT(inRemote); if ( inLocal != 0 ) { // maybe conflict - same uid in both files if ( (take = takePwMDataItem( inLocal, inRemote, mLastSync, mode, fullDateRange) ) ) { qDebug("take %d %s ", take, inLocal->desc.c_str()); if ( take == 3 ) return e_syncError; if ( take == 1 ) {// take local - int oldlistpos = inRemote->listViewPos; - (*inRemote) = (*inLocal); - inRemote->listViewPos = oldlistpos; + inRemote->syncItem(*inLocal, mSyncLauncher); ++changedRemote; } else { // take == 2 take remote - int oldlistpos = inLocal->listViewPos; - (*inLocal) = (*inRemote); - inLocal->listViewPos = oldlistpos; + inLocal->syncItem(*inRemote, mSyncLauncher); ++changedLocal; } } } else { // no conflict if ( inRemote->meta.update > mLastSync || mode == 5 ) { inRemote->meta.update = modifiedSync; //first check if we have a matching category in the local file diff --git a/pwmanager/pwmanager/pwmdoc.h b/pwmanager/pwmanager/pwmdoc.h index e419c24..09923ab 100644 --- a/pwmanager/pwmanager/pwmdoc.h +++ b/pwmanager/pwmanager/pwmdoc.h @@ -219,16 +219,36 @@ struct PwMDataItem if ( name != a.name ) return false; if ( pw != a.pw ) return false; if ( comment != a.comment ) return false; if ( url != a.url ) return false; if ( launcher != a.launcher ) return false; //all other field will not be checked. return true; } + + //US ENH: this sync method actually copies all values from the parameter like the =operator + //does with two exceptions: listViewPos will not be changed, and the launcher only if required. + bool PwMDataItem::syncItem(const PwMDataItem &a, bool syncLauncher=true ) + { + desc = a.desc; + name = a.name; + pw = a.pw; + comment = a.comment; + url = a.url; + if (syncLauncher == true) + launcher = a.launcher; + meta = a.meta; + binary = a.binary; + lockStat = a.lockStat; + rev = a.rev; + + return true; + } + }; struct PwMCategoryItem { /** all PwMDataItems (all passwords) within this category */ vector<PwMDataItem> d; /** category name/description */ string name; |