make the widgetexplorer work

patch by Bhushan Shah <bhush94@gmail.com>
wilder-5.14
Marco Martin 12 years ago
parent 74ba2b7bb7
commit 40067a5790
  1. 11
      shell/standaloneappcorona.cpp
  2. 1
      shell/standaloneappcorona.h

@ -43,6 +43,7 @@ StandaloneAppCorona::StandaloneAppCorona(const QString &coronaPlugin, QObject *p
Plasma::Package package = Plasma::PluginLoader::self()->loadPackage("Plasma/Shell"); Plasma::Package package = Plasma::PluginLoader::self()->loadPackage("Plasma/Shell");
package.setPath(m_coronaPlugin); package.setPath(m_coronaPlugin);
package.setAllowExternalPaths(true);
setPackage(package); setPackage(package);
Plasma::Theme theme; Plasma::Theme theme;
@ -172,6 +173,9 @@ void StandaloneAppCorona::currentActivityChanged(const QString &newActivity)
Plasma::Containment *c = createContainmentForActivity(newActivity, 0); Plasma::Containment *c = createContainmentForActivity(newActivity, 0);
connect(c, &Plasma::Containment::showAddWidgetsInterface,
this, &StandaloneAppCorona::toggleWidgetExplorer);
QAction *removeAction = c->actions()->action("remove"); QAction *removeAction = c->actions()->action("remove");
if (removeAction) { if (removeAction) {
removeAction->deleteLater(); removeAction->deleteLater();
@ -180,6 +184,13 @@ void StandaloneAppCorona::currentActivityChanged(const QString &newActivity)
} }
void StandaloneAppCorona::toggleWidgetExplorer()
{
//The view QML has to provide something to display the widget explorer
m_view->rootObject()->metaObject()->invokeMethod(m_view->rootObject(), "toggleWidgetExplorer", Q_ARG(QVariant, QVariant::fromValue(sender())));
return;
}
void StandaloneAppCorona::insertActivity(const QString &id, Activity *activity) void StandaloneAppCorona::insertActivity(const QString &id, Activity *activity)
{ {
m_activities.insert(id, activity); m_activities.insert(id, activity);

@ -52,6 +52,7 @@ public Q_SLOTS:
void currentActivityChanged(const QString &newActivity); void currentActivityChanged(const QString &newActivity);
void activityAdded(const QString &id); void activityAdded(const QString &id);
void activityRemoved(const QString &id); void activityRemoved(const QString &id);
void toggleWidgetExplorer();
protected Q_SLOTS: protected Q_SLOTS:
int screenForContainment(const Plasma::Containment *containment) const; int screenForContainment(const Plasma::Containment *containment) const;

Loading…
Cancel
Save