Fix issues with clicking directories in tree view
Summary:
Selecting another directory in tree while showing an image in view mode,
opens the first image from the selected directory in view mode. If the
folder contains subfolders, gwenview selects the first one and switches
to browse mode.
This patch changes selection of first item back to first image
(introduced in D8934) to fix this and toggles between browse/view mode
only after clicking the already selected directory in tree.
Additionally a trailing slash is stripped from the current dir url in
context manager to fix a failing compare to initially stored dir url.
BUG: 306835
Test Plan:
- Open image in view mode
- Click on another directory in tree view
-> Should view the first image in new directory
- Open image in view mode
- Click multiple times on the same directory in tree view
-> Should toggle browse/view mode
Reviewers: rkflx
Reviewed By: rkflx
Subscribers: ngraham, rkflx
Differential Revision: https://phabricator.kde.org/D9886