6 /////////////////////////////////////////////////////////////////
8 /////////////////////////////////////////////////////////////////
13 // cout << "Const FlagRow ()\n";
19 //cout << "Destr FlagRow\n";
20 // while (!flag.isEmpty())
21 // delete (flag.takeFirst() );
24 void FlagRow::addFlag (Flag *flag)
29 activeNames.append (flag->getName());
32 Flag* FlagRow::getFlag (const QString &name)
35 while (i<=flags.size()-1)
37 if (flags.at(i)->getName()==name)
44 QStringList FlagRow::activeFlagNames()
50 bool FlagRow::isActive (const QString &name)
52 return activeNames.contains (name);
55 void FlagRow::toggle (const QString &name, FlagRow *masterRow)
62 if (!masterRow) return;
64 Flag *flag=masterRow->getFlag (name);
66 QString mygroup=flag->getGroup();
68 for (int i=0;i<activeNames.size();++i)
70 flag=masterRow->getFlag (activeNames.at(i) );
71 if (name!=activeNames.at(i) && !mygroup.isEmpty() && mygroup==flag->getGroup())
72 deactivate (activeNames.at(i));
77 void FlagRow::activate (const QString &name)
79 if (!activeNames.contains (name))
80 activeNames.append (name);
82 qWarning (QString("FlagRow::activate - %1 is already active").arg(name));
86 void FlagRow::deactivate (const QString &name)
88 int n=activeNames.indexOf (name);
90 activeNames.removeAt(n);
92 qWarning (QString("FlagRow::deactivate - %1 is not active").arg(name));
95 void FlagRow::deactivateAll ()
97 if (!toolBar) activeNames.clear();
101 void FlagRow::resetUsedCounter()
103 for (int i=0; i<flags.size(); ++i)
104 flags.at(i)->setUsed (false);
107 QString FlagRow::saveToDir (const QString &tmpdir,const QString &prefix, bool writeflags)
114 if (!activeNames.isEmpty())
115 for (int i=0; i<activeNames.size(); ++i)
117 // save flag to xml, if flag is set
118 s+=valueElement("standardflag",activeNames.at(i));
120 // and tell parentRow, that this flag is used
121 masterRow->getFlag(activeNames.at(i))->setUsed(true);
124 // Save icons to dir, if verbose is set (xml export)
126 // and this flag is really used somewhere
128 for (int i=0; i<flags.size(); ++i)
129 if (flags.at(i)->isUsed()) flags.at(i)->saveToDir (tmpdir,prefix);
133 void FlagRow::setName (const QString &n)
138 void FlagRow::setToolBar (QToolBar *tb)
143 void FlagRow::setMasterRow (FlagRow *row)
148 void FlagRow::updateToolBar (const QStringList &activeNames)
152 if (activeNames.isEmpty() )
153 for (int i=0;i<flags.size();++i)
154 flags.at(i)->getAction()->setChecked (false);
156 for (int i=0;i<flags.size();++i)
157 flags.at(i)->getAction()->setChecked (
158 activeNames.contains (flags.at(i)->getName()));