fix(AppContentMenu): 修改快速启动相关接口
This commit is contained in:
parent
b639b318ce
commit
7347f09a77
|
@ -103,30 +103,30 @@ void AppContentMenu::addToTop(QObject *parent, const QString &appId, const int &
|
||||||
|
|
||||||
void AppContentMenu::addToPanelAction(QObject *parent, const QString &appId, QList<QAction *> &list)
|
void AppContentMenu::addToPanelAction(QObject *parent, const QString &appId, QList<QAction *> &list)
|
||||||
{
|
{
|
||||||
QDBusInterface iface("com.ukui.panel.desktop", "/", "com.ukui.panel.desktop", QDBusConnection::sessionBus());
|
QDBusInterface iface("org.ukui.taskManager", "/taskManager", "org.ukui.taskManager", QDBusConnection::sessionBus());
|
||||||
|
|
||||||
if (!iface.isValid()) {
|
if (!iface.isValid()) {
|
||||||
qWarning() << "Panel desktop dbusinterface error";
|
qWarning() << "Ukui taskManager dbusinterface error";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
iface.setTimeout(1);
|
iface.setTimeout(1);
|
||||||
QDBusReply<bool> isFixedOnTaskBar = iface.call("CheckIfExist", appId);
|
QDBusReply<bool> isFixedOnTaskBar = iface.call("checkQuickLauncher", appId);
|
||||||
|
|
||||||
if (!isFixedOnTaskBar.isValid()) {
|
if (!isFixedOnTaskBar.isValid()) {
|
||||||
qWarning() << "Panel desktop dbusinterface call CheckIfExist timeout";
|
qWarning() << "Ukui taskManager dbusinterface call checkQuickLauncher timeout";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString actionName = isFixedOnTaskBar ? QObject::tr("Remove from taskbar") : QObject::tr("Add to taskbar");
|
QString actionName = isFixedOnTaskBar ? QObject::tr("Remove from taskbar") : QObject::tr("Add to taskbar");
|
||||||
QString functionName = isFixedOnTaskBar ? "RemoveFromTaskbar" : "AddToTaskbar";
|
QString functionName = isFixedOnTaskBar ? "removeQuickLauncher" : "addQuickLauncher";
|
||||||
list << new QAction(actionName, parent);
|
list << new QAction(actionName, parent);
|
||||||
|
|
||||||
QObject::connect(list.last(), &QAction::triggered, parent, [appId, functionName] {
|
QObject::connect(list.last(), &QAction::triggered, parent, [appId, functionName] {
|
||||||
QDBusInterface iface("com.ukui.panel.desktop", "/", "com.ukui.panel.desktop", QDBusConnection::sessionBus());
|
QDBusInterface iface("org.ukui.taskManager", "/taskManager", "org.ukui.taskManager", QDBusConnection::sessionBus());
|
||||||
|
|
||||||
if (!iface.isValid()) {
|
if (!iface.isValid()) {
|
||||||
qWarning() << "Panel desktop dbusinterface error";
|
qWarning() << "Ukui taskManager dbusinterface error";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue