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