Skip to content

Commit

Permalink
fix: try to activate dialog service before init manager
Browse files Browse the repository at this point in the history
In linglong container, application couldn't find binary `dde-desktop`,
and `com.deepin.filemanager.filedialog` may not be activated.
So we use the `D-Bus Activation` mechanism to activate this service.

Issue: linuxdeepin/developer-center#8433

Signed-off-by: ComixHe <[email protected]>
  • Loading branch information
ComixHe committed May 13, 2024
1 parent 722df56 commit 78e8e1f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion platformthemeplugin/qdeepinfiledialoghelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,18 @@ void QDeepinFileDialogHelper::initDBusFileDialogManager()
} else {
dialogService = DIALOG_SERVICE;
}

const auto *managerObjectPath = "/com/deepin/filemanager/filedialogmanager";
auto conn = QDBusConnection::sessionBus();
auto reply = conn.call(QDBusMessage::createMethodCall(dialogService, managerObjectPath , "org.freedesktop.DBus.Peer", "Ping"));

if(reply.type() != QDBusMessage::ReplyMessage) {
qCWarning(fileDialogHelper) << reply.errorMessage();
}

if (QDBusConnection::sessionBus().interface()->isServiceRegistered(dialogService).value()
|| !QStandardPaths::findExecutable("dde-desktop").isEmpty()) {
manager = new DFileDialogManager(dialogService, "/com/deepin/filemanager/filedialogmanager", QDBusConnection::sessionBus());
manager = new DFileDialogManager(dialogService, managerObjectPath, QDBusConnection::sessionBus());
}
}

Expand Down

0 comments on commit 78e8e1f

Please sign in to comment.