Commit e399041e authored by Nate Graham's avatar Nate Graham
Browse files

[kcms/baloo] Only show "Delete index?" message when there is an index

Otherwise it will always appear when indexing is disabled even after the
index has already been deleted.

BUG: 436354
FIXED-IN: 5.22
parent 2536848f
......@@ -128,9 +128,14 @@ void ServerConfigModule::deleteIndex()
QFile(balooDatabaseLocation()).remove();
}
QString ServerConfigModule::indexFileSize()
int ServerConfigModule::rawIndexFileSize()
{
return KFormat().formatByteSize(QFile(balooDatabaseLocation()).size());
return QFile(balooDatabaseLocation()).size();
}
QString ServerConfigModule::prettyIndexFileSize()
{
return KFormat().formatByteSize(rawIndexFileSize());
}
#include "kcm.moc"
......@@ -44,7 +44,8 @@ public:
FilteredFolderModel *filteredModel() const;
Q_INVOKABLE void deleteIndex();
Q_INVOKABLE QString indexFileSize();
Q_INVOKABLE int rawIndexFileSize();
Q_INVOKABLE QString prettyIndexFileSize();
public Q_SLOTS:
void load() override;
......
......@@ -62,10 +62,10 @@ KCM.SimpleKCM {
Kirigami.InlineMessage {
id: indexingDisabledWarning
Layout.fillWidth: true
visible: !kcm.balooSettings.indexingEnabled && !kcm.needsSave
visible: !kcm.balooSettings.indexingEnabled && !kcm.needsSave && kcm.rawIndexFileSize() > 0
type: Kirigami.MessageType.Warning
showCloseButton: true
text: i18n("Do you want to delete the saved index data? %1 of space will be freed, but if indexing is re-enabled later, the entire index will have to be re-created from scratch. This may take some time, depending on how many files you have.", kcm.indexFileSize());
text: i18n("Do you want to delete the saved index data? %1 of space will be freed, but if indexing is re-enabled later, the entire index will have to be re-created from scratch. This may take some time, depending on how many files you have.", kcm.prettyIndexFileSize());
actions: [
Kirigami.Action {
text: i18n("Delete Index Data")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment