Rewrite AppChooser dialog
ClosedPublic

Authored by jgrulich on Oct 17 2019, 1:30 PM.

Details

Summary

The new version of dialog allows you to select any application if associated applications are not what users want. The dialog
also now uses model and view, where the view is written in QML as QWidgets don't have anything like QGridView.

Screenshot of the dialog:

Diff Detail

Repository
R838 Flatpak Support: KDE Portal for XDG Desktop
Branch
new-app-dialog
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 17846
Build 17864: arc lint + arc unit
jgrulich created this revision.Oct 17 2019, 1:30 PM
Restricted Application added a project: Plasma. · View Herald TranscriptOct 17 2019, 1:30 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
jgrulich requested review of this revision.Oct 17 2019, 1:30 PM
jgrulich updated this revision to Diff 68137.Oct 17 2019, 1:41 PM

Do not duplicate desktop files

jgrulich edited the summary of this revision. (Show Details)Oct 17 2019, 1:43 PM
jgrulich added a reviewer: Plasma.
jgrulich added a comment.EditedOct 17 2019, 1:46 PM

This is the initial state of the dialog, which presents only apps associated with given mimetype. Then if you click at the button below, it will show all the apps and provide a search bar.

The highlighted application is application which was used last time for the given mimetype. I don't otherwise use highlight for the apps when moving with mouse over them.

ognarb added a subscriber: ognarb.Oct 17 2019, 1:51 PM

I would add text on the button e.g "Show more", otherwise it's quite difficult to know how to show more apps

I would add text on the button e.g "Show more", otherwise it's quite difficult to know how to show more apps

There is a tooltip, but maybe showing text next to it might be better.

jgrulich updated this revision to Diff 68140.Oct 17 2019, 1:55 PM

Add text to the button rather then using tooltip

Is this better?

apol added a subscriber: apol.Oct 17 2019, 3:27 PM

+1 looks much better

What's the best way to test this out?

Use Dolphin from Flathub to open some file.

GB_2 added a subscriber: GB_2.Oct 17 2019, 5:12 PM
GB_2 added inline comments.
src/qml/AppChooserDialog.qml
48

"Select an application to open <b>%1</b>. More applications are available in <a href=#discover>Discover</a>."

86

"Show More"

119

We don't really use rounded rectangles for highlights anywhere (except in the Plasma theme).

Give the scrollview a frame and a white background or else apps look cut off and weird and there's a mysteriously hovering scroller:

Also why are there duplicates in here?

Finally, I would consider adding the "Other applications are available in Discover" text to the bottom, so it doesn't interrupt the dialog's flow.

src/qml/AppChooserDialog.qml
123

Change the cursor to the pointing hand cursor when hovering over something that will immediately perform an action when clicked

141

Allow this label to become a multi-line string for apps that have long-ish names:

Give the scrollview a frame and a white background or else apps look cut off and weird and there's a mysteriously hovering scroller:

Also why are there duplicates in here?

From the screenshot I can see you use the current version of the dialog. Make sure you installed it to the correct location, on my system (Fedora) it's installed to /usr/libexec/xdg-desktop-portal-kde.

jgrulich updated this revision to Diff 68218.Oct 18 2019, 8:10 AM

Address review comments

Finally, I would consider adding the "Other applications are available in Discover" text to the bottom, so it doesn't interrupt the dialog's flow.

I'm not sure about that, because we already have the button and the search bar at the botttom.

On my system, it's at /usr/lib64/libexec/xdg-desktop-portal-kde. I tried overriding that file with the one I just built from source (because it didn't seem to use the built-from-source one at ~/kde/usr/lib64/libexec/xdg-desktop-portal-kde) but even then, I still get the old dialog in the Flatpak version of Dolphin. What am I doing wrong here?

On my system, it's at /usr/lib64/libexec/xdg-desktop-portal-kde. I tried overriding that file with the one I just built from source (because it didn't seem to use the built-from-source one at ~/kde/usr/lib64/libexec/xdg-desktop-portal-kde) but even then, I still get the old dialog in the Flatpak version of Dolphin. What am I doing wrong here?

Did you kill the previous one? It might still be running and that's why it didn't pick the new dialog. You can also start it manually, just kill any xdg-desktop-portal-kde instance and run the one you want (from any location). It will even tell you it's already running when you use "QT_LOGGING_RULES='xdp*.debug=true'".

ngraham requested changes to this revision.Oct 18 2019, 1:14 PM

Aha, the old one was indeed still running! I can see the new one now.

  • My request to give the scrollview a frame and the background isn't implemented yet.
  • My request to use the pointing hand cursor when hovering over an app isn't implemented yet.
  • Long app names still get elided rather than becoming multi-line strings.
src/qml/AppChooserDialog.qml
99

Set left and right anchors too so it takes up the full width

103

Capitalize the S

This revision now requires changes to proceed.Oct 18 2019, 1:14 PM
jgrulich updated this revision to Diff 68382.Oct 20 2019, 6:03 PM
  • Improvements based on review comments
jgrulich marked 6 inline comments as done.Oct 20 2019, 6:03 PM

So close! You don't need to create a Rectangle to give the ScrollView a white background; just set Component.onCompleted: background.visible = true on the scrollview itself. Here's an example of how it's done in the Notifications KCM: https://cgit.kde.org/plasma-desktop.git/tree/kcms/notifications/package/contents/ui/SourcesPage.qml#n94

So close! You don't need to create a Rectangle to give the ScrollView a white background; just set Component.onCompleted: background.visible = true on the scrollview itself. Here's an example of how it's done in the Notifications KCM: https://cgit.kde.org/plasma-desktop.git/tree/kcms/notifications/package/contents/ui/SourcesPage.qml#n94

It doesn't seem to work in my case.

ngraham added a subscriber: mart.Oct 21 2019, 5:26 PM

So close! You don't need to create a Rectangle to give the ScrollView a white background; just set Component.onCompleted: background.visible = true on the scrollview itself. Here's an example of how it's done in the Notifications KCM: https://cgit.kde.org/plasma-desktop.git/tree/kcms/notifications/package/contents/ui/SourcesPage.qml#n94

It doesn't seem to work in my case.

That's odd. Any idea why, @mart or @apol?

jgrulich updated this revision to Diff 68501.Oct 22 2019, 7:48 AM
  • Code improvements
jgrulich updated this revision to Diff 68502.Oct 22 2019, 7:49 AM
  • Add Kirigami2 as a dependency

Updated screenshot:

To be honest, I liked the result more when the "view" wasn't using a different background.

ngraham added a reviewer: VDG.Oct 22 2019, 2:19 PM

There still isn't a border around the inner view. That's what I'm trying to get there. Otherwise it doesn't look like an inner view; it looks like a floating rectangle.

There still isn't a border around the inner view. That's what I'm trying to get there. Otherwise it doesn't look like an inner view; it looks like a floating rectangle.

Right, I don't really know what would be a proper way to implement this, just adding borders around the rectangle might be one solution, but I would rather use or make it work the way you suggested before.Does someone have an idea how to do that? @mart or @apol?

jgrulich updated this revision to Diff 68673.Oct 24 2019, 12:32 PM
  • Add border around the view and use small radius around for item highlight

There still isn't a border around the inner view. That's what I'm trying to get there. Otherwise it doesn't look like an inner view; it looks like a floating rectangle.

Solved now. I used same border which is used in Kirigami components. I also added small rounding for the highlight, which I think makes it little more nicer.

ngraham accepted this revision.Oct 24 2019, 5:03 PM
This revision is now accepted and ready to land.Oct 24 2019, 5:03 PM
This revision was automatically updated to reflect the committed changes.