[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: handling complex logic to enable/disable actions
From: Stefano Crocco <stefano.crocco () alice ! it>
Date: 2009-06-23 12:42:48
Message-ID: 200906231442.49002.stefano.crocco () alice ! it
[Download RAW message or body]
Hello to everyone,
I'm developing an application for KDE, and I'm usingthe XML GUI framework to
enable and disable actions. I know how to do it for simple situations. For
example, if I have an action which starts an external process and one which
stops it, I can write:
<State name="process_started">
<enable>
<Action name="stop_process"/>
</enable>
<disable>
<Action name="start_process/>
</disable>
</State>
This way, when I set the "process_started" state, the "stop_process" action
will be enabled and the "start_process" will be disabled.
The problem arises if I need a more complex logic to find out whether an
action should be enabled or not. For example, suppose that I have an action
called "action1" which needs to be enabled only if there are both an open
project and an open document. A first attempt would then be
<State name="project_exists">
<enable>
<Action name="action1"/>
</enable>
</State>
<State name="document_exists">
<enable>
<Action name="action1"/>
</enable>
</State>
Of course, this won't work: as soon as the "project_exists" state is set, the
action will be activated, even if the "document_exists" state isn't set.
My question is: is it possible to use the XML GUI framework also to handle
these more complex situations? If, that's impossible, what would be the best
approach? I tried searching the KDE API documentation and google for hints,
but found nothing. I also thought of looking at the source code of some
application which could have the same problem, but I could think of none.
Any suggestions are welcome
Thanks in advance
Stefano
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic