move Applet::backgroundHints in the scriptEngine
the background hints are UI specific, therefore they go just in the script engine
This commit is contained in:
parent
e5bc563158
commit
f28d7c7220
@ -489,21 +489,6 @@ void Applet::setImmutability(const ImmutabilityType immutable)
|
|||||||
updateConstraints(ImmutableConstraint);
|
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
|
bool Applet::hasFailedToLaunch() const
|
||||||
{
|
{
|
||||||
return d->failed;
|
return d->failed;
|
||||||
|
@ -462,19 +462,6 @@ class PLASMA_EXPORT Applet : public QObject
|
|||||||
**/
|
**/
|
||||||
bool hasConfigurationInterface() const;
|
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,
|
* Reimplement this method so provide a configuration interface,
|
||||||
* parented to the supplied widget. Ownership of the widgets is passed
|
* 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);
|
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
|
//Completely UI-specific, remove or move to scriptengine
|
||||||
/**
|
/**
|
||||||
|
@ -72,7 +72,6 @@ Containment::Containment(QObject *parent,
|
|||||||
{
|
{
|
||||||
// WARNING: do not access config() OR globalConfig() in this method!
|
// WARNING: do not access config() OR globalConfig() in this method!
|
||||||
// that requires a scene, which is not available at this point
|
// that requires a scene, which is not available at this point
|
||||||
setBackgroundHints(NoBackground);
|
|
||||||
setContainmentType(CustomContainment);
|
setContainmentType(CustomContainment);
|
||||||
setHasConfigurationInterface(false);
|
setHasConfigurationInterface(false);
|
||||||
}
|
}
|
||||||
@ -83,7 +82,6 @@ Containment::Containment(QObject *parent, const QVariantList &args)
|
|||||||
{
|
{
|
||||||
// WARNING: do not access config() OR globalConfig() in this method!
|
// WARNING: do not access config() OR globalConfig() in this method!
|
||||||
// that requires a scene, which is not available at this point
|
// that requires a scene, which is not available at this point
|
||||||
setBackgroundHints(NoBackground);
|
|
||||||
setHasConfigurationInterface(false);
|
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!
|
// WARNING: do not access config() OR globalConfig() in this method!
|
||||||
// that requires a scene, which is not available at this point
|
// that requires a scene, which is not available at this point
|
||||||
setBackgroundHints(NoBackground);
|
|
||||||
setHasConfigurationInterface(false);
|
setHasConfigurationInterface(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,11 +511,6 @@ void Containment::addApplet(Applet *applet, const QPointF &pos)
|
|||||||
|
|
||||||
Containment *currentContainment = applet->containment();
|
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) {
|
if (currentContainment && currentContainment != this) {
|
||||||
emit currentContainment->appletRemoved(applet);
|
emit currentContainment->appletRemoved(applet);
|
||||||
|
|
||||||
|
@ -53,7 +53,6 @@ AppletPrivate::AppletPrivate(KService::Ptr service, const KPluginInfo *info, int
|
|||||||
: appletId(uniqueID),
|
: appletId(uniqueID),
|
||||||
q(applet),
|
q(applet),
|
||||||
remotingService(0),
|
remotingService(0),
|
||||||
backgroundHints(StandardBackground),
|
|
||||||
immutability(Mutable),
|
immutability(Mutable),
|
||||||
appletDescription(info ? *info : KPluginInfo(service)),
|
appletDescription(info ? *info : KPluginInfo(service)),
|
||||||
mainConfig(0),
|
mainConfig(0),
|
||||||
@ -103,9 +102,6 @@ void AppletPrivate::init(const QString &packagePath)
|
|||||||
// WARNING: do not access config() OR globalConfig() in this method!
|
// WARNING: do not access config() OR globalConfig() in this method!
|
||||||
// that requires a scene, which is not available at this point
|
// 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?
|
q->setHasConfigurationInterface(true); //FIXME why not default it to true in the constructor?
|
||||||
|
|
||||||
QAction *closeApplet = actions->action("remove");
|
QAction *closeApplet = actions->action("remove");
|
||||||
@ -128,12 +124,6 @@ void AppletPrivate::init(const QString &packagePath)
|
|||||||
return;
|
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();
|
QString api = appletDescription.property("X-Plasma-API").toString();
|
||||||
|
|
||||||
// we have a scripted plasmoid
|
// we have a scripted plasmoid
|
||||||
|
@ -131,7 +131,6 @@ public:
|
|||||||
|
|
||||||
// applet attributes
|
// applet attributes
|
||||||
Service *remotingService;
|
Service *remotingService;
|
||||||
BackgroundHints backgroundHints;
|
|
||||||
ImmutabilityType immutability;
|
ImmutabilityType immutability;
|
||||||
|
|
||||||
// applet info we keep around in case its needed
|
// applet info we keep around in case its needed
|
||||||
|
@ -45,14 +45,14 @@ Q_DECLARE_METATYPE(AppletInterface*)
|
|||||||
AppletInterface::AppletInterface(DeclarativeAppletScript *script, QQuickItem *parent)
|
AppletInterface::AppletInterface(DeclarativeAppletScript *script, QQuickItem *parent)
|
||||||
: QQuickItem(parent),
|
: QQuickItem(parent),
|
||||||
m_appletScriptEngine(script),
|
m_appletScriptEngine(script),
|
||||||
m_actionSignals(0)
|
m_actionSignals(0),
|
||||||
|
m_backgroundHints(Plasma::StandardBackground)
|
||||||
{
|
{
|
||||||
qmlRegisterType<AppletInterface>();
|
qmlRegisterType<AppletInterface>();
|
||||||
connect(this, SIGNAL(releaseVisualFocus()), applet(), SIGNAL(releaseVisualFocus()));
|
connect(this, SIGNAL(releaseVisualFocus()), applet(), SIGNAL(releaseVisualFocus()));
|
||||||
connect(this, SIGNAL(configNeedsSaving()), applet(), SIGNAL(configNeedsSaving()));
|
connect(this, SIGNAL(configNeedsSaving()), applet(), SIGNAL(configNeedsSaving()));
|
||||||
connect(applet(), SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)), this, SIGNAL(immutableChanged()));
|
connect(applet(), SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)), this, SIGNAL(immutableChanged()));
|
||||||
connect(applet(), SIGNAL(newStatus(Plasma::ItemStatus)), this, SIGNAL(statusChanged()));
|
connect(applet(), SIGNAL(newStatus(Plasma::ItemStatus)), this, SIGNAL(statusChanged()));
|
||||||
connect(applet(), SIGNAL(backgroundHintsChanged(Plasma::BackgroundHints)), this, SIGNAL(backgroundHintsChanged()));
|
|
||||||
connect(m_appletScriptEngine, SIGNAL(formFactorChanged()),
|
connect(m_appletScriptEngine, SIGNAL(formFactorChanged()),
|
||||||
this, SIGNAL(formFactorChanged()));
|
this, SIGNAL(formFactorChanged()));
|
||||||
connect(m_appletScriptEngine, SIGNAL(locationChanged()),
|
connect(m_appletScriptEngine, SIGNAL(locationChanged()),
|
||||||
@ -97,12 +97,17 @@ void AppletInterface::setBusy(bool busy)
|
|||||||
|
|
||||||
AppletInterface::BackgroundHints AppletInterface::backgroundHints() const
|
AppletInterface::BackgroundHints AppletInterface::backgroundHints() const
|
||||||
{
|
{
|
||||||
return static_cast<BackgroundHints>(static_cast<int>(applet()->backgroundHints()));
|
return (BackgroundHints)m_backgroundHints;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppletInterface::setBackgroundHints(BackgroundHints hint)
|
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)
|
void AppletInterface::setConfigurationRequired(bool needsConfiguring, const QString &reason)
|
||||||
|
@ -275,6 +275,9 @@ private:
|
|||||||
QSignalMapper *m_actionSignals;
|
QSignalMapper *m_actionSignals;
|
||||||
QString m_currentConfig;
|
QString m_currentConfig;
|
||||||
QMap<QString, Plasma::ConfigLoader*> m_configs;
|
QMap<QString, Plasma::ConfigLoader*> m_configs;
|
||||||
|
|
||||||
|
//UI-specific properties
|
||||||
|
Plasma::BackgroundHints m_backgroundHints;
|
||||||
};
|
};
|
||||||
|
|
||||||
class JsAppletInterface : public AppletInterface
|
class JsAppletInterface : public AppletInterface
|
||||||
|
Loading…
Reference in New Issue
Block a user