5 /////////////////////////////////////////////////////////////////
7 /////////////////////////////////////////////////////////////////
12 // cout << "Const FlagRow ()\n";
18 //cout << "Destr FlagRow\n";
19 // while (!flag.isEmpty())
20 // delete (flag.takeFirst() );
23 void FlagRow::addFlag (Flag *flag)
28 activeNames.append (flag->getName());
31 Flag* FlagRow::getFlag (const QString &name)
34 while (i<=flags.size()-1)
36 if (flags.at(i)->getName()==name)
43 QStringList FlagRow::activeFlagNames()
49 bool FlagRow::isActive (const QString &name)
52 foreach (n,activeNames)
53 if (n==name) return true;
57 void FlagRow::toggle (const QString &name, FlagRow *masterRow)
64 if (!masterRow) return;
66 Flag *flag=masterRow->getFlag (name);
68 QString mygroup=flag->getGroup();
70 for (int i=0;i<activeNames.size();++i)
72 flag=masterRow->getFlag (activeNames.at(i) );
73 if (name!=activeNames.at(i) && !mygroup.isEmpty() && mygroup==flag->getGroup())
74 deactivate (activeNames.at(i));
79 void FlagRow::activate (const QString &name)
82 activeNames.append (name);
84 qWarning (QString("FlagRow::activate - %1 is already active").arg(name));
88 void FlagRow::deactivate (const QString &name) //FIXME-4 complaints if CTRL-E is pressed with focus on NoteEditor ?!
90 int n=activeNames.indexOf (name);
92 activeNames.removeAt(n);
94 qWarning (QString("FlagRow::deactivate - %1 is not active").arg(name));
97 void FlagRow::deactivateAll ()
99 if (!toolBar) activeNames.clear();
103 void FlagRow::resetUsedCounter()
105 for (int i=0; i<flags.size(); ++i)
106 flags.at(i)->setUsed (false);
109 QString FlagRow::saveToDir (const QString &tmpdir,const QString &prefix, bool writeflags)
116 if (!activeNames.isEmpty())
117 for (int i=0; i<activeNames.size(); ++i)
119 // save flag to xml, if flag is set
120 s+=valueElement("standardflag",activeNames.at(i));
122 // and tell parentRow, that this flag is used
123 masterRow->getFlag(activeNames.at(i))->setUsed(true);
126 // Save icons to dir, if verbose is set (xml export)
128 // and this flag is really used somewhere
130 for (int i=0; i<flags.size(); ++i)
131 if (flags.at(i)->isUsed()) flags.at(i)->saveToDir (tmpdir,prefix);
135 void FlagRow::setName (const QString &n)
140 void FlagRow::setToolBar (QToolBar *tb)
145 void FlagRow::setMasterRow (FlagRow *row)
150 void FlagRow::updateToolBar (const QStringList &activeNames)
154 for (int i=0;i<flags.size();++i)
155 flags.at(i)->getAction()->setChecked (false);
156 for (int i=0;i<flags.size();++i)
158 int n=activeNames.indexOf (flags.at(i)->getName());
160 flags.at(i)->getAction()->setChecked (true);