-
Notifications
You must be signed in to change notification settings - Fork 55
fix: taskmanager context menu should use app name instead of window title #1271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideFixes incorrect labeling in the task manager context menu by using the application name role instead of the window title for active items File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…itle 是重构分支实现时的行为错误. PMS: BUG-335633 Log:
deepin pr auto review这段代码的修改主要是改进了菜单名称的获取逻辑,我来分析一下改进前后的代码并提供审查意见: 改进点分析
潜在问题和改进建议
改进建议代码示例QString DockGlobalElementModel::getMenus(const QModelIndex &index) const
{
// ... 前面的代码保持不变 ...
QString appNameInMenu = tr("Open");
if (model == m_activeAppModel) {
appNameInMenu = index.data(TaskManager::NameRole).toString();
// In case a window does not belong to a known application, use the window title instead
if (appNameInMenu.isEmpty()) {
appNameInMenu = index.data(TaskManager::WinTitleRole).toString();
}
}
menusArray.append(QJsonObject{{"id", ""}, {"name", appNameInMenu}});
auto actions = model->index(row, 0).data(TaskManager::ActionsRole).toByteArray();
if (!actions.isEmpty()) {
QJsonParseError error;
auto doc = QJsonDocument::fromJson(actions, &error);
if (error.error == QJsonParseError::NoError) {
for (auto action : doc.array()) {
// ... 处理 action ...
}
} else {
qWarning() << "Failed to parse actions JSON:" << error.errorString();
}
} else {
qWarning() << "Empty actions received for row" << row;
}
// ... 后面的代码保持不变 ...
}这些改进可以提高代码的健壮性和可维护性,同时更好地处理异常情况。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, BLumia The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
是重构分支实现时的行为错误.
Summary by Sourcery
Bug Fixes: