[AppletInterface] Expose immutability

This allows an applet to query whether widgets are user-locked or
locked down by Kiosk restrictions.

CHANGELOG: Plasmoids can now tell whether widgets are locked by the user or sysadmin restrictions

REVIEW: 127909
This commit is contained in:
Kai Uwe Broulik 2016-05-19 17:12:02 +02:00
parent 1c8b795938
commit 41e260d886
2 changed files with 23 additions and 5 deletions

View File

@ -66,7 +66,7 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, const QVariant
connect(this, &AppletInterface::configNeedsSaving, connect(this, &AppletInterface::configNeedsSaving,
applet(), &Plasma::Applet::configNeedsSaving); applet(), &Plasma::Applet::configNeedsSaving);
connect(applet(), &Plasma::Applet::immutabilityChanged, connect(applet(), &Plasma::Applet::immutabilityChanged,
this, &AppletInterface::immutableChanged); this, &AppletInterface::immutabilityChanged);
connect(applet(), &Plasma::Applet::userConfiguringChanged, connect(applet(), &Plasma::Applet::userConfiguringChanged,
this, &AppletInterface::userConfiguringChanged); this, &AppletInterface::userConfiguringChanged);
@ -137,7 +137,7 @@ AppletInterface::AppletInterface(Plasma::Applet *a, const QVariantList &args, QQ
connect(this, &AppletInterface::configNeedsSaving, connect(this, &AppletInterface::configNeedsSaving,
applet(), &Plasma::Applet::configNeedsSaving); applet(), &Plasma::Applet::configNeedsSaving);
connect(applet(), &Plasma::Applet::immutabilityChanged, connect(applet(), &Plasma::Applet::immutabilityChanged,
this, &AppletInterface::immutableChanged); this, &AppletInterface::immutabilityChanged);
connect(applet(), &Plasma::Applet::userConfiguringChanged, connect(applet(), &Plasma::Applet::userConfiguringChanged,
this, &AppletInterface::userConfiguringChanged); this, &AppletInterface::userConfiguringChanged);
connect(applet(), &Plasma::Applet::configurationRequiredChanged, connect(applet(), &Plasma::Applet::configurationRequiredChanged,
@ -535,6 +535,11 @@ bool AppletInterface::immutable() const
return applet()->immutability() != Plasma::Types::Mutable; return applet()->immutability() != Plasma::Types::Mutable;
} }
Plasma::Types::ImmutabilityType AppletInterface::immutability() const
{
return applet()->immutability();
}
bool AppletInterface::userConfiguring() const bool AppletInterface::userConfiguring() const
{ {
return applet()->isUserConfiguring(); return applet()->isUserConfiguring();

View File

@ -149,9 +149,21 @@ class AppletInterface : public PlasmaQuick::AppletQuickItem
Q_PROPERTY(Plasma::Types::BackgroundHints backgroundHints WRITE setBackgroundHints READ backgroundHints NOTIFY backgroundHintsChanged) Q_PROPERTY(Plasma::Types::BackgroundHints backgroundHints WRITE setBackgroundHints READ backgroundHints NOTIFY backgroundHintsChanged)
/** /**
* The immutability state of the Corona. the plasmoid implementation should avoid allowing "dangerous" modifications from the user when in an immutable mode * Whether the Corona is immutable. The plasmoid implementation should avoid allowing "dangerous" modifications from the user when in an immutable mode
*
* This is true when immutability is not Mutable
*/ */
Q_PROPERTY(bool immutable READ immutable NOTIFY immutableChanged) Q_PROPERTY(bool immutable READ immutable NOTIFY immutabilityChanged)
/**
* The immutability of the Corona.
*
* Use this if you need more granular control than just using the immutable property
*
* @see immutable
* @since 5.23
*/
Q_PROPERTY(Plasma::Types::ImmutabilityType immutability READ immutability NOTIFY immutabilityChanged)
/** /**
* True when the user is configuring, for instance when the configuration dialog is open. * True when the user is configuring, for instance when the configuration dialog is open.
@ -337,6 +349,7 @@ public:
QRect screenGeometry() const; QRect screenGeometry() const;
bool immutable() const; bool immutable() const;
Plasma::Types::ImmutabilityType immutability() const;
bool userConfiguring() const; bool userConfiguring() const;
int apiVersion() const; int apiVersion() const;
@ -388,7 +401,7 @@ Q_SIGNALS:
void formFactorChanged(); void formFactorChanged();
void locationChanged(); void locationChanged();
void contextChanged(); void contextChanged();
void immutableChanged(); void immutabilityChanged();
void statusChanged(); void statusChanged();
void backgroundHintsChanged(); void backgroundHintsChanged();
void busyChanged(); void busyChanged();