diff --git a/search-ukcc-plugin/search.cpp b/search-ukcc-plugin/search.cpp index e197fc5..601ad68 100644 --- a/search-ukcc-plugin/search.cpp +++ b/search-ukcc-plugin/search.cpp @@ -981,9 +981,28 @@ void Search::initAiSettings() { } void Search::onGetAiModelBtnClicked() { -// if (!isModelReady) { - QProcess::startDetached("kylin-model-downloader", {}); -// } else { -// qWarning() << "Model is ready."; -// } + bool res(false); + auto appLaunchInterface = new QDBusInterface(QStringLiteral("com.kylin.ProcessManager"), + QStringLiteral("/com/kylin/ProcessManager/AppLauncher"), + QStringLiteral("com.kylin.ProcessManager.AppLauncher"), + QDBusConnection::sessionBus()); + if(!appLaunchInterface->isValid()) { + qWarning() << qPrintable(QDBusConnection::sessionBus().lastError().message()); + res = false; + } else { + appLaunchInterface->setTimeout(10000); + QDBusReply reply = appLaunchInterface->call("LaunchApp", "/usr/share/applications/kylin-ai-model-manager.desktop"); + if(reply.isValid()) { + res = true; + } else { + qWarning() << "ProcessManager dbus called failed!" << reply.error(); + res = false; + } + } + delete appLaunchInterface; + appLaunchInterface = nullptr; + + if (!res) { + QProcess::startDetached("kylin-ai-model-manager", {}); + } }