Skip to content

feat: add focus with AlphabetCategory when change to another word.#576

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-289159
Jun 12, 2025
Merged

feat: add focus with AlphabetCategory when change to another word.#576
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-289159

Conversation

@wjyrich
Copy link
Copy Markdown
Contributor

@wjyrich wjyrich commented Jun 11, 2025

as title.

PMS-BUG-289159

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Jun 11, 2025

Reviewer's Guide

This PR implements a new currentCategory-driven focus mechanism in the alphabet category popup by introducing a delayed index-setting timer, exposes helper APIs in the grid container, and updates the app list view to trigger the new focus behavior when switching categories.

Sequence Diagram: Alphabet Category Focus Update

sequenceDiagram
    actor User
    participant AppListView
    participant AlphabetCategoryPopup
    participant setIndexTimer
    participant alphabetCategoryContainer

    User->>AppListView: Clicks alphabet section (e.g., "S") OR Clicks letter in AlphabetCategoryPopup
    alt User clicks section in AppListView
        AppListView->>AlphabetCategoryPopup: setCurrentCategory("S")
    else User clicks letter in AlphabetCategoryPopup
        AlphabetCategoryPopup->>AlphabetCategoryPopup: setCurrentCategory("S") via onCategoryClicked
    end

    AlphabetCategoryPopup->>AlphabetCategoryPopup: currentCategory = "S"
    AlphabetCategoryPopup->>setIndexTimer: category = "S"
    AlphabetCategoryPopup->>setIndexTimer: restart()

    Note over setIndexTimer: Timer waits for 'interval' (10ms)

    setIndexTimer->>setIndexTimer: onTriggered()
    setIndexTimer->>alphabetCategoryContainer: model = alphabetCategoryDelegateModel.model
    loop Find category in model
        setIndexTimer->>setIndexTimer: if (model[i] === category)
    end
    opt Category found
        setIndexTimer->>alphabetCategoryContainer: highlightMoveDuration = 0
        setIndexTimer->>alphabetCategoryContainer: currentIndex = foundIndex
        setIndexTimer->>alphabetCategoryContainer: highlightMoveDuration = originalDuration
    end
Loading

Class Diagram: QML Component Updates for Alphabet Navigation

classDiagram
  class AlphabetCategoryPopup {
    +string currentCategory
    +setCurrentCategory(category: string)
    -Timer setIndexTimer
  }
  class GridViewContainer {
    +currentIndex: alias
    +highlightMoveDuration: alias
    +setCurrentIndex(index: int)
  }
  class AppListView {
    %% No new public members, but existing methods call AlphabetCategoryPopup's new method
  }
  AppListView ..> AlphabetCategoryPopup : calls setCurrentCategory()
  AlphabetCategoryPopup ..> GridViewContainer : uses features of (as internal alphabetCategoryContainer)
Loading

File-Level Changes

Change Details Files
Add currentCategory and delayed focus logic in AlphabetCategoryPopup
  • Introduced currentCategory property and setCurrentCategory() method
  • Added Timer to defer scrolling until model updates
  • Disabled highlightMoveDuration temporarily to jump without animation
  • Added onCurrentCategoryChanged handler to restart the timer
qml/windowed/AlphabetCategoryPopup.qml
Expose and control currentIndex and highlightMoveDuration in GridViewContainer
  • Added aliases for currentIndex and highlightMoveDuration
  • Implemented setCurrentIndex() helper method
qml/windowed/GridViewContainer.qml
Trigger popup focus update in AppListView when category changes
  • Call setCurrentCategory() when opening popup on section click
  • Call setCurrentCategory() in onCategoryClicked before closing list
qml/windowed/AppListView.qml

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

@wjyrich wjyrich force-pushed the fix-bug-289159 branch 2 times, most recently from 191804d to d514701 Compare June 12, 2025 01:14
Comment thread qml/windowed/GridViewContainer.qml Outdated
Comment thread qml/windowed/GridViewContainer.qml
@wjyrich wjyrich force-pushed the fix-bug-289159 branch 2 times, most recently from 1b3d6cd to 13cd2b8 Compare June 12, 2025 02:20
Comment thread qml/windowed/AlphabetCategoryPopup.qml Outdated
Comment thread qml/windowed/GridViewContainer.qml Outdated
Comment thread qml/windowed/AlphabetCategoryPopup.qml Outdated
Comment thread qml/windowed/AlphabetCategoryPopup.qml Outdated
@wjyrich wjyrich force-pushed the fix-bug-289159 branch 2 times, most recently from fe354c8 to 94e7c6f Compare June 12, 2025 06:04
18202781743
18202781743 previously approved these changes Jun 12, 2025
Comment thread qml/windowed/AlphabetCategoryPopup.qml Outdated
@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

@wjyrich
Copy link
Copy Markdown
Contributor Author

wjyrich commented Jun 12, 2025

/forcemerge

@deepin-bot
Copy link
Copy Markdown

deepin-bot Bot commented Jun 12, 2025

This pr force merged! (status: blocked)

@deepin-bot deepin-bot Bot merged commit 57c4023 into linuxdeepin:master Jun 12, 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.

4 participants