expose containmentInterface::actions
the toolbox will use it
This commit is contained in:
parent
2817591bee
commit
70cef22211
@ -555,6 +555,24 @@ QString ContainmentInterface::activity() const
|
||||
return containment()->activity();
|
||||
}
|
||||
|
||||
QList<QObject*> ContainmentInterface::actions() const
|
||||
{
|
||||
//FIXME: giving directly a QList<QAction*> crashes
|
||||
|
||||
//use a multimap to sort by action type
|
||||
QMultiMap<int, QObject*> actions;
|
||||
foreach (QAction *a, containment()->actions()->actions()) {
|
||||
if (a->isEnabled()) {
|
||||
actions.insert(a->data().toInt(), a);
|
||||
}
|
||||
}
|
||||
foreach (QAction *a, containment()->corona()->actions()->actions()) {
|
||||
if (a->isEnabled()) {
|
||||
actions.insert(a->data().toInt(), a);
|
||||
}
|
||||
}
|
||||
return actions.values();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -58,6 +58,11 @@ class ContainmentInterface : public AppletInterface
|
||||
*/
|
||||
Q_PROPERTY(QString activity READ activity NOTIFY activityChanged)
|
||||
|
||||
/**
|
||||
* Actions associated to this containment or corona
|
||||
*/
|
||||
Q_PROPERTY(QList<QObject*> actions READ actions NOTIFY actionsChanged)
|
||||
|
||||
public:
|
||||
ContainmentInterface(DeclarativeAppletScript *parent);
|
||||
//Not for QML
|
||||
@ -75,6 +80,8 @@ public:
|
||||
|
||||
QString activity() const;
|
||||
|
||||
QList<QObject*> actions() const;
|
||||
|
||||
/**
|
||||
* FIXME: either a property or not accessible at all. Lock or unlock widgets
|
||||
*/
|
||||
@ -127,6 +134,7 @@ Q_SIGNALS:
|
||||
void drawWallpaperChanged();
|
||||
void containmentTypeChanged();
|
||||
///void immutableChanged();
|
||||
void actionsChanged();
|
||||
|
||||
protected Q_SLOTS:
|
||||
void appletAddedForward(Plasma::Applet *applet);
|
||||
|
Loading…
Reference in New Issue
Block a user