1.1 --- a/flagrowobj.cpp Tue Jun 06 14:58:11 2006 +0000
1.2 +++ b/flagrowobj.cpp Wed Jun 14 14:43:18 2006 +0000
1.3 @@ -1,5 +1,7 @@
1.4 #include "flagrowobj.h"
1.5
1.6 +#include <QToolBar>
1.7 +
1.8 /////////////////////////////////////////////////////////////////
1.9 // FlagRowObj
1.10 /////////////////////////////////////////////////////////////////
1.11 @@ -232,15 +234,16 @@
1.12 }
1.13 }
1.14
1.15 +void FlagRowObj::setToolBar(QToolBar *tb)
1.16 +{
1.17 + toolbar=tb;
1.18 +}
1.19 +
1.20 void FlagRowObj::setEnabled (bool b)
1.21 {
1.22 - // If we have no parent, we are the default FlagRowObj
1.23 - // and have QToolbarButtons
1.24 - if (!parentRow)
1.25 + if (toolbar)
1.26 {
1.27 - FlagObj *fo;
1.28 - for (fo=flag.first();fo; fo=flag.next() )
1.29 - fo->setEnabled (b);
1.30 + toolbar->setEnabled (b);
1.31 }
1.32 }
1.33
1.34 @@ -286,45 +289,13 @@
1.35 name=n;
1.36 }
1.37
1.38 -void FlagRowObj::makeToolbar (Q3MainWindow *w, const QString &n)
1.39 -{
1.40 - //Only make toolbar for the parentrow, not each row in branches
1.41 - if (!parentRow)
1.42 - {
1.43 - // create bar and buttons
1.44 - Q3ToolBar* tb = new Q3ToolBar( w);
1.45 - tb->setLabel (n);
1.46 - QAction *a;
1.47 - FlagObj *fo;
1.48 - for (fo=flag.first();fo; fo=flag.next() )
1.49 - {
1.50 - a=new QAction (
1.51 -// FIXME was in QT3: fo->getToolTip(),
1.52 - fo->getPixmap(),
1.53 - fo->getName(),
1.54 -// 0,
1.55 - w
1.56 -// fo->getName()
1.57 - );
1.58 - a->setToggleAction(true);
1.59 -// a->setTooltip (fo->getToolTip());
1.60 - // FIXME should not be enabled by default, later in updateToolbar
1.61 - a->setEnabled(true);
1.62 - a->addTo (tb);
1.63 - fo->setButton (a);
1.64 - connect(a, SIGNAL( activated() ),
1.65 - w, SLOT( standardFlagChanged() ) );
1.66 - }
1.67 - } else
1.68 - qWarning ("FlagRowObj::makeToolbar must not be called for ordinary rows");
1.69 -}
1.70 -
1.71 void FlagRowObj::updateToolbar()
1.72 {
1.73 FlagObj *fo;
1.74 if (parentRow)
1.75 {
1.76 // We are just a branch, not the toolbar default
1.77 + // but state has to be copied from ourselves to parentrow!
1.78 parentRow->deactivateAll();
1.79 // In parentRow activate all existing (==active) flags
1.80 for (fo=flag.first();fo; fo=flag.next() )
1.81 @@ -333,8 +304,12 @@
1.82 } else
1.83 {
1.84 // We are the toolbar default
1.85 - for (fo=flag.first();fo; fo=flag.next() )
1.86 - fo->updateButton();
1.87 + if (toolbar)
1.88 + {
1.89 + // Update state of actions in toolbar
1.90 + for (fo=flag.first();fo; fo=flag.next() )
1.91 + fo->updateAction();
1.92 + }
1.93 }
1.94 }
1.95