Commit 19d0b8f4 authored by Weixuan Xiao's avatar Weixuan Xiao
Browse files

Improve D-Bus processing on macOS

Unset launchctl env before running the new one, to avoid connecting through the old launchctl env.
Show a warn message for D-Bus connection failure on macOS.
parent cb7a9203
Pipeline #195687 passed with stage
in 5 minutes and 2 seconds
......@@ -84,6 +84,7 @@ int IndicatorHelper::daemonHook(QProcess &kdeconnectd)
// Here we will try to bring our private session D-Bus
if (!hasUsableSessionBus) {
qDebug() << "Launching private session D-Bus.";
DBusHelper::macosUnsetLaunchctlEnv();
DBusHelper::launchDBusDaemon();
// Wait for dbus daemon env
QProcess getLaunchdDBusEnv;
......@@ -99,9 +100,19 @@ int IndicatorHelper::daemonHook(QProcess &kdeconnectd)
QString launchdDBusEnv = QString::fromLocal8Bit(getLaunchdDBusEnv.readAllStandardOutput());
if (launchdDBusEnv.length() > 0 && QDBusConnection::sessionBus().isConnected()) {
if (!launchdDBusEnv.isEmpty() && QDBusConnection::sessionBus().isConnected()) {
qDebug() << "Private D-Bus daemon launched and connected.";
hasUsableSessionBus = true;
} else if (!launchdDBusEnv.isEmpty()) {
// Show a warning and exit
qCritical() << "Invalid " << KDECONNECT_SESSION_DBUS_LAUNCHD_ENV << "env: \""
<< launchdDBusEnv << "\"";
QMessageBox::critical(nullptr, i18n("KDE Connect"),
i18n("Cannot connect to DBus\n"
"KDE Connect will quit"),
QMessageBox::Abort,
QMessageBox::Abort);
} else {
// Show a warning and exit
qCritical() << "Fail to get launchctl" << KDECONNECT_SESSION_DBUS_LAUNCHD_ENV << "env";
......
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