Skip to content

fix(dialog): update my schedule icon theme sync and scroll behavior#333

Open
wangruoxuan3782 wants to merge 1 commit into
linuxdeepin:masterfrom
wangruoxuan3782:fix-myschedule-icon-scroll
Open

fix(dialog): update my schedule icon theme sync and scroll behavior#333
wangruoxuan3782 wants to merge 1 commit into
linuxdeepin:masterfrom
wangruoxuan3782:fix-myschedule-icon-scroll

Conversation

@wangruoxuan3782

@wangruoxuan3782 wangruoxuan3782 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

修改内容:

  1. 在主题切换后同步刷新我的日程弹窗图标,确保左上角应用图标跟随系统主题变化。
  2. 优化日程内容区域高度与滚动条显示逻辑,内容未超出可视区域时关闭滚动条和滚动效果。
  3. 在内容超出显示区域时保留垂直滚动能力,避免完整内容被截断。

Change summary:

  1. Refresh the My Schedule dialog icon when the theme changes so the top-left app icon stays in sync with the system theme.
  2. Refine the schedule content height and scrollbar logic so scrolling stays disabled when the content fits in the visible area.
  3. Keep vertical scrolling available only when the content exceeds the visible area to avoid truncating longer content.

PMS: BUG-368849
PMS: BUG-368851

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wangruoxuan3782

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
Copy Markdown

Hi @wangruoxuan3782. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sourcery-ai

sourcery-ai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR updates the "My Schedule" dialog to make its icon follow the system theme and refines the scroll behaviour of the schedule content area so scrollbars and scrolling only appear when needed.

Sequence diagram for theme-based dialog icon update

sequenceDiagram
    participant DGuiApplicationHelper
    participant CMyScheduleView

    DGuiApplicationHelper->>CMyScheduleView: themeTypeChanged(type)
    CMyScheduleView->>CMyScheduleView: setLabelTextColor(type)
    CMyScheduleView->>CMyScheduleView: updateDialogIcon()
    CMyScheduleView->>CMyScheduleView: setIcon(QIcon::fromTheme(dde-calendar))
Loading

File-Level Changes

Change Details Files
Adjust schedule content area sizing and scroll behavior so scrolling is enabled only when content exceeds the visible area.
  • Compute schedule content height once and reuse it instead of recalculating inline.
  • Introduce a needScroll flag based on content height threshold to decide whether the area should be scrollable.
  • Set the scroll area’s fixed height based on either the threshold or minimal height for small content.
  • Configure vertical and horizontal scroll bar policies to disable scrollbars when content fits and enable vertical scrollbar as needed when it overflows.
  • Set the schedule label’s fixed height differently depending on whether scrolling is needed to ensure proper layout.
src/calendar-client/src/dialog/myscheduleview.cpp
Make the "My Schedule" dialog icon follow the current system theme and update when the theme changes.
  • Add an updateDialogIcon slot that sets the window icon from the themed "dde-calendar" icon.
  • Use updateDialogIcon in initUI instead of constructing the icon from CDynamicIcon.
  • Connect the themeTypeChanged signal to updateDialogIcon so the dialog icon refreshes when the theme changes.
  • Declare updateDialogIcon in the CMyScheduleView class header as a public slot.
src/calendar-client/src/dialog/myscheduleview.cpp
src/calendar-client/src/dialog/myscheduleview.h

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:

  • The hard-coded height thresholds (100 and 17) used to determine scrolling and minimum label height would be clearer and easier to maintain if extracted into named constants or configuration values.
  • updateDialogIcon() switches from CDynamicIcon::getInstance()->getPixmap() to QIcon::fromTheme("dde-calendar"); if theme-based behavior or fallback logic is encapsulated in CDynamicIcon, consider reusing it here to keep icon handling consistent across the app.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The hard-coded height thresholds (`100` and `17`) used to determine scrolling and minimum label height would be clearer and easier to maintain if extracted into named constants or configuration values.
- `updateDialogIcon()` switches from `CDynamicIcon::getInstance()->getPixmap()` to `QIcon::fromTheme("dde-calendar")`; if theme-based behavior or fallback logic is encapsulated in `CDynamicIcon`, consider reusing it here to keep icon handling consistent across the app.

## Individual Comments

### Comment 1
<location path="src/calendar-client/src/dialog/myscheduleview.cpp" line_range="98-103" />
<code_context>
     }

-    if (strList.count() * h > 100) {
+    const int scheduleContentH = strList.count() * h;
+    const bool needScroll = scheduleContentH > 100;
+    if (needScroll) {
         m_scheduleLabelH = 100;
     } else {
         int minH = 17;
-        m_scheduleLabelH = strList.count() * h;
+        m_scheduleLabelH = scheduleContentH;
</code_context>
<issue_to_address>
**suggestion:** Consider extracting the hardcoded height values into named constants for maintainability.

Since `100` (scroll threshold) and `17` (minimum label height) are reused and encode layout assumptions, please extract them into clearly named constants (e.g. `kScheduleScrollThreshold`, `kScheduleMinHeight`) or class members to document intent and simplify future UI changes.

Suggested implementation:

```cpp
        resultStr += str;
    }

    static constexpr int kScheduleScrollThreshold = 100;
    static constexpr int kScheduleMinHeight = 17;

    const int scheduleContentH = strList.count() * h;
    const bool needScroll = scheduleContentH > kScheduleScrollThreshold;
    if (needScroll) {
        m_scheduleLabelH = kScheduleScrollThreshold;
    } else {
        int minH = kScheduleMinHeight;
        m_scheduleLabelH = scheduleContentH;
        m_scheduleLabelH = m_scheduleLabelH >= minH ? m_scheduleLabelH : minH;
    }
    //更新控件高度
    area->setFixedHeight(m_scheduleLabelH);
    area->setVerticalScrollBarPolicy(needScroll ? Qt::ScrollBarAsNeeded : Qt::ScrollBarAlwaysOff);
    area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_scheduleLabel->setText(resultStr);
    m_scheduleLabel->setFixedHeight(needScroll ? scheduleContentH : m_scheduleLabelH);

    m_timeLabelH = 26;

```

If these layout constants are used elsewhere in `MyScheduleView` or other files, consider moving `kScheduleScrollThreshold` and `kScheduleMinHeight` to class scope (e.g. as `static constexpr` members in the corresponding header) or to an anonymous namespace at the top of this `.cpp` file, and then use those shared definitions instead of function-local ones.
</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 on lines +98 to 103
const int scheduleContentH = strList.count() * h;
const bool needScroll = scheduleContentH > 100;
if (needScroll) {
m_scheduleLabelH = 100;
} else {
int minH = 17;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Consider extracting the hardcoded height values into named constants for maintainability.

Since 100 (scroll threshold) and 17 (minimum label height) are reused and encode layout assumptions, please extract them into clearly named constants (e.g. kScheduleScrollThreshold, kScheduleMinHeight) or class members to document intent and simplify future UI changes.

Suggested implementation:

        resultStr += str;
    }

    static constexpr int kScheduleScrollThreshold = 100;
    static constexpr int kScheduleMinHeight = 17;

    const int scheduleContentH = strList.count() * h;
    const bool needScroll = scheduleContentH > kScheduleScrollThreshold;
    if (needScroll) {
        m_scheduleLabelH = kScheduleScrollThreshold;
    } else {
        int minH = kScheduleMinHeight;
        m_scheduleLabelH = scheduleContentH;
        m_scheduleLabelH = m_scheduleLabelH >= minH ? m_scheduleLabelH : minH;
    }
    //更新控件高度
    area->setFixedHeight(m_scheduleLabelH);
    area->setVerticalScrollBarPolicy(needScroll ? Qt::ScrollBarAsNeeded : Qt::ScrollBarAlwaysOff);
    area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_scheduleLabel->setText(resultStr);
    m_scheduleLabel->setFixedHeight(needScroll ? scheduleContentH : m_scheduleLabelH);

    m_timeLabelH = 26;

If these layout constants are used elsewhere in MyScheduleView or other files, consider moving kScheduleScrollThreshold and kScheduleMinHeight to class scope (e.g. as static constexpr members in the corresponding header) or to an anonymous namespace at the top of this .cpp file, and then use those shared definitions instead of function-local ones.

@wangruoxuan3782

Copy link
Copy Markdown
Contributor Author

/ok-to-test

@deepin-ci-robot

Copy link
Copy Markdown

@wangruoxuan3782: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/ok-to-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@wangruoxuan3782 wangruoxuan3782 changed the title fix: 优化我的日程弹窗图标和滚动条显示 fix: update schedule dialog icon and scroll behavior Jul 3, 2026
@wangruoxuan3782
wangruoxuan3782 force-pushed the fix-myschedule-icon-scroll branch from 8f6cc2a to e78b248 Compare July 3, 2026 03:06
1. 在主题切换后同步刷新我的日程弹窗图标,确保左上角应用图标跟随系统主题变化。
2. 优化日程内容区域高度与滚动条显示逻辑,内容未超出可视区域时关闭滚动条和滚动效果。
3. 在内容超出显示区域时保留垂直滚动能力,避免完整内容被截断。

1. Refresh the My Schedule dialog icon when the theme changes so the top-left app icon stays in sync with the system theme.
2. Refine the schedule content height and scrollbar logic so scrolling stays disabled when the content fits in the visible area.
3. Keep vertical scrolling available only when the content exceeds the visible area to avoid truncating longer content.

PMS: BUG-368849
PMS: BUG-368851
Log:
- Updated the My Schedule dialog icon when the theme changes.
- Disabled unnecessary scrolling when schedule content fits in the visible area.
@wangruoxuan3782
wangruoxuan3782 force-pushed the fix-myschedule-icon-scroll branch from e78b248 to 30f82e5 Compare July 3, 2026 07:38
@wangruoxuan3782 wangruoxuan3782 changed the title fix: update schedule dialog icon and scroll behavior fix(dialog): update my schedule icon theme sync and scroll behavior Jul 3, 2026
@deepin-bot

deepin-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 6.5.41
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #335

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants