Fix exit due to too early D-Bus call on macOS

Move D-Bus call related code after daemonHook.
This should also keep compatibility on Windows.
This commit is contained in:
Weixuan XIAO 2021-06-22 15:03:46 +02:00
parent 8356cf4e5b
commit 6f342d3ec2

View file

@ -42,11 +42,6 @@ int main(int argc, char** argv)
i18n("(C) 2016 Aleix Pol Gonzalez"));
KAboutData::setApplicationData(about);
KDBusService dbusService(KDBusService::Unique);
// Trigger loading the KIconLoader plugin
about.setProgramLogo(QIcon(QStringLiteral(":/icons/kdeconnect/kdeconnect.svg")));
#ifdef Q_OS_WIN
KColorSchemeManager manager;
QApplication::setStyle(QStringLiteral("breeze"));
@ -58,11 +53,17 @@ int main(int argc, char** argv)
helper.preInit();
// Run Daemon initialization step
// When run from macOS app bundle, D-Bus call should be later than kdeconnectd and D-Bus daemon
QProcess kdeconnectd;
if (helper.daemonHook(kdeconnectd)) {
return -1;
}
KDBusService dbusService(KDBusService::Unique);
// Trigger loading the KIconLoader plugin
about.setProgramLogo(QIcon(QStringLiteral(":/icons/kdeconnect/kdeconnect.svg")));
DevicesModel model;
model.setDisplayFilter(DevicesModel::Reachable | DevicesModel::Paired);
QMenu* menu = new QMenu;