Commit 67980bc2 authored by Luca Weiss's avatar Luca Weiss

feat(kded): add getAutoRotate method and rename lockAutoRotate

lockAutoRotate(true) would enable the automatic rotation and
lockAutoRotate(false) would disable auto rotation which is the opposite
of what the function name would imply, so rename it to setAutoRotate.

We also need a getter for the value to display the status in the UI.
This getter checks if all applicable outputs have auto rotate enabled
and returns that value.

Test Plan: tested on Plasma Mobile

Reviewers: #plasma, bshah, nicolasfella, romangg

Reviewed By: #plasma, bshah, romangg

Subscribers: romangg, nicolasfella, plasma-devel

Tags: #plasma

Differential Revision:
parent 544a7c14
......@@ -94,6 +94,18 @@ void Config::setDeviceOrientation(QOrientationReading::Orientation orientation)
bool Config::getAutoRotate() const
const auto outputs = m_data->outputs();
return std::all_of(outputs.cbegin(), outputs.cend(),
[this](KScreen::OutputPtr output) {
if (output->type() != KScreen::Output::Type::Panel) {
return true;
return m_control->getAutoRotate(output);
void Config::setAutoRotate(bool value)
for (KScreen::OutputPtr &output : m_data->outputs()) {
......@@ -47,6 +47,7 @@ public:
void activateControlWatching();
bool autoRotationRequested() const;
void setDeviceOrientation(QOrientationReading::Orientation orientation);
bool getAutoRotate() const;
void setAutoRotate(bool value);
void log();
......@@ -248,7 +248,12 @@ void KScreenDaemon::applyLayoutPreset(const QString &presetName)
void KScreenDaemon::lockAutoRotate(bool value)
bool KScreenDaemon::getAutoRotate()
return m_monitoredConfig->getAutoRotate();
void KScreenDaemon::setAutoRotate(bool value)
if (!m_monitoredConfig) {
......@@ -52,7 +52,8 @@ public:
public Q_SLOTS:
// DBus
void applyLayoutPreset(const QString &presetName);
void lockAutoRotate(bool value);
bool getAutoRotate();
void setAutoRotate(bool value);
// DBus
......@@ -5,8 +5,11 @@
<method name="applyLayoutPreset">
<arg type="s" name="presetName" direction="in" />
<method name="lockAutoRotate">
<arg type="b" name="lock" direction="in" />
<method name="getAutoRotate">
<arg type="b" direction="out" />
<method name="setAutoRotate">
<arg type="b" name="value" direction="in" />
<signal name="outputConnected">
<arg type="s" name="outputName" direction="out" />
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment