diff --git a/containments/panel/package/contents/ui/quicksettings/QuickSettings.qml b/containments/panel/package/contents/ui/quicksettings/QuickSettings.qml index 3bf5b9a2..b183f713 100644 --- a/containments/panel/package/contents/ui/quicksettings/QuickSettings.qml +++ b/containments/panel/package/contents/ui/quicksettings/QuickSettings.qml @@ -213,7 +213,7 @@ Item { settingsModel.append({ "text": i18n("Flashlight"), "icon": "flashlight-on", - "enabled": false, + "enabled": plasmoid.nativeInterface.torchEnabled, "settingsCommand": "", "toggleFunction": "toggleTorch", "applet": null diff --git a/containments/panel/phonepanel.cpp b/containments/panel/phonepanel.cpp index ebffe502..7754c65a 100644 --- a/containments/panel/phonepanel.cpp +++ b/containments/panel/phonepanel.cpp @@ -107,8 +107,12 @@ void PhonePanel::toggleTorch() write(fd, m_running ? "0" : "1", 1); close(fd); m_running = !m_running; + Q_EMIT torchChanged(m_running); +} +bool PhonePanel::torchEnabled() const +{ + return m_running; } - bool PhonePanel::autoRotate() { QDBusPendingReply reply = m_kscreenInterface->getAutoRotate(); diff --git a/containments/panel/phonepanel.h b/containments/panel/phonepanel.h index b51b33d6..0a47e409 100644 --- a/containments/panel/phonepanel.h +++ b/containments/panel/phonepanel.h @@ -31,7 +31,7 @@ class PhonePanel : public Plasma::Containment { Q_OBJECT Q_PROPERTY(bool autoRotateEnabled READ autoRotate WRITE setAutoRotate NOTIFY autoRotateChanged); - + Q_PROPERTY(bool torchEnabled READ torchEnabled NOTIFY torchChanged); public: PhonePanel( QObject *parent, const QVariantList &args ); ~PhonePanel() override; @@ -43,9 +43,12 @@ public Q_SLOTS: bool autoRotate(); void setAutoRotate(bool value); + + bool torchEnabled() const; signals: void autoRotateChanged(bool value); + void torchChanged(bool value); private: bool m_running = false;