diff --git a/kcms/baloo/package/contents/ui/constants.js b/kcms/baloo/package/contents/ui/constants.js new file mode 100644 --- /dev/null +++ b/kcms/baloo/package/contents/ui/constants.js @@ -0,0 +1,34 @@ +/* + * This file is part of the KDE Baloo Project + * Copyright (C) 2015 Pinak Ahuja + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) version 3, or any + * later version accepted by the membership of KDE e.V. (or its + * successor approved by the membership of KDE e.V.), which shall + * act as a proxy defined in Section 6 of version 3 of the license. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + */ + +var State = { + Idle: 0, + Suspended: 1, + FirstRun: 2, + NewFiles: 3, + ModifiedFiles: 4, + XAttrFiles: 5, + ContentIndexing: 6, + UnindexedFileCheck: 7, + StaleIndexEntriesClean: 8, + LowPowerIdle: 9 +} diff --git a/kcms/baloo/package/contents/ui/main.qml b/kcms/baloo/package/contents/ui/main.qml --- a/kcms/baloo/package/contents/ui/main.qml +++ b/kcms/baloo/package/contents/ui/main.qml @@ -22,15 +22,22 @@ import QtQuick.Layouts 1.1 import QtQuick.Controls 2.11 as QQC2 import QtQuick.Dialogs 1.2 as QtDialogs +import org.kde.baloo.experimental 0.1 as Baloo import org.kde.kirigami 2.4 as Kirigami import org.kde.kcm 1.1 as KCM +import "constants.js" as Constants KCM.SimpleKCM { id: root implicitHeight: Kirigami.Units.gridUnit * 22 KCM.ConfigModule.quickHelp: i18n("This module lets you configure the file indexer and search functionality.") + + Baloo.Monitor { + id: monitor + } + ColumnLayout { anchors.fill: parent anchors.margins: Kirigami.Units.largeSpacing @@ -55,9 +62,65 @@ checked: kcm.fileContents onCheckStateChanged: kcm.fileContents = checked } + Item { Layout.preferredHeight: Kirigami.Units.gridUnit } + + // Current status + suspend/resume button + RowLayout { + Layout.fillWidth: true + + visible: fileSearchEnabled.checked + + QQC2.Label { + text: i18n("Indexer State: %1", monitor.stateString) + } + + QQC2.Button { + id: toggleButton + text: monitor.state == Constants.State.Suspended ? i18n("Resume") : i18n("Suspend") + onClicked: monitor.toggleSuspendState() + } + } + + // Current status, if indexing + ColumnLayout { + Layout.fillWidth: true + Layout.leftMargin: Kirigami.Units.largeSpacing * 2 + Layout.rightMargin: Kirigami.Units.largeSpacing * 2 + + visible: fileSearchEnabled.checked && monitor.state != Constants.State.Idle && monitor.state != Constants.State.LowPowerIdle + + QQC2.ProgressBar { + id: progress + Layout.fillWidth: true + + to: monitor.totalFiles + value: monitor.filesIndexed + } + + QQC2.Label { + id: filePath + + Layout.fillWidth: true + + elide: Text.ElideMiddle + text: { + if (monitor.state == Constants.State.ContentIndexing) { + return i18n("Currently indexing: %1", monitor.filePath) + } else { + return "" + } + } + } + } + + Item { + Layout.preferredHeight: Kirigami.Units.gridUnit + visible: fileSearchEnabled.checked + } + QQC2.Label { text: i18n("Do not search in these locations:") }