Better auto completion for transfert operation (not two times the same operation completed)
This commit is contained in:
@@ -49,7 +49,8 @@ GridAccount::GridAccount(KissCount* kiss, QWidget *parent,
|
||||
_parent(parent), _kiss(kiss), _setWeek(setWeek),
|
||||
_databaseSynchronization(synchronizeWithDatabase), _loadOperations(false),
|
||||
_curMonth(0), _curYear(0), _treeSignalMapper(this), _checkSignalMapper(this),
|
||||
_deleteSignalMapper(this), _inModification(false), _completer(0)
|
||||
_deleteSignalMapper(this), _inModification(false), _completer(0),
|
||||
_transfertCompletionIndex(0)
|
||||
{
|
||||
DEFAULT_FONT(font);
|
||||
int i;
|
||||
@@ -865,7 +866,7 @@ void GridAccount::OnOperationModified(int row, int col)
|
||||
int op_complete = 6, i, last_day;
|
||||
QString value, v ;
|
||||
QDate date;
|
||||
bool need_insertion = false;
|
||||
bool need_insertion = false, transfertCompleted = false;
|
||||
QColor color ;
|
||||
unsigned char r, g, b;
|
||||
std::vector<int>::iterator it;
|
||||
@@ -926,7 +927,7 @@ void GridAccount::OnOperationModified(int row, int col)
|
||||
!item(row, ACCOUNT)->text().length()))
|
||||
{
|
||||
new_op.fix_cost = (row <= _fixCosts);
|
||||
if (_kiss->SearchPreviousOperation(&op_tmp, new_op, _curMonth, _curYear, _canAddOperation))
|
||||
if (_kiss->SearchPreviousOperation(&op_tmp, new_op, _curMonth, _curYear, _canAddOperation, _transfertCompletionIndex))
|
||||
{
|
||||
if (!item(row, CATEGORY)->text().length())
|
||||
setItem(row, CATEGORY, new QTableWidgetItem(_(user->GetCategoryName(op_tmp.category).toStdString().c_str())));
|
||||
@@ -936,6 +937,8 @@ void GridAccount::OnOperationModified(int row, int col)
|
||||
|
||||
col = CATEGORY;
|
||||
new_op.fix_cost = (new_op.category == user->GetCategoryId("Fix"));
|
||||
if (op_tmp.transfert != 0)
|
||||
transfertCompleted = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1066,6 +1069,9 @@ void GridAccount::OnOperationModified(int row, int col)
|
||||
SET_ROW_FONT(row, font);
|
||||
|
||||
new_op.id = _kiss->AddOperation(new_op);
|
||||
|
||||
if (transfertCompleted)
|
||||
_transfertCompletionIndex = (_transfertCompletionIndex + 1) % 2;
|
||||
}
|
||||
|
||||
if (!new_op.meta && user->GetAccount(new_op.account).blocked && new_op.amount < 0)
|
||||
|
||||
@@ -85,6 +85,8 @@ private:
|
||||
QSignalMapper _treeSignalMapper, _checkSignalMapper, _deleteSignalMapper;
|
||||
bool _inModification;
|
||||
QCompleter* _completer;
|
||||
int _transfertCompletionIndex;
|
||||
|
||||
void SetWeek(int week, int line);
|
||||
void ResetWeeks();
|
||||
void ComputeWeeks();
|
||||
|
||||
Reference in New Issue
Block a user