Second version
This commit is contained in:
@@ -52,10 +52,12 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent, bool lowResolution) :
|
||||
|
||||
_changeAccountButton = new QPushButton(_("Change account"));
|
||||
_changeCategoryButton = new QPushButton(_("Change category"));
|
||||
_changeTagButton = new QPushButton(_("Change tag"));
|
||||
_renameButton = new QPushButton(_("Rename"));
|
||||
|
||||
connect(_changeAccountButton, SIGNAL(clicked()), this, SLOT(OnButtonChangeAccount()));
|
||||
connect(_changeCategoryButton, SIGNAL(clicked()), this, SLOT(OnButtonChangeCategory()));
|
||||
connect(_changeTagButton, SIGNAL(clicked()), this, SLOT(OnButtonChangeTag()));
|
||||
connect(_renameButton, SIGNAL(clicked()), this, SLOT(OnButtonRename()));
|
||||
|
||||
_categories = new QString[user->GetCategoriesNumber()] ;
|
||||
@@ -72,6 +74,7 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent, bool lowResolution) :
|
||||
|
||||
vbox2->addWidget(_changeAccountButton);
|
||||
vbox2->addWidget(_changeCategoryButton);
|
||||
vbox2->addWidget(_changeTagButton);
|
||||
vbox2->addWidget(_renameButton);
|
||||
|
||||
hbox->addLayout(vbox2);
|
||||
@@ -255,6 +258,51 @@ void SearchPanel::OnButtonChangeCategory()
|
||||
_wxUI->NeedReload();
|
||||
}
|
||||
|
||||
static void ChangeTag(Operation* op, void** params)
|
||||
{
|
||||
int* tag = (int*) params[0];
|
||||
|
||||
op->tag = *tag;
|
||||
}
|
||||
|
||||
void SearchPanel::OnButtonChangeTag()
|
||||
{
|
||||
int i, a;
|
||||
std::vector<int> rows;
|
||||
User* user = _kiss->GetUser();
|
||||
QStringList tags;
|
||||
std::vector<Operation>::iterator it;
|
||||
QString res;
|
||||
int tag;
|
||||
void * params[] = {&tag};
|
||||
|
||||
if (!_operations) return;
|
||||
|
||||
_grid->GetSelectedOperations(&rows);
|
||||
|
||||
tags << _("None");
|
||||
for(i=0; i < user->GetTagsNumber(); i++)
|
||||
tags << _(user->_tags[i].name.toStdString().c_str());
|
||||
|
||||
res = QInputDialog::getItem(0, "KissCount", _("Choose a new tag"), tags, 0, false);
|
||||
|
||||
if (res.length())
|
||||
{
|
||||
a = tags.indexOf(res);
|
||||
tag = user->_tags[a].id ;
|
||||
}
|
||||
else
|
||||
{
|
||||
tag = 0;
|
||||
}
|
||||
|
||||
_grid->MassUpdate(rows, true, ChangeTag, params);
|
||||
|
||||
UpdateCostRepartition();
|
||||
|
||||
_wxUI->NeedReload();
|
||||
}
|
||||
|
||||
static void ChangeName(Operation* op, void** params)
|
||||
{
|
||||
QString* description = (QString*) params[0];
|
||||
|
||||
Reference in New Issue
Block a user