Bug 406058 - On first run, default save as location is often incorrect
Summary: On first run, default save as location is often incorrect
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Boudhayan Gupta
Depends on:
Reported: 2019-03-30 21:07 UTC by Nate Graham
Modified: 2019-06-05 13:39 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:

The issue (158.90 KB, image/png)
2019-03-30 21:07 UTC, Nate Graham

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2019-03-30 21:07:44 UTC
Created attachment 119167 [details]
The issue

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..."

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

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

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

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