Better auto completion for transfert operation (not two times the same operation completed)
This commit is contained in:
parent
9991415e2c
commit
bfd16a6540
|
@ -1,4 +1,4 @@
|
||||||
v0.3 (27/03/2012)
|
v0.3 (11/04/2012)
|
||||||
** User **
|
** User **
|
||||||
New interface in Qt
|
New interface in Qt
|
||||||
Use BDD file from .local/share/kisscount
|
Use BDD file from .local/share/kisscount
|
||||||
|
@ -7,6 +7,7 @@ v0.3 (27/03/2012)
|
||||||
Description is now auto-completed
|
Description is now auto-completed
|
||||||
Snapshot feature
|
Snapshot feature
|
||||||
Display date in locale format
|
Display date in locale format
|
||||||
|
Better auto completion for transfert operation (not two times the same operation completed)
|
||||||
|
|
||||||
** Dev **
|
** Dev **
|
||||||
Version 3 of database (account hidden item added)
|
Version 3 of database (account hidden item added)
|
||||||
|
|
|
@ -410,10 +410,9 @@ std::vector<Operation>* KissCount::Search(QString* description, QDate* dateFrom,
|
||||||
return _db->Search(_user, description, dateFrom, dateTo, amountFrom, amountTo, categories, types, accounts, true);
|
return _db->Search(_user, description, dateFrom, dateTo, amountFrom, amountTo, categories, types, accounts, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KissCount::SearchPreviousOperation(Operation* res, Operation& op, int month, int year, bool limitToType)
|
bool KissCount::SearchPreviousOperation(Operation* res, Operation& op, int month, int year, bool limitToType, int index)
|
||||||
{
|
{
|
||||||
std::vector<Operation>* operations;
|
std::vector<Operation>* operations;
|
||||||
QDate* date ;
|
|
||||||
//wxDateSpan threeMonths(0, 3); Not working :(
|
//wxDateSpan threeMonths(0, 3); Not working :(
|
||||||
std::vector<int> v;
|
std::vector<int> v;
|
||||||
int i;
|
int i;
|
||||||
|
@ -425,15 +424,12 @@ bool KissCount::SearchPreviousOperation(Operation* res, Operation& op, int month
|
||||||
month += 12;
|
month += 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
date = new QDate(year, month, 0);
|
QDate date = QDate(year, month, 0);
|
||||||
|
|
||||||
if (limitToType)
|
if (limitToType)
|
||||||
operations = _db->Search(_user, &op.description, date, 0, 0, 0, v, op.fix_cost ? +Database::FIX_OP : +Database::NON_FIX_OP, v, false);
|
operations = _db->Search(_user, &op.description, &date, 0, 0, 0, v, op.fix_cost ? +Database::FIX_OP : +Database::NON_FIX_OP, v, false);
|
||||||
else
|
else
|
||||||
operations = _db->Search(_user, &op.description, date, 0, 0, 0, v, Database::ALL_OP, v, false);
|
operations = _db->Search(_user, &op.description, &date, 0, 0, 0, v, Database::ALL_OP, v, false);
|
||||||
|
|
||||||
|
|
||||||
delete date;
|
|
||||||
|
|
||||||
if (!operations->size())
|
if (!operations->size())
|
||||||
{
|
{
|
||||||
|
@ -442,7 +438,7 @@ bool KissCount::SearchPreviousOperation(Operation* res, Operation& op, int month
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=operations->size()-1; i>=0; i--)
|
for(i=operations->size()-1; i>=0; i--)
|
||||||
if (!(*operations)[i].meta)
|
if (!(*operations)[i].meta && index--)
|
||||||
{
|
{
|
||||||
*res = (*operations)[i];
|
*res = (*operations)[i];
|
||||||
delete operations;
|
delete operations;
|
||||||
|
|
|
@ -104,7 +104,7 @@ public:
|
||||||
double* amountFrom, double* amountTo,
|
double* amountFrom, double* amountTo,
|
||||||
std::vector<int> categories, int types, std::vector<int> accounts);
|
std::vector<int> categories, int types, std::vector<int> accounts);
|
||||||
|
|
||||||
bool SearchPreviousOperation(Operation* res, Operation& op, int month, int year, bool limitToType);
|
bool SearchPreviousOperation(Operation* res, Operation& op, int month, int year, bool limitToType, int index);
|
||||||
|
|
||||||
void GetStats(int monthFrom, int yearFrom, int monthTo, int yearTo,
|
void GetStats(int monthFrom, int yearFrom, int monthTo, int yearTo,
|
||||||
std::map<int, std::map<int, std::map<int, double> > >* accountAmounts,
|
std::map<int, std::map<int, std::map<int, double> > >* accountAmounts,
|
||||||
|
|
|
@ -49,7 +49,8 @@ GridAccount::GridAccount(KissCount* kiss, QWidget *parent,
|
||||||
_parent(parent), _kiss(kiss), _setWeek(setWeek),
|
_parent(parent), _kiss(kiss), _setWeek(setWeek),
|
||||||
_databaseSynchronization(synchronizeWithDatabase), _loadOperations(false),
|
_databaseSynchronization(synchronizeWithDatabase), _loadOperations(false),
|
||||||
_curMonth(0), _curYear(0), _treeSignalMapper(this), _checkSignalMapper(this),
|
_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);
|
DEFAULT_FONT(font);
|
||||||
int i;
|
int i;
|
||||||
|
@ -865,7 +866,7 @@ void GridAccount::OnOperationModified(int row, int col)
|
||||||
int op_complete = 6, i, last_day;
|
int op_complete = 6, i, last_day;
|
||||||
QString value, v ;
|
QString value, v ;
|
||||||
QDate date;
|
QDate date;
|
||||||
bool need_insertion = false;
|
bool need_insertion = false, transfertCompleted = false;
|
||||||
QColor color ;
|
QColor color ;
|
||||||
unsigned char r, g, b;
|
unsigned char r, g, b;
|
||||||
std::vector<int>::iterator it;
|
std::vector<int>::iterator it;
|
||||||
|
@ -926,7 +927,7 @@ void GridAccount::OnOperationModified(int row, int col)
|
||||||
!item(row, ACCOUNT)->text().length()))
|
!item(row, ACCOUNT)->text().length()))
|
||||||
{
|
{
|
||||||
new_op.fix_cost = (row <= _fixCosts);
|
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())
|
if (!item(row, CATEGORY)->text().length())
|
||||||
setItem(row, CATEGORY, new QTableWidgetItem(_(user->GetCategoryName(op_tmp.category).toStdString().c_str())));
|
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;
|
col = CATEGORY;
|
||||||
new_op.fix_cost = (new_op.category == user->GetCategoryId("Fix"));
|
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);
|
SET_ROW_FONT(row, font);
|
||||||
|
|
||||||
new_op.id = _kiss->AddOperation(new_op);
|
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)
|
if (!new_op.meta && user->GetAccount(new_op.account).blocked && new_op.amount < 0)
|
||||||
|
|
|
@ -85,6 +85,8 @@ private:
|
||||||
QSignalMapper _treeSignalMapper, _checkSignalMapper, _deleteSignalMapper;
|
QSignalMapper _treeSignalMapper, _checkSignalMapper, _deleteSignalMapper;
|
||||||
bool _inModification;
|
bool _inModification;
|
||||||
QCompleter* _completer;
|
QCompleter* _completer;
|
||||||
|
int _transfertCompletionIndex;
|
||||||
|
|
||||||
void SetWeek(int week, int line);
|
void SetWeek(int week, int line);
|
||||||
void ResetWeeks();
|
void ResetWeeks();
|
||||||
void ComputeWeeks();
|
void ComputeWeeks();
|
||||||
|
|
Loading…
Reference in New Issue