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 | ||
27 | 28 | | |||
28 | KCM.SimpleKCM { | 29 | KCM.SimpleKCM { | ||
29 | id: root | 30 | id: root | ||
30 | 31 | | |||
31 | implicitHeight: Kirigami.Units.gridUnit * 22 | 32 | implicitHeight: Kirigami.Units.gridUnit * 22 | ||
32 | 33 | | |||
33 | KCM.ConfigModule.quickHelp: i18n("This module lets you configure the file indexer and search functionality.") | 34 | KCM.ConfigModule.quickHelp: i18n("This module lets you configure the file indexer and search functionality.") | ||
35 | | ||||
36 | Baloo.Monitor { | ||||
37 | id: monitor | ||||
38 | } | ||||
39 | | ||||
34 | ColumnLayout { | 40 | ColumnLayout { | ||
35 | anchors.fill: parent | 41 | anchors.fill: parent | ||
36 | anchors.margins: Kirigami.Units.largeSpacing | 42 | anchors.margins: Kirigami.Units.largeSpacing | ||
37 | 43 | | |||
38 | QQC2.Label { | 44 | QQC2.Label { | ||
39 | text: i18n("File Search helps you quickly locate all your files based on their content.") | 45 | text: i18n("File Search helps you quickly locate all your files based on their content.") | ||
40 | } | 46 | } | ||
41 | 47 | | |||
42 | QQC2.CheckBox { | 48 | QQC2.CheckBox { | ||
43 | id: fileSearchEnabled | 49 | id: fileSearchEnabled | ||
44 | text: i18n("Enable File Search") | 50 | text: i18n("Enable File Search") | ||
45 | checked: kcm.indexing | 51 | checked: kcm.indexing | ||
46 | onCheckStateChanged: { | 52 | onCheckStateChanged: { | ||
47 | kcm.indexing = checked | 53 | kcm.indexing = checked | ||
48 | } | 54 | } | ||
49 | } | 55 | } | ||
50 | 56 | | |||
51 | QQC2.CheckBox { | 57 | QQC2.CheckBox { | ||
52 | id: indexFileContents | 58 | id: indexFileContents | ||
53 | text: i18n("Also index file content") | 59 | text: i18n("Also index file content") | ||
54 | enabled: fileSearchEnabled.checked | 60 | enabled: fileSearchEnabled.checked | ||
55 | checked: kcm.fileContents | 61 | checked: kcm.fileContents | ||
56 | onCheckStateChanged: kcm.fileContents = checked | 62 | onCheckStateChanged: kcm.fileContents = checked | ||
57 | } | 63 | } | ||
64 | | ||||
65 | Item { | ||||
66 | Layout.preferredHeight: Kirigami.Units.gridUnit | ||||
67 | } | ||||
68 | | ||||
69 | // Current status, if indexing | ||||
70 | ColumnLayout { | ||||
71 | Layout.fillWidth: true | ||||
72 | | ||||
73 | visible: fileSearchEnabled.checked | ||||
74 | | ||||
75 | | ||||
76 | RowLayout { | ||||
77 | Layout.alignment: Qt.AlignHCenter | ||||
78 | QQC2.Label { | ||||
79 | text: i18n("Status: %1, %2\% complete", monitor.stateString, Math.floor(monitor.filesIndexed / monitor.totalFiles * 100)) | ||||
80 | } | ||||
81 | | ||||
82 | QQC2.Button { | ||||
83 | text: monitor.state == Baloo.Baloo.Suspended ? i18n("Resume Indexer") : i18n("Pause Indexer") | ||||
84 | onClicked: monitor.toggleSuspendState() | ||||
85 | } | ||||
86 | } | ||||
87 | | ||||
88 | QQC2.ProgressBar { | ||||
89 | id: progressBar | ||||
90 | Layout.fillWidth: true | ||||
91 | | ||||
92 | visible: switch(monitor.state) { | ||||
93 | case Baloo.Baloo.FirstRun: | ||||
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… | |||||
94 | case Baloo.Baloo.NewFiles: | ||||
95 | case Baloo.Baloo.ModifiedFiles: | ||||
96 | case Baloo.Baloo.XAttrFiles: | ||||
97 | case Baloo.Baloo.ContentIndexing: | ||||
98 | case Baloo.Baloo.UnindexedFileCheck: | ||||
99 | case Baloo.Baloo.StaleIndexEntriesClean: | ||||
100 | return true; | ||||
101 | break; | ||||
102 | default: | ||||
103 | return false; | ||||
104 | break; | ||||
105 | } | ||||
106 | | ||||
107 | to: monitor.totalFiles | ||||
108 | value: monitor.filesIndexed | ||||
109 | } | ||||
110 | | ||||
111 | QQC2.Label { | ||||
112 | id: filePath | ||||
113 | | ||||
114 | Layout.fillWidth: true | ||||
115 | | ||||
116 | visible: text.length > 0 | ||||
117 | | ||||
118 | elide: Text.ElideMiddle | ||||
119 | text: progressBar.visible ? i18n("Currently indexing: %1", monitor.filePath) : "" | ||||
120 | } | ||||
121 | } | ||||
122 | | ||||
58 | Item { | 123 | Item { | ||
59 | Layout.preferredHeight: Kirigami.Units.gridUnit | 124 | Layout.preferredHeight: Kirigami.Units.gridUnit | ||
125 | visible: fileSearchEnabled.checked | ||||
60 | } | 126 | } | ||
127 | | ||||
61 | QQC2.Label { | 128 | QQC2.Label { | ||
62 | text: i18n("Do not search in these locations:") | 129 | text: i18n("Do not search in these locations:") | ||
63 | } | 130 | } | ||
64 | 131 | | |||
65 | QQC2.ScrollView { | 132 | QQC2.ScrollView { | ||
66 | id: bgObject | 133 | id: bgObject | ||
67 | Component.onCompleted: bgObject.background.visible = true | 134 | Component.onCompleted: bgObject.background.visible = true | ||
68 | Layout.fillWidth: true | 135 | Layout.fillWidth: true | ||
69 | Layout.fillHeight: true | 136 | Layout.fillHeight: true | ||
70 | 137 | | |||
71 | ListView { | 138 | ListView { | ||
72 | id: fileExcludeList | 139 | id: fileExcludeList | ||
73 | anchors.fill: parent | 140 | anchors.fill: parent | ||
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… | |||||
74 | 141 | | |||
75 | model: kcm.filteredModel | 142 | model: kcm.filteredModel | ||
76 | delegate: Kirigami.BasicListItem { | 143 | delegate: Kirigami.BasicListItem { | ||
77 | icon: model.decoration | 144 | icon: model.decoration | ||
78 | label: model.folder | 145 | label: model.folder | ||
79 | onClicked: fileExcludeList.currentIndex = index | 146 | onClicked: fileExcludeList.currentIndex = index | ||
80 | } | 147 | } | ||
81 | } | 148 | } | ||
82 | } | 149 | } | ||
83 | 150 | | |||
84 | RowLayout { | 151 | RowLayout { | ||
davidedmundson: what about:
LowPowerIdle? | |||||
85 | QQC2.Button { | 152 | QQC2.Button { | ||
86 | id: addFolder | 153 | id: addFolder | ||
87 | icon.name: "list-add" | 154 | icon.name: "list-add" | ||
88 | onClicked: fileDialogLoader.active = true | 155 | onClicked: fileDialogLoader.active = true | ||
89 | } | 156 | } | ||
90 | 157 | | |||
91 | QQC2.Button{ | 158 | QQC2.Button{ | ||
92 | id: removeFolder | 159 | id: removeFolder | ||
93 | icon.name: "list-remove" | 160 | icon.name: "list-remove" | ||
94 | enabled: fileExcludeList.currentIndex !== -1 | 161 | enabled: fileExcludeList.currentIndex !== -1 | ||
95 | onClicked: { | 162 | onClicked: { | ||
96 | kcm.filteredModel.removeFolder(fileExcludeList.currentIndex) | 163 | kcm.filteredModel.removeFolder(fileExcludeList.currentIndex) | ||
97 | } | 164 | } | ||
98 | } | 165 | } | ||
99 | } | 166 | } | ||
100 | } | 167 | } | ||
101 | 168 | | |||
102 | Loader { | 169 | Loader { | ||
davidedmundson: Is the space after %1 deliberate? | |||||
103 | id: fileDialogLoader | 170 | id: fileDialogLoader | ||
104 | active: false | 171 | active: false | ||
105 | sourceComponent: QtDialogs.FileDialog { | 172 | sourceComponent: QtDialogs.FileDialog { | ||
106 | title: i18n("Select a folder to filter") | 173 | title: i18n("Select a folder to filter") | ||
107 | folder: shortcuts.home | 174 | folder: shortcuts.home | ||
108 | selectFolder: true | 175 | selectFolder: true | ||
109 | 176 | | |||
110 | onAccepted: { | 177 | onAccepted: { | ||
Show All 12 Lines |
Monitor's property is called state. Lowercase S.
A switch statement here might make this a bit easier to read.