summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-10-08 00:24:58 (UTC)
committer ulf69 <ulf69>2004-10-08 00:24:58 (UTC)
commit309df8e8df3a17602f948025b7951b21ec5c3fed (patch) (side-by-side diff)
treef1b504be724510bd8d49b106cd1b98e09187c547
parent91e43b55a0ddf6a6f39f4ed3ae828ddad6ec89a5 (diff)
downloadkdepimpi-309df8e8df3a17602f948025b7951b21ec5c3fed.zip
kdepimpi-309df8e8df3a17602f948025b7951b21ec5c3fed.tar.gz
kdepimpi-309df8e8df3a17602f948025b7951b21ec5c3fed.tar.bz2
*** empty log message ***
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp36
-rw-r--r--pwmanager/pwmanager/pwmdoc.h34
-rw-r--r--pwmanager/pwmanager/serializer.cpp2
3 files changed, 56 insertions, 16 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
@@ -2800,6 +2800,6 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
int changedRemote = 0;
- PwMSyncItem* syncItemLocal;
- PwMSyncItem* syncItemRemote;
+ PwMSyncItem syncItemLocal;
+ PwMSyncItem syncItemRemote;
QString mCurrentSyncName = manager->getCurrentSyncName();
@@ -2829,5 +2829,5 @@ 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());
//Step 2. Find syncinfo in remote file and create if not existent.
@@ -2853,5 +2853,5 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
- if ( syncItemLocal->lastSyncDate == mLastSync ) {
+ if ( syncItemLocal.lastSyncDate == mLastSync ) {
qDebug("FULLDATE 2");
fullDateRange = true;
@@ -2859,10 +2859,10 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
if ( ! fullDateRange ) {
- if ( syncItemLocal->lastSyncDate != syncItemRemote->lastSyncDate ) {
+ if ( syncItemLocal.lastSyncDate != syncItemRemote->lastSyncDate ) {
// qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() );
//qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec());
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() );
}
}
@@ -2921,7 +2921,10 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
if ( inRemote->meta.update > mLastSync || mode == 5 ) {
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);
++addedPasswordsLocal;
@@ -2954,4 +2957,6 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
inLocal = syncLocal->findEntryByID( uid, &catLocal, &indexLocal );
inRemote = syncRemote->findEntryByID( uid, &catRemote, &indexRemote );
+ PWM_ASSERT(inLocal);
+
if ( inRemote == 0 ) {
if ( inLocal->meta.update < mLastSync && mode != 4 ) {
@@ -2964,8 +2969,15 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
++addedPasswordsRemote;
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);
}
@@ -2986,6 +2998,6 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
- syncItemLocal->lastSyncDate = mLastSync;
- syncItemRemote->lastSyncDate = mLastSync;
+ syncItemLocal.lastSyncDate = mLastSync;
+ syncItemRemote.lastSyncDate = mLastSync;
// addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ;
@@ -3283,5 +3295,5 @@ QStringList PwMDoc::getIDEntryList()
entrI = entrBegin;
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
@@ -119,5 +119,5 @@ struct PwMMetaData
//US ENH: enhancements of the filestructure
/* each entry gets a unique id assigned */
- QString uniqueid;
+ string uniqueid;
@@ -130,4 +130,15 @@ struct PwMMetaData
uniqueid = KApplication::randomString(8);
}
+
+ 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,4 +219,21 @@ 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;
+ }
+
};
@@ -764,6 +792,6 @@ 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]); }
/** delete entry */
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
@@ -647,5 +647,5 @@ 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);
e->appendChild(tag);