try to expose containment directly

this is something that should not be done, still searching the least invasive way
This commit is contained in:
Marco Martin 2013-10-30 13:25:46 +01:00
parent d20bc0ea1b
commit 5ab1867657
5 changed files with 10 additions and 26 deletions

View File

@ -36,6 +36,8 @@ Item {
property int minimumWidth: theme.mSize(theme.defaultFont).width * 12
property int minimumHeight: 800//topBar.height + list.delegateHeight + (widgetExplorer.orientation == Qt.Horizontal ? scrollBar.height : 0) + 4
property alias containment: widgetExplorer.containment
property Item getWidgetsButton
property Item categoryButton
@ -43,7 +45,7 @@ Item {
WidgetExplorer {
id: widgetExplorer
view: desktop
//view: desktop
onShouldClose: main.closed();
}

View File

@ -32,7 +32,7 @@ Rectangle {
property Item containment
function toggleWidgetExplorer() {
function toggleWidgetExplorer(containment) {
console.log("Widget Explorer toggled");
sidePanelStack.pop(blankPage);
@ -42,6 +42,7 @@ Rectangle {
} else {
var page = sidePanelStack.push(Qt.resolvedUrl("../explorer/WidgetExplorer.qml"));
page.closed.connect(function(){sidePanelStack.state = "closed";});
page.containment = containment;
sidePanelStack.state = "widgetExplorer";
}
}

View File

@ -91,7 +91,7 @@ ShellCorona::ShellCorona(QObject *parent)
d->desktopDefaultsConfig = KConfigGroup(KSharedConfig::openConfig(package().filePath("defaults")), "Desktop");
qmlRegisterType<WidgetExplorer>("org.kde.plasma.private.shell", 2, 0, "WidgetExplorer");
qmlRegisterType<DesktopView>();
qmlRegisterType<Plasma::Containment>();
connect(&d->appConfigSyncTimer, &QTimer::timeout,
this, &ShellCorona::syncAppConfig);
@ -469,7 +469,7 @@ void ShellCorona::toggleWidgetExplorer()
foreach (DesktopView *view, d->views) {
if (view->screen()->geometry().contains(cursorPos)) {
//The view QML has to provide something to display the activity explorer
view->rootObject()->metaObject()->invokeMethod(view->rootObject(), "toggleWidgetExplorer");
view->rootObject()->metaObject()->invokeMethod(view->rootObject(), "toggleWidgetExplorer", Q_ARG(QVariant, QVariant::fromValue(sender())));
return;
}
}

View File

@ -297,20 +297,6 @@ WidgetExplorer::~WidgetExplorer()
}
PlasmaQuickView *WidgetExplorer::view()
{
return d->view;
}
void WidgetExplorer::setView(PlasmaQuickView *view)
{
d->view = view;
if (view) {
setContainment(view->containment());
}
emit viewChanged();
}
void WidgetExplorer::setApplication(const QString &app)
{
if (d->application == app && !app.isEmpty()) {
@ -346,6 +332,7 @@ void WidgetExplorer::setContainment(Plasma::Containment *containment)
}
d->initRunningApplets();
emit containmentChanged();
}
}

View File

@ -80,10 +80,7 @@ class WidgetExplorer : public QObject
*/
Q_PROPERTY(QString application READ application WRITE setApplication NOTIFY applicationChanged)
/**
* The view in which we want to add widgets in the end
*/
Q_PROPERTY(PlasmaQuickView *view READ view WRITE setView NOTIFY viewChanged)
Q_PROPERTY(Plasma::Containment *containment READ containment WRITE setContainment NOTIFY containmentChanged)
public:
explicit WidgetExplorer(QObject *parent = 0);
@ -116,10 +113,6 @@ public:
*/
Plasma::Corona *corona() const;
PlasmaQuickView *view();
void setView(PlasmaQuickView *view);
QObject *widgetsModel() const;
QObject *filterModel() const;
@ -137,6 +130,7 @@ Q_SIGNALS:
void shouldClose();
void viewChanged();
void applicationChanged();
void containmentChanged();
public Q_SLOTS:
/**