summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/pwmdoc.h
authorulf69 <ulf69>2004-10-06 00:35:59 (UTC)
committer ulf69 <ulf69>2004-10-06 00:35:59 (UTC)
commit904cbf4f2a418d3cadc74a6168a4565ae6ebc3c5 (patch) (side-by-side diff)
tree22bb491b5886234a0ed21b882df73732ea99bf84 /pwmanager/pwmanager/pwmdoc.h
parent07fa092b413b7cde1bd4fc797ce0b30adcb8668d (diff)
downloadkdepimpi-904cbf4f2a418d3cadc74a6168a4565ae6ebc3c5.zip
kdepimpi-904cbf4f2a418d3cadc74a6168a4565ae6ebc3c5.tar.gz
kdepimpi-904cbf4f2a418d3cadc74a6168a4565ae6ebc3c5.tar.bz2
*** empty log message ***
Diffstat (limited to 'pwmanager/pwmanager/pwmdoc.h') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwmdoc.h70
1 files changed, 62 insertions, 8 deletions
diff --git a/pwmanager/pwmanager/pwmdoc.h b/pwmanager/pwmanager/pwmdoc.h
index ea4d687..91277f6 100644
--- a/pwmanager/pwmanager/pwmdoc.h
+++ b/pwmanager/pwmanager/pwmdoc.h
@@ -206,6 +206,7 @@ struct PwMDataItem
if (clearMeta)
meta.clear();
}
+
};
struct PwMCategoryItem
@@ -222,6 +223,31 @@ struct PwMCategoryItem
}
};
+struct PwMSyncItem
+{
+ string syncName;
+ QDateTime lastSyncDate;
+
+ void clear()
+ {
+ lastSyncDate = QDateTime();
+ syncName = "";
+ }
+};
+
+struct PwMItem
+{
+ vector<PwMCategoryItem> dta;
+ vector<PwMSyncItem> syncDta;
+
+ void clear()
+ {
+ dta.clear();
+ syncDta.clear();
+ }
+};
+
+
/** "Function Object" for sort()ing PwMDataItem::listViewPos */
class dta_lvp_greater
{
@@ -440,13 +466,14 @@ public:
/** returns number of entries */
unsigned int numEntries(const QString &category);
unsigned int numEntries(unsigned int category)
- { return dta[category].d.size(); }
+ { return dti.dta[category].d.size(); }
/** returns number of categories */
unsigned int numCategories()
- { return dta.size(); }
+ { return dti.dta.size(); }
/** returns the name of the category at "index" */
const string* getCategory(unsigned int index)
- { return (&(dta[index].name)); }
+ { return (&(dti.dta[index].name)); }
+
/** returns the data of item at "index".
* It unlocks the entry if it's locked and unlockIfLocked is true.
* If the entry is locked, but unlockIfLocked is false, it'll not return
@@ -472,7 +499,7 @@ public:
/** returns the lock-status at "index" */
bool isLocked(const QString &category, unsigned int index);
bool isLocked(unsigned int category, unsigned int index)
- { return dta[category].d[index].lockStat; }
+ { return dti.dta[category].d[index].lockStat; }
/** returns the deeplock status */
bool isDeepLocked()
{ return getDocStatFlag(DOC_STAT_DEEPLOCKED); }
@@ -574,13 +601,13 @@ public:
{ --dataChangedLock; }
/** returns the revision count of the item at cat/index */
unsigned int getEntryRevCnt(unsigned int category, unsigned int index)
- { return dta[category].d[index].rev; }
+ { return dti.dta[category].d[index].rev; }
/** returns a const pointer to the entries meta */
const PwMMetaData * getEntryMeta(unsigned int category, unsigned int index)
- { return &(dta[category].d[index].meta); }
+ { return &(dti.dta[category].d[index].meta); }
/** is the entry at "category" "index" a binary entry? */
bool isBinEntry(unsigned int category, unsigned int index)
- { return dta[category].d[index].binary; }
+ { return dti.dta[category].d[index].binary; }
public slots:
/** wrapper for PwMTray */
@@ -613,8 +640,10 @@ public:
protected:
/** current file for this doc */
QString filename;
+//US ENH: we need a place where we keep the syncentries. So I invented
+// struct PwMItem, that has a vector of PwMCategoryItem and vector of PwMSyncItem
/** holds all data */
- vector<PwMCategoryItem> dta;
+ PwMItem dti;
/** maximum number of entries */
unsigned int maxEntries;
/** currently used password to encrypt data */
@@ -707,6 +736,12 @@ protected:
//US ENH: this is the magic function that syncronizes the local doc with the remote doc.
PwMerror syncronize(KSyncManager* manager, PwMDoc* syncLocal, PwMDoc* syncRemote, int mode );
+ //takePwMDataItem returns the following values
+ // 0 equal
+ // 1 take local
+ // 2 take remote
+ // 3 cancel
+ int takePwMDataItem( PwMDataItem* local, PwMDataItem* remote, QDateTime lastSync, int mode , bool full );
//the following methods are the overwritten callbackmethods from the syncinterface
virtual bool sync(KSyncManager* manager, QString filename, int mode);
@@ -717,7 +752,26 @@ protected:
virtual bool sync_isModified();
//called by the syncmanager to indicate that the work has to be saved.
virtual void sync_save();
+
#endif
+ private:
+ //US ENH: helpermethods to access the sync data for a certain syncname.
+ // It returns the syncdatas index
+ bool findSyncData(const QString &syncname, unsigned int *index);
+
+ /** add new syncdataentry */
+ PwMerror addSyncDataEntry(PwMSyncItem *d, bool dontFlagDirty = false);
+
+ /** returns a pointer to the syncdata */
+ PwMSyncItem* getSyncDataEntry(unsigned int index)
+ { return &(dti.syncDta[index]); }
+
+ /** delete entry */
+ bool delSyncDataEntry(unsigned int index, bool dontFlagDirty = false);
+
+ PwMDataItem* findEntryByID(const QString &uid, unsigned int *category, unsigned int *index);
+
+ QStringList getIDEntryList();
};