functionality for widget explorer is there

This commit is contained in:
Marco Martin 2013-10-23 22:49:17 +02:00
parent 60e5a57c23
commit 52b95779ad
3 changed files with 53 additions and 15 deletions

View File

@ -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;
}
}
]
}
}

View File

@ -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();
}

View File

@ -154,6 +154,7 @@ Q_SIGNALS:
void orientationChanged();
void widgetsMenuActionsChanged();
void extraActionsChanged();
void closed();
public Q_SLOTS:
/**