diff --git a/kcms/baloo/kcm.cpp b/kcms/baloo/kcm.cpp --- a/kcms/baloo/kcm.cpp +++ b/kcms/baloo/kcm.cpp @@ -119,6 +119,18 @@ ); QDBusConnection::sessionBus().asyncCall(message); + + // Delete the index when we turn off indexing + QString balooDBLocation; + QString envBalooPath = QString::fromLocal8Bit(qgetenv("BALOO_DB_PATH")); + if (!envBalooPath.isEmpty()) { + balooDBLocation = envBalooPath; + } else { + balooDBLocation = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/baloo/index"); + } + QFile(balooDBLocation).remove(); + m_previouslyEnabled = false; + } // Start cleaner 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 @@ -33,6 +33,16 @@ anchors.fill: parent anchors.margins: Kirigami.Units.largeSpacing + Kirigami.InlineMessage { + id: turnOffIndexingWarning + Layout.fillWidth: true + visible: false + type: Kirigami.MessageType.Warning + showCloseButton: true + text: i18n("Turning off file search will remove all existing index data."); + + } + QQC2.Label { text: i18n("File Search helps you quickly locate all your files based on their content.") } @@ -42,6 +52,7 @@ text: i18n("Enable File Search") checked: kcm.indexing onCheckStateChanged: { + turnOffIndexingWarning.visible = !checked; kcm.indexing = checked } }