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

FancyMenu: support favorites reordening by drag drop #2013

Merged
merged 3 commits into from
Jan 27, 2024

Conversation

gfgit
Copy link
Member

@gfgit gfgit commented Jan 25, 2024

Closes #1988

@gfgit gfgit force-pushed the work/gfgit/fancymenu_favorites_drag branch from 24a1bda to 4634f3f Compare January 25, 2024 16:27
@gfgit
Copy link
Member Author

gfgit commented Jan 25, 2024

Well actually we could reuse text/uri-list mime instead of custom application/x-lxqtfavoritesdragrow but then it would also accept foreign drops. They get rejected after by comparing with current favorites.
The original row is calculated on drop so it does not need to be stored inside drag mime data.

@gfgit gfgit requested review from tsujan and stefonarch January 25, 2024 16:30
Copy link
Member

@stefonarch stefonarch left a comment

Choose a reason for hiding this comment

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

Not sure if I missed something, but I can't DND favorites.

@tsujan
Copy link
Member

tsujan commented Jan 25, 2024

I haven't started to review this PR because I've found a serious issue with DNDing items from Fancy Menu into PCManFM-Qt under Wayland (haven't tried X11). As I should first see where the cause is (Qt5, Qt in general, or just Fancy Menu?), I have to delay the review for a while. I'll report it when I find the time to investigate it but, IMO, fixing it has priority.

@tsujan
Copy link
Member

tsujan commented Jan 25, 2024

OK, I tested under X11: there's also a problem there, with the same cause but a slightly different effect. The cause is that Fancy Menu isn't closed on DNDing; the effect is that the focus is locked by Fancy Menu, until somewhere is clicked.

I emphasize that this issue exits in the git source (and so, not related to the current PR).

return mimeData;
}

bool LXQtFancyMenuAppModel::dropMimeData(const QMimeData *data_, Qt::DropAction action,
int row, int column, const QModelIndex &p)
Copy link
Member

Choose a reason for hiding this comment

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

Please comment out unused variables like this:

bool LXQtFancyMenuAppModel::dropMimeData(const QMimeData *data_, Qt::DropAction /*action*/,
                                         int row, int /*column*/, const QModelIndex &p)

@tsujan
Copy link
Member

tsujan commented Jan 26, 2024

In addition to the above reviews, please make sure you've checked that old and new rows/positions are always valid, i.e., they are greater than -1 and less than the number of items. You could ignore this comment if you've already done it (I didn't check).

@gfgit
Copy link
Member Author

gfgit commented Jan 27, 2024

In addition to the above reviews, please make sure you've checked that old and new rows/positions are always valid, i.e., they are greater than -1 and less than the number of items. You could ignore this comment if you've already done it (I didn't check).

Well I've read Qt default implementation and row == -1 is interpreted as a drop below last row.
Currently to drop at last row you have to drag close to last item, you cannot just drop is the empty area below it. In my opinion this is not bad, also because row == -1 might be received in other situations where drop is not close to last row so it would be weird if item ended up there.
But this behavior is just one line change so I can implement it if it's wanted.

@tsujan
Copy link
Member

tsujan commented Jan 27, 2024

Done by entirely removing mFavorites

Yes, that's better; mFavorites seemed like a duplication. Will review the new code soon.

But this behavior is just one line change so I can implement it if it's wanted.

I just meant safeguards against crashes. If no crash can happen, this is OK, especially after the removal of mFavorites.

@stefonarch
Copy link
Member

Looks working fine now at first test.

Copy link
Member

@tsujan tsujan left a comment

Choose a reason for hiding this comment

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

The PR looks OK to me.

The code has a minor problem that isn't related to this PR: the list of favorites in ~/.config/lxqt/panel.conf may be much longer than their real size. This doesn't affect the user but, IMO, the list should be edited too. @gfgit, please fix it in another PR, after this is merged.

@tsujan
Copy link
Member

tsujan commented Jan 27, 2024

@stefonarch
If you find no problem in what this PR is supposed to do, please merge it.

Copy link
Member

@stefonarch stefonarch left a comment

Choose a reason for hiding this comment

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

Works without issues, thanks!

@stefonarch stefonarch merged commit a7bab6a into lxqt:master Jan 27, 2024
1 check passed
@gfgit gfgit deleted the work/gfgit/fancymenu_favorites_drag branch February 21, 2024 15:27
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.

Fancy Menu: Support changing of the order of favorites by DND
3 participants