summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp36
-rw-r--r--pwmanager/pwmanager/pwmdoc.h38
-rw-r--r--pwmanager/pwmanager/serializer.cpp2
3 files changed, 58 insertions, 18 deletions
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp
index 76a45f4..ab3238a 100644
--- a/pwmanager/pwmanager/pwmdoc.cpp
+++ b/pwmanager/pwmanager/pwmdoc.cpp
@@ -2801,4 +2801,4 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
- PwMSyncItem* syncItemLocal;
- PwMSyncItem* syncItemRemote;
+ PwMSyncItem syncItemLocal;
+ PwMSyncItem syncItemRemote;
@@ -2830,3 +2830,3 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
syncItemLocal = syncLocal->getSyncDataEntry(index);
- qDebug("Last Sync %s ", syncItemLocal->lastSyncDate.toString().latin1());
+ qDebug("Last Sync %s ", syncItemLocal.lastSyncDate.toString().latin1());
@@ -2854,3 +2854,3 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
- if ( syncItemLocal->lastSyncDate == mLastSync ) {
+ if ( syncItemLocal.lastSyncDate == mLastSync ) {
qDebug("FULLDATE 2");
@@ -2860,3 +2860,3 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
if ( ! fullDateRange ) {
- if ( syncItemLocal->lastSyncDate != syncItemRemote->lastSyncDate ) {
+ if ( syncItemLocal.lastSyncDate != syncItemRemote->lastSyncDate ) {
@@ -2865,3 +2865,3 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
fullDateRange = true;
- qDebug("FULLDATE 3 %s %s", syncItemLocal->lastSyncDate.toString().latin1() , syncItemRemote->lastSyncDate.toString().latin1() );
+ qDebug("FULLDATE 3 %s %s", syncItemLocal.lastSyncDate.toString().latin1() , syncItemRemote.lastSyncDate.toString().latin1() );
}
@@ -2922,5 +2922,8 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
inRemote->meta.update = modifiedSync;
+
+ //first check if we have a matching category in the local file
+ const string* remotecat = syncRemote->getCategory(catRemote);
//US syncRemote->insertAddressee( inRemote, false );
//US syncLocal->insertAddressee( inRemote, false );
- syncLocal->addEntry("newcategory", inRemote, true, false);
+ syncLocal->addEntry(remotecat->c_str(), inRemote, true, false);
@@ -2955,2 +2958,4 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
inRemote = syncRemote->findEntryByID( uid, &catRemote, &indexRemote );
+ PWM_ASSERT(inLocal);
+
if ( inRemote == 0 ) {
@@ -2965,6 +2970,13 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
inLocal->meta.update = modifiedSync;
+
+ //first check if we have a matching category in the remote file
+ const string* localcat = syncLocal->getCategory(catLocal);
+
//USsyncLocal->insertAddressee( inLocal, false );
- (*inRemote) = (*inLocal);
+ PwMDataItem newEntry;
+ newEntry = *inLocal;
+ inRemote = &newEntry;
+
//USsyncRemote->insertAddressee( inRemote, false );
- syncRemote->addEntry("newcategory", inRemote, true, false);
+ syncRemote->addEntry(localcat->c_str(), inRemote, true, false);
@@ -2987,4 +2999,4 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
- syncItemLocal->lastSyncDate = mLastSync;
- syncItemRemote->lastSyncDate = mLastSync;
+ syncItemLocal.lastSyncDate = mLastSync;
+ syncItemRemote.lastSyncDate = mLastSync;
@@ -3284,3 +3296,3 @@ QStringList PwMDoc::getIDEntryList()
while (entrI != entrEnd) {
- results.append( (*entrI).meta.uniqueid );
+ results.append( (*entrI).meta.uniqueid.c_str() );
++entrI;
diff --git a/pwmanager/pwmanager/pwmdoc.h b/pwmanager/pwmanager/pwmdoc.h
index 91277f6..ddab7f3 100644
--- a/pwmanager/pwmanager/pwmdoc.h
+++ b/pwmanager/pwmanager/pwmdoc.h
@@ -118,5 +118,5 @@ struct PwMMetaData
- //US ENH: enhancements of the filestructure
- /* each entry gets a unique id assigned */
- QString uniqueid;
+ //US ENH: enhancements of the filestructure
+ /* each entry gets a unique id assigned */
+ string uniqueid;
@@ -131,2 +131,13 @@ struct PwMMetaData
}
+
+ PwMMetaData& operator = (const PwMMetaData& x)
+ {
+ create = x.create;
+ expire = x.expire;
+ update = x.update;
+ updateInt = x.updateInt;
+ uniqueid = x.uniqueid;
+ return *this;
+ }
+
inline bool isValid() const
@@ -208,2 +219,19 @@ struct PwMDataItem
}
+
+ PwMDataItem& operator = (const PwMDataItem& x)
+ {
+ qDebug("oper=%s", x.desc.c_str());
+ desc = x.desc;
+ name = x.name;
+ pw = x.pw;
+ comment = x.comment;
+ url = x.url;
+ launcher = x.launcher;
+ lockStat = x.lockStat;
+ listViewPos = x.listViewPos;
+ binary = x.binary;
+ meta = x.meta;
+ rev = x.rev;
+ return *this;
+ }
@@ -765,4 +793,4 @@ protected:
/** returns a pointer to the syncdata */
- PwMSyncItem* getSyncDataEntry(unsigned int index)
- { return &(dti.syncDta[index]); }
+ PwMSyncItem getSyncDataEntry(unsigned int index)
+ { return *(dti.syncDta[index]); }
diff --git a/pwmanager/pwmanager/serializer.cpp b/pwmanager/pwmanager/serializer.cpp
index f615082..74b3354 100644
--- a/pwmanager/pwmanager/serializer.cpp
+++ b/pwmanager/pwmanager/serializer.cpp
@@ -648,3 +648,3 @@ bool Serializer::writeMeta(QDomElement *e,
tag = domDoc->createElement(META_UNIQUEID);
- text = domDoc->createTextNode(escapeEntryData(dta.uniqueid));
+ text = domDoc->createTextNode(escapeEntryData(dta.uniqueid.c_str()));
tag.appendChild(text);