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. :/)
wilder-5.14
Sebastian Kügler 13 years ago
parent a9afbf6907
commit 276cff1ee2
  1. 9
      qmlpackages/desktop/contents/explorer/AppletDelegate.qml
  2. 65
      qmlpackages/desktop/contents/explorer/WidgetExplorer.qml
  3. 2
      widgetexplorer/widgetexplorer.cpp
  4. 5
      widgetexplorer/widgetexplorer.h

@ -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

@ -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

@ -358,7 +358,7 @@ WidgetExplorer::WidgetExplorer(QObject *parent)
:QObject(parent),
d(new WidgetExplorerPrivate(this))
{
d->init(Plasma::BottomEdge);
d->init(Plasma::LeftEdge);
}
WidgetExplorer::~WidgetExplorer()

@ -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

Loading…
Cancel
Save