Libksysguard

FaceDetailsConfig.qml
1 /*
2  * Copyright 2019 Marco Martin <[email protected]>
3  * Copyright 2019 David Edmundson <[email protected]>
4  * Copyright 2019 Arjen Hiemstra <[email protected]>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Library General Public License as
8  * published by the Free Software Foundation; either version 2, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this program; if not, write to the
18  * Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  */
21 
22 import QtQuick 2.9
23 import QtQuick.Layouts 1.2
24 
25 import org.kde.kirigami 2.5 as Kirigami
26 import org.kde.kquickcontrols 2.0
27 
28 import org.kde.ksysguard.sensors 1.0 as Sensors
29 import org.kde.ksysguard.faces 1.0 as Faces
30 
31 Loader {
32  id: root
33 
34  property Faces.SensorFaceController controller
35 
36  signal configurationChanged
37 
38  function saveConfig() {
39  if (item.saveConfig) {
40  item.saveConfig()
41  }
42  for (var key in root.controller.faceConfiguration) {
43  if (item.hasOwnProperty("cfg_" + key)) {
44  root.controller.faceConfiguration[key] = item["cfg_" + key]
45  }
46  }
47  }
48 
49 
50  onItemChanged: {
51  if (!item || !root.controller.faceConfiguration) {
52  return;
53  }
54 
55  for (var key in root.controller.faceConfiguration) {
56  if (!item.hasOwnProperty("cfg_" + key)) {
57  continue;
58  }
59 
60  item["cfg_" + key] = root.controller.faceConfiguration[key];
61  var changedSignal = item["cfg_" + key + "Changed"];
62  if (changedSignal) {
63  changedSignal.connect(root.configurationChanged);
64  }
65  }
66  }
67 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Mar 4 2021 23:09:25 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.