kdecore: ksycoca database is usable without kded

there is config option to disable resources monitoring in which case even if
kded is started it will not keep the database up-to-date and it has to be
done manually

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-06-13 08:01:13 +03:00
parent 5e08cfa749
commit b0a5d8b2bf

View file

@ -327,14 +327,8 @@ bool KSycocaPrivate::checkDatabase(BehaviorsIfNotFound ifNotFound)
closeDatabase(); // close the dummy one closeDatabase(); // close the dummy one
static const QString kdedInterface = QString::fromLatin1("org.kde.kded");
QDBusConnectionInterface* sessionInterface = QDBusConnection::sessionBus().interface();
// We can only use the installed ksycoca file if kded is running, since
// kded is what keeps the file up-to-date.
const bool kdedRunning = sessionInterface->isServiceRegistered(kdedInterface);
// Check if new database already available // Check if new database already available
if (kdedRunning && openDatabase(ifNotFound & IfNotFoundOpenDummy)) { if (openDatabase(ifNotFound & IfNotFoundOpenDummy)) {
if (checkVersion()) { if (checkVersion()) {
// Database exists, and version is ok. // Database exists, and version is ok.
return true; return true;
@ -361,6 +355,9 @@ bool KSycocaPrivate::checkDatabase(BehaviorsIfNotFound ifNotFound)
} }
// If kded is not running we need to launch it as it monitors for changes // If kded is not running we need to launch it as it monitors for changes
static const QString kdedInterface = QString::fromLatin1("org.kde.kded");
QDBusConnectionInterface* sessionInterface = QDBusConnection::sessionBus().interface();
const bool kdedRunning = sessionInterface->isServiceRegistered(kdedInterface);
if (!kdedRunning) { if (!kdedRunning) {
kDebug(7011) << "Launching kded"; kDebug(7011) << "Launching kded";
sessionInterface->startService(kdedInterface); sessionInterface->startService(kdedInterface);