Skip to content

Conversation

@18202781743
Copy link
Contributor

@18202781743 18202781743 commented Jul 10, 2025

  1. Removed DataPanel.qml and related test functionality from
    NotifyHeader.qml
  2. Removed legacy DBus notification handling code in
    notificationcenterpanel.cpp
  3. Cleaned up NotifyAccessor by removing debug/test methods (addNotify,
    fetchDataInfo)
  4. Simplified notification removal methods to only use new dataUpdater
    interface
  5. Improved database error logging in DBAccessor
  6. Enhanced notification logging in NotificationManager

These changes remove unused debug/test code and legacy DBus interfaces
that were replaced by the new dataUpdater system. The cleanup improves
code maintainability and reduces potential security surface by removing
unused code paths. The logging improvements provide better debugging
information while removing redundant debug tools.

refactor: 移除调试面板和遗留DBus代码

  1. 移除DataPanel.qml及NotifyHeader.qml中的相关测试功能
  2. 删除notificationcenterpanel.cpp中的遗留DBus通知处理代码
  3. 清理NotifyAccessor中的调试/测试方法(addNotify, fetchDataInfo)
  4. 简化通知移除方法,仅使用新的dataUpdater接口
  5. 在DBAccessor中改进数据库错误日志记录
  6. 在NotificationManager中增强通知日志记录

这些变更移除了未使用的调试/测试代码和被新dataUpdater系统取代的遗留DBus接
口。清理工作提高了代码可维护性,并通过移除未使用的代码路径减少了潜在的安
全风险。日志记录的改进在移除冗余调试工具的同时提供了更好的调试信息。

Summary by Sourcery

Remove unused debug panel and legacy DBus code, streamline notification removal through the new dataUpdater interface, and improve logging across the notification framework

Enhancements:

  • Remove DataPanel.qml and related debug/test UI components from QML and drop them from the build module
  • Remove legacy DBus notification handling fallback in NotificationCenterPanel to enforce the new dataUpdater integration
  • Clean up NotifyAccessor by removing obsolete debug/test methods and properties and consolidating entity removal to always use the dataUpdater interface
  • Enhance logging by adding detailed database error messages in DBAccessor and standardizing notification logs in NotificationManager to use qInfo

Build:

  • Remove DataPanel.qml from the QML module in CMakeLists.txt

1. Removed DataPanel.qml and related test functionality from
NotifyHeader.qml
2. Removed legacy DBus notification handling code in
notificationcenterpanel.cpp
3. Cleaned up NotifyAccessor by removing debug/test methods (addNotify,
fetchDataInfo)
4. Simplified notification removal methods to only use new dataUpdater
interface
5. Improved database error logging in DBAccessor
6. Enhanced notification logging in NotificationManager

These changes remove unused debug/test code and legacy DBus interfaces
that were replaced by the new dataUpdater system. The cleanup improves
code maintainability and reduces potential security surface by removing
unused code paths. The logging improvements provide better debugging
information while removing redundant debug tools.

refactor: 移除调试面板和遗留DBus代码

1. 移除DataPanel.qml及NotifyHeader.qml中的相关测试功能
2. 删除notificationcenterpanel.cpp中的遗留DBus通知处理代码
3. 清理NotifyAccessor中的调试/测试方法(addNotify, fetchDataInfo)
4. 简化通知移除方法,仅使用新的dataUpdater接口
5. 在DBAccessor中改进数据库错误日志记录
6. 在NotificationManager中增强通知日志记录

这些变更移除了未使用的调试/测试代码和被新dataUpdater系统取代的遗留DBus接
口。清理工作提高了代码可维护性,并通过移除未使用的代码路径减少了潜在的安
全风险。日志记录的改进在移除冗余调试工具的同时提供了更好的调试信息。
@deepin-ci-robot
Copy link

deepin pr auto review

关键摘要:

  • CMakeLists.txt 文件中删除了 DataPanel.qml 文件,需要确认这是否是有意为之,以及是否有其他代码依赖于该文件。
  • NotifyHeader.qml 文件中删除了与 DataPanel.qml 相关的代码,需要检查是否有其他逻辑依赖于这些删除的代码。
  • NotificationCenterPanel.cpp 文件中删除了旧的 DBus 接口代码,确认新的接口是否已经完全替代了旧接口。
  • NotifyAccessor.cpp 文件中删除了 addNotifyfetchDataInfo 函数,需要确认是否有其他代码依赖于这些函数,并且是否有替代的实现。
  • NotifyAccessor.h 文件中删除了 dataInfoapps 属性,需要确认是否有其他 QML 代码依赖于这些属性,并且是否有替代的实现。
  • DBAccessor.cpp 文件中增加了对数据库错误的日志输出,这是一个好的做法,可以有助于调试。
  • NotificationManager.cpp 文件中增加了对通知的详细日志输出,这有助于调试和监控。

是否建议立即修改:

  • 确认删除 DataPanel.qml 和相关代码是否是有意为之,并确保没有遗漏其他依赖。
  • 检查 NotifyHeader.qml 中删除的代码是否有替代逻辑,或者是否有其他组件需要这些功能。
  • 确认新的接口是否已经完全替代了旧的 DBus 接口,并确保所有相关的功能都已经迁移。
  • 如果 addNotifyfetchDataInfo 函数被删除,需要提供替代的实现,或者确认是否有其他代码可以替代这些功能。
  • 如果 dataInfoapps 属性被删除,需要提供替代的实现,或者确认是否有其他代码可以替代这些属性。
  • 增加的日志输出是一个好的做法,应该保留这些日志输出,以便于后续的调试和监控。

@sourcery-ai
Copy link

sourcery-ai bot commented Jul 10, 2025

Reviewer's Guide

This PR removes the unused debug panel and legacy DBus notification paths, consolidates NotifyAccessor’s removal logic onto the new dataUpdater interface, and tightens up logging in both the database accessor and notification manager for clearer diagnostics.

Class diagram for NotifyAccessor after debug/test code removal

classDiagram
    class NotifyAccessor {
        +static NotifyAccessor* instance()
        +void removeEntity(qint64 id)
        +void removeEntityByApp(const QString &appName)
        +void clear()
        +void closeNotify(const NotifyEntity &entity, NotifyEntity::ClosedReason reason)
        +void onNotificationStateChanged(qint64 id, int processedType)
        +void onReceivedRecord(const QString &id)
        +bool debugging() const
        +void setDataUpdater(QObject *server)
        +void setEnabled(bool enabled)
        +void openNotificationSetting()
        -DataAccessor *m_accessor
        -QObject *m_dataUpdater
        -QStringList m_pinnedApps
        -bool m_debugging
        -bool m_enabled
    }

    class DataAccessor
    class NotifyEntity
    NotifyAccessor --> DataAccessor
    NotifyAccessor --> NotifyEntity
Loading

Class diagram for DBAccessor with improved error logging

classDiagram
    class DBAccessor {
        +bool open(const QString &dataPath)
        +bool isValid() const
        +qint64 addEntity(const NotifyEntity &entity)
        ...
    }
    class QSqlDatabase
    class QSqlError
    DBAccessor --> QSqlDatabase
    DBAccessor --> QSqlError
Loading

Class diagram for NotificationManager with enhanced logging

classDiagram
    class NotificationManager {
        +uint Notify(const QString &appName, uint replacesId, const QString &appIcon, const QString &summary, const QString &body, const QStringList &actions, const QVariantMap &hints, int expireTimeout)
        ...
    }
Loading

File-Level Changes

Change Details Files
Removed debug/test UI panel and related loader logic
  • Deleted DataPanel.qml and its loader in NotifyHeader.qml
  • Removed headerClicked signal and associated MouseArea handling
  • Updated CMakeLists to drop DataPanel.qml from the build
panels/notification/center/NotifyHeader.qml
panels/notification/center/CMakeLists.txt
panels/notification/center/DataPanel.qml
Eliminated legacy DBus connection handling
  • Removed old QDBus session connection and RecordAdded slot in initialization
  • Added early return on invalid connection to simplify flow
panels/notification/center/notificationcenterpanel.cpp
Refactored NotifyAccessor to use only the new dataUpdater API
  • Simplified removeEntity, removeEntityByApp, and clear to always invoke m_dataUpdater
  • Removed debug/test methods (addNotify, fetchDataInfo) and their Q_PROPERTY declarations
  • Deleted related slots, signals, and backing fields for dataInfo and apps
panels/notification/center/notifyaccessor.cpp
panels/notification/center/notifyaccessor.h
Enhanced diagnostic logging
  • Upgraded Notify logging from qDebug to qInfo for better visibility
  • Augmented DBAccessor::isValid to emit qWarning on database errors
panels/notification/server/notificationmanager.cpp
panels/notification/common/dbaccessor.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

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 @18202781743 - I've reviewed your changes and they look great!


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.

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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 49420ce into linuxdeepin:master Jul 10, 2025
9 of 10 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