Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #967: Search Bar Key Board Short Cut Performs the same as Mouse Click #1061

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

ShaopengLin
Copy link
Collaborator

@ShaopengLin ShaopengLin commented Mar 15, 2024

Bug reason:
Our current focus in events performs actions based on event types, but we did not pass an event type into a user-defined focus event.

Changes:

  • Refactored previous redundant code into the actions menu code.
  • Moved the action to SearchBar
  • Explicitly stated the reason for the focus in the event is from a shortcut (though the OtherReason would work as well but let's try to be explicit.)

Fix #967

@kelson42 kelson42 requested a review from veloman-yunkan March 20, 2024 18:43
@kelson42 kelson42 force-pushed the Issue#967-fix-search-bar-shortcut branch from d967894 to bb5c340 Compare March 20, 2024 18:43
@kelson42
Copy link
Collaborator

@ShaopengLin Thank you very much for your PR, I finally have assigned a reviewer for it.

Comment on lines -406 to +442
CREATE_ACTION_SHORTCUT(SearchArticleAction, gt("search-article"), QKeySequence(Qt::CTRL | Qt::Key_L));
HIDE_ACTION(SearchArticleAction);
CREATE_ACTION_SHORTCUTS(SearchArticleAction, gt("search-article"), QList<QKeySequence>({QKeySequence(Qt::Key_F6), QKeySequence(Qt::CTRL | Qt::Key_L), QKeySequence(Qt::ALT | Qt::Key_D)}));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you unhide the SearchArticleAction intentionally?

Copy link
Collaborator Author

@ShaopengLin ShaopengLin Mar 24, 2024

Choose a reason for hiding this comment

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

Yeah, the last commit history says actions not needed for the alpha are hidden and is 6 years ago. Since #436 wanted this feature, I believe it is ok to revive this feature?

Edit: this is the commit 6f8b1ab

@@ -403,8 +403,7 @@ void KiwixApp::createActions()
HIDE_ACTION(SavePageAsAction);
*/

CREATE_ACTION_SHORTCUT(SearchArticleAction, gt("search-article"), QKeySequence(Qt::CTRL | Qt::Key_L));
HIDE_ACTION(SearchArticleAction);
CREATE_ACTION_SHORTCUTS(SearchArticleAction, gt("search-article"), QList<QKeySequence>({QKeySequence(Qt::Key_F6), QKeySequence(Qt::CTRL | Qt::Key_L), QKeySequence(Qt::ALT | Qt::Key_D)}));

CREATE_ACTION_SHORTCUT(SearchLibraryAction, gt("search-in-library"), QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_R));
HIDE_ACTION(SearchLibraryAction);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Question to @kelson42 and @mgautierfr: SearchLibraryAction doesn't seem to work in the current version of kiwix-desktop. Did it ever work, was support for it deliberately dropped or was that functionally accidentally broken?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@veloman-yunkan I'm not able to answer at the code level. What is user visible impact?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@kelson42 The question is not about the change. It is about the search-in-library action that is supposed to be activated via the CTRL+SHIFT+R keyboard shortcut.

Copy link
Member

Choose a reason for hiding this comment

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

Probably never worked. Multi-zim search is implemented in libzim but I don't recall we have implemented it in kiwix-desktop.

Copy link
Collaborator

Choose a reason for hiding this comment

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

For me this ticket is not about the library... so I wonder why we talk about it! Honestly I have not clue what this PR should fixed because I don't understand the issue in a first place. So probably not going to merge it as long as the issue itself is not "cristal clear".

@kelson42 kelson42 force-pushed the Issue#967-fix-search-bar-shortcut branch 2 times, most recently from cdec31a to dd1b120 Compare April 6, 2024 08:20
@kelson42 kelson42 force-pushed the Issue#967-fix-search-bar-shortcut branch from dd1b120 to 3ad884e Compare April 12, 2024 07:23
Refactored shortcut to search bar and removed redundant code. Fix kiwix#967
@kelson42 kelson42 force-pushed the Issue#967-fix-search-bar-shortcut branch from 3ad884e to 366ab1d Compare April 12, 2024 10:48
@kelson42 kelson42 merged commit 20f32d0 into kiwix:main Apr 12, 2024
4 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.

Set focus on search bar shortcuts such as f6, ctrl + l, alt + d don't properly work
4 participants