Skip to content

Commit edd30db

Browse files
committed
fix: taskmanager context menu should use app name instead of window title
是重构分支实现时的行为错误. PMS: BUG-335633 Log:
1 parent dc5a5cc commit edd30db

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

panels/dock/taskmanager/dockglobalelementmodel.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,15 @@ QString DockGlobalElementModel::getMenus(const QModelIndex &index) const
262262
auto row = std::get<2>(data);
263263

264264
QJsonArray menusArray;
265-
menusArray.append(QJsonObject{{"id", ""}, {"name", model == m_activeAppModel ? index.data(TaskManager::WinTitleRole).toString() : tr("Open")}});
265+
QString appNameInMenu = tr("Open");
266+
if (model == m_activeAppModel) {
267+
appNameInMenu = index.data(TaskManager::NameRole).toString();
268+
// In case a window does not belongs to a known application, use the window title instead
269+
if (appNameInMenu.isEmpty()) {
270+
appNameInMenu = index.data(TaskManager::WinTitleRole).toString();
271+
}
272+
}
273+
menusArray.append(QJsonObject{{"id", ""}, {"name", appNameInMenu}});
266274

267275
auto actions = model->index(row, 0).data(TaskManager::ActionsRole).toByteArray();
268276
for (auto action : QJsonDocument::fromJson(actions).array()) {

0 commit comments

Comments
 (0)