Bug 448618 - "Save as" for a new file does not use the directory of the last used file at the opening the dialog
Summary: "Save as" for a new file does not use the directory of the last used file at ...
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: application (show other bugs)
Version: 21.12.1
Platform: Slackware Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-16 19:53 UTC by Dmitri Koulikoff
Modified: 2022-02-13 14:58 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Few clicks to create a new file (2.94 MB, video/x-matroska)
2022-01-17 21:06 UTC, Dmitri Koulikoff
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitri Koulikoff 2022-01-16 19:53:36 UTC
SUMMARY

"If anything can spoil, it will.
"If anything can not spoil, it will either"
© Murphy's Law

When I need to create a new file in my project in one of the multiple directories in kde4 I used the File -> 
Open menu command being on one of the file of this directory to open the dialogue with this directory to be the default and the current file selected. Then I updated the name to be a new one and by clicking "Open" obtained a new file. What I especially liked the file was not created at this moment and I can edit it. I can create it physically performing the "Save" operation.
In kde5 as I was told this is not more possible due to the new version of the Qt. Now the most natural way is to create a new file with File -> New and then save it with File -> Save or File -> Save As. 

The problem is that when I open the window to save it the default directory I see in the save dialogue is not the same as the last file selected. BUT IT SHOULD!

STEPS TO REPRODUCE
1. Open several file in different directories
2. Create a new one using File -> New
3. Try to save it.

OBSERVED RESULT

In the "Save File" dialogue the selected directory is not the one, the last selected file was in before the new file was "created". (Indeed it was not created, only Kate has prepared a space for it.)


EXPECTED RESULT

The "Save File" dialogue must be opened in the directory, the previously used file was in

SOFTWARE/OS VERSIONS
Operating System: Slackware 15.0-rc3
KDE Plasma Version: 5.23.5
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.3
Kernel Version: 5.15.15 (64-bit)
Graphics Platform: X11
Processors: 12 × Intel® Core™ i7-9750H CPU @ 2.60GHz
Memory: 31.1 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 630

ADDITIONAL INFORMATION

I have nothing against implementation of the old behaviour with File -> Open a new file. ;-) Since it requires less operations and does not touch the disk until the file is prepared.
Comment 1 Christoph Cullmann 2022-01-16 21:34:53 UTC
Yeah, that would be nice to have.
We perhaps need to expose either the sorted view list in the KTextEditor API to allow for that or some working directory one shall use for such things in the part.
ATM if I am not mistaken the part is providing these actions and has no way to query the right directory, as it has no idea what was the least recently used URL.
Comment 2 Christoph Cullmann 2022-01-17 19:11:30 UTC
Oh, I did miss that this was some "grave" bug, this is an improvement.
As said, unfortunately it is not completely trivial to implement.
Comment 3 Christoph Cullmann 2022-01-17 19:27:44 UTC
https://invent.kde.org/utilities/kate/-/merge_requests/567

First part: expose sorted list of views
Comment 4 Dmitri Koulikoff 2022-01-17 20:52:42 UTC
(In reply to Christoph Cullmann from comment #2)
> Oh, I did miss that this was some "grave" bug, this is an improvement.

  for me it is a grave bug, since I lose a lot of time every day working on my projects. I have regularly to add new files to them. And now it takes 10 times more time.

> As said, unfortunately it is not completely trivial to implement.

  I bet it is much easier to implement allowing to open a new file as it was in kde ;-)
Comment 5 Dmitri Koulikoff 2022-01-17 21:06:18 UTC
Created attachment 145599 [details]
Few clicks to create a new file
Comment 6 Dmitri Koulikoff 2022-01-17 21:15:07 UTC
(In reply to Christoph Cullmann from comment #3)
> https://invent.kde.org/utilities/kate/-/merge_requests/567
> 
> First part: expose sorted list of views

this is related to my bug report https://bugs.kde.org/show_bug.cgi?id=434062
Comment 7 Christoph Cullmann 2022-01-18 18:58:33 UTC
You will not increase my willingness to work on this issue by attaching some videos.
Comment 8 Dmitri Koulikoff 2022-01-18 20:54:12 UTC
(In reply to Christoph Cullmann from comment #7)
> You will not increase my willingness to work on this issue by attaching some
> videos.

Then assign it to somebody else. Who want the product to be perfect.
Comment 9 Bug Janitor Service 2022-02-12 15:11:10 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/286
Comment 10 Waqar Ahmed 2022-02-13 14:58:07 UTC
Git commit 6c5f489c81f1ae819443b459c4484138200b0b57 by Waqar Ahmed, on behalf of Christoph Cullmann.
Committed on 13/02/2022 at 14:53.
Pushed by waqar into branch 'master'.

use the url of the latest used document for save

instead of falling back to current working directory,
try to use the last used view url

M  +27   -10   src/document/katedocument.cpp
M  +8    -0    src/document/katedocument.h
M  +5    -0    src/include/ktexteditor/mainwindow.h

https://invent.kde.org/frameworks/ktexteditor/commit/6c5f489c81f1ae819443b459c4484138200b0b57