浏览代码

fixed service not starting or stopping

Malte Veerman 7 年之前
父节点
当前提交
467322099f
共有 3 个文件被更改,包括 6 次插入12 次删除
  1. 4 6
      fancontrol-gui/package/contents/ui/Application.qml
  2. 1 5
      import/qml/FanItem.qml
  3. 1 1
      import/src/systemdcommunicator.cpp

+ 4 - 6
fancontrol-gui/package/contents/ui/Application.qml

@@ -124,21 +124,19 @@ ApplicationWindow {
         id: startAction
         id: startAction
         text: i18n("Start")
         text: i18n("Start")
         enabled: !!Fancontrol.base.systemdCom && !Fancontrol.base.systemdCom.serviceActive
         enabled: !!Fancontrol.base.systemdCom && !Fancontrol.base.systemdCom.serviceActive
-        onTriggered: {
-            Fancontrol.base.systemdCom.serviceActive = true;
-        }
         iconName: "media-playback-start"
         iconName: "media-playback-start"
         tooltip: i18n("Enable manual control")
         tooltip: i18n("Enable manual control")
+
+        onTriggered: Fancontrol.base.systemdCom.serviceActive = true
     }
     }
     Action {
     Action {
         id: stopAction
         id: stopAction
         text: i18n("Stop")
         text: i18n("Stop")
         enabled: !!Fancontrol.base.systemdCom && Fancontrol.base.systemdCom.serviceActive
         enabled: !!Fancontrol.base.systemdCom && Fancontrol.base.systemdCom.serviceActive
-        onTriggered: {
-            Fancontrol.base.systemdCom.serviceActive = false;
-        }
         iconName: "media-playback-stop"
         iconName: "media-playback-stop"
         tooltip: i18n("Disable manual control")
         tooltip: i18n("Disable manual control")
+
+        onTriggered: Fancontrol.base.systemdCom.serviceActive = false
     }
     }
     SystemPalette {
     SystemPalette {
         id: palette
         id: palette

+ 1 - 5
import/qml/FanItem.qml

@@ -78,11 +78,7 @@ Rectangle {
         font.pointSize: 14
         font.pointSize: 14
         selectByMouse: true
         selectByMouse: true
 
 
-        onTextChanged: {
-            if (!!fan) {
-                fan.name = text;
-            }
-        }
+        onTextChanged: if (!!fan && fan.name != text) fan.name = text
 
 
         Connections {
         Connections {
             target: fan
             target: fan

+ 1 - 1
import/src/systemdcommunicator.cpp

@@ -308,7 +308,7 @@ void SystemdCommunicator::apply(bool serviceRestart)
         if (m_serviceActive != systemdServiceActive())
         if (m_serviceActive != systemdServiceActive())
         {
         {
             QString method;
             QString method;
-            if (m_serviceEnabled)
+            if (m_serviceActive)
             {
             {
                 emit info(i18n("Starting service: \'%1\'", m_serviceName));
                 emit info(i18n("Starting service: \'%1\'", m_serviceName));
                 method = QStringLiteral("StartUnit");
                 method = QStringLiteral("StartUnit");