diff -r 7a96bd401351 -r 3b0b9352cf49 flagrowobj.cpp --- a/flagrowobj.cpp Sun Jan 30 12:58:47 2005 +0000 +++ b/flagrowobj.cpp Fri Jul 08 07:24:42 2005 +0000 @@ -133,7 +133,7 @@ return false; } -void FlagRowObj::toggle (const QString &foname) +void FlagRowObj::toggle (const QString &foname, bool exclusive) { FlagObj *fo=findFlag (foname); if (fo) @@ -150,6 +150,11 @@ { fo=addFlag (fo); fo->activate(); + if (exclusive) + { + deactivateGroup (fo); + updateToolbar(); + } } else qWarning ("FlagRowObj ("+name+")::toggle ("+foname+") failed - could not find it in parentRow"); } @@ -190,6 +195,7 @@ } } + void FlagRowObj::deactivate (const QString &foname) { FlagObj *fo=findFlag (foname); @@ -204,13 +210,23 @@ { FlagObj *fo; for (fo=flag.first();fo; fo=flag.next() ) - { fo->deactivate(); - } } else qWarning ("FlagRowObj::deactivateAll mustn't be called for ordinary rows"); } +void FlagRowObj::deactivateGroup (FlagObj *keepfo) +{ + // deactivate all flags in keepof, but keep keepfo [sic!] + if (keepfo) + { + FlagObj *fo; + for (fo=flag.first();fo; fo=flag.next() ) + if (keepfo->getGroup()==fo->getGroup() && keepfo!=fo) + flag.remove(fo); + } +} + void FlagRowObj::setEnabled (bool b) { // If we have no parent, we are the default FlagRowObj @@ -262,6 +278,7 @@ void FlagRowObj::makeToolbar (QMainWindow *w, const QString &n) { + //Only make toolbar for the parentrow, not each row in branches if (!parentRow) { // create bar and buttons @@ -291,7 +308,7 @@ qWarning ("FlagRowObj::makeToolbar mustn't be called for ordinary rows"); } -void FlagRowObj::updateToolBar() +void FlagRowObj::updateToolbar() { FlagObj *fo; if (parentRow) @@ -301,7 +318,7 @@ // In parentRow activate all existing (==active) flags for (fo=flag.first();fo; fo=flag.next() ) parentRow->activate(fo->getName()); - parentRow->updateToolBar(); + parentRow->updateToolbar(); } else { // We are the toolbar default