Skip to content

Conversation

@Johnson-zs
Copy link
Contributor

@Johnson-zs Johnson-zs commented Jun 16, 2025

… local machine"

This reverts commit da1dd4f.

Summary by Sourcery

Revert the previous remote-copy fix and remove all X11 clipboard monitoring support in favor of a simplified Qt-only implementation.

Enhancements:

  • Remove X11-based clipboard monitoring classes and helper functions
  • Simplify onClipboardDataChanged() by dropping its argument and reading QClipboard data directly
  • Replace calls to readFirstClipboard() with direct onClipboardDataChanged() invocations
  • Delete ClipboardMonitor files and related includes

Build:

  • Drop XCB and xcb-xfixes dependencies from CMake configurations

@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Johnson-zs

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

@deepin-ci-robot
Copy link
Contributor

deepin pr auto review

代码审查意见:

  1. dfm-base.cmake文件中,移除了对XCB的依赖,但未在代码中删除相应的引用。建议检查并删除所有与XCB相关的代码。

  2. clipboard.cpp文件中,onClipboardDataChanged函数的签名已更改,但未更新所有调用该函数的地方。需要确保所有调用点都已更新以匹配新的函数签名。

  3. clipboard.cpp文件中,readFirstClipboard函数已被删除,但未在clipboard.h文件中删除相应的声明。建议更新clipboard.h以删除readFirstClipboard函数的声明。

  4. clipboardmonitor.cppclipboardmonitor.h文件中,整个文件已被删除,但未在clipboard.cppclipboard.h文件中删除相应的引用。需要检查并删除所有与ClipboardMonitor相关的代码。

  5. fileoperationseventreceiver.cpp文件中,handleOperationCopy函数的调用中,handle参数被省略。建议检查并添加handle参数。

  6. clipboardmenuscene.cpp文件中,dpfSignalDispatcher->publish函数的调用中,handle参数被省略。建议检查并添加handle参数。

  7. core.cpp文件中,ClipBoard::instance()->readFirstClipboard();已被替换为ClipBoard::instance()->onClipboardDataChanged();。建议检查并更新所有类似的调用,以确保代码的一致性。

  8. CMakeLists.txt文件中,移除了对XCB的依赖,但未在代码中删除相应的引用。建议检查并删除所有与XCB相关的代码。

以上是代码审查意见,请根据实际情况进行修改和调整。

@sourcery-ai
Copy link

sourcery-ai bot commented Jun 16, 2025

Reviewer's Guide

This PR reverts the cloud desktop file copy feature by stripping out X11 clipboard monitoring and related dependencies, refactors clipboard change handling to directly use QClipboard::mimeData, updates plugin initialization to remove first-read logic, and cleans up CMake configurations by dropping XCB checks and linking.

Sequence Diagram: Clipboard Data Processing Flow

sequenceDiagram
    title "Sequence Diagram: Clipboard Data Processing Flow"
    participant QAppClipboard as "QApplication::clipboard()"
    participant ClipBoardService as "dfmbase::ClipBoard"
    participant QClipboardAPI as "QClipboard API"
    participant GlobalHandler as "GlobalData::onClipboardDataChanged"

    QAppClipboard ->> ClipBoardService: dataChanged() signal
    activate ClipBoardService
    ClipBoardService ->> ClipBoardService: onClipboardDataChanged() slot
    ClipBoardService ->> QClipboardAPI: mimeData()
    QClipboardAPI -->> ClipBoardService: const QMimeData*
    ClipBoardService ->> GlobalHandler: onClipboardDataChanged()
    ClipBoardService ->> ClipBoardService: emit clipboardDataChanged() signal
    deactivate ClipBoardService
Loading

Sequence Diagram: Plugin Clipboard Initialization Method Change

sequenceDiagram
    title "Sequence Diagram: Plugin Clipboard Initialization Method Change"
    participant CorePlugin as "Core Plugin (ddplugin-core/dfmplugin-core)"
    participant ClipBoardService as "dfmbase::ClipBoard"

    CorePlugin ->> ClipBoardService: instance()
    ClipBoardService -->> CorePlugin: ClipBoard*

    alt Removed Initialization Path
        CorePlugin ->> ClipBoardService: readFirstClipboard() (Method Removed)
        activate ClipBoardService
        %% Internally would have called onClipboardDataChanged(formats)
        deactivate ClipBoardService
    else Current Initialization Path
        CorePlugin ->> ClipBoardService: onClipboardDataChanged()
        activate ClipBoardService
        %% Internally processes clipboard data directly
        deactivate ClipBoardService
    end
Loading

File-Level Changes

Change Details Files
Remove X11 clipboard monitoring and related code
  • Deleted ClipboardMonitor, WindowUtils includes and global X11 flags
  • Removed init(), readFirstClipboard, getFirstMimeTypesByX11 implementations
  • Deleted clipboardmonitor.cpp/.h and library loading logic
src/dfm-base/utils/clipboard.cpp
src/dfm-base/utils/clipboard.h
src/dfm-base/utils/clipboardmonitor.cpp
src/dfm-base/utils/clipboardmonitor.h
Simplify onClipboardDataChanged to use QClipboard directly
  • Changed handler signature to no-argument and fetch mimeData internally
  • Replaced formats.contains checks with mimeData->hasFormat calls
  • Streamlined warning/log messages for missing or invalid formats
src/dfm-base/utils/clipboard.cpp
Replace first-read clipboard calls with direct change trigger
  • Replaced ClipBoard::readFirstClipboard() calls with onClipboardDataChanged()
  • Removed readFirstClipboard method and init() invocations
  • Updated plugin core initializers in desktop and filemanager plugins
src/plugins/desktop/ddplugin-core/core.cpp
src/plugins/filemanager/dfmplugin-core/core.cpp
Drop XCB and xcb-xfixes pkg checks and linking from CMake
  • Removed pkg_check_modules PC_XCB and related variable definitions
  • Removed XCB include/libs linking in dfm-base.cmake and tests CMakeLists
  • Deleted xcb-xfixes from target_link_libraries
src/dfm-base/dfm-base.cmake
tests/dfm-base/CMakeLists.txt

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

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Johnson-zs - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `src/dfm-base/utils/clipboard.cpp:59` </location>
<code_context>
+    if (mimeData->hasFormat(kRemoteCopyKey)) {
+        qCWarning(logDFMBase) << "clipboard use other !";
         clipboardAction = ClipBoard::kRemoteAction;
         remoteCurrentCount++;
         return;
     }
</code_context>

<issue_to_address>
Incrementing QAtomicInt with ++ may not convey memory ordering

Prefer using an explicit atomic method such as `fetchAndAddRelaxed(1)` to make memory ordering intentions clear.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
        remoteCurrentCount++;
=======
        remoteCurrentCount.fetchAndAddRelaxed(1);
>>>>>>> REPLACE

</suggested_fix>

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.

// 远程协助功能
if (formats.contains(kRemoteAssistanceCopyKey)) {
qCInfo(logDFMBase) << "Remote assistance copy action detected";
if (mimeData->hasFormat(kRemoteAssistanceCopyKey)) {
Copy link

Choose a reason for hiding this comment

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

suggestion: Incrementing QAtomicInt with ++ may not convey memory ordering

Prefer using an explicit atomic method such as fetchAndAddRelaxed(1) to make memory ordering intentions clear.

Suggested change
remoteCurrentCount++;
remoteCurrentCount.fetchAndAddRelaxed(1);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

revert不对原逻辑改动

Copy link

Choose a reason for hiding this comment

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

这条建议只是从“风格和可读性”角度来提:

QAtomicInt 的 “++” 操作确实会原子加一,但它的内存顺序语义是隐含的。为了让代码读起来更直观,也更明确地表达“这里不需要强制的 acquire/release,仅仅是一个放宽版的原子加一”,我们才推荐把

remoteCurrentCount++;

改成

remoteCurrentCount.fetchAndAddRelaxed(1);

两者在功能上是一致的,不会改变现有逻辑。如果你觉得“++”已经足够且更简洁,也完全可以保留,PR 的 revert 本身也不影响这部分行为。只是为了后续维护时一看就知道“这是个 relax(宽松)模式的原子加一”,才建议显式调用 fetchAndAddRelaxed

@github-actions
Copy link

  • 敏感词检查失败, 检测到1个文件存在敏感词
详情
{
    "src/plugins/common/dfmplugin-fileoperations/fileoperationsevent/fileoperationseventreceiver.cpp": [
        {
            "line": "            key = \"Name\";",
            "line_number": 375,
            "rule": "S106",
            "reason": "Var naming | ff5dbee3ee"
        }
    ]
}

@Johnson-zs
Copy link
Contributor Author

/forcemerge

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jun 16, 2025

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit e7295b4 into linuxdeepin:master Jun 16, 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.

2 participants