Add ctrl+r shortcut to check/uncheck operations

This commit is contained in:
Grégory Soutadé 2018-10-07 12:18:57 +02:00
parent ec3ac0a8b4
commit 0a80a781a7
3 changed files with 28 additions and 1 deletions

View File

@ -3,6 +3,7 @@ v0.8 (07/10/2018)
Add multi month operation support : Normal operation with description "... (XX/YY)" will be forwarded to next month
Auto fill operation amount if it was the same for the last 3 operations
Add quick transfert dialog (ctrl+t shortcut)
Add ctrl+r shortcut to check/uncheck operations
** Dev **
** Bugs **
Current account value is badly computed if operations are not in date order

View File

@ -125,7 +125,10 @@ GridAccount::GridAccount(KissCount* kiss, KissPanel *parent,
connect(this, SIGNAL(cellChanged(int, int)), this, SLOT(OnOperationModified(int, int)));
if (canAddOperation)
{
_ctrlT = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_T), this, SLOT(OnCtrlT()));
_ctrlR = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_R), this, SLOT(OnCtrlR()));
}
}
GridAccount::~GridAccount()
@ -1711,3 +1714,25 @@ void GridAccount::OnCtrlT(void)
}
}
}
void GridAccount::OnCtrlR(void)
{
QModelIndexList selected = selectedIndexes();
std::vector<int> rows;
std::vector<int>::iterator it;
int row;
for (int i = 0; i < selected.size(); ++i)
{
row = selected[i].row();
it = std::find(rows.begin(), rows.end(), row);
if (it != rows.end())
continue;
OnCheckClicked(_displayedOperations[row].id);
rows.push_back(row);
}
}

View File

@ -72,6 +72,7 @@ private slots:
void OnCheckClicked(int id);
void OnDeleteClicked(int id);
void OnCtrlT(void);
void OnCtrlR(void);
private:
KissPanel* _parent;
@ -88,7 +89,7 @@ private:
bool _inModification;
QCompleter* _completer;
int _transfertCompletionIndex;
QShortcut* _ctrlT;
QShortcut* _ctrlT, *_ctrlR;
void SetWeek(int week, int line);
void ResetWeeks();