[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-04-01 0:27:42
Message-ID: 1143851262.042346.8032.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 525162 by sebsauer:

Option to execute synchron/asynchron. Async is default.
http://kexi-project.org/wiki/wiki/index.php?Macros_Discussion#Issue1:_Synchronous_or_asynchronous_macros_


 M  +17 -0     action.cpp  
 M  +13 -0     action.h  
 M  +11 -6     context.cpp  


--- trunk/playground/office/komacro/lib/action.cpp #525161:525162
@@ -47,6 +47,12 @@
             QString comment;
 
             /**
+             * Defines if this action should be executed synchron
+             * (blocking) or asynchron (nonblocking).
+             */
+            bool blocking;
+
+            /**
             * Cached QDomElement.
             */
             QDomElement element;
@@ -56,6 +62,7 @@
             */
             Private(Manager* const manager)
                 : manager(manager)
+                , blocking(true)
             {
             }
 
@@ -112,6 +119,16 @@
     d->comment = comment;
 }
 
+bool Action::isBlocking() const
+{
+    return d->blocking;
+}
+
+void Action::setBlocking(bool blocking)
+{
+    d->blocking = blocking;
+}
+
 const QDomElement& Action::domElement() const
 {
     return d->element;
--- trunk/playground/office/komacro/lib/action.h #525161:525162
@@ -95,6 +95,19 @@
             void setComment(const QString& comment);
 
             /**
+             * @return true if this Action should be executed synchron (blocking)
+             * or false if execution is asynchron (nonblocking).
+             */
+            bool isBlocking() const;
+
+            /**
+             * If \p blocking is true this Action will be executed synchron and
+             * therefore blocking and if its false the execution is done
+             * asynchron in a more nonblocking way.
+             */
+            void setBlocking(bool blocking);
+
+            /**
             * @return this instance as serialized QDomElement.
             */
             const QDomElement& domElement() const;
--- trunk/playground/office/komacro/lib/context.cpp #525161:525162
@@ -129,16 +129,21 @@
             Action* action = (*d->childit).data();
             //increment iterator
             ++d->childit;
-            //we got an action
-            if(action) {
-            	//connect action activated signal to our activate slot.
+            if(! action) {
+                return; //abort if there stays no action.
+            }
+            if(action->isBlocking()) { // execution should be done synchron/blocking
+                //activate the action
+                action->activate(this);
+                //recursive call ourself to handle the next action.
+                activate();
+            }
+            else { // execution should be done asynchron/nonblocking
+                //connect action activated signal to our activate slot.
                 connect(action, SIGNAL(activated()), this, SLOT(activate()));
-
                 //QTimer::singleShot(1000, action, SLOT(activate())); //testcase
-                
                 //activate the action
                 action->activate(this);
-                return; // job is done
             }
         }
     }
[prev in list] [next in list] [prev in thread] [next in thread] 

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