summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-10-08 00:24:58 (UTC)
committer ulf69 <ulf69>2004-10-08 00:24:58 (UTC)
commit309df8e8df3a17602f948025b7951b21ec5c3fed (patch) (unidiff)
treef1b504be724510bd8d49b106cd1b98e09187c547
parent91e43b55a0ddf6a6f39f4ed3ae828ddad6ec89a5 (diff)
downloadkdepimpi-309df8e8df3a17602f948025b7951b21ec5c3fed.zip
kdepimpi-309df8e8df3a17602f948025b7951b21ec5c3fed.tar.gz
kdepimpi-309df8e8df3a17602f948025b7951b21ec5c3fed.tar.bz2
*** empty log message ***
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
@@ -2800,6 +2800,6 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
2800 int changedRemote = 0; 2800 int changedRemote = 0;
2801 2801
2802 PwMSyncItem* syncItemLocal; 2802 PwMSyncItem syncItemLocal;
2803 PwMSyncItem* syncItemRemote; 2803 PwMSyncItem syncItemRemote;
2804 2804
2805 QString mCurrentSyncName = manager->getCurrentSyncName(); 2805 QString mCurrentSyncName = manager->getCurrentSyncName();
@@ -2829,5 +2829,5 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
2829 2829
2830 syncItemLocal = syncLocal->getSyncDataEntry(index); 2830 syncItemLocal = syncLocal->getSyncDataEntry(index);
2831 qDebug("Last Sync %s ", syncItemLocal->lastSyncDate.toString().latin1()); 2831 qDebug("Last Sync %s ", syncItemLocal.lastSyncDate.toString().latin1());
2832 2832
2833 //Step 2. Find syncinfo in remote file and create if not existent. 2833 //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
2853 2853
2854 2854
2855 if ( syncItemLocal->lastSyncDate == mLastSync ) { 2855 if ( syncItemLocal.lastSyncDate == mLastSync ) {
2856 qDebug("FULLDATE 2"); 2856 qDebug("FULLDATE 2");
2857 fullDateRange = true; 2857 fullDateRange = true;
@@ -2859,10 +2859,10 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
2859 2859
2860 if ( ! fullDateRange ) { 2860 if ( ! fullDateRange ) {
2861 if ( syncItemLocal->lastSyncDate != syncItemRemote->lastSyncDate ) { 2861 if ( syncItemLocal.lastSyncDate != syncItemRemote->lastSyncDate ) {
2862 2862
2863 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); 2863 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() );
2864 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); 2864 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec());
2865 fullDateRange = true; 2865 fullDateRange = true;
2866 qDebug("FULLDATE 3 %s %s", syncItemLocal->lastSyncDate.toString().latin1() , syncItemRemote->lastSyncDate.toString().latin1() ); 2866 qDebug("FULLDATE 3 %s %s", syncItemLocal.lastSyncDate.toString().latin1() , syncItemRemote.lastSyncDate.toString().latin1() );
2867 } 2867 }
2868 } 2868 }
@@ -2921,7 +2921,10 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
2921 if ( inRemote->meta.update > mLastSync || mode == 5 ) { 2921 if ( inRemote->meta.update > mLastSync || mode == 5 ) {
2922 inRemote->meta.update = modifiedSync; 2922 inRemote->meta.update = modifiedSync;
2923
2924 //first check if we have a matching category in the local file
2925 const string* remotecat = syncRemote->getCategory(catRemote);
2923 //US syncRemote->insertAddressee( inRemote, false ); 2926 //US syncRemote->insertAddressee( inRemote, false );
2924 //US syncLocal->insertAddressee( inRemote, false ); 2927 //US syncLocal->insertAddressee( inRemote, false );
2925 syncLocal->addEntry("newcategory", inRemote, true, false); 2928 syncLocal->addEntry(remotecat->c_str(), inRemote, true, false);
2926 2929
2927 ++addedPasswordsLocal; 2930 ++addedPasswordsLocal;
@@ -2954,4 +2957,6 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
2954 inLocal = syncLocal->findEntryByID( uid, &catLocal, &indexLocal ); 2957 inLocal = syncLocal->findEntryByID( uid, &catLocal, &indexLocal );
2955 inRemote = syncRemote->findEntryByID( uid, &catRemote, &indexRemote ); 2958 inRemote = syncRemote->findEntryByID( uid, &catRemote, &indexRemote );
2959 PWM_ASSERT(inLocal);
2960
2956 if ( inRemote == 0 ) { 2961 if ( inRemote == 0 ) {
2957 if ( inLocal->meta.update < mLastSync && mode != 4 ) { 2962 if ( inLocal->meta.update < mLastSync && mode != 4 ) {
@@ -2964,8 +2969,15 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
2964 ++addedPasswordsRemote; 2969 ++addedPasswordsRemote;
2965 inLocal->meta.update = modifiedSync; 2970 inLocal->meta.update = modifiedSync;
2971
2972 //first check if we have a matching category in the remote file
2973 const string* localcat = syncLocal->getCategory(catLocal);
2974
2966 //USsyncLocal->insertAddressee( inLocal, false ); 2975 //USsyncLocal->insertAddressee( inLocal, false );
2967 (*inRemote) = (*inLocal); 2976 PwMDataItem newEntry;
2977 newEntry = *inLocal;
2978 inRemote = &newEntry;
2979
2968 //USsyncRemote->insertAddressee( inRemote, false ); 2980 //USsyncRemote->insertAddressee( inRemote, false );
2969 syncRemote->addEntry("newcategory", inRemote, true, false); 2981 syncRemote->addEntry(localcat->c_str(), inRemote, true, false);
2970 2982
2971 } 2983 }
@@ -2986,6 +2998,6 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
2986 2998
2987 2999
2988 syncItemLocal->lastSyncDate = mLastSync; 3000 syncItemLocal.lastSyncDate = mLastSync;
2989 syncItemRemote->lastSyncDate = mLastSync; 3001 syncItemRemote.lastSyncDate = mLastSync;
2990 3002
2991 // addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; 3003 // addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ;
@@ -3283,5 +3295,5 @@ QStringList PwMDoc::getIDEntryList()
3283 entrI = entrBegin; 3295 entrI = entrBegin;
3284 while (entrI != entrEnd) { 3296 while (entrI != entrEnd) {
3285 results.append( (*entrI).meta.uniqueid ); 3297 results.append( (*entrI).meta.uniqueid.c_str() );
3286 ++entrI; 3298 ++entrI;
3287 } 3299 }
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
@@ -117,7 +117,7 @@ struct PwMMetaData
117 unsigned long updateInt; 117 unsigned long updateInt;
118 118
119 //US ENH: enhancements of the filestructure 119 //US ENH: enhancements of the filestructure
120 /* each entry gets a unique id assigned */ 120 /* each entry gets a unique id assigned */
121 QString uniqueid; 121 string uniqueid;
122 122
123 123
@@ -130,4 +130,15 @@ struct PwMMetaData
130 uniqueid = KApplication::randomString(8); 130 uniqueid = KApplication::randomString(8);
131 } 131 }
132
133 PwMMetaData& operator = (const PwMMetaData& x)
134 {
135 create = x.create;
136 expire = x.expire;
137 update = x.update;
138 updateInt = x.updateInt;
139 uniqueid = x.uniqueid;
140 return *this;
141 }
142
132 inline bool isValid() const 143 inline bool isValid() const
133 { 144 {
@@ -207,4 +218,21 @@ struct PwMDataItem
207 meta.clear(); 218 meta.clear();
208 } 219 }
220
221 PwMDataItem& operator = (const PwMDataItem& x)
222 {
223 qDebug("oper=%s", x.desc.c_str());
224 desc = x.desc;
225 name = x.name;
226 pw = x.pw;
227 comment = x.comment;
228 url = x.url;
229 launcher = x.launcher;
230 lockStat = x.lockStat;
231 listViewPos = x.listViewPos;
232 binary = x.binary;
233 meta = x.meta;
234 rev = x.rev;
235 return *this;
236 }
209 237
210}; 238};
@@ -764,6 +792,6 @@ protected:
764 792
765 /** returns a pointer to the syncdata */ 793 /** returns a pointer to the syncdata */
766 PwMSyncItem* getSyncDataEntry(unsigned int index) 794 PwMSyncItem getSyncDataEntry(unsigned int index)
767 { return &(dti.syncDta[index]); } 795 { return *(dti.syncDta[index]); }
768 796
769 /** delete entry */ 797 /** 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,
647 647
648 tag = domDoc->createElement(META_UNIQUEID); 648 tag = domDoc->createElement(META_UNIQUEID);
649 text = domDoc->createTextNode(escapeEntryData(dta.uniqueid)); 649 text = domDoc->createTextNode(escapeEntryData(dta.uniqueid.c_str()));
650 tag.appendChild(text); 650 tag.appendChild(text);
651 e->appendChild(tag); 651 e->appendChild(tag);