functionality for widget explorer is there
This commit is contained in:
parent
60e5a57c23
commit
52b95779ad
@ -33,37 +33,68 @@ Rectangle {
|
||||
function toggleWidgetExplorer(explorerObject) {
|
||||
console.log("Widget Explorer toggled");
|
||||
|
||||
if (0&&sidePanel.visible) {
|
||||
explorerObject.close()
|
||||
sidePanel.visible = false;
|
||||
sidePanelStack.pop(blankPage);
|
||||
|
||||
if (sidePanelStack.state == "widgetExplorer") {
|
||||
explorerObject.close();
|
||||
sidePanelStack.state = "closed";
|
||||
} else {
|
||||
explorerObject.parent = sidePanelStack
|
||||
explorerObject.anchors.fill = parent;
|
||||
sidePanel.visible = true;
|
||||
sidePanel.height = containment.availableScreenRegion(containment.screen)[0].height;
|
||||
sidePanelStack.push(explorerObject);
|
||||
explorerObject.closed.connect(function(){sidePanelStack.state = "closed";});
|
||||
sidePanelStack.state = "widgetExplorer";
|
||||
}
|
||||
}
|
||||
|
||||
function toggleActivityManager() {
|
||||
console.log("Activity manger toggled");
|
||||
|
||||
if (sidePanel.visible) {
|
||||
sidePanelStack.source = '';
|
||||
sidePanel.visible = false;
|
||||
sidePanelStack.pop(blankPage);
|
||||
|
||||
if (sidePanelStack.state == "activitySwitcher") {
|
||||
sidePanelStack.state = "closed";
|
||||
} else {
|
||||
sidePanelStack.source = Qt.resolvedUrl("../activityswitcher/ActivitySwitcher.qml");
|
||||
sidePanel.visible = true;
|
||||
sidePanel.height = containment.availableScreenRegion(containment.screen)[0].height;
|
||||
sidePanelStack.push(Qt.resolvedUrl("../activityswitcher/ActivitySwitcher.qml"));
|
||||
sidePanelStack.state = "activitySwitcher";
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaCore.Dialog {
|
||||
id: sidePanel
|
||||
location: PlasmaCore.Types.LeftEdge
|
||||
mainItem: Loader {
|
||||
mainItem: PlasmaComponents.PageStack {
|
||||
id: sidePanelStack
|
||||
state: "closed"
|
||||
width: 250
|
||||
height: 500
|
||||
initialPage: Item {
|
||||
id: blankPage
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "closed"
|
||||
PropertyChanges {
|
||||
target: sidePanel
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "widgetExplorer"
|
||||
PropertyChanges {
|
||||
target: sidePanel
|
||||
visible: true
|
||||
height: containment.availableScreenRegion(containment.screen)[0].height;
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "activitySwitcher"
|
||||
PropertyChanges {
|
||||
target: sidePanel
|
||||
visible: true
|
||||
height: containment.availableScreenRegion(containment.screen)[0].height;
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,8 @@
|
||||
|
||||
#include <QQmlEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QQmlExpression>
|
||||
#include <QQmlProperty>
|
||||
|
||||
#include <klocalizedstring.h>
|
||||
#include <kservicetypetrader.h>
|
||||
@ -359,6 +361,10 @@ void WidgetExplorer::setSource(const QUrl &source)
|
||||
d->qmlObject->completeInitialization();
|
||||
QQuickItem *i = qobject_cast<QQuickItem *>(d->qmlObject->rootObject());
|
||||
i->setParentItem(this);
|
||||
//set anchors
|
||||
QQmlExpression expr(d->qmlObject->engine()->rootContext(), d->qmlObject->rootObject(), "parent");
|
||||
QQmlProperty prop(d->qmlObject->rootObject(), "anchors.fill");
|
||||
prop.write(expr.evaluate());
|
||||
}
|
||||
|
||||
QUrl WidgetExplorer::source() const
|
||||
@ -520,7 +526,7 @@ void WidgetExplorer::uninstall(const QString &pluginName)
|
||||
|
||||
void WidgetExplorer::close()
|
||||
{
|
||||
//d->qmlObject->engine()->rootContext()->setContextProperty("widgetExplorer", 0);
|
||||
emit closed();
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
|
@ -154,6 +154,7 @@ Q_SIGNALS:
|
||||
void orientationChanged();
|
||||
void widgetsMenuActionsChanged();
|
||||
void extraActionsChanged();
|
||||
void closed();
|
||||
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user