Commit 093ed784 authored by David Faure's avatar David Faure
Browse files

kontact: simplify ksycoca-related startup code

Summary:
ksycoca is rebuilt in process these days, looping and waiting
[for kbuildsycoca] makes no sense anymore [for a long time now].

CCBUG: 414137

Test Plan:
deleted ksycoca file, started kontact, it said "rebuilding ksycoca"
and started up fine

Reviewers: mlaurent, winterz, vkrause

Reviewed By: vkrause

Subscribers: kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D25531
parent 1dd86d2c
......@@ -136,36 +136,15 @@ void MainWindow::initGUI()
}
}
void MainWindow::waitForKSycoca()
{
int i = 0;
while (i < KSYCOCA_WAIT_TIMEOUT) {
if (KSycoca::isAvailable()) {
return;
}
// When KSycoca is not available that usually means Kontact
// was started before kded is done with it's first run
// we want to block Kontact execution to
// give Kded time to initialize and create the
// System Configuration database necessary for further
// Kontact startup
qCDebug(KONTACT_LOG) << "Waiting for KSycoca";
#ifdef WIN32
Sleep(1000);
#else
sleep(1);
#endif
++i;
}
// This should only happen if the distribution is broken
qFatal("KSycoca unavailable. Kontact will be unable to find plugins.");
}
void MainWindow::initObject()
{
if (!KSycoca::isAvailable()) {
waitForKSycoca();
qDebug() << "Trying to create ksycoca...";
KSycoca::self()->ensureCacheValid();
if (!KSycoca::isAvailable()) {
// This should only happen if the distribution is broken, or the disk full
qFatal("KSycoca unavailable. Kontact will be unable to find plugins.");
}
}
KService::List offers = KServiceTypeTrader::self()->query(
QStringLiteral("Kontact/Plugin"),
......
......@@ -90,7 +90,6 @@ private:
void initAboutScreen();
void loadSettings();
void saveSettings();
void waitForKSycoca();
bool isPluginLoaded(const KPluginInfo &);
KontactInterface::Plugin *pluginFromInfo(const KPluginInfo &);
......
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