Skip to content

fix: improve file manager command handling#669

Merged
lzwind merged 1 commit into
linuxdeepin:develop/snipefrom
18202781743:master
Jun 9, 2025
Merged

fix: improve file manager command handling#669
lzwind merged 1 commit into
linuxdeepin:develop/snipefrom
18202781743:master

Conversation

@18202781743

Copy link
Copy Markdown
Contributor
  1. Changed command strings to QStringList for better argument handling
  2. Fixed typo in pin_screenshots module (changed "select how-item" to correct "--show-item")
  3. Improved consistency across different modules for file manager commands
  4. Added missing QtCore/qcontainerfwd.h include for QStringList support

These changes make the file manager command execution more reliable and maintainable by:

  • Using proper argument separation with QStringList instead of comma- separated strings
  • Ensuring consistent behavior across different parts of the application
  • Fixing a typo that could cause the file manager to fail
  • Adding required header for QStringList operations

fix: 改进文件管理器命令处理

  1. 将命令字符串改为 QStringList 以更好地处理参数
  2. 修复 pin_screenshots 模块中的拼写错误(将 "select how-item" 改为正确 的 "--show-item")
  3. 提高不同模块间文件管理器命令的一致性
  4. 添加缺失的 QtCore/qcontainerfwd.h 头文件以支持 QStringList

这些改进通过以下方式使文件管理器命令执行更可靠和可维护:

  • 使用 QStringList 而不是逗号分隔的字符串来正确分离参数
  • 确保应用程序不同部分行为一致
  • 修复可能导致文件管理器失败的拼写错误
  • 添加 QStringList 操作所需的头文件

pms: BUG-317649

@18202781743

Copy link
Copy Markdown
Contributor Author

Comment thread src/pin_screenshots/mainwindow.cpp Outdated
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

代码审查意见:

  1. 代码风格一致性

    • main_window.cpppin_screenshots/mainwindow.cpp中,commandsavepathcommand变量在修改后都使用了QStringList,但在record_process.cpp中,savepathcommand仍然使用了QString。建议统一使用QStringList,保持代码风格的一致性。
  2. 可读性

    • main_window.cpppin_screenshots/mainwindow.cpp中,commandsavepathcommand的构建使用了QStringList,这比原来的QString拼接更加清晰和易于维护。建议在record_process.cpp中也采用同样的方式,以提高代码的可读性。
  3. 资源管理

    • record_process.cpp中,hintssavepathcommand的初始化在同一个作用域内,但savepathcommand在初始化后没有被使用。如果savepathcommand不再需要,应该移除它以避免潜在的混淆。
  4. 错误处理

    • main_window.cpppin_screenshots/mainwindow.cpp中,当QStandardPaths::findExecutable返回空字符串时,程序会继续执行,但没有处理这种情况。建议添加错误处理逻辑,例如显示一个错误消息给用户,或者记录错误日志。
  5. 代码重复

    • main_window.cpppin_screenshots/mainwindow.cpphints["x-deepin-action-_open"]的设置逻辑几乎相同,可以考虑将这部分代码提取到一个公共函数中,以减少代码重复。
  6. 安全性

    • 在构建commandsavepathcommand时,直接使用了saveFilePathsavePath,没有进行任何形式的验证或清理。如果这些路径来自用户输入,应该进行适当的验证和清理,以防止路径注入等安全问题。

综上所述,建议对代码进行重构,以提高代码的可读性、一致性和安全性。

@deepin-bot

deepin-bot Bot commented Jun 5, 2025

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 6.5.19
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #671

1. Changed command strings to QStringList for better argument handling
2. Fixed typo in pin_screenshots module (changed "select how-item" to
correct "--show-item")
3. Improved consistency across different modules for file manager
commands
4. Added missing QtCore/qcontainerfwd.h include for QStringList support

These changes make the file manager command execution more reliable and
maintainable by:
- Using proper argument separation with QStringList instead of comma-
separated strings
- Ensuring consistent behavior across different parts of the application
- Fixing a typo that could cause the file manager to fail
- Adding required header for QStringList operations

fix: 改进文件管理器命令处理

1. 将命令字符串改为 QStringList 以更好地处理参数
2. 修复 pin_screenshots 模块中的拼写错误(将 "select how-item" 改为正确
的 "--show-item")
3. 提高不同模块间文件管理器命令的一致性
4. 添加缺失的 QtCore/qcontainerfwd.h 头文件以支持 QStringList

这些改进通过以下方式使文件管理器命令执行更可靠和可维护:
- 使用 QStringList 而不是逗号分隔的字符串来正确分离参数
- 确保应用程序不同部分行为一致
- 修复可能导致文件管理器失败的拼写错误
- 添加 QStringList 操作所需的头文件

pms: BUG-317649
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, lzwind

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

@lzwind lzwind merged commit 92b939c into linuxdeepin:develop/snipe Jun 9, 2025
7 of 9 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