From 243e8d23e339225204724c609430f3fc49e0e345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Tue, 26 Mar 2013 01:55:17 +0100 Subject: [PATCH] make widgetexplorer show up it lists widgets, allows to add them now. Categories and download new widgets are disabled for now. It seems PlasmaComponents.MenuItem is broken (it inherits its API from QAction, but in QtQuick, it has to be a QQuickItem to be accepted as Delegate. This might need glue-api. :/) --- .../contents/explorer/AppletDelegate.qml | 9 ++- .../contents/explorer/WidgetExplorer.qml | 65 +++++++++++-------- src/shell/widgetexplorer/widgetexplorer.cpp | 2 +- src/shell/widgetexplorer/widgetexplorer.h | 5 +- 4 files changed, 50 insertions(+), 31 deletions(-) diff --git a/src/shell/qmlpackages/desktop/contents/explorer/AppletDelegate.qml b/src/shell/qmlpackages/desktop/contents/explorer/AppletDelegate.qml index 6ea09c2be..1faa195a7 100644 --- a/src/shell/qmlpackages/desktop/contents/explorer/AppletDelegate.qml +++ b/src/shell/qmlpackages/desktop/contents/explorer/AppletDelegate.qml @@ -33,10 +33,17 @@ PlasmaCore.FrameSvgItem { property string description: model.description property string author: model.author property string email: model.email - property string license: model.license + //property string license: model.license + property string license: "GPL" // FIXME property string pluginName: model.pluginName property bool local: model.local + function i18n(inp) { // FIXME: HACK! + return inp; + + } + + ListView.onRemove: SequentialAnimation { PropertyAction { target: background diff --git a/src/shell/qmlpackages/desktop/contents/explorer/WidgetExplorer.qml b/src/shell/qmlpackages/desktop/contents/explorer/WidgetExplorer.qml index 5a09d6e74..0b488f1c4 100644 --- a/src/shell/qmlpackages/desktop/contents/explorer/WidgetExplorer.qml +++ b/src/shell/qmlpackages/desktop/contents/explorer/WidgetExplorer.qml @@ -25,8 +25,10 @@ import org.kde.qtextracomponents 2.0 Item { id: main + width: 400 + height: 800 //this is used to perfectly align the filter field and delegates - property int cellWidth: theme.defaultFont.mSize.width * 20 + property int cellWidth: theme.defaultFont.pixelSize * 20 property int minimumWidth: cellWidth + ( widgetExplorer.orientation == Qt.Horizontal @@ -38,6 +40,12 @@ Item { property Item getWidgetsButton property Item categoryButton + + function i18n(inp) { // FIXME: HACK! + return inp; + + } + PlasmaComponents.ContextMenu { id: categoriesDialog visualParent: main.categoryButton @@ -45,22 +53,22 @@ Item { Repeater { parent: categoriesDialog model: widgetExplorer.filterModel - delegate: PlasmaComponents.MenuItem { - text: display - separator: model["separator"] - onClicked: { - list.contentX = 0 - list.contentY = 0 - var item = widgetExplorer.filterModel.get(index) - - widgetExplorer.widgetsModel.filterType = item.filterType - widgetExplorer.widgetsModel.filterQuery = item.filterData - main.categoryButton.text = item.display - } - Component.onCompleted: { - parent = categoriesDialog - } - } +// delegate: PlasmaComponents.MenuItem { +// text: display +// separator: model["separator"] +// onClicked: { +// list.contentX = 0 +// list.contentY = 0 +// var item = widgetExplorer.filterModel.get(index) +// +// widgetExplorer.widgetsModel.filterType = item.filterType +// widgetExplorer.widgetsModel.filterQuery = item.filterData +// main.categoryButton.text = item.display +// } +// Component.onCompleted: { +// parent = categoriesDialog +// } +// } } PlasmaComponents.ContextMenu { @@ -70,15 +78,15 @@ Item { Repeater { parent: getWidgetsDialog model: widgetExplorer.widgetsMenuActions - delegate: PlasmaComponents.MenuItem { - icon: modelData.icon - text: modelData.text - separator: modelData.separator - onClicked: modelData.trigger() - Component.onCompleted: { - parent = getWidgetsDialog - } - } +// delegate: PlasmaComponents.MenuItem { +// icon: modelData.icon +// text: modelData.text +// separator: modelData.separator +// onClicked: modelData.trigger() +// Component.onCompleted: { +// parent = getWidgetsDialog +// } +// } } PlasmaCore.Dialog { @@ -283,7 +291,7 @@ Item { id: list property int delegateWidth: (widgetExplorer.orientation == Qt.Horizontal) ? (list.width / Math.floor(list.width / cellWidth)) : list.width - property int delegateHeight: theme.defaultFont.mSize.height * 7 - 4 + property int delegateHeight: theme.defaultFont.pixelSize * 7 - 4 anchors.fill: parent @@ -313,7 +321,8 @@ Item { id: bottomBar sourceComponent: (widgetExplorer.orientation == Qt.Horizontal) ? undefined : verticalBottomBarComponent - height: item.height + //height: item.height + height: 48 // FIXME anchors { left: parent.left right: parent.right diff --git a/src/shell/widgetexplorer/widgetexplorer.cpp b/src/shell/widgetexplorer/widgetexplorer.cpp index 230aed61b..26502adc2 100644 --- a/src/shell/widgetexplorer/widgetexplorer.cpp +++ b/src/shell/widgetexplorer/widgetexplorer.cpp @@ -358,7 +358,7 @@ WidgetExplorer::WidgetExplorer(QObject *parent) :QObject(parent), d(new WidgetExplorerPrivate(this)) { - d->init(Plasma::BottomEdge); + d->init(Plasma::LeftEdge); } WidgetExplorer::~WidgetExplorer() diff --git a/src/shell/widgetexplorer/widgetexplorer.h b/src/shell/widgetexplorer/widgetexplorer.h index ea0e0377b..5790e0eeb 100644 --- a/src/shell/widgetexplorer/widgetexplorer.h +++ b/src/shell/widgetexplorer/widgetexplorer.h @@ -39,11 +39,14 @@ class WidgetExplorerPrivate; class WidgetAction : public QAction { Q_OBJECT - Q_PROPERTY(bool separator READ isSeparator WRITE setSeparator) + Q_PROPERTY(bool separator READ isSeparator WRITE setSeparator NOTIFY separatorChanged) public: WidgetAction(QObject *parent = 0); WidgetAction(const QIcon &icon, const QString &text, QObject *parent); + +Q_SIGNALS: + void separatorChanged(); }; class WidgetExplorer : public QObject