mirror of
https://gitdl.cn/https://github.com/chakralinux/desktop.git
synced 2025-02-04 03:37:16 +08:00
110 lines
3.6 KiB
Diff
110 lines
3.6 KiB
Diff
commit 77a4ec2cd7e59035efe895e12912c0695b11deef
|
|
Author: Vishesh Handa <me@vhanda.in>
|
|
Date: Tue Apr 22 16:29:12 2014 +0200
|
|
|
|
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
|
|
|
|
diff --git a/src/file/kcm/configwidget.ui b/src/file/kcm/configwidget.ui
|
|
index 484ec2c..0d12432 100644
|
|
--- a/src/file/kcm/configwidget.ui
|
|
+++ b/src/file/kcm/configwidget.ui
|
|
@@ -55,6 +55,13 @@
|
|
</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">
|
|
<enum>Qt::Vertical</enum>
|
|
diff --git a/src/file/kcm/kcm.cpp b/src/file/kcm/kcm.cpp
|
|
index f40d365..10a242e 100644
|
|
--- a/src/file/kcm/kcm.cpp
|
|
+++ b/src/file/kcm/kcm.cpp
|
|
@@ -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"
|
|
diff --git a/src/file/kcm/kcm.h b/src/file/kcm/kcm.h
|
|
index 440849d..6ff5813 100644
|
|
--- a/src/file/kcm/kcm.h
|
|
+++ b/src/file/kcm/kcm.h
|
|
@@ -39,7 +39,9 @@ public Q_SLOTS:
|
|
void save();
|
|
void defaults();
|
|
|
|
+ void folderSelectionChanged();
|
|
private:
|
|
+ bool m_previouslyEnabled;
|
|
};
|
|
}
|
|
|