Skip to content

fix: Remove the "Translate" option#375

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:release/eaglefrom
add-uos:release/eagle
Jul 24, 2025
Merged

fix: Remove the "Translate" option#375
deepin-bot[bot] merged 1 commit into
linuxdeepin:release/eaglefrom
add-uos:release/eagle

Conversation

@add-uos
Copy link
Copy Markdown
Contributor

@add-uos add-uos commented Jul 24, 2025

Remove the "Translate" option from the original right-click menu in the text editor

Log: Remove the "Translate" option from the original right-click menu in the text editor
Task: https://pms.uniontech.com/task-view-378241.html

Summary by Sourcery

Remove the “Translate” option from the text editor’s right-click menu and disable all related functionality.

Enhancements:

  • Remove the Translate QAction initialization, menu entry, and signal-slot connection in TextEdit
  • Comment out the slot_translate method implementation and its declaration

Tests:

  • Comment out the unit test for slot_translate

Chores:

  • Disable translation triggers from touch gestures and three-finger tap in event filters and fingerZoom

Remove the "Translate" option from the original right-click menu in the
text editor

Log: Remove the "Translate" option from the original right-click menu in
the text editor
Task: https://pms.uniontech.com/task-view-378241.html
@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

代码审查意见:

  1. 注释掉的代码:

    • TextEdit::initRightClickedMenuTextEdit::popRightMenuTextEdit::eventFilterTextEdit::fingerZoom函数中,注释掉了m_translateAction的创建和连接。如果这些功能暂时不需要,应该确认是否需要彻底移除相关代码,以保持代码的整洁和可维护性。
    • TextEdit::restoreMarkStatusTextEdit::getWordAtCursor函数中,注释掉了slot_translate函数的声明和定义。如果这些功能暂时不需要,应该移除这些函数,以避免混淆。
  2. 测试用例:

    • 注释掉了test_textedit测试用例中的slot_translate测试。如果这些功能暂时不需要,应该移除这些测试用例,以避免混淆。
  3. 代码风格:

    • TextEdit::popRightMenu函数中,m_translateAction->setEnabled(false);m_translateAction->setEnabled(translateState);之间缺少空行,建议添加空行以提高代码的可读性。
  4. 安全性:

    • QProcess::startDetached函数用于启动外部程序,应该确保传递给该函数的参数是安全的,以防止潜在的注入攻击。如果"dbus-send"命令的参数是用户输入的,应该进行适当的验证和清理。
  5. 代码质量:

    • TextEdit::eventFilterTextEdit::fingerZoom函数中,注释掉了处理多点触控的代码。如果这些功能暂时不需要,应该移除这些代码,以避免混淆。
    • TextEdit::restoreMarkStatusTextEdit::getWordAtCursor函数中,注释掉了slot_translate函数的声明和定义。如果这些功能暂时不需要,应该移除这些函数,以避免混淆。

总体来说,注释掉的代码应该仔细考虑是否需要移除,以保持代码的整洁和可维护性。同时,应该确保代码的安全性,避免潜在的注入攻击。

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Jul 24, 2025

Reviewer's Guide

This PR fully disables the “Translate” feature by commenting out its UI instantiation, signal-slot wiring, menu integration, gesture triggers, and associated unit test rather than removing code paths, effectively hiding and disabling translation functionality in the text editor.

File-Level Changes

Change Details Files
Remove "Translate" action from right-click menu
  • Commented out QAction instantiation for Translate
  • Commented out connect call binding the action to slot_translate
  • Disabled Translate-related menu enable/disable logic in popRightMenu
src/editor/dtextedit.cpp
Disable slot_translate and its gesture triggers
  • Commented out slot_translate declaration in header
  • Commented out slot_translate implementation in source
  • Commented out slot_translate calls in eventFilter and fingerZoom methods
src/editor/dtextedit.cpp
src/editor/dtextedit.h
Disable unit test for slot_translate
  • Commented out TEST_F block for slot_translate in ut_textedit.cpp
tests/src/editor/ut_textedit.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

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos, max-lvs

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

@add-uos
Copy link
Copy Markdown
Contributor Author

add-uos commented Jul 24, 2025

/merge

@deepin-bot deepin-bot Bot merged commit 0150124 into linuxdeepin:release/eagle Jul 24, 2025
20 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