Diffstat (limited to 'pwmanager/pwmanager/serializer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | pwmanager/pwmanager/serializer.cpp | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/pwmanager/pwmanager/serializer.cpp b/pwmanager/pwmanager/serializer.cpp index 5753c1d..507fa30 100644 --- a/pwmanager/pwmanager/serializer.cpp +++ b/pwmanager/pwmanager/serializer.cpp @@ -41,3 +41,3 @@ #define META_UPDATE_INT "i" -//US ENH : uniqueid +//US ENH : uniqueid and sync information #define META_UNIQUEID "n" @@ -58,2 +58,5 @@ #define CAT_NAME_OLD "name" +//US ENH : optional text for categories +#define CAT_TEXT_OLD "text" + #define ENTRY_PREFIX_OLD "entry_" @@ -75,2 +78,5 @@ #define CAT_NAME_NEW "n" +//US ENH : optional text for categories +#define CAT_TEXT_NEW "t" + #define ENTRY_PREFIX_NEW "e" @@ -93,2 +99,6 @@ # define CAT_NAME_WR CAT_NAME_OLD + +//US ENH : optional text for categories +# define CAT_TEXT_WR CAT_TEXT_OLD + # define ENTRY_PREFIX_WR ENTRY_PREFIX_OLD @@ -110,2 +120,6 @@ # define CAT_NAME_WR CAT_NAME_NEW + +//US ENH : optional text for categories +# define CAT_TEXT_WR CAT_TEXT_NEW + # define ENTRY_PREFIX_WR ENTRY_PREFIX_NEW @@ -273,2 +287,3 @@ bool Serializer::readCategories(const QDomNode &n, QString name; + QString text; unsigned int numCat = nl.count(), i; @@ -292,2 +307,19 @@ bool Serializer::readCategories(const QDomNode &n, curCat.name = name.latin1(); + + //US ENH: new version might include text for description, name and pw + text = cur.toElement().attribute(CAT_TEXT_NEW); + if (text == QString::null) + text = cur.toElement().attribute(CAT_TEXT_OLD); + if (text != QString::null) + { + QStringList textlist = QStringList::split(";", text, true); + unsigned int num = textlist.count(); + if (num > 0) + curCat.desc_text = textlist[0].latin1(); + if (num > 1) + curCat.name_text = textlist[1].latin1(); + if (num > 2) + curCat.pw_text = textlist[2].latin1(); + } + if (!readEntries(cur, &curEntr)) { @@ -503,2 +535,12 @@ bool Serializer::addCategories(QDomElement *e, curCat.setAttribute(CAT_NAME_WR, curName); + + //US ENH: new version includes text for description, name and pw + QStringList curTextList; + curTextList << dta[i].desc_text.c_str(); + curTextList << dta[i].name_text.c_str(); + curTextList << dta[i].pw_text.c_str(); + QString text = curTextList.join(";"); + curCat.setAttribute(CAT_TEXT_WR, text); + + if (!addEntries(&curCat, dta[i].d)) { |