From 3f8c573edba709b9552604da853b76259d10f8e3 Mon Sep 17 00:00:00 2001 From: lixueman Date: Thu, 23 Jun 2022 16:23:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BA=94=E7=94=A8=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=99=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/UserInterface/tabletwindow.cpp | 2 +- src/UtilityFunction/utility.cpp | 36 +++++++++++++++++++----------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/UserInterface/tabletwindow.cpp b/src/UserInterface/tabletwindow.cpp index 4f26924..378ad1f 100755 --- a/src/UserInterface/tabletwindow.cpp +++ b/src/UserInterface/tabletwindow.cpp @@ -615,7 +615,7 @@ void TabletWindow::execApplication(QString desktopfp) if (!g_subProjectCodeName.contains("mavis") || (g_subProjectCodeName.contains("mavis") && !QDBusReply(iface.call("LaunchApp", desktopfp)))) { - execApp(desktopfp); +// execApp(desktopfp); QString str; //打开文件.desktop GError **error = nullptr; diff --git a/src/UtilityFunction/utility.cpp b/src/UtilityFunction/utility.cpp index 3eee325..40c6f08 100755 --- a/src/UtilityFunction/utility.cpp +++ b/src/UtilityFunction/utility.cpp @@ -710,22 +710,32 @@ bool deleteAppRecord(QString desktopfn) void execApp(QString desktopfp) { - UkuiMenuInterface interface; - if (interface.checkKreApp(desktopfp)) { - QProcess::startDetached(interface.getAppExec(desktopfp)); - } else { - QString appName = interface.getAppExec(desktopfp); - QStringList strList = (appName.replace("\"", "")).split(" "); + QDBusInterface iface("com.kylin.AppManager", + "/com/kylin/AppManager", + "com.kylin.AppManager", + QDBusConnection::sessionBus()); + QDBusReply res = iface.call("LaunchApp", desktopfp); - if (QString(strList.at(0)) == "kmplayer") { - QProcess::startDetached(strList.at(0)); - return; + if (!res.isValid() || !res) { + + UkuiMenuInterface interface; + + if (interface.checkKreApp(desktopfp)) { + QProcess::startDetached(interface.getAppExec(desktopfp)); + } else { + QString appName = interface.getAppExec(desktopfp); + QStringList strList = (appName.replace("\"", "")).split(" "); + + if (QString(strList.at(0)) == "kmplayer") { + QProcess::startDetached(strList.at(0)); + return; + } + + GDesktopAppInfo *desktopAppInfo = g_desktop_app_info_new_from_filename(desktopfp.toLocal8Bit().data()); + g_app_info_launch(G_APP_INFO(desktopAppInfo), nullptr, nullptr, nullptr); + g_object_unref(desktopAppInfo); } - - GDesktopAppInfo *desktopAppInfo = g_desktop_app_info_new_from_filename(desktopfp.toLocal8Bit().data()); - g_app_info_launch(G_APP_INFO(desktopAppInfo), nullptr, nullptr, nullptr); - g_object_unref(desktopAppInfo); } QFileInfo fileInfo(desktopfp);