Commit 77a4ec2c authored by Vishesh Handa's avatar Vishesh Handa

Add an explicit disable checkbox for Baloo

This adds a new string "Enable Desktop Search"

FEATURE: 331932
FIXED-IN: 4.13.1
CCMAIL: kde-i18n-doc@kde.org
parent badd626d
......@@ -54,6 +54,13 @@
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="m_enableCheckbox">
<property name="text">
<string>Enable Desktop Search</string>
</property>
</widget>
</item>
<item>
<spacer name="bottomSpacer">
<property name="orientation">
......
......@@ -70,6 +70,10 @@ ServerConfigModule::ServerConfigModule(QWidget* parent, const QVariantList& args
connect(m_folderSelectionWidget, SIGNAL(changed()),
this, SLOT(changed()));
connect(m_folderSelectionWidget, SIGNAL(changed()),
this, SLOT(folderSelectionChanged()));
connect(m_enableCheckbox, SIGNAL(stateChanged(int)),
this, SLOT(changed()));
}
......@@ -84,6 +88,10 @@ void ServerConfigModule::load()
KConfig config("baloofilerc");
KConfigGroup group = config.group("General");
KConfigGroup basicSettings = config.group("Basic Settings");
m_previouslyEnabled = basicSettings.readEntry("Indexing-Enabled", true);
m_enableCheckbox->setChecked(m_previouslyEnabled);
QStringList includeFolders = group.readPathEntry("folders", defaultFolders());
QStringList excludeFolders = group.readPathEntry("exclude folders", QStringList());
m_folderSelectionWidget->setFolders(includeFolders, excludeFolders);
......@@ -102,15 +110,24 @@ void ServerConfigModule::save()
KConfig config("baloofilerc");
KConfigGroup basicSettings = config.group("Basic Settings");
bool indexingEnabled = !m_folderSelectionWidget->allMountPointsExcluded();
basicSettings.writeEntry("Indexing-Enabled", indexingEnabled);
bool mountPointsEx = m_folderSelectionWidget->allMountPointsExcluded();
bool enabled = m_enableCheckbox->isChecked();
if (mountPointsEx)
enabled = false;
basicSettings.writeEntry("Indexing-Enabled", enabled);
// 2.2 Update normals paths
config.group("General").writePathEntry("folders", includeFolders);
config.group("General").writePathEntry("exclude folders", excludeFolders);
if (m_previouslyEnabled != enabled) {
config.group("General").deleteEntry("first run");
}
// Start Baloo
if (indexingEnabled) {
if (enabled) {
const QString exe = KStandardDirs::findExe(QLatin1String("baloo_file"));
QProcess::startDetached(exe);
}
......@@ -137,4 +154,10 @@ void ServerConfigModule::defaults()
m_folderSelectionWidget->setFolders(defaultFolders(), QStringList());
}
void ServerConfigModule::folderSelectionChanged()
{
bool disabled = m_folderSelectionWidget->allMountPointsExcluded();
m_enableCheckbox->setChecked(!disabled);
}
#include "kcm.moc"
......@@ -39,7 +39,9 @@ public Q_SLOTS:
void save();
void defaults();
void folderSelectionChanged();
private:
bool m_previouslyEnabled;
};
}
......
Markdown is supported
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