Tag management : first version

This commit is contained in:
2014-11-10 11:54:28 +01:00
parent 899dc3db71
commit 57d4b90182
32 changed files with 868 additions and 60 deletions

View File

@@ -145,13 +145,38 @@ bool CSVExportEngine::SaveCategories()
return true;
}
bool CSVExportEngine::SaveTags()
{
Tag tag;
std::map<int, int>::iterator it;
QString v;
*_writer << "Tags" << endl << endl;
*_writer << "id;name" << endl;
for(it=_tags.begin(); it!=_tags.end(); it++)
{
tag = _user->GetTag(it->first);
ESCAPE_CHARS(tag.name);
*_writer << QString::number(tag.id) << ";";
*_writer << "\"" << tag.name << "\"" << ";";
*_writer << endl;
}
*_writer << endl << endl;
return true;
}
bool CSVExportEngine::SaveOperations(std::vector<Operation>* operations)
{
std::vector<Operation>::iterator it;
QString v;
*_writer << "Operations" << endl << endl;
*_writer << "id;parent;day;month;year;amount;description;category;fix_cost;account;checked;transfert;formula;meta;virtual" << endl;
*_writer << "id;parent;day;month;year;amount;description;category;fix_cost;account;checked;transfert;formula;meta;virtual;tag" << endl;
for(it=operations->begin(); it!=operations->end(); it++)
{
@@ -172,6 +197,7 @@ bool CSVExportEngine::SaveOperations(std::vector<Operation>* operations)
*_writer << it->formula << ";";
*_writer << (it->meta ? "1" : "0") << ";";
*_writer << (it->_virtual ? "1" : "0");
*_writer << QString::number(it->tag) << ";";
*_writer << endl;
}
@@ -202,6 +228,7 @@ bool CSVExportEngine::SaveFile(std::vector<Operation>* operations)
SaveAccounts();
SaveAccountAmounts();
SaveCategories();
SaveTags();
SaveOperations(operations);
file.flush();