Changeset View
Changeset View
Standalone View
Standalone View
kcms/baloo/package/contents/ui/main.qml
Show All 16 Lines | |||||
17 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | import QtQuick 2.1 | 21 | import QtQuick 2.1 | ||
22 | import QtQuick.Layouts 1.1 | 22 | import QtQuick.Layouts 1.1 | ||
23 | import QtQuick.Controls 2.11 as QQC2 | 23 | import QtQuick.Controls 2.11 as QQC2 | ||
24 | import QtQuick.Dialogs 1.2 as QtDialogs | 24 | import QtQuick.Dialogs 1.2 as QtDialogs | ||
25 | import org.kde.baloo.experimental 0.1 as Baloo | ||||
25 | import org.kde.kirigami 2.4 as Kirigami | 26 | import org.kde.kirigami 2.4 as Kirigami | ||
26 | import org.kde.kcm 1.1 as KCM | 27 | import org.kde.kcm 1.1 as KCM | ||
28 | import "constants.js" as Constants | ||||
27 | 29 | | |||
28 | KCM.SimpleKCM { | 30 | KCM.SimpleKCM { | ||
29 | id: root | 31 | id: root | ||
30 | 32 | | |||
31 | implicitHeight: Kirigami.Units.gridUnit * 22 | 33 | implicitHeight: Kirigami.Units.gridUnit * 22 | ||
32 | 34 | | |||
33 | KCM.ConfigModule.quickHelp: i18n("This module lets you configure the file indexer and search functionality.") | 35 | KCM.ConfigModule.quickHelp: i18n("This module lets you configure the file indexer and search functionality.") | ||
36 | | ||||
37 | Baloo.Monitor { | ||||
38 | id: monitor | ||||
39 | } | ||||
40 | | ||||
34 | ColumnLayout { | 41 | ColumnLayout { | ||
35 | anchors.fill: parent | 42 | anchors.fill: parent | ||
36 | anchors.margins: Kirigami.Units.largeSpacing | 43 | anchors.margins: Kirigami.Units.largeSpacing | ||
37 | 44 | | |||
38 | QQC2.Label { | 45 | QQC2.Label { | ||
39 | text: i18n("File Search helps you quickly locate all your files based on their content.") | 46 | text: i18n("File Search helps you quickly locate all your files based on their content.") | ||
40 | } | 47 | } | ||
41 | 48 | | |||
42 | QQC2.CheckBox { | 49 | QQC2.CheckBox { | ||
43 | id: fileSearchEnabled | 50 | id: fileSearchEnabled | ||
44 | text: i18n("Enable File Search") | 51 | text: i18n("Enable File Search") | ||
45 | checked: kcm.indexing | 52 | checked: kcm.indexing | ||
46 | onCheckStateChanged: { | 53 | onCheckStateChanged: { | ||
47 | kcm.indexing = checked | 54 | kcm.indexing = checked | ||
48 | } | 55 | } | ||
49 | } | 56 | } | ||
50 | 57 | | |||
51 | QQC2.CheckBox { | 58 | QQC2.CheckBox { | ||
52 | id: indexFileContents | 59 | id: indexFileContents | ||
53 | text: i18n("Also index file content") | 60 | text: i18n("Also index file content") | ||
54 | enabled: fileSearchEnabled.checked | 61 | enabled: fileSearchEnabled.checked | ||
55 | checked: kcm.fileContents | 62 | checked: kcm.fileContents | ||
56 | onCheckStateChanged: kcm.fileContents = checked | 63 | onCheckStateChanged: kcm.fileContents = checked | ||
57 | } | 64 | } | ||
65 | | ||||
58 | Item { | 66 | Item { | ||
59 | Layout.preferredHeight: Kirigami.Units.gridUnit | 67 | Layout.preferredHeight: Kirigami.Units.gridUnit | ||
60 | } | 68 | } | ||
69 | | ||||
70 | // Current status + suspend/resume button | ||||
71 | RowLayout { | ||||
72 | Layout.fillWidth: true | ||||
73 | | ||||
74 | visible: fileSearchEnabled.checked | ||||
75 | | ||||
76 | QQC2.Label { | ||||
77 | text: i18n("Indexer State: %1", monitor.stateString) | ||||
78 | } | ||||
79 | | ||||
80 | QQC2.Button { | ||||
81 | id: toggleButton | ||||
82 | text: monitor.state == Constants.State.Suspended ? i18n("Resume") : i18n("Suspend") | ||||
davidedmundson: This is the wrong way round | |||||
Edit, no it wasn't wrong But I have found what is. I export this as the class Baloo, but the import is also under Baloo So for this to work against my patch it would be Baloo.Baloo.Suspended davidedmundson: Edit, no it wasn't wrong
But I have found what is.
I export this as the class Baloo, but the… | |||||
This isn't in this diff davidedmundson: >So for this to work against my patch it would be Baloo.Baloo.Suspended
This isn't in this… | |||||
83 | onClicked: monitor.toggleSuspendState() | ||||
84 | } | ||||
85 | } | ||||
86 | | ||||
87 | // Current status, if indexing | ||||
88 | ColumnLayout { | ||||
89 | Layout.fillWidth: true | ||||
90 | Layout.leftMargin: Kirigami.Units.largeSpacing * 2 | ||||
91 | Layout.rightMargin: Kirigami.Units.largeSpacing * 2 | ||||
92 | | ||||
93 | visible: fileSearchEnabled.checked && monitor.state != Constants.State.Idle && monitor.state != Constants.State.LowPowerIdle | ||||
davidedmundson: what about:
LowPowerIdle? | |||||
94 | | ||||
Monitor's property is called state. Lowercase S. A switch statement here might make this a bit easier to read. davidedmundson: Monitor's property is called state. Lowercase S.
A switch statement here might make this a bit… | |||||
Done, but now opening the KCM prints a ton of these errors: QMetaProperty::read: Unable to handle unregistered datatype 'Baloo::IndexerState' for property 'Baloo::Monitor::state' ngraham: Done, but now opening the KCM prints a ton of these errors:
```
QMetaProperty::read: Unable to… | |||||
95 | QQC2.ProgressBar { | ||||
96 | id: progress | ||||
97 | Layout.fillWidth: true | ||||
98 | | ||||
99 | to: monitor.totalFiles | ||||
100 | value: monitor.filesIndexed | ||||
101 | } | ||||
102 | | ||||
103 | QQC2.Label { | ||||
104 | id: filePath | ||||
105 | | ||||
106 | Layout.fillWidth: true | ||||
107 | | ||||
108 | elide: Text.ElideMiddle | ||||
109 | text: { | ||||
110 | if (monitor.state == Constants.State.ContentIndexing) { | ||||
111 | return i18n("Currently indexing: %1", monitor.filePath) | ||||
davidedmundson: Is the space after %1 deliberate? | |||||
112 | } else { | ||||
113 | return "" | ||||
114 | } | ||||
115 | } | ||||
116 | } | ||||
117 | } | ||||
118 | | ||||
119 | Item { | ||||
120 | Layout.preferredHeight: Kirigami.Units.gridUnit | ||||
121 | visible: fileSearchEnabled.checked | ||||
122 | } | ||||
123 | | ||||
61 | QQC2.Label { | 124 | QQC2.Label { | ||
62 | text: i18n("Do not search in these locations:") | 125 | text: i18n("Do not search in these locations:") | ||
63 | } | 126 | } | ||
64 | 127 | | |||
65 | QQC2.ScrollView { | 128 | QQC2.ScrollView { | ||
66 | id: bgObject | 129 | id: bgObject | ||
67 | Component.onCompleted: bgObject.background.visible = true | 130 | Component.onCompleted: bgObject.background.visible = true | ||
68 | Layout.fillWidth: true | 131 | Layout.fillWidth: true | ||
▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines |
This is the wrong way round