move the config dialog in the shell
it still doesn't successfully load
This commit is contained in:
parent
db5ef57480
commit
e7ca00e534
@ -73,8 +73,8 @@ AppletPrivate::AppletPrivate(KService::Ptr service, const KPluginInfo *info, int
|
|||||||
} else if (appletId > s_maxAppletId) {
|
} else if (appletId > s_maxAppletId) {
|
||||||
s_maxAppletId = appletId;
|
s_maxAppletId = appletId;
|
||||||
}
|
}
|
||||||
QObject::connect(actions->action("configure"), SIGNAL(QAction::triggered()),
|
QObject::connect(actions->action("configure"), SIGNAL(triggered()),
|
||||||
q, SLOT(Applet::requestConfiguration));
|
q, SLOT(requestConfiguration()));
|
||||||
}
|
}
|
||||||
|
|
||||||
AppletPrivate::~AppletPrivate()
|
AppletPrivate::~AppletPrivate()
|
||||||
|
@ -18,8 +18,6 @@ set(declarative_appletscript_SRCS
|
|||||||
declarative/packageaccessmanagerfactory.cpp
|
declarative/packageaccessmanagerfactory.cpp
|
||||||
declarative/qmlobject.cpp
|
declarative/qmlobject.cpp
|
||||||
plasmoid/appletinterface.cpp
|
plasmoid/appletinterface.cpp
|
||||||
plasmoid/configview.cpp
|
|
||||||
plasmoid/containmentconfigview.cpp
|
|
||||||
plasmoid/containmentinterface.cpp
|
plasmoid/containmentinterface.cpp
|
||||||
plasmoid/declarativeappletscript.cpp
|
plasmoid/declarativeappletscript.cpp
|
||||||
plasmoid/wallpaperinterface.cpp
|
plasmoid/wallpaperinterface.cpp
|
||||||
|
@ -46,8 +46,6 @@
|
|||||||
#include <Plasma/PluginLoader>
|
#include <Plasma/PluginLoader>
|
||||||
|
|
||||||
#include "containmentinterface.h"
|
#include "containmentinterface.h"
|
||||||
#include "configview.h"
|
|
||||||
#include "containmentconfigview.h"
|
|
||||||
#include "declarative/configpropertymap.h"
|
#include "declarative/configpropertymap.h"
|
||||||
#include "declarative/qmlobject.h"
|
#include "declarative/qmlobject.h"
|
||||||
#include "declarative/packageaccessmanagerfactory.h"
|
#include "declarative/packageaccessmanagerfactory.h"
|
||||||
@ -76,9 +74,6 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, QQuickItem *pa
|
|||||||
connect(m_appletScriptEngine, SIGNAL(contextChanged()),
|
connect(m_appletScriptEngine, SIGNAL(contextChanged()),
|
||||||
this, SIGNAL(contextChanged()));
|
this, SIGNAL(contextChanged()));
|
||||||
|
|
||||||
connect(applet()->actions()->action("configure"), &QAction::triggered,
|
|
||||||
this, &AppletInterface::configureTriggered);
|
|
||||||
|
|
||||||
m_qmlObject = new QmlObject(this);
|
m_qmlObject = new QmlObject(this);
|
||||||
m_qmlObject->setInitializationDelayed(true);
|
m_qmlObject->setInitializationDelayed(true);
|
||||||
|
|
||||||
@ -457,7 +452,8 @@ bool AppletInterface::immutable() const
|
|||||||
|
|
||||||
bool AppletInterface::userConfiguring() const
|
bool AppletInterface::userConfiguring() const
|
||||||
{
|
{
|
||||||
return m_configView.data()->isVisible();
|
//FIXME
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AppletInterface::apiVersion() const
|
int AppletInterface::apiVersion() const
|
||||||
@ -620,37 +616,4 @@ QmlObject *AppletInterface::qmlObject()
|
|||||||
return m_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) {
|
|
||||||
ContainmentInterface *ci = qobject_cast<ContainmentInterface *>(this);
|
|
||||||
|
|
||||||
if (ci) {
|
|
||||||
m_configView = new ContainmentConfigView(ci);
|
|
||||||
} else {
|
|
||||||
m_configView = new ConfigView(this);
|
|
||||||
}
|
|
||||||
m_configView.data()->init();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_configView.data()->show();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if (m_configView) {
|
|
||||||
m_configView.data()->hide();
|
|
||||||
m_configView.data()->deleteLater();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "moc_appletinterface.cpp"
|
#include "moc_appletinterface.cpp"
|
||||||
|
@ -231,15 +231,10 @@ Q_SIGNALS:
|
|||||||
void busyChanged();
|
void busyChanged();
|
||||||
void expandedChanged();
|
void expandedChanged();
|
||||||
|
|
||||||
//it's important those slots are private because must not be invokable by qml
|
|
||||||
private Q_SLOTS:
|
|
||||||
void configureTriggered();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void init();
|
virtual void init();
|
||||||
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
|
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
|
||||||
void itemChange(ItemChange change, const ItemChangeData &value);
|
void itemChange(ItemChange change, const ItemChangeData &value);
|
||||||
void setConfigurationInterfaceShown(bool show);
|
|
||||||
|
|
||||||
DeclarativeAppletScript *m_appletScriptEngine;
|
DeclarativeAppletScript *m_appletScriptEngine;
|
||||||
|
|
||||||
@ -255,7 +250,6 @@ private:
|
|||||||
//UI-specific members ------------------
|
//UI-specific members ------------------
|
||||||
QmlObject *m_qmlObject;
|
QmlObject *m_qmlObject;
|
||||||
QWeakPointer<QObject> m_compactUiObject;
|
QWeakPointer<QObject> m_compactUiObject;
|
||||||
QWeakPointer<ConfigView> m_configView;
|
|
||||||
|
|
||||||
QTimer *m_creationTimer;
|
QTimer *m_creationTimer;
|
||||||
|
|
||||||
|
@ -56,6 +56,8 @@ set(widgetexplorer_SRC
|
|||||||
|
|
||||||
add_executable(plasma-shell
|
add_executable(plasma-shell
|
||||||
main.cpp
|
main.cpp
|
||||||
|
configview.cpp
|
||||||
|
containmentconfigview.cpp
|
||||||
desktopcorona.cpp
|
desktopcorona.cpp
|
||||||
panelview.cpp
|
panelview.cpp
|
||||||
shellpluginloader.cpp
|
shellpluginloader.cpp
|
||||||
|
@ -18,16 +18,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "configview.h"
|
#include "configview.h"
|
||||||
#include "plasmoid/appletinterface.h"
|
#include "Plasma/Applet"
|
||||||
#include "plasmoid/containmentinterface.h"
|
#include "Plasma/Containment"
|
||||||
#include "plasmoid/wallpaperinterface.h"
|
//#include "plasmoid/wallpaperinterface.h"
|
||||||
#include "declarative/configpropertymap.h"
|
#include "kdeclarative/configpropertymap.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QQmlComponent>
|
#include <QQmlComponent>
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
|
#include <QQuickItem>
|
||||||
|
|
||||||
#include <KGlobal>
|
#include <KGlobal>
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
@ -146,7 +147,7 @@ QVariant ConfigModel::data(const QModelIndex& index, int role) const
|
|||||||
return m_categories.at(index.row())->icon();
|
return m_categories.at(index.row())->icon();
|
||||||
case SourceRole:
|
case SourceRole:
|
||||||
if (m_appletInterface) {
|
if (m_appletInterface) {
|
||||||
return QUrl::fromLocalFile(m_appletInterface.data()->applet()->package().filePath("ui", m_categories.at(index.row())->source()));
|
return QUrl::fromLocalFile(m_appletInterface.data()->package().filePath("ui", m_categories.at(index.row())->source()));
|
||||||
} else {
|
} else {
|
||||||
return m_categories.at(index.row())->source();
|
return m_categories.at(index.row())->source();
|
||||||
}
|
}
|
||||||
@ -167,7 +168,7 @@ QVariant ConfigModel::get(int row) const
|
|||||||
value["name"] = m_categories.at(row)->name();
|
value["name"] = m_categories.at(row)->name();
|
||||||
value["icon"] = m_categories.at(row)->icon();
|
value["icon"] = m_categories.at(row)->icon();
|
||||||
if (m_appletInterface) {
|
if (m_appletInterface) {
|
||||||
value["source"] = QUrl::fromLocalFile(m_appletInterface.data()->applet()->package().filePath("components", m_categories.at(row)->source()));
|
value["source"] = QUrl::fromLocalFile(m_appletInterface.data()->package().filePath("components", m_categories.at(row)->source()));
|
||||||
} else {
|
} else {
|
||||||
value["source"] = m_categories.at(row)->source();
|
value["source"] = m_categories.at(row)->source();
|
||||||
}
|
}
|
||||||
@ -193,12 +194,12 @@ void ConfigModel::clear()
|
|||||||
emit countChanged();
|
emit countChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigModel::setAppletInterface(AppletInterface *interface)
|
void ConfigModel::setApplet(Plasma::Applet *interface)
|
||||||
{
|
{
|
||||||
m_appletInterface = interface;
|
m_appletInterface = interface;
|
||||||
}
|
}
|
||||||
|
|
||||||
AppletInterface *ConfigModel::appletInterface() const
|
Plasma::Applet *ConfigModel::applet() const
|
||||||
{
|
{
|
||||||
return m_appletInterface.data();
|
return m_appletInterface.data();
|
||||||
}
|
}
|
||||||
@ -259,19 +260,19 @@ void ConfigModel::categories_clear(QQmlListProperty<ConfigCategory> *prop)
|
|||||||
|
|
||||||
|
|
||||||
//////////////////////////////ConfigView
|
//////////////////////////////ConfigView
|
||||||
ConfigView::ConfigView(AppletInterface *interface, QWindow *parent)
|
ConfigView::ConfigView(Plasma::Applet *interface, QWindow *parent)
|
||||||
: QQuickView(parent),
|
: QQuickView(parent),
|
||||||
m_appletInterface(interface)
|
m_applet(interface)
|
||||||
{
|
{
|
||||||
qmlRegisterType<ConfigModel>("org.kde.plasma.configuration", 2, 0, "ConfigModel");
|
qmlRegisterType<ConfigModel>("org.kde.plasma.configuration", 2, 0, "ConfigModel");
|
||||||
qmlRegisterType<ConfigCategory>("org.kde.plasma.configuration", 2, 0, "ConfigCategory");
|
qmlRegisterType<ConfigCategory>("org.kde.plasma.configuration", 2, 0, "ConfigCategory");
|
||||||
|
|
||||||
//FIXME: problem on nvidia, all windows should be transparent or won't show
|
//FIXME: problem on nvidia, all windows should be transparent or won't show
|
||||||
setColor(Qt::transparent);
|
setColor(Qt::transparent);
|
||||||
setTitle(i18n("%1 Settings", m_appletInterface->applet()->title()));
|
setTitle(i18n("%1 Settings", m_applet->title()));
|
||||||
|
|
||||||
|
|
||||||
if (!m_appletInterface->applet()->containment()->corona()->package().isValid()) {
|
if (!m_applet->containment()->corona()->package().isValid()) {
|
||||||
qWarning() << "Invalid home screen package";
|
qWarning() << "Invalid home screen package";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,17 +280,17 @@ ConfigView::ConfigView(AppletInterface *interface, QWindow *parent)
|
|||||||
|
|
||||||
|
|
||||||
//config model local of the applet
|
//config model local of the applet
|
||||||
QQmlComponent *component = new QQmlComponent(engine(), QUrl::fromLocalFile(m_appletInterface->applet()->package().filePath("configmodel")), this);
|
QQmlComponent *component = new QQmlComponent(engine(), QUrl::fromLocalFile(m_applet->package().filePath("configmodel")), this);
|
||||||
QObject *object = component->create(engine()->rootContext());
|
QObject *object = component->create(engine()->rootContext());
|
||||||
m_configModel = qobject_cast<ConfigModel *>(object);
|
m_configModel = qobject_cast<ConfigModel *>(object);
|
||||||
if (m_configModel) {
|
if (m_configModel) {
|
||||||
m_configModel->setAppletInterface(m_appletInterface);
|
m_configModel->setApplet(m_applet);
|
||||||
} else {
|
} else {
|
||||||
delete object;
|
delete object;
|
||||||
}
|
}
|
||||||
delete component;
|
delete component;
|
||||||
|
|
||||||
ContainmentInterface *cont = qobject_cast<ContainmentInterface *>(m_appletInterface);
|
Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(m_applet);
|
||||||
|
|
||||||
engine()->rootContext()->setContextProperty("plasmoid", interface);
|
engine()->rootContext()->setContextProperty("plasmoid", interface);
|
||||||
engine()->rootContext()->setContextProperty("configDialog", this);
|
engine()->rootContext()->setContextProperty("configDialog", this);
|
||||||
@ -301,7 +302,7 @@ ConfigView::~ConfigView()
|
|||||||
|
|
||||||
void ConfigView::init()
|
void ConfigView::init()
|
||||||
{
|
{
|
||||||
setSource(QUrl::fromLocalFile(m_appletInterface->applet()->containment()->corona()->package().filePath("configurationui")));
|
setSource(QUrl::fromLocalFile(m_applet->containment()->corona()->package().filePath("configurationui")));
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigModel *ConfigView::configModel() const
|
ConfigModel *ConfigView::configModel() const
|
@ -26,7 +26,10 @@
|
|||||||
#include <QQmlListProperty>
|
#include <QQmlListProperty>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
|
||||||
class AppletInterface;
|
namespace Plasma {
|
||||||
|
class Applet;
|
||||||
|
}
|
||||||
|
|
||||||
class ConfigPropertyMap;
|
class ConfigPropertyMap;
|
||||||
|
|
||||||
|
|
||||||
@ -87,8 +90,8 @@ public:
|
|||||||
void appendCategory(ConfigCategory *c);
|
void appendCategory(ConfigCategory *c);
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
void setAppletInterface(AppletInterface *interface);
|
void setApplet(Plasma::Applet *interface);
|
||||||
AppletInterface *appletInterface() const;
|
Plasma::Applet *applet() const;
|
||||||
|
|
||||||
int count() {return rowCount();}
|
int count() {return rowCount();}
|
||||||
virtual int rowCount(const QModelIndex &index = QModelIndex()) const;
|
virtual int rowCount(const QModelIndex &index = QModelIndex()) const;
|
||||||
@ -107,7 +110,7 @@ Q_SIGNALS:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QList<ConfigCategory*>m_categories;
|
QList<ConfigCategory*>m_categories;
|
||||||
QWeakPointer<AppletInterface> m_appletInterface;
|
QWeakPointer<Plasma::Applet> m_appletInterface;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -119,7 +122,7 @@ class ConfigView : public QQuickView
|
|||||||
Q_PROPERTY(ConfigModel *configModel READ configModel CONSTANT)
|
Q_PROPERTY(ConfigModel *configModel READ configModel CONSTANT)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConfigView(AppletInterface *scriptEngine, QWindow *parent = 0);
|
ConfigView(Plasma::Applet *applet, QWindow *parent = 0);
|
||||||
virtual ~ConfigView();
|
virtual ~ConfigView();
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
@ -131,7 +134,7 @@ protected:
|
|||||||
void resizeEvent(QResizeEvent *re);
|
void resizeEvent(QResizeEvent *re);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AppletInterface *m_appletInterface;
|
Plasma::Applet *m_applet;
|
||||||
ConfigModel *m_configModel;
|
ConfigModel *m_configModel;
|
||||||
};
|
};
|
||||||
|
|
@ -18,13 +18,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "containmentconfigview.h"
|
#include "containmentconfigview.h"
|
||||||
#include "plasmoid/containmentinterface.h"
|
#include <Plasma/Containment>
|
||||||
#include "plasmoid/wallpaperinterface.h"
|
//#include "plasmoid/wallpaperinterface.h"
|
||||||
#include "declarative/configpropertymap.h"
|
#include <kdeclarative/configpropertymap.h>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
|
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
@ -33,14 +34,14 @@
|
|||||||
|
|
||||||
|
|
||||||
//////////////////////////////ContainmentConfigView
|
//////////////////////////////ContainmentConfigView
|
||||||
ContainmentConfigView::ContainmentConfigView(ContainmentInterface *interface, QWindow *parent)
|
ContainmentConfigView::ContainmentConfigView(Plasma::Containment *cont, QWindow *parent)
|
||||||
: ConfigView(interface, parent),
|
: ConfigView(cont, parent),
|
||||||
m_containmentInterface(interface),
|
m_containment(cont),
|
||||||
m_wallpaperConfigModel(0),
|
m_wallpaperConfigModel(0),
|
||||||
m_currentWallpaperConfig(0)
|
m_currentWallpaperConfig(0)
|
||||||
{
|
{
|
||||||
engine()->rootContext()->setContextProperty("configDialog", this);
|
engine()->rootContext()->setContextProperty("configDialog", this);
|
||||||
setCurrentWallpaper(interface->containment()->wallpaper());
|
setCurrentWallpaper(cont->containment()->wallpaper());
|
||||||
}
|
}
|
||||||
|
|
||||||
ContainmentConfigView::~ContainmentConfigView()
|
ContainmentConfigView::~ContainmentConfigView()
|
||||||
@ -94,17 +95,17 @@ QString ContainmentConfigView::currentWallpaper() const
|
|||||||
|
|
||||||
void ContainmentConfigView::setCurrentWallpaper(const QString &wallpaper)
|
void ContainmentConfigView::setCurrentWallpaper(const QString &wallpaper)
|
||||||
{
|
{
|
||||||
if (m_currentWallpaper == wallpaper) {
|
/*if (m_currentWallpaper == wallpaper) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_containmentInterface->containment()->wallpaper() == wallpaper) {
|
if (m_containment->containment()->wallpaper() == wallpaper) {
|
||||||
delete m_currentWallpaperConfig;
|
delete m_currentWallpaperConfig;
|
||||||
if (m_containmentInterface->wallpaperInterface()) {
|
if (m_containment->wallpaperInterface()) {
|
||||||
m_currentWallpaperConfig = m_containmentInterface->wallpaperInterface()->configuration();
|
m_currentWallpaperConfig = m_containment->wallpaperInterface()->configuration();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (m_containmentInterface->containment()->wallpaper() != m_currentWallpaper) {
|
if (m_containment->containment()->wallpaper() != m_currentWallpaper) {
|
||||||
delete m_currentWallpaperConfig;
|
delete m_currentWallpaperConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,10 +114,10 @@ void ContainmentConfigView::setCurrentWallpaper(const QString &wallpaper)
|
|||||||
pkg.setDefaultPackageRoot("plasma/wallpapers");
|
pkg.setDefaultPackageRoot("plasma/wallpapers");
|
||||||
pkg.setPath(wallpaper);
|
pkg.setPath(wallpaper);
|
||||||
QFile file(pkg.filePath("config", "main.xml"));
|
QFile file(pkg.filePath("config", "main.xml"));
|
||||||
KConfigGroup cfg = m_containmentInterface->containment()->config();
|
KConfigGroup cfg = m_containment->containment()->config();
|
||||||
cfg = KConfigGroup(&cfg, "Wallpaper");
|
cfg = KConfigGroup(&cfg, "Wallpaper");
|
||||||
m_currentWallpaperConfig = new ConfigPropertyMap(new Plasma::ConfigLoader(&cfg, &file), this);
|
m_currentWallpaperConfig = new ConfigPropertyMap(new Plasma::ConfigLoader(&cfg, &file), this);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
m_currentWallpaper = wallpaper;
|
m_currentWallpaper = wallpaper;
|
||||||
emit currentWallpaperChanged();
|
emit currentWallpaperChanged();
|
||||||
@ -125,13 +126,13 @@ void ContainmentConfigView::setCurrentWallpaper(const QString &wallpaper)
|
|||||||
|
|
||||||
void ContainmentConfigView::applyWallpaper()
|
void ContainmentConfigView::applyWallpaper()
|
||||||
{
|
{
|
||||||
m_containmentInterface->containment()->setWallpaper(m_currentWallpaper);
|
/*m_containment->containment()->setWallpaper(m_currentWallpaper);
|
||||||
|
|
||||||
if (m_currentWallpaperConfig != m_containmentInterface->wallpaperInterface()->configuration()) {
|
if (m_currentWallpaperConfig != m_containment->wallpaperInterface()->configuration()) {
|
||||||
delete m_currentWallpaperConfig;
|
delete m_currentWallpaperConfig;
|
||||||
m_currentWallpaperConfig = m_containmentInterface->wallpaperInterface()->configuration();
|
m_currentWallpaperConfig = m_containment->wallpaperInterface()->configuration();
|
||||||
emit wallpaperConfigurationChanged();
|
emit wallpaperConfigurationChanged();
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_containmentconfigview.cpp"
|
#include "moc_containmentconfigview.cpp"
|
@ -23,7 +23,9 @@
|
|||||||
|
|
||||||
#include "configview.h"
|
#include "configview.h"
|
||||||
|
|
||||||
class ContainmentInterface;
|
namespace Plasma {
|
||||||
|
class Containment;
|
||||||
|
}
|
||||||
class ConfigPropertyMap;
|
class ConfigPropertyMap;
|
||||||
|
|
||||||
|
|
||||||
@ -36,7 +38,7 @@ class ContainmentConfigView : public ConfigView
|
|||||||
Q_PROPERTY(QString currentWallpaper READ currentWallpaper WRITE setCurrentWallpaper NOTIFY currentWallpaperChanged)
|
Q_PROPERTY(QString currentWallpaper READ currentWallpaper WRITE setCurrentWallpaper NOTIFY currentWallpaperChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ContainmentConfigView(ContainmentInterface *interface, QWindow *parent = 0);
|
ContainmentConfigView(Plasma::Containment *interface, QWindow *parent = 0);
|
||||||
virtual ~ContainmentConfigView();
|
virtual ~ContainmentConfigView();
|
||||||
|
|
||||||
ConfigModel *wallpaperConfigModel();
|
ConfigModel *wallpaperConfigModel();
|
||||||
@ -51,7 +53,7 @@ Q_SIGNALS:
|
|||||||
void wallpaperConfigurationChanged();
|
void wallpaperConfigurationChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ContainmentInterface *m_containmentInterface;
|
Plasma::Containment *m_containment;
|
||||||
ConfigModel *m_wallpaperConfigModel;
|
ConfigModel *m_wallpaperConfigModel;
|
||||||
QString m_currentWallpaper;
|
QString m_currentWallpaper;
|
||||||
ConfigPropertyMap *m_currentWallpaperConfig;
|
ConfigPropertyMap *m_currentWallpaperConfig;
|
@ -29,6 +29,7 @@
|
|||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
#include <Plasma/Package>
|
#include <Plasma/Package>
|
||||||
|
|
||||||
|
#include "containmentconfigview.h"
|
||||||
#include "panelview.h"
|
#include "panelview.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
#include "scripting/desktopscriptengine.h"
|
#include "scripting/desktopscriptengine.h"
|
||||||
@ -266,7 +267,10 @@ void DesktopCorona::updateScreenOwner(int wasScreen, int isScreen, Plasma::Conta
|
|||||||
|
|
||||||
void DesktopCorona::handleContainmentAdded(Plasma::Containment* c)
|
void DesktopCorona::handleContainmentAdded(Plasma::Containment* c)
|
||||||
{
|
{
|
||||||
connect(c, &Plasma::Containment::showAddWidgetsInterface, this, &DesktopCorona::showWidgetExplorer);
|
connect(c, &Plasma::Containment::showAddWidgetsInterface,
|
||||||
|
this, &DesktopCorona::showWidgetExplorer);
|
||||||
|
connect(c, &Plasma::Containment::configureRequested,
|
||||||
|
this, &DesktopCorona::showConfigurationInterface);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesktopCorona::showWidgetExplorer()
|
void DesktopCorona::showWidgetExplorer()
|
||||||
@ -300,5 +304,30 @@ void DesktopCorona::printScriptMessage(const QString &message)
|
|||||||
qDebug() << message;
|
qDebug() << message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DesktopCorona::showConfigurationInterface(Plasma::Applet *applet)
|
||||||
|
{
|
||||||
|
if (m_configView) {
|
||||||
|
m_configView.data()->hide();
|
||||||
|
m_configView.data()->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!applet || !applet->containment()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_configView) {
|
||||||
|
Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(applet);
|
||||||
|
|
||||||
|
if (cont) {
|
||||||
|
m_configView = new ContainmentConfigView(cont);
|
||||||
|
} else {
|
||||||
|
m_configView = new ConfigView(applet);
|
||||||
|
}
|
||||||
|
m_configView.data()->init();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_configView.data()->show();
|
||||||
|
}
|
||||||
|
|
||||||
#include "desktopcorona.moc"
|
#include "desktopcorona.moc"
|
||||||
|
|
||||||
|
@ -23,6 +23,8 @@ class * Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
#include "plasma/corona.h"
|
#include "plasma/corona.h"
|
||||||
|
|
||||||
|
#include "configview.h"
|
||||||
|
|
||||||
class QDesktopWidget;
|
class QDesktopWidget;
|
||||||
class QQuickView;
|
class QQuickView;
|
||||||
class PanelView;
|
class PanelView;
|
||||||
@ -83,6 +85,8 @@ protected Q_SLOTS:
|
|||||||
void printScriptError(const QString &error);
|
void printScriptError(const QString &error);
|
||||||
void printScriptMessage(const QString &message);
|
void printScriptMessage(const QString &message);
|
||||||
|
|
||||||
|
void showConfigurationInterface(Plasma::Applet *applet);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void handleContainmentAdded(Plasma::Containment *c);
|
void handleContainmentAdded(Plasma::Containment *c);
|
||||||
void showWidgetExplorer();
|
void showWidgetExplorer();
|
||||||
@ -93,6 +97,7 @@ private:
|
|||||||
WidgetExplorerView *m_widgetExplorerView;
|
WidgetExplorerView *m_widgetExplorerView;
|
||||||
QHash<Plasma::Containment *, PanelView *> m_panelViews;
|
QHash<Plasma::Containment *, PanelView *> m_panelViews;
|
||||||
KConfigGroup m_desktopDefaultsConfig;
|
KConfigGroup m_desktopDefaultsConfig;
|
||||||
|
QWeakPointer<ConfigView> m_configView;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user