Bug 406058

Summary: On first run, default save as location is often incorrect
Product: [Applications] Spectacle Reporter: Nate Graham <nate>
Component: GeneralAssignee: Boudhayan Gupta <me>
Status: RESOLVED FIXED    
Severity: normal CC: kde
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: The issue

Description Nate Graham 2019-03-30 21:07:44 UTC
Created attachment 119167 [details]
The issue

STEPS TO REPRODUCE
1. Download Neon dev unstable 
2. Boot it in live mode on a VM or on physical hardware
3. Hit PrintScreen key
4. Click "Save as..."


OBSERVED RESULT
Save dialog opens showing /, with no filename in the name field


EXPECTED RESULT
Save dialog should display default save location (~/Pictures)
Comment 1 David Redondo 2019-05-31 10:45:51 UTC
I think this there are two bugs. The first one is that the default Url we pass to the file dialog is missing "file://". The second bug which is currently hidden by the first is that the we actually trim the Pictures part from "~/Pictures" because we are returning a folder from the code paths that expect a file. Could you test
if https://phabricator.kde.org/P396 produces the expected result?
Comment 2 Nate Graham 2019-05-31 12:41:57 UTC
Yep, that looks like both an accurate description of the cause and the correct fix. Feel free to submit a patch!
Comment 3 David Redondo 2019-06-05 13:39:31 UTC
Git commit 0a1f081ebe75eaf25a1142e5efd00cb2354e35fe by David Redondo.
Committed on 05/06/2019 at 13:39.
Pushed by davidre into branch 'master'.

Change defaultSaveLocation to use QUrl

Summary:
There were two issues with the default save lcoation. First the url passed to
QFileDialog was missing the "file://" prefix and the file dialog would open in
the working directory of the application (usually /). The second issue hidden
by this was that the last part of the path (~/Pictures) was removed because it
was returned through functions which expect file paths and trim them to get a
path to a folder. To avoid this a slash is added to the path.

Test Plan:
Open Spectacle with a fresh user or delete lines related to save paths from
your spectaclerc. Clicking on "Save as..." should open the dialog in
~/Pictures.

Reviewers: #spectacle, ngraham

Reviewed By: #spectacle, ngraham

Subscribers: ngraham, broulik

Tags: #spectacle

Differential Revision: https://phabricator.kde.org/D21556

M  +1    -5    src/ExportManager.cpp
M  +1    -1    src/Gui/KSMainWindow.cpp
M  +2    -2    src/Gui/SettingsDialog/SaveOptionsPage.cpp
M  +11   -9    src/SpectacleConfig.cpp
M  +2    -2    src/SpectacleConfig.h

https://commits.kde.org/spectacle/0a1f081ebe75eaf25a1142e5efd00cb2354e35fe