Tag management : first version
This commit is contained in:
@@ -84,6 +84,9 @@ bool XMLImportEngine::startElement (const QString& namespaceURI, const QString&
|
||||
else if (qName == "category")
|
||||
LoadCategory(attrs);
|
||||
|
||||
else if (qName == "tag")
|
||||
LoadTag(attrs);
|
||||
|
||||
else if (qName == "operation")
|
||||
LoadOperation(attrs);
|
||||
else
|
||||
@@ -201,6 +204,32 @@ void XMLImportEngine::LoadCategory(const QXmlAttributes& attrs)
|
||||
_unresolvedCategories.push_back(cat);
|
||||
}
|
||||
|
||||
void XMLImportEngine::LoadTag(const QXmlAttributes& attrs)
|
||||
{
|
||||
QString name;
|
||||
int id;
|
||||
Tag tag;
|
||||
static int unknownTag = 0;
|
||||
|
||||
tag.name = name = attrs.value("name");
|
||||
tag.id = id = attrs.value("id").toInt();
|
||||
|
||||
UNESCAPE_CHARS(tag.name);
|
||||
|
||||
try
|
||||
{
|
||||
int tagId = _user->GetTagId(name);
|
||||
|
||||
_tags[id] = tagId;
|
||||
return;
|
||||
}
|
||||
catch(User::TagNotFound e)
|
||||
{}
|
||||
|
||||
_tags[id] = --unknownTag;
|
||||
_unresolvedTags.push_back(tag);
|
||||
}
|
||||
|
||||
void XMLImportEngine::LoadOperation(const QXmlAttributes& attrs)
|
||||
{
|
||||
Operation op;
|
||||
@@ -213,6 +242,7 @@ void XMLImportEngine::LoadOperation(const QXmlAttributes& attrs)
|
||||
op.amount = attrs.value("amount").toInt();
|
||||
op.description = attrs.value("description");
|
||||
op.category = attrs.value("category").toInt();
|
||||
op.tag = attrs.value("tag").toInt();
|
||||
op.fix_cost = (attrs.value("fix_cost") == "1");
|
||||
op.account = attrs.value("account").toInt();
|
||||
op.checked = (attrs.value("checked") == "1");
|
||||
|
||||
Reference in New Issue
Block a user