[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/office/komacro/lib
From:       Sebastian Sauer <mail () dipe ! org>
Date:       2006-03-31 23:26:10
Message-ID: 1143847570.272200.3649.nullmailer () svn ! kde ! org
[Download RAW message or body]

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<QString, Action::Ptr> actionmap;
+
+            /**
             * A list of @a Action instances that are children of this
             * @a Macro instance.
             */
-            QValueList<Action::Ptr> actions;
+            QValueList<Action::Ptr> 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<Action::Ptr> 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.
             */
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic