Skip to content

feat: set desktop file names and install desktop entries#437

Merged
18202781743 merged 1 commit into
linuxdeepin:masterfrom
18202781743:master
Jun 23, 2026
Merged

feat: set desktop file names and install desktop entries#437
18202781743 merged 1 commit into
linuxdeepin:masterfrom
18202781743:master

Conversation

@18202781743

@18202781743 18202781743 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor
  1. Add org.deepin.dde.* desktop files for all dde-session-ui
    applications
  2. Set DesktopFileName property in all application main.cpp files
  3. Set proper application names and organization names consistently
  4. Install desktop files to share/applications directory via CMake
  5. Update copyright years from 2023 to 2026 across all files
  6. Add optimization to skip touchscreen dialog if device already
    associated
  7. Ensure consistent application metadata for session UI components

Log: Added desktop entry files and enabled proper installation for dde-
session-ui applications

Influence:

  1. Verify all desktop files are installed in /usr/share/applications/
  2. Test each application starts correctly via its desktop entry
  3. Confirm application name and desktop file name consistency
  4. Verify touchscreen dialog skips when device already associated
  5. Check copyright header update does not affect functionality
  6. Test reset-password-dialog with new desktop file name setting

feat: 为所有dde-session-ui应用设置桌面文件名并安装桌面入口文件

  1. 为所有dde-session-ui应用程序添加org.deepin.dde.*桌面文件
  2. 在所有应用程序的main.cpp中设置DesktopFileName属性
  3. 统一设置正确的应用程序名称和组织名称
  4. 通过CMake将桌面文件安装到share/applications目录
  5. 将所有文件的版权年份从2023更新至2026
  6. 优化触摸屏对话框,若设备已关联则跳过显示
  7. 确保会话UI组件的应用程序元数据一致性

Log: 新增dde-session-ui应用的桌面入口文件并启用安装

Influence:

  1. 验证所有桌面文件已安装至/usr/share/applications/
  2. 测试每个应用程序通过桌面文件正确启动
  3. 确认应用程序名称和桌面文件名称的一致性
  4. 验证触摸屏对话框在设备已关联时跳过显示
  5. 检查版权头更新不影响功能
  6. 使用新的桌面文件名设置测试重置密码对话框

PMS: BUG-366057

Summary by Sourcery

Add desktop entry integration and metadata normalization for dde-session-ui applications, including a small behavioral optimization in the touchscreen dialog.

New Features:

  • Provide org.deepin.dde.* desktop entry files for all dde-session-ui components and install them to the system applications directory via CMake.

Enhancements:

  • Set consistent organization name, application name, and desktop file name metadata across all dde-session-ui application entry points.
  • Skip showing the touchscreen selection dialog when the target device is already associated to a display.
  • Update SPDX copyright year ranges to 2026 across affected source and build files.

Build:

  • Extend the CMake configuration to install all desktop files from misc/applications into the standard data applications directory.

@sourcery-ai

sourcery-ai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR standardizes application metadata and desktop integration across all dde-session-ui components by setting consistent Qt application properties, adding and installing org.deepin.dde.* .desktop files, updating copyright years, and optimizing the touchscreen dialog flow when a device is already associated.

Sequence diagram for optimized touchscreen dialog launch flow

sequenceDiagram
    actor User
    participant DesktopEnv
    participant TouchscreenDialog as dde_touchscreen_dialog
    participant Display
    participant TouchscreenSetting

    User ->> DesktopEnv: launch org.deepin.dde.touchscreen-dialog.desktop
    DesktopEnv ->> TouchscreenDialog: start main(argc, argv)
    TouchscreenDialog ->> TouchscreenDialog: setOrganizationName
    TouchscreenDialog ->> TouchscreenDialog: setApplicationName
    TouchscreenDialog ->> TouchscreenDialog: setDesktopFileName
    TouchscreenDialog ->> Display: touchMap()
    Display -->> TouchscreenDialog: touchMap
    alt [touchUUID in touchMap]
        TouchscreenDialog ->> TouchscreenDialog: qDebug
        TouchscreenDialog -->> DesktopEnv: exit 0
    else [touchUUID not in touchMap]
        TouchscreenDialog ->> TouchscreenSetting: TouchscreenSetting(touchUUID)
    end
Loading

File-Level Changes

Change Details Files
Configure Qt application metadata (organization, name, desktop file) consistently for all dde-session-ui binaries.
  • Set organizationName to "deepin" where missing in main.cpp entry points.
  • Align applicationName values with the corresponding executable names (e.g. dde-lowpower, reset-password-dialog).
  • Set desktopFileName in each application to its org.deepin.dde.* desktop ID string.
dde-touchscreen-dialog/src/main.cpp
dde-blackwidget/src/main.cpp
dde-lowpower/src/main.cpp
dde-hints-dialog/src/main.cpp
dde-warning-dialog/src/main.cpp
dde-wm-chooser/src/main.cpp
reset-password-dialog/main.cpp
dde-license-dialog/src/main.cpp
dde-pixmix/src/main.cpp
dde-suspend-dialog/src/main.cpp
dde-welcome/src/main.cpp
dde-bluetooth-dialog/src/main.cpp
Install desktop entry files for all dde-session-ui applications via CMake.
  • Add a misc/applications directory containing org.deepin.dde.*.desktop files for each application.
  • Use file(GLOB ...) in the top-level CMakeLists.txt to collect all desktop files.
  • Install the collected desktop files into ${CMAKE_INSTALL_DATADIR}/applications (typically /usr/share/applications).
CMakeLists.txt
misc/applications/org.deepin.dde.blackwidget.desktop
misc/applications/org.deepin.dde.bluetooth-dialog.desktop
misc/applications/org.deepin.dde.hints-dialog.desktop
misc/applications/org.deepin.dde.license-dialog.desktop
misc/applications/org.deepin.dde.lowpower.desktop
misc/applications/org.deepin.dde.pixmix.desktop
misc/applications/org.deepin.dde.reset-password-dialog.desktop
misc/applications/org.deepin.dde.suspend-dialog.desktop
misc/applications/org.deepin.dde.touchscreen-dialog.desktop
misc/applications/org.deepin.dde.warning-dialog.desktop
misc/applications/org.deepin.dde.welcome.desktop
misc/applications/org.deepin.dde.wm-chooser.desktop
Optimize dde-touchscreen-dialog behavior when the touchscreen device is already mapped to a display.
  • Extract the touchscreen device UUID from positional arguments into a named variable.
  • Query display.touchMap() and check if the UUID is already present.
  • If already associated, log a debug message and exit successfully without showing the selection window.
  • Otherwise, construct TouchscreenSetting with the UUID as before.
dde-touchscreen-dialog/src/main.cpp
Update SPDX copyright headers to include the year 2026.
  • Extend existing year ranges (e.g. 2015 - 2022, 2016 - 2023) to end at 2026 in source and build files used by this PR.
dde-touchscreen-dialog/src/main.cpp
CMakeLists.txt
dde-blackwidget/src/main.cpp
dde-lowpower/src/main.cpp
dde-hints-dialog/src/main.cpp
dde-warning-dialog/src/main.cpp
dde-wm-chooser/src/main.cpp
reset-password-dialog/main.cpp
dde-pixmix/src/main.cpp
dde-suspend-dialog/src/main.cpp
dde-welcome/src/main.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • In the top-level CMakeLists.txt, consider using CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_SOURCE_DIR when globbing desktop files so this still works correctly if the project is added as a subdirectory of a larger build.
  • For consistency and potential minor performance benefits, you may want to wrap the string literals passed to setOrganizationName and setApplicationName in QStringLiteral, as you already do for setDesktopFileName.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the top-level CMakeLists.txt, consider using CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_SOURCE_DIR when globbing desktop files so this still works correctly if the project is added as a subdirectory of a larger build.
- For consistency and potential minor performance benefits, you may want to wrap the string literals passed to setOrganizationName and setApplicationName in QStringLiteral, as you already do for setDesktopFileName.

## Individual Comments

### Comment 1
<location path="dde-touchscreen-dialog/src/main.cpp" line_range="55-61" />
<code_context>
-    TouchscreenSetting s(posArguments.first());
+    // 如果该触摸设备已被关联到屏幕,则不再弹出选择窗口
+    const QString &touchUUID = posArguments.first();
+    const auto touchMap = display.touchMap();
+    if (touchMap.contains(touchUUID)) {
+        qDebug() << "touchscreen already associated:" << touchUUID << "->" << touchMap[touchUUID];
+        return 0;
</code_context>
<issue_to_address>
**suggestion (performance):** Avoid copying the entire touch map when a const reference is sufficient.

If `display.touchMap()` returns a large container, copying it each time adds unnecessary overhead. Prefer binding a const reference:

```cpp
const auto &touchMap = display.touchMap();
```

```suggestion
    // 如果该触摸设备已被关联到屏幕,则不再弹出选择窗口
    const QString &touchUUID = posArguments.first();
    const auto &touchMap = display.touchMap();
    if (touchMap.contains(touchUUID)) {
        qDebug() << "touchscreen already associated:" << touchUUID << "->" << touchMap[touchUUID];
        return 0;
    }
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread dde-touchscreen-dialog/src/main.cpp
BLumia
BLumia previously approved these changes Jun 23, 2026
1. Add org.deepin.dde.* desktop files for all dde-session-ui
applications
2. Set DesktopFileName property in all application main.cpp files
3. Set proper application names and organization names consistently
4. Install desktop files to share/applications directory via CMake
5. Update copyright years from 2023 to 2026 across all files
6. Add optimization to skip touchscreen dialog if device already
associated
7. Ensure consistent application metadata for session UI components

Log: Added desktop entry files and enabled proper installation for dde-
session-ui applications

Influence:
1. Verify all desktop files are installed in /usr/share/applications/
2. Test each application starts correctly via its desktop entry
3. Confirm application name and desktop file name consistency
4. Verify touchscreen dialog skips when device already associated
5. Check copyright header update does not affect functionality
6. Test reset-password-dialog with new desktop file name setting

feat: 为所有dde-session-ui应用设置桌面文件名并安装桌面入口文件

1. 为所有dde-session-ui应用程序添加org.deepin.dde.*桌面文件
2. 在所有应用程序的main.cpp中设置DesktopFileName属性
3. 统一设置正确的应用程序名称和组织名称
4. 通过CMake将桌面文件安装到share/applications目录
5. 将所有文件的版权年份从2023更新至2026
6. 优化触摸屏对话框,若设备已关联则跳过显示
7. 确保会话UI组件的应用程序元数据一致性

Log: 新增dde-session-ui应用的桌面入口文件并启用安装

Influence:
1. 验证所有桌面文件已安装至/usr/share/applications/
2. 测试每个应用程序通过桌面文件正确启动
3. 确认应用程序名称和桌面文件名称的一致性
4. 验证触摸屏对话框在设备已关联时跳过显示
5. 检查版权头更新不影响功能
6. 使用新的桌面文件名设置测试重置密码对话框

PMS: BUG-366057
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:75分

■ 【总体评价】

代码修复了触摸屏重复弹窗问题并规范化了桌面文件配置,但存在冗余逻辑和大量重复代码
逻辑正确但因冗余代码和重复模式扣25分

■ 【详细分析】

  • 1.语法逻辑(存在错误)✕

dde-touchscreen-dialog/src/main.cppmain 函数中,存在连续两行对同一属性进行相反设置的冗余代码:app.setQuitOnLastWindowClosed(false); 紧接着 app.setQuitOnLastWindowClosed(true);,前者被后者立刻覆盖,属于无效操作或遗留的调试代码。
潜在问题:代码意图不明确,可能掩盖原本想要实现非标准退出逻辑的设计缺陷。
建议:删除 app.setQuitOnLastWindowClosed(false); 这行冗余代码。

  • 2.代码质量(一般)✕

本次提交在十多个模块的 main.cpp 中进行了高度同质化的修改(添加 setOrganizationNamesetApplicationNamesetDesktopFileName),存在大量样板代码重复。同时新增的 misc/applications/*.desktop 文件内容几乎完全一致。
潜在问题:维护成本增加,未来若需修改桌面文件标准,需同步修改十余处;dde-touchscreen-dialog 中使用了 qDebug() 输出关联信息,在生产环境中可能产生不必要的日志噪音。
建议:考虑将应用初始化逻辑抽取为公共的初始化函数或宏;将 qDebug() 替换为条件编译的调试日志或更低级别的日志输出。

  • 3.代码性能(无性能问题)✓

新增的触摸屏关联判断逻辑 touchMap.contains(touchUUID) 基于哈希表查找,时间复杂度为 O(1),对性能无负面影响。批量安装桌面文件和设置应用属性均在启动阶段执行,无性能瓶颈。

  • 4.代码安全(存在0个安全漏洞)✓

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
代码未引入命令注入、路径遍历等安全风险。新增的 .desktop 文件将 Exec 设置为 /bin/false 并配合 NoDisplay=true,有效防止了从桌面环境直接拉起这些后台或触发式对话框,符合安全规范。

  • 建议:保持当前安全的桌面文件配置方式。

■ 【改进建议代码示例】

diff --git a/dde-touchscreen-dialog/src/main.cpp b/dde-touchscreen-dialog/src/main.cpp
index ade16e9b..12345678 100644
--- a/dde-touchscreen-dialog/src/main.cpp
+++ b/dde-touchscreen-dialog/src/main.cpp
@@ -21,8 +21,7 @@ using namespace org::deepin::dde;
 int main(int argc, char *argv[])
 {
     DApplication app(argc, argv);
     app.setOrganizationName("deepin");
     app.setApplicationName("dde-touchscreen-dialog");
     app.setDesktopFileName(QStringLiteral("org.deepin.dde.touchscreen-dialog"));
-    app.setQuitOnLastWindowClosed(false);
     app.setQuitOnLastWindowClosed(true);
 

@deepin-ci-robot

Copy link
Copy Markdown

[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.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@18202781743 18202781743 merged commit 035315f into linuxdeepin:master Jun 23, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants