diff -r dba9303a1a5c -r c810a11d11d9 flagrowobj.cpp --- a/flagrowobj.cpp Wed May 18 07:39:58 2005 +0000 +++ b/flagrowobj.cpp Mon May 23 15:28:20 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