ad a stub config ui
the config ui layout will be decided from the corona. the desktop one will end up having desktop components still missing: * binding to plasmoid object * way close the dialog * use ok/apply/cancel * how to implement difference between ok to apply and instant apply?
This commit is contained in:
parent
0b091ec503
commit
cfe6a40d3d
@ -489,11 +489,11 @@ void Applet::flushPendingConstraintsEvents()
|
||||
|
||||
QAction *configAction = d->actions->action("configure");
|
||||
if (configAction) {
|
||||
if (d->isContainment) {
|
||||
/*if (d->isContainment) {
|
||||
connect(configAction, SIGNAL(triggered(bool)), this, SLOT(requestConfiguration()), Qt::UniqueConnection);
|
||||
} else {
|
||||
connect(configAction, SIGNAL(triggered(bool)), this, SLOT(showConfigurationInterface()), Qt::UniqueConnection);
|
||||
}
|
||||
}*/
|
||||
|
||||
if (d->hasConfigurationInterface) {
|
||||
bool canConfig = unlocked || KAuthorized::authorize("plasma/allow_configure_when_locked");
|
||||
|
@ -74,6 +74,9 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, QQuickItem *pa
|
||||
connect(m_appletScriptEngine, SIGNAL(contextChanged()),
|
||||
this, SIGNAL(contextChanged()));
|
||||
|
||||
connect(applet()->action("configure"), &QAction::triggered,
|
||||
this, &AppletInterface::configureTriggered);
|
||||
|
||||
m_qmlObject = new QmlObject(this);
|
||||
m_qmlObject->setInitializationDelayed(true);
|
||||
|
||||
@ -596,4 +599,41 @@ QmlObject *AppletInterface::qmlObject()
|
||||
return m_qmlObject;
|
||||
}
|
||||
|
||||
void AppletInterface::configureTriggered()
|
||||
{
|
||||
setConfigurationInterfaceShown(true);
|
||||
}
|
||||
|
||||
void AppletInterface::setConfigurationInterfaceShown(bool show)
|
||||
{
|
||||
if (!applet()->containment() || !applet()->containment()->corona()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (show) {
|
||||
if (m_configView) {
|
||||
m_configView.data()->show();
|
||||
return;
|
||||
} else {
|
||||
m_configView = new QQuickView();
|
||||
//FIXME: problem on nvidia, all windows should be transparent or won't show
|
||||
m_configView.data()->setColor(Qt::transparent);
|
||||
m_configView.data()->setTitle(i18n("%1 Settings", applet()->title()));
|
||||
}
|
||||
|
||||
if (!applet()->containment()->corona()->package().isValid()) {
|
||||
qWarning() << "Invalid home screen package";
|
||||
}
|
||||
|
||||
m_configView.data()->setResizeMode(QQuickView::SizeRootObjectToView);
|
||||
m_configView.data()->setSource(QUrl::fromLocalFile(applet()->containment()->corona()->package().filePath("ui", "Configuration.qml")));
|
||||
m_configView.data()->show();
|
||||
} else {
|
||||
if (m_configView) {
|
||||
m_configView.data()->hide();
|
||||
m_configView.data()->deleteLater();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_appletinterface.cpp"
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <QQuickItem>
|
||||
#include <QScriptValue>
|
||||
#include <QQuickView>
|
||||
|
||||
#include <Plasma/Applet>
|
||||
#include <Plasma/Theme>
|
||||
@ -226,13 +227,15 @@ Q_SIGNALS:
|
||||
void busyChanged();
|
||||
void expandedChanged();
|
||||
|
||||
//it's important this slot is private because must not be invokable by qml
|
||||
public Q_SLOTS:
|
||||
//it's important those slots are private because must not be invokable by qml
|
||||
private Q_SLOTS:
|
||||
void init();
|
||||
void configureTriggered();
|
||||
|
||||
protected:
|
||||
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
|
||||
void itemChange(ItemChange change, const ItemChangeData &value);
|
||||
void setConfigurationInterfaceShown(bool show);
|
||||
|
||||
DeclarativeAppletScript *m_appletScriptEngine;
|
||||
|
||||
@ -248,6 +251,7 @@ private:
|
||||
//UI-specific members ------------------
|
||||
QmlObject *m_qmlObject;
|
||||
QWeakPointer<QObject> m_compactUiObject;
|
||||
QWeakPointer<QQuickView> m_configView;
|
||||
|
||||
QTimer *m_creationTimer;
|
||||
|
||||
|
113
src/shell/qmlpackages/desktop/contents/ui/Configuration.qml
Normal file
113
src/shell/qmlpackages/desktop/contents/ui/Configuration.qml
Normal file
@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright 2013 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.components 0.1 as PlasmaComponents
|
||||
import org.kde.plasma.extras 0.1 as PlasmaExtras
|
||||
import org.kde.plasma.core 0.1 as PlasmaCore
|
||||
|
||||
//TODO: all of this will be done with desktop components
|
||||
Rectangle {
|
||||
id: root
|
||||
color: "lightgray"
|
||||
width: 640
|
||||
height: 480
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
Row {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
height: parent.height - buttonsRow.height
|
||||
PlasmaExtras.ScrollArea {
|
||||
id: categoriesScroll
|
||||
anchors {
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
width: 100
|
||||
Flickable {
|
||||
contentWidth: width
|
||||
contentHeight: categoriesColumn.height
|
||||
Column {
|
||||
id: categoriesColumn
|
||||
width: parent.width
|
||||
Column {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
PlasmaCore.IconItem {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: theme.IconSizeHuge
|
||||
height: width
|
||||
source: "preferences-desktop-keyboard"
|
||||
}
|
||||
PlasmaComponents.Label {
|
||||
text: "Keyboard shortcut"
|
||||
wrapMode: Text.Wrap
|
||||
horizontalAlignment: Text.alignHCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
PlasmaExtras.ScrollArea {
|
||||
anchors {
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
width: parent.width - categoriesScroll.width
|
||||
Flickable {
|
||||
contentWidth: width
|
||||
contentHeight: main.height
|
||||
Item {
|
||||
id: main
|
||||
width: parent.width
|
||||
height: childrenRect.height
|
||||
Text {
|
||||
text: "Configuration goes here"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Row {
|
||||
id: buttonsRow
|
||||
spacing: 4
|
||||
anchors {
|
||||
right: parent.right
|
||||
rightMargin: spacing
|
||||
}
|
||||
PlasmaComponents.Button {
|
||||
iconSource: "dialog-ok"
|
||||
text: "Ok"
|
||||
}
|
||||
PlasmaComponents.Button {
|
||||
iconSource: "dialog-ok-apply"
|
||||
text: "Apply"
|
||||
}
|
||||
PlasmaComponents.Button {
|
||||
iconSource: "dialog-cancel"
|
||||
text: "Cancel"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user