Unity Action API
Signals | Public Member Functions | Properties | List of all members
unity::action::ActionManager Class Reference
Inheritance diagram for unity::action::ActionManager:

Signals

void actionsChanged ()
 
void localContextsChanged ()
 
 Q_REVISION (1) void quit()
 

Public Member Functions

 ActionManager (QObject *parent=0)
 
QSet< Action * > actions () const
 
Q_INVOKABLE void addAction (unity::action::Action *action)
 
Q_INVOKABLE void addLocalContext (unity::action::ActionContext *context)
 
Q_INVOKABLE unity::action::ActionContextglobalContext ()
 
QSet< ActionContext * > localContexts () const
 
Q_INVOKABLE void removeAction (unity::action::Action *action)
 
Q_INVOKABLE void removeLocalContext (unity::action::ActionContext *context)
 

Properties

unity::action::ActionContext globalContext
 

Detailed Description

ActionManager exports the application actions to the external components. See Platform Integration and Action Contexts for more details.

Constructor & Destructor Documentation

ActionManager::ActionManager ( QObject *  parent = 0)
explicit
Parameters
parentparent QObject or 0

Creates a new ActionManager.

Also creates a global context which can be accessed with ActionManager::globalContext

Member Function Documentation

QSet< Action * > ActionManager::actions ( ) const
Returns
The set of actions the manager is currently aware of.

If an action is part of multiple contexts it's still only included once in the set.

void unity::action::ActionManager::actionsChanged ( )
signal

An action was either added or removed from the global context or any of the local contexts the manager is currently tracking.

void ActionManager::addAction ( unity::action::Action action)
Parameters
actionaction to be added

this is a shorthand for

manager->globalContext()->addAction(action);
See also
ActionContext::addAction()
void ActionManager::addLocalContext ( unity::action::ActionContext context)
Parameters
contextcontext to be added

Adds a local context.

Calling this function multiple times with the same context does not have any side effects; the context gets added only once.

ActionManager monitors if the context is deleted and does the appropriate cleanup when necessary, so it is not mandatory to call removeLocalContext() before the context is destroyed.

Note
If context::active is true when added, the context is made the current active one.
context must not be 0.
QSet< ActionContext * > ActionManager::localContexts ( ) const
Returns
The set of local contexts the manager is aware of.
void unity::action::ActionManager::localContextsChanged ( )
signal

A local context was either added or removed.

void ActionManager::removeAction ( unity::action::Action action)
Parameters
actionaction to be removed

this is a shorthand for

manager->globalContext()->removeAction(action);
See also
ActionContext::removeAction()
void ActionManager::removeLocalContext ( unity::action::ActionContext context)
Parameters
contextcontext to be removed

Removes a local context.

Calling this function multiple times with the same context does not have any side effects; the context gets removed only if it was previously added with addLocalContext().

Note
if the removed context is the current active one after the removal there is no active local context.
context must not be 0

Property Documentation

ActionContext * ActionManager::globalContext
read

The globalContext of the Application.

Note
Setting the ActionContext::active on the global context has no effect;
Accessors:
globalContext()

The documentation for this class was generated from the following files: