Version: CVS (using Devel) OS: Linux files named in a .hidden file in the current directory should be hidden when dot files are hidden Reproducible: Always Steps to Reproduce: view a directory from a component that connects KdirLister - such as dolphin - containing a .hidden file that contains the name of a specific file in that directory to hide Actual Results: named file is visible Expected Results: named file should be invisible unless hidden files - dot files - are generally visible see bug #245994 in dolphin comments #64740 - originally kde3
Created attachment 49684 [details] patch to add private methods to KDirLister I'm ready to hear comments whether the methods should really be private; My feeling is that it would be irregular for an app to need to override the inclusion of files listed in .hidden as 'in the group of' dot files, so that standard handling of dot files should include files listed in .hidden it may need some more tuning to guarantee that the timing of it all is right Best regards Mark
Created attachment 49685 [details] improvement to patch to time the retrieval / consideration of .hidden file contents more correctly now waits until the signals have been sent, to update the list then emit the signal that the filters have changed; works properly - could need advanced testing
*** Bug 245994 has been marked as a duplicate of this bug. ***
Maybe David can comment on the patch.
It would be easier to comment on it on reviewboard, but here it goes: The approach seems generally OK. In details: - the QStringList of hidden files should probably be a QSet for faster lookup, since this is called for every file... or maybe better: instead of a lookup, maybe this could actually modify the kfileitem directly (while parsing the .hidden file) and set it to hidden? Another reason for changing it to do things that way, is that the current code (iterating over dirData.listersCurrentlyListing and calling setHiddenList) breaks in the case of dirlisters that hold multiple directories (e.g. when enabling expandable folders in dolphin and viewing things as a tree). Basically, add a KFileItem::setHidden() method, which does d->m_hidden = KFileItemPrivate::Hidden; - QRegExp is horribly slow, please rewrite this without using a regexp (which doesn't really seem necessary anyway). - QStringList thelist = QStringList::QStringList(); is two mentions too many, just write QStringList thelist; Please email me directly or use reviewboard.kde.org if I don't see your answer, I'm failing at monitoring all incoming bugzilla emails.
SVN commit 1195269 by graesslin: Fix Prevent Screen Locking electric border action. Thanks to Ralf Hemmenstaedt for providing the patch. BUG: 246260 FIXED-IN: 4.5.4 M +1 -1 options.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1195269
sorry, typo in commit message
1. when do we get this? 2. how is this different from bug 64740? 3. why not support a per-user .hidden-file directly in the home directory, too? 4. does this support wildcards? (e.g. i have a directory only for LaTeX-documents, so i want to hide every *.aux, *.log, *~ and *.backup file in there)
(In reply to comment #8) > 1. when do we get this? Mark, have you updated your patch and submitted it via reviewboard/email, as David suggested? > 2. how is this different from bug 64740? It's not. I'm just not sure which one should be marked as a duplicate - the present one contains a patch+discussion about it, the other one has lots of votes, so maybe one could wait until the issue is resolved and then close both together.
why aren’t the votes of dupes added to the remaining bug (and the comments merged)?
(In reply to comment #10) > why aren’t the votes of dupes added to the remaining bug (and the comments > merged)? I think that Bugzilla does not have that feature, but I agree that at least a transfer of the votes would be nice to have.
*** Bug 320925 has been marked as a duplicate of this bug. ***
Is this feature ever going to be added to KDE? It's 2014 already! The standard way of hiding a file (prepending a dot) requires renaming it, so it's not always possible. That's why this feature would be a very nice addition! And, to please everyone, you could add a configuration option to enable/disable this feature.
(In reply to Bruno Nova from comment #13) > Is this feature ever going to be added to KDE? It's 2014 already! Well, David said in comment 5 that the approach of Mark's patch in comment 2 is generally OK. Since Mark did not respond to any of David's suggestions in 4 years or submitted a patch to Review Board AFAIK, I think that anyone who has some time and motivation to look into the issue should feel free to take the patch and finish the work. > And, to please everyone, you could add a configuration option to > enable/disable this feature. I think we should either add this feature or leave it as it is, but please do not add an option. Config options do definitely not please everyone ;-) Adding options for every little detail will slowly turn the settings dialog into a big mess, makes testing all code paths extremely hard, and will introduce new bugs.
(In reply to Frank Reininghaus from comment #14) That was a fast response! > > And, to please everyone, you could add a configuration option to > > enable/disable this feature. > > I think we should either add this feature or leave it as it is, but please > do not add an option. > > Config options do definitely not please everyone ;-) Adding options for > every little detail will slowly turn the settings dialog into a big mess, > makes testing all code paths extremely hard, and will introduce new bugs. You have a point. :) I never developed for KDE, and I'm also not using KDE right now (but I occasionally thing about switching to it). As there already is a patch, I could try looking into it. If only small changes are required I may update the patch, but no promises. But if someone else with more experience wants to do it, go ahead! :)
Created attachment 87784 [details] Updated patch I'm using Ubuntu 14.04. I got the code with "apt-get source kde4libs" (package version4:4.13.2a-0ubuntu0.2), then applied the changes in the old patch, adapting it when necessary. Then I compiled it, installed Dolphin, replaced the installed libkio.so and tested. It works, but not perfectly. It seems Dolphin displays all files as before, then hides those listed in ".hidden". I also sometimes needed to press F5 for those files to be hidden, especially when changing folders. I've attached the updated patch. I'll look at the suggestions and try to improve it.
If you're going to work on this, you should use reviewboard. It works a lot better for reviewing patches.
Created attachment 87801 [details] Updated patch 2 I've updated the patch. I followed David's suggestions, and the patch is now simpler (almost completely different). The approach is a bit different now. I've tested this in Ubuntu 14.04 (Unity) with Dolphin. It seems to be working, but this will need a lot more testing (in full KDE). I've attached the patch. Tomorrow or next week I will try to base the patch on KDE's current version (after I find it) and add this to the review board.
I've now tested this in actual KDE (Kubuntu 14.04 in VirtualBox), and it's not working correctly in the home folder for some reason. Initially it works fine and hides the files listed in ".hidden", but then it makes them visible. Pressing F5 hides them again. When testing in another folder (tried ~/Documents), the patch worked perfectly. I've seen this in Dolphin, the folder widget and the open/save dialog. Maybe d->m_hidden is reset to KFileItemPrivate::Auto in some place. I'll try to find out why this happens, and put the patch in the review board, eventually.
*** This bug has been confirmed by popular vote. ***
Hi Bruno, thank you very much for your work, it is highly appreciated. :-) Have you fixed the problem of files coming visible again yet? Best regards Yannik Sembritzki
Not yet. I haven't had much time lately. But I will try to fix that issue sooner or later, or ask for help if I can't figure it out :).
The files listed in ".hidden" also reappear if I choose to show hidden files, then choose to hide them again. I see, in the debug output, KDirListerCache::updateDirectory being called when this happens. That's probably where d->m_hidden is set to KFileItemPrivate::Auto. I wouldn't mind some help from someone who knows how these classes work. :)
Created attachment 88079 [details] Updated patch 3 OK, it seems we're going somewhere! I copied the code I added in slotEntries() to slotUpdateResult() (these methods resemble each other), and now the files in ".hidden" stay hidden, both in Dolphin and the folder widget (very brief test). The patch isn't finished yet (duplicating code isn't a good practice), but I've attached it, just in case. Note that the patch is (still) based on the source code package in Ubuntu 14.04 (it makes it easier for me to test it). KDE developers, is this the official repository for this library (KIO): https://projects.kde.org/projects/frameworks/kio/repository ? It's organized very differently from what's in the Ubuntu repository. Next week I would like to base the patch on the official repository and send it to the review board.
Sounds great. Thank you for the status update and your work so far. Looking forward to the final patch. Yannik Am 01.08.2014 20:47, schrieb Bruno Nova: > https://bugs.kde.org/show_bug.cgi?id=246260 > > Bruno Nova <brunomb.nova@gmail.com> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > Attachment #87801 [details]|0 |1 > is obsolete| | > > --- Comment #24 from Bruno Nova <brunomb.nova@gmail.com> --- > Created attachment 88079 [details] > --> https://bugs.kde.org/attachment.cgi?id=88079&action=edit > Updated patch 3 > > OK, it seems we're going somewhere! > I copied the code I added in slotEntries() to slotUpdateResult() (these methods > resemble each other), and now the files in ".hidden" stay hidden, both in > Dolphin and the folder widget (very brief test). > The patch isn't finished yet (duplicating code isn't a good practice), but I've > attached it, just in case. > > Note that the patch is (still) based on the source code package in Ubuntu 14.04 > (it makes it easier for me to test it). > > KDE developers, is this the official repository for this library (KIO): > https://projects.kde.org/projects/frameworks/kio/repository ? It's organized > very differently from what's in the Ubuntu repository. > Next week I would like to base the patch on the official repository and send it > to the review board. >
Thanks for working on this, Bruno. (In reply to Bruno Nova from comment #24) > Created attachment 88079 [details] > Updated patch 3 I cannot say very much about the KDirLister internals, but you should try to follow the kdelibs coding style: https://techbase.kde.org/Policies/Kdelibs_Coding_Style In particular, also use braces ({...}) after if-statements even if only a single line follows. > KDE developers, is this the official repository for this library (KIO): > https://projects.kde.org/projects/frameworks/kio/repository ? Yes. This is the Qt5-based version of KIO. The source code package in Ubuntu is most likely based on the Qt4-version of kdelibs, which is shipped as a single package. The Qt4/kdelibs 4.x version is in bug-fix-only mode. New features should go to the Qt5-based kio repository (David Faure, who maintains KIO, has the final say in that).
(In reply to Frank Reininghaus from comment #26) > I cannot say very much about the KDirLister internals, but you should try to > follow the kdelibs coding style: > > https://techbase.kde.org/Policies/Kdelibs_Coding_Style Thank you for the link! > Yes. This is the Qt5-based version of KIO. The source code package in Ubuntu > is most likely based on the Qt4-version of kdelibs, which is shipped as a > single package. This also crossed my mind. It makes sense! I'll keep working on the Qt4-version for now, and then I'll work on the Qt5-version (I hope the code hasn't changed much).
Created attachment 88105 [details] .hidden support for KDE4 Here is the final (I hope) patch for KDE4/Qt4, which is probably the version being used is most distributions right now. I refactored the code according to the coding style. KDE developers might want to check if they agree with the implementation and placement of the declarations. I've tested this a bit. It seems to be working everywhere I tested: Dolphin, folder view widget, Kate open/save dialogs and even in Dolphin's detailed/tree view. More thorough tests should be done, though. I'll start working on the KDE5 version now.
I submitted the patch for KDE5 to the review board here: https://git.reviewboard.kde.org/r/119607/ I haven't tested that patch yet.
It would probably be better if a developer running KDE5 built and tested the patch in the review board. I had no success building KIO yet.
*** Bug 64740 has been marked as a duplicate of this bug. ***
The patch I submitted to the review board (https://git.reviewboard.kde.org/r/119607/) has had no response yet. Could any KDE developer, who knows more about this than me, check if the patch information is correct? Particularly the "Reviewers" part. Also, I did manage to build and run KIO with the patch in KDE5 Project Neon some time ago, but it seems both KDE4 and KDE5 libraries are used in different places, so it's a bit of a mess to test it. More info is in the review board.
(In reply to Bruno Nova from comment #32) > Could any KDE developer, who knows more about this than me, check if the > patch information is correct? Particularly the "Reviewers" part. You should add the "kdeframeworks" group to all review requests that affect one of the KDE Frameworks.
(In reply to Frank Reininghaus from comment #33) > (In reply to Bruno Nova from comment #32) > > Could any KDE developer, who knows more about this than me, check if the > > patch information is correct? Particularly the "Reviewers" part. > > You should add the "kdeframeworks" group to all review requests that affect > one of the KDE Frameworks. Thank you for the very quick response! I did what you said.
Git commit a67a1534726edfea63dec7841f90f68898c2e26b by David Faure, on behalf of Bruno Nova. Committed on 01/01/2015 at 20:30. Pushed by dfaure into branch 'master'. Support for ".hidden" files This adds support for *.hidden* files to KDE. When listing a directory, the files/folders listed in the *.hidden* file will be hidden, unless the user has chosen to show hidden files. This patch was initially based on the patch provided by Mark in Bug #246260. Unittest by David Faure in next commit. Change-Id: I5e28de50e1fb9f3517ac22c9f2160f50bf11f798 M +71 -1 src/core/kcoredirlister.cpp M +21 -0 src/core/kcoredirlister_p.h M +7 -0 src/core/kfileitem.cpp M +6 -0 src/core/kfileitem.h http://commits.kde.org/kio/a67a1534726edfea63dec7841f90f68898c2e26b
Git commit 30e9d1c82206435c43acc9b2bef67c194560e0bb by David Faure. Committed on 01/01/2015 at 21:54. Pushed by dfaure into branch 'master'. Unittest for the .hidden file feature Change-Id: I845aeca0e0b6f6ce0bc62059d2d36e9f6fd111da M +49 -5 autotests/kdirmodeltest.cpp M +2 -0 autotests/kdirmodeltest.h http://commits.kde.org/kio/30e9d1c82206435c43acc9b2bef67c194560e0bb
Please reimplement this for Dolphin 19.04
With the beginning of 2021, is there any chance that Dolphin 19.12 will see this feature again? Or any of the Upcoming releases of Dolphin? Would be highly appreciating it. Anyway thanks for all the great work!!
EDIT: .hidden behaviour seems to be working! It didnt at first, when I created a new ".hidden" file. But then I copied the ".hidden" file from another computer where it has been working for a while. Out of some strange reason it works now.