fix(frontend):更新应用搜索添加到任务栏任务栏时使用的dbus接口.

This commit is contained in:
JunjieBai 2024-06-05 09:08:02 +08:00 committed by iaom
parent 6dfa46df54
commit b9b41c7ccd
1 changed files with 12 additions and 8 deletions

View File

@ -320,19 +320,23 @@ bool AppSearchPlugin::launch(const QString &path)
bool AppSearchPlugin::addPanelShortcut(const QString& path) bool AppSearchPlugin::addPanelShortcut(const QString& path)
{ {
DataCollecter::collectLaunchEvent(QStringLiteral("applicationSearch"), QStringLiteral("addPanelShortcut")); DataCollecter::collectLaunchEvent(QStringLiteral("applicationSearch"), QStringLiteral("addPanelShortcut"));
QDBusInterface iface("com.ukui.panel.desktop", QDBusInterface iface("org.ukui.taskManager",
"/", "/taskManager",
"com.ukui.panel.desktop", "org.ukui.taskManager",
QDBusConnection::sessionBus()); QDBusConnection::sessionBus());
if(iface.isValid()) { if(iface.isValid()) {
QDBusReply<bool> isExist = iface.call("CheckIfExist", path); QDBusReply<bool> isExist = iface.call("checkQuickLauncher", path);
if(isExist) { if (isExist) {
qWarning() << "Add shortcut to panel failed, because it is already existed!"; qWarning() << "Add shortcut to panel failed, because it is already existed!";
return false; return false;
} }
QDBusReply<QVariant> ret = iface.call("AddToTaskbar", path); QDBusReply<QVariant> ret = iface.call("addQuickLauncher", path);
qDebug() << "Add shortcut to panel successed!"; if (ret.isValid()) {
return true; qDebug() << "Add shortcut to taskManager successed!";
return true;
} else {
qWarning() << "Fail to add shortcut to taskManager!";
}
} }
return false; return false;
} }