Second version

This commit is contained in:
2014-11-10 13:50:00 +01:00
parent 57d4b90182
commit 459e07ee11
6 changed files with 72 additions and 11 deletions

View File

@@ -121,7 +121,8 @@ GridAccount::GridAccount(KissCount* kiss, QWidget *parent,
}
_tags = new QString[user->GetTagsNumber()] ;
for(i=0, tagIt = user->_tags.begin();
_tags[0] = _("No Tag");
for(i=1, tagIt = user->_tags.begin();
tagIt != user->_tags.end();
tagIt++, i++)
{
@@ -246,7 +247,7 @@ void GridAccount::LoadOperations(std::vector<Operation>* operations, int month,
ChoiceDelegate* categoryEditor = new ChoiceDelegate(this, _categories, user->GetCategoriesNumber()-1);
setItemDelegateForColumn(CATEGORY, categoryEditor);
ChoiceDelegate* tagEditor = new ChoiceDelegate(this, _tags, user->GetTagsNumber());
ChoiceDelegate* tagEditor = new ChoiceDelegate(this, _tags, user->GetTagsNumber()+1);
setItemDelegateForColumn(TAG, tagEditor);
ChoiceDelegate* accountEditor = new ChoiceDelegate(this, _accounts, _nbAccounts);
@@ -405,7 +406,10 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix,
if (!fix && !op.meta)
setItem(line, CATEGORY, new QTableWidgetItem(_(cat.name.toStdString().c_str())));
setItem(line, TAG, new QTableWidgetItem(_(tag.name.toStdString().c_str())));
if (tag.id)
setItem(line, TAG, new QTableWidgetItem(_(tag.name.toStdString().c_str())));
else
setItem(line, TAG, new QTableWidgetItem(""));
checkBox = new QCheckBox();
checkBox->setCheckState(Qt::Unchecked);
@@ -448,6 +452,7 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix,
if (op.meta)
resizeColumnToContents(TREE);
resizeColumnToContents(CATEGORY);
resizeColumnToContents(TAG);
resizeColumnToContents(ACCOUNT);
}
}
@@ -1034,6 +1039,7 @@ void GridAccount::OnOperationModified(int row, int col)
catch (User::TagNotFound e)
{
op_complete++;
setItem(row, TAG, new QTableWidgetItem(""));
}
op_complete--;
}
@@ -1117,6 +1123,11 @@ void GridAccount::OnOperationModified(int row, int col)
if (need_insertion)
InsertIntoGrid(new_op);
else
{
resizeColumnToContents(CATEGORY);
resizeColumnToContents(TAG);
}
if (new_op.parent)
{