GridAccount still displayed not valid accounts for choice
This commit is contained in:
parent
fea2136e73
commit
6efa5183ab
|
@ -48,7 +48,8 @@ GridAccount::GridAccount(KissCount* kiss, QWidget *parent,
|
|||
: QTableWidget(parent), _fixCosts(0), _week1(0),
|
||||
_week2(0), _week3(0), _week4(0), _week5(0), _canAddOperation(canAddOperation),
|
||||
_parent(parent), _kiss(kiss), _setWeek(setWeek),
|
||||
_databaseSynchronization(synchronizeWithDatabase), _loadOperations(false),
|
||||
_databaseSynchronization(synchronizeWithDatabase), _accounts(0),
|
||||
_loadOperations(false),
|
||||
_curMonth(0), _curYear(0), _treeSignalMapper(this), _checkSignalMapper(this),
|
||||
_deleteSignalMapper(this), _inModification(false), _completer(0),
|
||||
_transfertCompletionIndex(0)
|
||||
|
@ -56,7 +57,6 @@ GridAccount::GridAccount(KissCount* kiss, QWidget *parent,
|
|||
DEFAULT_FONT(font);
|
||||
int i;
|
||||
User* user = _kiss->GetUser();
|
||||
std::vector<Account>::iterator accountIt;
|
||||
std::vector<Category>::iterator categoryIt;
|
||||
std::vector<Tag>::iterator tagIt;
|
||||
QTableWidgetItem* item;
|
||||
|
@ -92,27 +92,6 @@ GridAccount::GridAccount(KissCount* kiss, QWidget *parent,
|
|||
label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
setCellWidget(0, CHECKED, label);
|
||||
|
||||
_nbAccounts = 0;
|
||||
for (accountIt = user->_accounts.begin();
|
||||
accountIt != user->_accounts.end();
|
||||
accountIt++)
|
||||
{
|
||||
if (!accountIt->hidden)
|
||||
_nbAccounts++;
|
||||
}
|
||||
|
||||
_accounts = new QString[_nbAccounts];
|
||||
for (i=0,
|
||||
accountIt = user->_accounts.begin();
|
||||
accountIt != user->_accounts.end();
|
||||
accountIt++, i++)
|
||||
{
|
||||
if (!accountIt->hidden)
|
||||
_accounts[i] = accountIt->name;
|
||||
else
|
||||
i--;
|
||||
}
|
||||
|
||||
_categories = new QString[user->GetCategoriesNumber()-1] ;
|
||||
for(i=0, categoryIt = user->_categories.begin()+1;
|
||||
categoryIt != user->_categories.end();
|
||||
|
@ -149,7 +128,8 @@ GridAccount::~GridAccount()
|
|||
{
|
||||
delete[] _categories;
|
||||
delete[] _tags;
|
||||
delete[] _accounts;
|
||||
if (_accounts)
|
||||
delete[] _accounts;
|
||||
if (_completer)
|
||||
delete _completer;
|
||||
}
|
||||
|
@ -210,7 +190,8 @@ void GridAccount::LoadOperations(std::vector<Operation>* operations, int month,
|
|||
{
|
||||
std::vector<Operation>::iterator it;
|
||||
User* user = _kiss->GetUser();
|
||||
int curLine = 0;
|
||||
std::vector<Account>::iterator accountIt;
|
||||
int curLine = 0, i;
|
||||
Operation NULLop;
|
||||
QStringList list;
|
||||
|
||||
|
@ -242,6 +223,29 @@ void GridAccount::LoadOperations(std::vector<Operation>* operations, int month,
|
|||
//_completer->setCompletionMode(QCompleter::InlineCompletion);
|
||||
}
|
||||
|
||||
_nbAccounts = 0;
|
||||
for (accountIt = user->_accounts.begin();
|
||||
accountIt != user->_accounts.end();
|
||||
accountIt++)
|
||||
{
|
||||
if (!accountIt->hidden && accountIt->validAt(month, year))
|
||||
_nbAccounts++;
|
||||
}
|
||||
|
||||
if (_accounts) delete[] _accounts;
|
||||
|
||||
_accounts = new QString[_nbAccounts];
|
||||
for (i=0,
|
||||
accountIt = user->_accounts.begin();
|
||||
accountIt != user->_accounts.end();
|
||||
accountIt++, i++)
|
||||
{
|
||||
if (!accountIt->hidden && accountIt->validAt(month, year))
|
||||
_accounts[i] = accountIt->name;
|
||||
else
|
||||
i--;
|
||||
}
|
||||
|
||||
TabDelegate* descriptionEditor = new TabDelegate(this, &_displayedOperations, _completer);
|
||||
setItemDelegateForColumn(DESCRIPTION, descriptionEditor);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user