* Goup/Ungroup initial work
* Add INSTALL file * Adapt KissCount to new resolution
This commit is contained in:
@@ -160,3 +160,56 @@ void User::LinkOrUnlinkOperation(Operation& op)
|
||||
op.transfert = wxT("");
|
||||
}
|
||||
}
|
||||
|
||||
void User::Group(Operation* op)
|
||||
{
|
||||
std::vector<Operation>::iterator it;
|
||||
std::vector<Operation*>::iterator it2;
|
||||
|
||||
for (it = (*_operations[op->year])[op->month].begin(); it != (*_operations[op->year])[op->month].end(); it++)
|
||||
{
|
||||
if (it->id == op->parent)
|
||||
{
|
||||
for (it2 = it->childs.begin(); it2 != it->childs.end(); it2++)
|
||||
if ((*it2)->id == op->id)
|
||||
break;
|
||||
// Already into childs
|
||||
if (it2 != it->childs.end()) return;
|
||||
it->childs.push_back(op);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void User::UnGroup(Operation* op)
|
||||
{
|
||||
std::vector<Operation>::iterator it;
|
||||
std::vector<Operation*>::iterator it2;
|
||||
|
||||
for (it = (*_operations[op->year])[op->month].begin(); it != (*_operations[op->year])[op->month].end(); it++)
|
||||
{
|
||||
if (it->id == op->parent)
|
||||
{
|
||||
for (it2 = it->childs.begin(); it2 != it->childs.end(); it2++)
|
||||
if ((*it2)->id == op->id)
|
||||
{
|
||||
it->childs.erase(it2);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void User::ResolveGroups(int year)
|
||||
{
|
||||
unsigned int i;
|
||||
std::map<unsigned int, std::vector<Operation> >::iterator it;
|
||||
|
||||
for (it = _operations[year]->begin(); it != _operations[year]->end(); it++)
|
||||
{
|
||||
for (i=0; i<it->second.size(); i++)
|
||||
if (it->second[i].parent.Length())
|
||||
Group(&((*_operations[year])[it->first])[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user