Bug 450832

Summary: Can't save anything with Flatpak packaging
Product: [Applications] Skanpage Reporter: Nate Graham <nate>
Component: generalAssignee: Alexander Stippich <a.stippich>
Status: RESOLVED UPSTREAM    
Severity: normal CC: jgrulich
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
URL: https://bugreports.qt.io/browse/QTBUG-101437
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Nate Graham 2022-02-25 16:55:38 UTC
I am working on packaging Skanlite for Flathub, and I'm running into the following issue with both 1.0 version and current git master:

STEPS TO REPRODUCE
1. Scan one or more documents
2. Click "Save"
3. In the file dialog, navigate to some location, type a filename, and click on the "Save" button

OBSERVED RESULT
The file dialogs closes, and main window shows a small message saying, "Nothing to save."

EXPECTED RESULT
The file is saved.

ADDITIONAL INFORMATION
Does not affect non-Flatpak version of the 1.0 release or current git master.

You can see my draft Flatpak manifest here: https://github.com/Pointedstick/flathub/blob/skanpage/org.kde.skanpage.json
Comment 1 Nate Graham 2022-02-25 17:13:37 UTC
I mean Skanpage, of course. The names are so similar that I always mix them up!
Comment 2 Alexander Stippich 2022-02-26 10:28:16 UTC
Well, I have zero experience with flatpaks, so I don't know what's going on.
The message is displayed in https://invent.kde.org/utilities/skanpage/-/blob/master/src/DocumentSaver.cpp at line 29.
Means that either the specified fileUrl for saveing is empty or the document contains no actual pages.
Since the scanning seems to be working, I guess it's the first.
Comment 3 Nate Graham 2022-02-28 22:11:12 UTC
OK, I will dig into it a bit soon. Probably a weird interaction with the XDG save portal that provides the file URL.
Comment 4 Nate Graham 2022-03-03 16:20:09 UTC
After some qWarning()/console.log() debugging, I've discovered that FileDialog in MainWindow.qml fails to set `fileUrl` after it's been accepted. This workes outside of a Flatpak, but fails within it, and I am starting to fear that this is a Qt bug.
Comment 5 Nate Graham 2022-03-03 19:05:11 UTC
Filed https://bugreports.qt.io/browse/QTBUG-101437 to track this.

There's a chance it's an issue in our KDE desktop portal implementation rather than in Qt, but I don't understand enough about how these pieces interact to figure that out. CCing Jan Grulich who is more familiar.