diff --git a/plasma/applet.cpp b/plasma/applet.cpp index 7a881cf33..d181e611b 100644 --- a/plasma/applet.cpp +++ b/plasma/applet.cpp @@ -489,21 +489,6 @@ void Applet::setImmutability(const ImmutabilityType immutable) updateConstraints(ImmutableConstraint); } -BackgroundHints Applet::backgroundHints() const -{ - return d->backgroundHints; -} - -void Applet::setBackgroundHints(const Plasma::BackgroundHints hints) -{ - if (d->backgroundHints == hints) { - return; - } - - d->backgroundHints = hints; - emit backgroundHintsChanged(hints); -} - bool Applet::hasFailedToLaunch() const { return d->failed; diff --git a/plasma/applet.h b/plasma/applet.h index 804f0a2b2..b16d459d9 100644 --- a/plasma/applet.h +++ b/plasma/applet.h @@ -462,19 +462,6 @@ class PLASMA_EXPORT Applet : public QObject **/ bool hasConfigurationInterface() const; - /** - * Sets the BackgroundHints for this applet @see BackgroundHint - * - * @param hints the BackgroundHint combination for this applet - */ - void setBackgroundHints(const Plasma::BackgroundHints hint); - - /** - * @return BackgroundHints flags combination telling if the standard background is shown - * and if it has a drop shadow - */ - Plasma::BackgroundHints backgroundHints() const; - /** * Reimplement this method so provide a configuration interface, * parented to the supplied widget. Ownership of the widgets is passed @@ -544,12 +531,6 @@ class PLASMA_EXPORT Applet : public QObject */ void messageButtonPressed(const Plasma::MessageButton button); - /** - * Emitted when background hints change - * @since 5.0 - */ - void backgroundHintsChanged(Plasma::BackgroundHints backgroundHints); - //Completely UI-specific, remove or move to scriptengine /** diff --git a/plasma/containment.cpp b/plasma/containment.cpp index 776e35bc9..fea6fa521 100644 --- a/plasma/containment.cpp +++ b/plasma/containment.cpp @@ -72,7 +72,6 @@ Containment::Containment(QObject *parent, { // WARNING: do not access config() OR globalConfig() in this method! // that requires a scene, which is not available at this point - setBackgroundHints(NoBackground); setContainmentType(CustomContainment); setHasConfigurationInterface(false); } @@ -83,7 +82,6 @@ Containment::Containment(QObject *parent, const QVariantList &args) { // WARNING: do not access config() OR globalConfig() in this method! // that requires a scene, which is not available at this point - setBackgroundHints(NoBackground); setHasConfigurationInterface(false); } @@ -93,7 +91,6 @@ Containment::Containment(const QString &packagePath, uint appletId, const QVaria { // WARNING: do not access config() OR globalConfig() in this method! // that requires a scene, which is not available at this point - setBackgroundHints(NoBackground); setHasConfigurationInterface(false); } @@ -514,11 +511,6 @@ void Containment::addApplet(Applet *applet, const QPointF &pos) Containment *currentContainment = applet->containment(); - if (d->type == PanelContainment) { - //panels don't want backgrounds, which is important when setting geometry - setBackgroundHints(NoBackground); - } - if (currentContainment && currentContainment != this) { emit currentContainment->appletRemoved(applet); diff --git a/plasma/private/applet_p.cpp b/plasma/private/applet_p.cpp index 3764d636d..c4512f9e2 100644 --- a/plasma/private/applet_p.cpp +++ b/plasma/private/applet_p.cpp @@ -53,7 +53,6 @@ AppletPrivate::AppletPrivate(KService::Ptr service, const KPluginInfo *info, int : appletId(uniqueID), q(applet), remotingService(0), - backgroundHints(StandardBackground), immutability(Mutable), appletDescription(info ? *info : KPluginInfo(service)), mainConfig(0), @@ -103,9 +102,6 @@ void AppletPrivate::init(const QString &packagePath) // WARNING: do not access config() OR globalConfig() in this method! // that requires a scene, which is not available at this point - //set a default size before any saved settings are read - QSize size(200, 200); - q->setBackgroundHints(DefaultBackground); q->setHasConfigurationInterface(true); //FIXME why not default it to true in the constructor? QAction *closeApplet = actions->action("remove"); @@ -128,12 +124,6 @@ void AppletPrivate::init(const QString &packagePath) return; } - QVariant s = appletDescription.property("X-Plasma-DefaultSize"); - if (s.isValid()) { - size = s.toSize(); - } - //kDebug() << "size" << size; - QString api = appletDescription.property("X-Plasma-API").toString(); // we have a scripted plasmoid diff --git a/plasma/private/applet_p.h b/plasma/private/applet_p.h index 352734aca..3e6c3fe14 100644 --- a/plasma/private/applet_p.h +++ b/plasma/private/applet_p.h @@ -131,7 +131,6 @@ public: // applet attributes Service *remotingService; - BackgroundHints backgroundHints; ImmutabilityType immutability; // applet info we keep around in case its needed diff --git a/scriptengines/qml/plasmoid/appletinterface.cpp b/scriptengines/qml/plasmoid/appletinterface.cpp index 5fcd21159..a6b72ac0b 100644 --- a/scriptengines/qml/plasmoid/appletinterface.cpp +++ b/scriptengines/qml/plasmoid/appletinterface.cpp @@ -45,14 +45,14 @@ Q_DECLARE_METATYPE(AppletInterface*) AppletInterface::AppletInterface(DeclarativeAppletScript *script, QQuickItem *parent) : QQuickItem(parent), m_appletScriptEngine(script), - m_actionSignals(0) + m_actionSignals(0), + m_backgroundHints(Plasma::StandardBackground) { qmlRegisterType(); connect(this, SIGNAL(releaseVisualFocus()), applet(), SIGNAL(releaseVisualFocus())); connect(this, SIGNAL(configNeedsSaving()), applet(), SIGNAL(configNeedsSaving())); connect(applet(), SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)), this, SIGNAL(immutableChanged())); connect(applet(), SIGNAL(newStatus(Plasma::ItemStatus)), this, SIGNAL(statusChanged())); - connect(applet(), SIGNAL(backgroundHintsChanged(Plasma::BackgroundHints)), this, SIGNAL(backgroundHintsChanged())); connect(m_appletScriptEngine, SIGNAL(formFactorChanged()), this, SIGNAL(formFactorChanged())); connect(m_appletScriptEngine, SIGNAL(locationChanged()), @@ -97,12 +97,17 @@ void AppletInterface::setBusy(bool busy) AppletInterface::BackgroundHints AppletInterface::backgroundHints() const { - return static_cast(static_cast(applet()->backgroundHints())); + return (BackgroundHints)m_backgroundHints; } void AppletInterface::setBackgroundHints(BackgroundHints hint) { - applet()->setBackgroundHints(Plasma::BackgroundHints(hint)); + if (m_backgroundHints == (Plasma::BackgroundHints)hint) { + return; + } + + m_backgroundHints = (Plasma::BackgroundHints)hint; + emit backgroundHintsChanged(); } void AppletInterface::setConfigurationRequired(bool needsConfiguring, const QString &reason) diff --git a/scriptengines/qml/plasmoid/appletinterface.h b/scriptengines/qml/plasmoid/appletinterface.h index aade93f5a..db439fe85 100644 --- a/scriptengines/qml/plasmoid/appletinterface.h +++ b/scriptengines/qml/plasmoid/appletinterface.h @@ -275,6 +275,9 @@ private: QSignalMapper *m_actionSignals; QString m_currentConfig; QMap m_configs; + +//UI-specific properties + Plasma::BackgroundHints m_backgroundHints; }; class JsAppletInterface : public AppletInterface