1.1 --- a/flagrowobj.cpp Sun Jan 30 12:58:47 2005 +0000
1.2 +++ b/flagrowobj.cpp Fri Jul 08 07:24:42 2005 +0000
1.3 @@ -133,7 +133,7 @@
1.4 return false;
1.5 }
1.6
1.7 -void FlagRowObj::toggle (const QString &foname)
1.8 +void FlagRowObj::toggle (const QString &foname, bool exclusive)
1.9 {
1.10 FlagObj *fo=findFlag (foname);
1.11 if (fo)
1.12 @@ -150,6 +150,11 @@
1.13 {
1.14 fo=addFlag (fo);
1.15 fo->activate();
1.16 + if (exclusive)
1.17 + {
1.18 + deactivateGroup (fo);
1.19 + updateToolbar();
1.20 + }
1.21 } else
1.22 qWarning ("FlagRowObj ("+name+")::toggle ("+foname+") failed - could not find it in parentRow");
1.23 }
1.24 @@ -190,6 +195,7 @@
1.25 }
1.26 }
1.27
1.28 +
1.29 void FlagRowObj::deactivate (const QString &foname)
1.30 {
1.31 FlagObj *fo=findFlag (foname);
1.32 @@ -204,13 +210,23 @@
1.33 {
1.34 FlagObj *fo;
1.35 for (fo=flag.first();fo; fo=flag.next() )
1.36 - {
1.37 fo->deactivate();
1.38 - }
1.39 } else
1.40 qWarning ("FlagRowObj::deactivateAll mustn't be called for ordinary rows");
1.41 }
1.42
1.43 +void FlagRowObj::deactivateGroup (FlagObj *keepfo)
1.44 +{
1.45 + // deactivate all flags in keepof, but keep keepfo [sic!]
1.46 + if (keepfo)
1.47 + {
1.48 + FlagObj *fo;
1.49 + for (fo=flag.first();fo; fo=flag.next() )
1.50 + if (keepfo->getGroup()==fo->getGroup() && keepfo!=fo)
1.51 + flag.remove(fo);
1.52 + }
1.53 +}
1.54 +
1.55 void FlagRowObj::setEnabled (bool b)
1.56 {
1.57 // If we have no parent, we are the default FlagRowObj
1.58 @@ -262,6 +278,7 @@
1.59
1.60 void FlagRowObj::makeToolbar (QMainWindow *w, const QString &n)
1.61 {
1.62 + //Only make toolbar for the parentrow, not each row in branches
1.63 if (!parentRow)
1.64 {
1.65 // create bar and buttons
1.66 @@ -291,7 +308,7 @@
1.67 qWarning ("FlagRowObj::makeToolbar mustn't be called for ordinary rows");
1.68 }
1.69
1.70 -void FlagRowObj::updateToolBar()
1.71 +void FlagRowObj::updateToolbar()
1.72 {
1.73 FlagObj *fo;
1.74 if (parentRow)
1.75 @@ -301,7 +318,7 @@
1.76 // In parentRow activate all existing (==active) flags
1.77 for (fo=flag.first();fo; fo=flag.next() )
1.78 parentRow->activate(fo->getName());
1.79 - parentRow->updateToolBar();
1.80 + parentRow->updateToolbar();
1.81 } else
1.82 {
1.83 // We are the toolbar default