Skip to content

Fix #832: Seperated Bookmark Button from Search Icon #1060

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

Merged
merged 6 commits into from
May 11, 2024

Conversation

ShaopengLin
Copy link
Collaborator

@ShaopengLin ShaopengLin commented Mar 15, 2024

Bug Reason:
The Bookmark mode is not enabled if there is text in the search bar.

Edited Changes:

  • Moved the Bookmark button to the right of the search bar.
  • The Bookmark button is disabled on non-Zim tabs
  • Users can find the Bookmark button in the Edit menu with Shortcut Ctrl + D, with Donation Shortcut now as Ctrl + Shift + D
  • Refactored SearchBar to QToolbar and moved line edits and buttons within the toolbar for less coupling.

Changes:
- Separated the focus check and text existence check. Having text in the search doesn't justify disabling the bookmark function.
- Making the button in search mode transparent, as it doesn't do anything and should trigger search mode. Having it being a focus-out event doesn't make sense.
- Making the button in bookmark mode have focus since it is not supposed to trigger search mode.

Carried over bugfix: The title isn't displaying properly after these steps:
1. searching which changes the page title
2. removes text in the search bar
3. Click on the article which should be displaying the previous(or a wrong) title.

Fix #832

@ShaopengLin
Copy link
Collaborator Author

@kelson42 Are you aware if this PR or "Carried over bugfix" is related to any other existing issues? I don't seem to find any.

@mgautierfr mgautierfr force-pushed the Issue#832-fix-book-mark branch from aaf17bd to 44d858c Compare April 8, 2024 12:56
Copy link
Member

@mgautierfr mgautierfr left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@veloman-yunkan veloman-yunkan left a comment

Choose a reason for hiding this comment

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

I think that we rather have a UI/UX bug that has to be fixed by separating the bookmark button from the search icon.

@kelson42 kelson42 force-pushed the Issue#832-fix-book-mark branch from 44d858c to 5780179 Compare April 8, 2024 19:59
@kelson42
Copy link
Collaborator

kelson42 commented Apr 8, 2024

@ShaopengLin We don't forget you... give us a bit of time please.

@kelson42 kelson42 self-requested a review April 21, 2024 10:50
@kelson42 kelson42 force-pushed the Issue#832-fix-book-mark branch from 5780179 to a7ba14d Compare April 21, 2024 10:54
@veloman-yunkan
Copy link
Collaborator

I think that we rather have a UI/UX bug that has to be fixed by separating the bookmark button from the search icon.

Why don't we (always) display the bookmark button on the right of the searchbar (like in Firefox)?

@kelson42
Copy link
Collaborator

@ShaopengLin I think your PR works well, but @veloman-yunkan is pretty pertinent. Would that be possible to move the star on the other end of the bar like in Web browser?

@ShaopengLin
Copy link
Collaborator Author

I think its doable. Just to clarify do you want it inside the search bar?

Do you want a seperate PR for this? If we want it done in the same PR, I will reword the title of this PR since we are changing the UI.

@kelson42
Copy link
Collaborator

@ShaopengLin Great. Yes, inside the searchbar (like in browser) and after discussion, we would prefer to have it in current PR.

@ShaopengLin ShaopengLin changed the title Fix #832: Bookmark Available Now by Clicking on Article after Search Fix #832: Seperated Bookmark Button from Search Icon May 3, 2024
@ShaopengLin ShaopengLin force-pushed the Issue#832-fix-book-mark branch 2 times, most recently from 00242ba to 71dc996 Compare May 3, 2024 03:09
@ShaopengLin
Copy link
Collaborator Author

ShaopengLin commented May 3, 2024

@kelson42 One thing to note, Chrome browsers all have Ctrl + D as the bookmark as a bookmark shortcut. This shortcut is taken already by the donation shortcut. This might be something to discuss if we deem a shortcut necessary.

@ShaopengLin
Copy link
Collaborator Author

Found a bug that mouse clicks to the button is falling through to the line edit. Working on a fix...

@kelson42
Copy link
Collaborator

kelson42 commented May 5, 2024

@kelson42 One thing to note, Chrome browsers all have Ctrl + D as the bookmark as a bookmark shortcut. This shortcut is taken already by the donation shortcut. This might be something to discuss if we deem a shortcut necessary.

CTRL+D being a standard browser shortcut to bookmark, I suspect this has the priority and we should not change this. Considering that donation menus is not something used on a regular base (would be great ;), you can put another letter which is "free".

@kelson42 kelson42 force-pushed the Issue#832-fix-book-mark branch from 71dc996 to 5eb83fb Compare May 5, 2024 09:17
Copy link
Collaborator

@kelson42 kelson42 left a comment

Choose a reason for hiding this comment

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

@ShaopengLin I have rebased on git main HEAD! Then tested this new version.

It works IMO basically how it should. At this stage I was not able to find fundamental problems. But a few things should be improved and (partly) are visible in this screenshot:
image

First thing is that the highligted zone margin is not the same on the top and on the right. It should be tested as well for RTL languages (with ./kiwix-desktop -reverse)
The second thing is that under certain conditions, the pointer is not OK and still show the input cursor in place of the arrow pointer. We have the same problem with the magnify glass.

@ShaopengLin
Copy link
Collaborator Author

ShaopengLin commented May 5, 2024

Since we might be adding a multi-zim search button as well later into the search bar, the search bar looks more like a sub-toolbar of the top widget. I am leaning toward refactoring it to a toolbar or a simple QWidget with a line edit and buttons.

This can solve a lot of the focus and mouse cursor issues, which otherwise will need manual eventFilters to handle. The buttons and line edits interactions remain cohesive as signal/slots between them can be jointly set in the widget. What do you think? @veloman-yunkan

Edit: IMHO it feels unnatural and hacky to have everything in a LineEdit. I tried the QToolBar refactor and it is so much easier to work with, that, I will just overwrite this commit.

@ShaopengLin ShaopengLin force-pushed the Issue#832-fix-book-mark branch from 5eb83fb to f9dc9f7 Compare May 6, 2024 19:37
@ShaopengLin ShaopengLin requested a review from kelson42 May 7, 2024 03:25
@kelson42
Copy link
Collaborator

kelson42 commented May 7, 2024

@veloman-yunkan Ready for tech review IMHO

Copy link
Collaborator

@veloman-yunkan veloman-yunkan left a comment

Choose a reason for hiding this comment

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

I looked through the changes briefly but their amount was above my natural ability to comprehend them all at once. Whenever possible, changes must be made in small incremental steps (and I believe this is how you arrived at the final code starting from the original code). Will you please kindly decompose this PR into several smaller changes? Each change must make sense on its own so that it is accurately described by its commit message.

@ShaopengLin ShaopengLin force-pushed the Issue#832-fix-book-mark branch from f9dc9f7 to 3e9f8f7 Compare May 7, 2024 19:21
@ShaopengLin ShaopengLin requested a review from veloman-yunkan May 7, 2024 19:22
Copy link
Collaborator

@veloman-yunkan veloman-yunkan left a comment

Choose a reason for hiding this comment

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

LGTM

SearchBar becomes QToolBar instead of QLineEdit. The previous LineEdit is now a child of SearchBar
Since we will be seperate search icon from bookmark button, we remove the logic in SearchButton and simply put an equivalent QLabel in SearchBar.
Renamed SearchButton to BookmarkButton since it no longer has the search icon. Moved BookmarkButton to the right side of SearchBar
Created a ON-OFF action for Bookmark and added in Edit Menu Actions. Assigned shortcut Ctrl + D, which the Donation shortcut is now Ctrl + SHIFT + D. Action disabled for non-Zim tabs
BookmarkButton is now a QToolButton to better work with actions. Now clicks can modify menu text displays and menu displays can simulate clicks.
Redefined styles sheets for new widgets. Increased button svg size since QToolButton doesn't increase button size to be larger than source.
@kelson42 kelson42 force-pushed the Issue#832-fix-book-mark branch from 3e9f8f7 to b49d6ec Compare May 11, 2024 11:00
@kelson42 kelson42 merged commit 921bc72 into kiwix:main May 11, 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.

Bookmark icon not always available
4 participants