summaryrefslogtreecommitdiffabout
path: root/pwmanager
Side-by-side diff
Diffstat (limited to 'pwmanager') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/serializer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/pwmanager/pwmanager/serializer.cpp b/pwmanager/pwmanager/serializer.cpp
index fcdcec3..9377e3d 100644
--- a/pwmanager/pwmanager/serializer.cpp
+++ b/pwmanager/pwmanager/serializer.cpp
@@ -353,129 +353,129 @@ bool Serializer::extractEntry(const QDomNode &n,
} else if (name == ENTRY_LVP_NEW ||
name == ENTRY_LVP_OLD) {
dta->listViewPos = strtol(text.latin1(), 0, 10);
} else if (name == ENTRY_BIN_NEW) {
// ENTRY_BIN_NEW == ENTRY_BIN_OLD
if (text == "0") {
dta->binary = false;
} else {
dta->binary = true;
}
} else if (name == ENTRY_META_NEW) {
// ENTRY_META_NEW == ENTRY_META_OLD
if (!extractMeta(cur, &dta->meta))
return false;
} else {
printDebug(string("Serializer::extractEntry(): invalid: ")
+ name.latin1());
}
}
dta->lockStat = defaultLockStat;
return true;
}
bool Serializer::extractMeta(const QDomNode &n,
PwMMetaData *dta)
{
QDomNode cur(n.firstChild());
QString name, val;
while (!cur.isNull()) {
name = cur.nodeName();
val = cur.toElement().text();
if (val == "") {
cur = cur.nextSibling();
continue;
}
#ifndef PWM_EMBEDDED
if (name == META_CREATE_DATE) {
dta->create = QDateTime::fromString(val, Qt::ISODate);
} else if (name == META_VALID_DATE) {
dta->valid = QDateTime::fromString(val, Qt::ISODate);
} else if (name == META_EXPIRE_DATE) {
dta->expire = QDateTime::fromString(val, Qt::ISODate);
} else if (name == META_UPDATE_DATE) {
dta->update = QDateTime::fromString(val, Qt::ISODate);
} else if (name == META_UPDATE_INT) {
dta->updateInt = strtoul(val.latin1(), 0, 10);
} else if (name == META_UNIQUEID) {
dta->uniqueid = unescapeEntryData(val).latin1();
} else {
printDebug(string("extractMeta(): invalid: ")
+ name.latin1());
}
#else
QDateTime m_dt;
if ((name == META_CREATE_DATE) ||
(name == META_VALID_DATE) ||
(name == META_EXPIRE_DATE) ||
(name == META_UPDATE_DATE))
{
int pos = val.find("T");
QString date = val.left(pos);
QString time = val.mid(pos+1);
- qDebug("Serializer::extractMeta : date=%s ,time=%s",date.latin1(), time.latin1() );
+ qDebug("Serializer::extractMeta from %s to date=%s ,time=%s",val.latin1(), date.latin1(), time.latin1() );
bool ok1, ok2;
QDate m_date = KGlobal::locale()->readDate(date, &ok1);
QTime m_time = KGlobal::locale()->readTime(time, &ok2);
if ((ok1 == false) || (ok2 == false))
qDebug("Serializer::extractMeta invalid date or time !!!!!!!!!!!!!");
m_dt.setDate(m_date);
m_dt.setTime(m_time);
}
if (name == META_CREATE_DATE) {
dta->create = m_dt;
} else if (name == META_VALID_DATE) {
dta->valid = m_dt;
} else if (name == META_EXPIRE_DATE) {
dta->expire = m_dt;
} else if (name == META_UPDATE_DATE) {
dta->update = m_dt;
} else if (name == META_UPDATE_INT) {
dta->updateInt = strtoul(val.latin1(), 0, 10);
} else if (name == META_UNIQUEID) {
dta->uniqueid = unescapeEntryData(val).latin1();
} else {
printDebug(string("extractMeta(): invalid: ")
+ name.latin1());
}
#endif
cur = cur.nextSibling();
}
return true;
}
bool Serializer::checkValid()
{
PWM_ASSERT(domDoc);
QDomElement root(domDoc->documentElement());
if (root.nodeName() != ROOT_MAGIC_NEW &&
root.nodeName() != ROOT_MAGIC_OLD) {
printDebug("Serializer: wrong magic");
return false;
}
if (root.attribute(VER_STR_NEW) != COMPAT_VER_NEW &&
root.attribute(VER_STR_OLD) != COMPAT_VER_OLD) {
printDebug("Serializer: wrong version");
return false;
}
return true;
}
QDomElement Serializer::genNewRoot()
{
PWM_ASSERT(domDoc);
QDomElement root(domDoc->createElement(ROOT_MAGIC_WR));
root.setAttribute(VER_STR_WR, COMPAT_VER_WR);
domDoc->appendChild(root);
return root;
}
bool Serializer::addCategories(QDomElement *e,
const vector<PwMCategoryItem> &dta)
{
unsigned int numCat = dta.size(), i;
QString curId, curName;