From kde-commits Fri Mar 31 23:26:10 2006 From: Sebastian Sauer Date: Fri, 31 Mar 2006 23:26:10 +0000 To: kde-commits Subject: playground/office/komacro/lib Message-Id: <1143847570.272200.3649.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=114384766805194 SVN commit 525155 by sebsauer: Prepare http://kexi-project.org/wiki/wiki/index.php?Macros_Discussion#Issue2:_Problem_with_ M +17 -4 macro.cpp M +6 -0 macro.h --- trunk/playground/office/komacro/lib/macro.cpp #525154:525155 @@ -40,10 +40,16 @@ public: /** + * A map of @a Action instances that are children of this + * @a Macro instance. + */ + QMap actionmap; + + /** * A list of @a Action instances that are children of this * @a Macro instance. */ - QValueList actions; + QValueList actionlist; }; @@ -90,17 +96,24 @@ void Macro::addChild(Action::Ptr action) { - d->actions.append( action ); + if(! d->actionmap.contains( action->name() )) + d->actionlist.append( action ); + d->actionmap.replace( action->name(), action ); } bool Macro::hasChildren() const { - return (! d->actions.empty()); + return (! d->actionlist.empty()); } +Action::Ptr Macro::child(const QString& name) const +{ + return d->actionmap[name]; +} + QValueList Macro::children() const { - return d->actions; + return d->actionlist; } void Macro::connectSignal(const QObject* sender, const char* signal) --- trunk/playground/office/komacro/lib/macro.h #525154:525155 @@ -90,6 +90,12 @@ bool hasChildren() const; /** + * @return the @a Action defined with \p name or NULL if + * this @a macro has no child with that name. + */ + Action::Ptr child(const QString& name) const; + + /** * @return Returns a list of @a Action children this Macro * has. */