Bug 424082 - When trying to create a directory that already exists using the Open/save dialog, it should just should take user instead of showing an error
Summary: When trying to create a directory that already exists using the Open/save dia...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: Open/save dialogs (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR minor
Target Milestone: ---
Assignee: KIO Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-11 00:12 UTC by jbn
Modified: 2020-12-14 19:25 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.76


Attachments
The panel I'm referring to showing the error I think is undesirable. (1.20 MB, video/webm)
2020-09-19 23:23 UTC, jbn
Details
sceenshot taken on neon unstable (116.01 KB, image/png)
2020-10-25 11:23 UTC, Patrick Silva
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jbn 2020-07-11 00:12:01 UTC
SUMMARY
Using the open/save directory panel to create a directory that already exists results in seeing an error "A file or folder named <path to your directory> already exists.". This should instead select the desired directory and possibly expand that directory to show other directories within.

STEPS TO REPRODUCE
1. Open a KDE app that uses the KDE standard directory open/save directory navigator panel. Do something that causes that panel to open.
2. Click "New Folder..." and specify the name of a folder that already exists.

OBSERVED RESULT
You will get the "A file or folder named <path to your directory> already exists." error.

EXPECTED RESULT
It shouldn't matter if the directory exists because clearly the user is trying to work in that directory. Therefore the path to the specified directory should be expanded, the directory specified should be selected, and the user should be left to do further work in that directory.

SOFTWARE/OS VERSIONS
Operating System: Debian GNU/Linux 
KDE Plasma Version: 5.17.5
KDE Frameworks Version: 5.70.0
Qt Version: 5.14.2
Kernel Version: 5.7.0-1-amd64
OS Type: 64-bit
Processors: 8 × AMD FX(tm)-8150 Eight-Core Processor
Memory: 31.3 GiB of RAM
Comment 1 Nate Graham 2020-07-12 14:30:13 UTC
Seems reasonable enough.
Comment 2 Ahmad Samir 2020-09-18 14:02:27 UTC
But what if the user actually wants to save the file in a new empty dir?

How about a middle ground? we could display the error message and select the existing dir, then user then could press Enter to open it and save there.
Comment 3 jbn 2020-09-19 00:15:53 UTC
Thanks for the feedback. I'd like to know what "select the existing dir, then user then could press Enter to open it and save there" looks like and what this might work like before I would agree to that because given only this description a panel indicating an error sounds like more typing and clicking than I'd expect to want to do. I also don't think that indicating an extant directory is an error, no matter whether I indicate that directory by clicking or typing.

Most of the time I indicate a directory to this panel, I need to work inside the directory that I indicated whether that directory has items in it or not. If I need a new empty directory, I would create the new empty directory I need and indicate that directory.
Comment 4 Ahmad Samir 2020-09-19 14:45:06 UTC
I've posted a gif to this merge request: https://invent.kde.org/frameworks/kio/-/merge_requests/141
Comment 5 jbn 2020-09-19 23:23:48 UTC
Created attachment 131791 [details]
The panel I'm referring to showing the error I think is undesirable.
Comment 6 jbn 2020-09-19 23:30:53 UTC
Thanks for the demonstration animation.

In reference to: https://invent.kde.org/frameworks/kio/uploads/6df68f21d5ccca1ac7be6b2b21b40b1b/Peek_2020-09-19_16-41.gif that in Dolphin, you've created a "kt" directory where this directory already exists. You got an error ("A folder named /home/ahmad/dev/kio/building-dir/bin/kt already exists") and the error panel has an OK button. You clicked the OK button to dismiss that error panel, the error panel disappeared, and then the animation loops.

I think there are a couple of misunderstandings in this discussion:

1. I'm talking about a different panel than what you're showing in the animation: What you're showing is in Dolphin, but what I'm talking about is the behavior of the open/save directory panel applications use when they want you to point a program to a directory. In this panel, one does not see all of the same icons and have the same functionality as a Dolphin file browser window. I've uploaded a WebM attachment (Attachment 131791 [details]) to show the panel I'm talking about.

2. The context is different: In the open/save directory panel one can create a new folder (via the "New Folder..." button) and it is there that I think creating a folder with the same path as one that already exists should not return an error but instead take the user to that folder just as if the folder were just created because in the context of this panel one is trying to say something like "I wish to point the application to this specified folder" and let the user get on with what they were working on.

To get to the panel I'm referring to, I used qBitTorrent version 4.2.5 (64-bit) on Debian GNU/Linux:

Operating System: Debian GNU/Linux 
KDE Plasma Version: 5.17.5
KDE Frameworks Version: 5.70.0
Qt Version: 5.14.2
Kernel Version: 5.8.0-1-amd64
OS Type: 64-bit
Processors: 8 × AMD FX(tm)-8150 Eight-Core Processor
Memory: 31.3 GiB of RAM

I imagine that there are other apps one could use to get to the same panel. This panel is chiefly about manipulating directories -- one can make a new directory (as you see I tried to do) but making a directory that matches a directory which already exists produces an error instead of taking the user to that directory.

I'm not well-versed in the set of KDE or Qt panels, so I'm not sure if we're both referring to the same panel (perhaps with a different configuration) or the same error. My main point is that in the middle of doing something else I think that getting to the desired directory should trump the details of whether that directory exists.
Comment 7 Ahmad Samir 2020-09-20 12:12:07 UTC
I see; IINM, it's the same dialogue, from KIO KFileWidgets and co., but with a different option set (where you can only select dirs), I'll test that one too.
Comment 9 David Faure 2020-10-10 12:43:38 UTC
Git commit 5f84f12d68ef33478b7b6f0052061c13505104ab by David Faure, on behalf of Ahmad Samir.
Committed on 10/10/2020 at 12:43.
Pushed by dfaure into branch 'master'.

In file dialogs, creating a dir that already exists should select it

If the user tries to create a new directory in the open/save file dialog,
and that directory already exists, select/highlight it in the view.

M  +3    -0    src/filewidgets/kdiroperator.cpp
M  +14   -1    src/filewidgets/knewfilemenu.cpp
M  +10   -0    src/filewidgets/knewfilemenu.h

https://invent.kde.org/frameworks/kio/commit/5f84f12d68ef33478b7b6f0052061c13505104ab
Comment 10 Ahmad Samir 2020-10-10 21:47:02 UTC
Actually this particular bug is fixed in plasma-integration, in kdirselectdialog. So it's fixed in master and I've just cherry-picked it to Plasma/5.20.

The KIO part is for the regular file open dialog and knewfilemenu.

Sorry about the confusion.
Comment 11 Patrick Silva 2020-10-16 15:26:59 UTC
This bug is still reproducible on neon unstable.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.20.80
KDE Frameworks Version: 5.76.0
Qt Version: 5.15.0
Comment 12 Ahmad Samir 2020-10-16 15:50:44 UTC
You mean with qbittorrent? or with the open/save file that's used in e.g. kate?
Comment 13 Patrick Silva 2020-10-16 16:34:51 UTC
(In reply to Ahmad Samir from comment #12)
> You mean with qbittorrent? or with the open/save file that's used in e.g.
> kate?

with the open/save file dialog
Comment 14 Ahmad Samir 2020-10-16 16:48:05 UTC
I tested again with recent-ish git snapshot, seems to work here.

Do you know the git commit that the kio package on neon is built from? (it was committed ~ 6 days ago to kio).
Comment 15 Patrick Silva 2020-10-16 18:00:48 UTC
(In reply to Ahmad Samir from comment #14)
> Do you know the git commit that the kio package on neon is built from? (it
> was committed ~ 6 days ago to kio).

unfortunately I do not know.
Comment 16 Ahmad Samir 2020-10-16 22:10:39 UTC
I've tested again and it seems work here, I've asked on IRC if someone running neon can test too (hopefully we'll get some feedback).
Comment 17 Patrick Silva 2020-10-25 11:23:48 UTC
Created attachment 132722 [details]
sceenshot taken on neon unstable

My screenshot shows the result when I try to create a directory that already exists.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.20.80
KDE Frameworks Version: 5.76.0
Qt Version: 5.15.0
Comment 18 Ahmad Samir 2020-10-25 12:03:45 UTC
(In reply to Patrick Silva from comment #17)
> Created attachment 132722 [details]
> sceenshot taken on neon unstable
> 
> My screenshot shows the result when I try to create a directory that already
> exists.
> 
That's a different, new, feature not directly related to the commit in comment#9. https://invent.kde.org/frameworks/kio/-/merge_requests/180

We may need to adapt that new behaviour to the kdiroperator use case...

> Operating System: KDE neon Unstable Edition
> KDE Plasma Version: 5.20.80
> KDE Frameworks Version: 5.76.0
> Qt Version: 5.15.0
Comment 19 Bug Janitor Service 2020-10-31 06:35:54 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/199
Comment 20 Méven Car 2020-10-31 17:42:42 UTC
Git commit 9cc4b4c76e7b7c837608a5c22853e673bf73876f by Méven Car.
Committed on 31/10/2020 at 17:42.
Pushed by meven into branch 'master'.

In file dialogs, select an existing dir when trying to create it

M  +5    -0    src/filewidgets/kdiroperator.cpp
M  +7    -0    src/filewidgets/kdiroperator.h
M  +1    -0    src/filewidgets/kfilewidget.cpp
M  +18   -5    src/filewidgets/knewfilemenu.cpp
M  +9    -0    src/filewidgets/knewfilemenu.h

https://invent.kde.org/frameworks/kio/commit/9cc4b4c76e7b7c837608a5c22853e673bf73876f
Comment 21 jbn 2020-12-14 18:59:02 UTC
Thanks for working on this!

I was a bit confused as to when I should expect to be able to see the change you filed; should the change be visible in any of the following software versions on the following architecture?

Operating System: Debian GNU/Linux
KDE Plasma Version: 5.19.5
KDE Frameworks Version: 5.74.0
Qt Version: 5.15.2
Kernel Version: 5.9.0-4-amd64
OS Type: 64-bit
Processors: 8 × AMD FX(tm)-8150 Eight-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: NV106
Comment 22 Ahmad Samir 2020-12-14 19:25:25 UTC
From the "Version Fixed In:" field in the bug report, the fix should be in Frameworks 5.76.