Bug 419434 - Folders without sub-folders are not expandable in the TreeView the "Filesystem Browser"
Summary: Folders without sub-folders are not expandable in the TreeView the "Filesyste...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: URL navigator (show other bugs)
Version: 5.68.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
: 420020 422084 422205 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-03-30 21:13 UTC by Mario Aichinger
Modified: 2020-06-29 21:36 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.72


Attachments
See the red arrow and the red box. (85.93 KB, image/png)
2020-03-30 21:13 UTC, Mario Aichinger
Details
fix (2.58 KB, patch)
2020-05-09 09:29 UTC, painless roaster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mario Aichinger 2020-03-30 21:13:57 UTC
Created attachment 127121 [details]
See the red arrow and the red box.

Non empty folders without folders in it (folders with only files in it) can't be expanded in the tree view mode of the "Filesystem Browser", the arrow next to the folder name is not displayed. This happens to folders containing only files or symlinks to folders.


STEPS TO REPRODUCE
1. open kate
2. open "Filesystem Browser"
3. select TreeView
4. expand a folder with a sub-folder in it, which has no sub-folder/folders
6. find you self with a non empty folder that can't be expanded

OBSERVED RESULT
Folders without sub folders cant be expanded.


EXPECTED RESULT
I would have expected all non empty folder in the TreeView mode to be expandable.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
Linux subplex 5.5.13-arch1-1 #1 SMP PREEMPT Wed, 25 Mar 2020 16:04:40 +0000 x86_64 GNU/Linux

KDE Plasma Version: 
5.18.3

KDE Frameworks Version: 
5.68.0

Qt Version: 
Qt 5.14.1 (built against 5.14.1)

ADDITIONAL INFORMATION
The xcb windowing system
Comment 1 Timothy 2020-04-15 10:17:14 UTC
I have the same problem. I found a workaround on one of my computers though. I installed Kate via Flatpak, and it's running version 19.12.3. The KDE frameworks is 5.67.0. The Qt is 5.14.1 (built against 5.14.1).
Comment 2 painless roaster 2020-05-06 07:16:16 UTC
Downgrade kf5-kio solved this problem.
Comment 3 Christoph Feck 2020-05-06 22:28:31 UTC
*** Bug 420020 has been marked as a duplicate of this bug. ***
Comment 4 painless roaster 2020-05-09 09:29:53 UTC
Created attachment 128272 [details]
fix

fix
Comment 5 Christoph Feck 2020-05-22 20:34:43 UTC
Could you please submit the patch for review? There might be issues developers want to discuss.

https://community.kde.org/Get_Involved/development#Submit_a_patch
Comment 6 Méven Car 2020-05-23 17:11:03 UTC
I believe https://phabricator.kde.org/D27731 caused the issue.
ebe7714300af53ba6f4b5cacddb53a2fd52c7d5a
Comment 7 Christoph Feck 2020-05-26 10:44:56 UTC
*** Bug 422084 has been marked as a duplicate of this bug. ***
Comment 8 David Faure 2020-05-30 00:13:45 UTC
Oops. I'll fix it.

I think KDirModel can just query the dirlister for the mode. But I'll write a unittest first.
Comment 9 David Faure 2020-05-30 00:56:54 UTC
Git commit fe87d93250d2f9b302e0498cc99a2b7d9fab7583 by David Faure.
Committed on 30/05/2020 at 00:56.
Pushed by dfaure into branch '2020_05_hasChildren_fix'.

KDirModel: fix hasChildren() regression for trees with files shown

The logic I introduced in commit ebe7714300af53ba6f4b5cacddb53a2fd52c7d5a
assumed that only subdirs were shown in the tree (konqueror sidebar use
case). However KDirOperator can also show files, so this introduced bug
419434. Now implemented correctly for both use cases, with unittest.
FIXED-IN: 5.71

M  +46   -0    autotests/kdirmodeltest.cpp
M  +2    -0    autotests/kdirmodeltest.h
M  +5    -1    src/widgets/kdirmodel.cpp

https://invent.kde.org/frameworks/kio/commit/fe87d93250d2f9b302e0498cc99a2b7d9fab7583
Comment 10 Wolfgang Bauer 2020-05-31 10:33:38 UTC
*** Bug 422205 has been marked as a duplicate of this bug. ***
Comment 11 Mario Aichinger 2020-06-20 19:33:37 UTC
Hi David,

I have found cases where your patch does not work. I have a directory with only a sym-link in it, this results in the same bug: the directory is not expendable. This also applies to named pipes and character devices. I assume this also happens with block devices but I can not find a test case for it. 

Mario
Comment 12 Mario Aichinger 2020-06-20 21:14:43 UTC
Note: This also applies to hidden files (.file).
Comment 13 Mario Aichinger 2020-06-21 01:03:52 UTC
Proposed patch: https://invent.kde.org/frameworks/kio/-/merge_requests/60
Comment 14 Mario Aichinger 2020-06-29 21:36:07 UTC
Git commit e15ab3807944f3d371ce1beb004c4a8474989626 by Mario Aichinger.
Committed on 29/06/2020 at 19:47.
Pushed by dfaure into branch 'master'.

KDirModel: fix hasChildren() regression for trees with hidden files, symlinks, pipes and character devices

This is a follow up to commit fe87d932 which fixed hasChildren() for directories with regular files in them.
With this commit not only directories with regular files in them are considered as non empty but also directories containing hidden files, symlinks, pipes and character devices.
FIXED-IN: 5.72

M  +64   -10   autotests/kdirmodeltest.cpp
M  +27   -7    autotests/kiotesthelper.h
M  +11   -3    src/widgets/kdirmodel.cpp

https://invent.kde.org/frameworks/kio/commit/e15ab3807944f3d371ce1beb004c4a8474989626