Changeset View
Changeset View
Standalone View
Standalone View
kcms/baloo/kcm.cpp
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Line(s) | |||||
68 | 68 | | |||
69 | ServerConfigModule::~ServerConfigModule() | 69 | ServerConfigModule::~ServerConfigModule() | ||
70 | { | 70 | { | ||
71 | } | 71 | } | ||
72 | 72 | | |||
73 | void ServerConfigModule::load() | 73 | void ServerConfigModule::load() | ||
74 | { | 74 | { | ||
75 | ManagedConfigModule::load(); | 75 | ManagedConfigModule::load(); | ||
76 | m_previouslyEnabled = m_settings->indexingEnabled(); | | |||
77 | } | 76 | } | ||
78 | 77 | | |||
79 | void ServerConfigModule::save() | 78 | void ServerConfigModule::save() | ||
80 | { | 79 | { | ||
81 | ManagedConfigModule::save(); | 80 | ManagedConfigModule::save(); | ||
82 | 81 | | |||
82 | // Update Baloo config or start Baloo | ||||
83 | if (m_settings->indexingEnabled()) { | ||||
84 | // Update the baloo_file's config cache - if it not yet running, | ||||
85 | // the DBus call goes nowhere | ||||
83 | Baloo::IndexerConfig config; | 86 | Baloo::IndexerConfig config; | ||
84 | config.setFirstRun(m_previouslyEnabled != m_settings->indexingEnabled()); | 87 | config.refresh(); | ||
85 | | ||||
86 | m_previouslyEnabled = m_settings->indexingEnabled(); | | |||
87 | 88 | | |||
88 | // Start Baloo | 89 | // Trying to start baloo when it is already running is fine | ||
89 | if (m_settings->indexingEnabled()) { | | |||
90 | const QString exe = QStandardPaths::findExecutable(QStringLiteral("baloo_file")); | 90 | const QString exe = QStandardPaths::findExecutable(QStringLiteral("baloo_file")); | ||
91 | QProcess::startDetached(exe, QStringList()); | 91 | QProcess::startDetached(exe, QStringList()); | ||
92 | } | 92 | } | ||
93 | else { | 93 | else { | ||
94 | QDBusMessage message = QDBusMessage::createMethodCall( | 94 | QDBusMessage message = QDBusMessage::createMethodCall( | ||
95 | QStringLiteral("org.kde.baloo"), | 95 | QStringLiteral("org.kde.baloo"), | ||
96 | QStringLiteral("/"), | 96 | QStringLiteral("/"), | ||
97 | QStringLiteral("org.kde.baloo.main"), | 97 | QStringLiteral("org.kde.baloo.main"), | ||
98 | QStringLiteral("quit") | 98 | QStringLiteral("quit") | ||
99 | ); | 99 | ); | ||
100 | 100 | | |||
101 | QDBusConnection::sessionBus().asyncCall(message); | 101 | QDBusConnection::sessionBus().asyncCall(message); | ||
102 | } | 102 | } | ||
103 | | ||||
104 | // Update the baloo_file's config cache | | |||
105 | config.refresh(); | | |||
106 | } | 103 | } | ||
107 | 104 | | |||
108 | FilteredFolderModel *ServerConfigModule::filteredModel() const | 105 | FilteredFolderModel *ServerConfigModule::filteredModel() const | ||
109 | { | 106 | { | ||
110 | return m_filteredFolderModel; | 107 | return m_filteredFolderModel; | ||
111 | } | 108 | } | ||
112 | 109 | | |||
113 | BalooSettings *ServerConfigModule::balooSettings() const | 110 | BalooSettings *ServerConfigModule::balooSettings() const | ||
114 | { | 111 | { | ||
115 | return m_settings; | 112 | return m_settings; | ||
116 | } | 113 | } | ||
117 | 114 | | |||
118 | #include "kcm.moc" | 115 | #include "kcm.moc" |