Introduced missing CustomData on Group and Entry

Introduce missing CustomData-attributes of KDBX4 format to allow
storing of plugin data for groups and entries - adopt Metadata to use
the same storage mechanism
Add simple view for CustomData as part of EditWidgetProperties
Tracking of CustomData-Modification using SIGNAL-SLOT update-mechanism
This commit is contained in:
Christian Kieschnick 2018-02-06 16:37:06 +01:00 committed by Janek Bevendorff
parent 698b44f71c
commit 0b54710734
18 changed files with 500 additions and 118 deletions

View file

@ -295,7 +295,7 @@ void KdbxXmlReader::parseMeta()
} else if (m_xml.name() == "Binaries") {
parseBinaries();
} else if (m_xml.name() == "CustomData") {
parseCustomData();
parseCustomData(m_meta->customData());
} else if (m_xml.name() == "SettingsChanged") {
m_meta->setSettingsChanged(readDateTime());
} else {
@ -397,20 +397,20 @@ void KdbxXmlReader::parseBinaries()
}
}
void KdbxXmlReader::parseCustomData()
void KdbxXmlReader::parseCustomData(CustomData *customData)
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "CustomData");
while (!m_xml.hasError() && m_xml.readNextStartElement()) {
if (m_xml.name() == "Item") {
parseCustomDataItem();
parseCustomDataItem(customData);
continue;
}
skipCurrentElement();
}
}
void KdbxXmlReader::parseCustomDataItem()
void KdbxXmlReader::parseCustomDataItem(CustomData *customData)
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "Item");
@ -432,7 +432,7 @@ void KdbxXmlReader::parseCustomDataItem()
}
if (keySet && valueSet) {
m_meta->addCustomField(key, value);
customData->set(key, value);
return;
}
@ -583,6 +583,10 @@ Group* KdbxXmlReader::parseGroup()
}
continue;
}
if (m_xml.name() == "CustomData") {
parseCustomData(group->customData());
continue;
}
skipCurrentElement();
}
@ -744,7 +748,10 @@ Entry* KdbxXmlReader::parseEntry(bool history)
}
continue;
}
if (m_xml.name() == "CustomData" ){
parseCustomData(entry->customData());
continue;
}
skipCurrentElement();
}