Bug 205954 - Disable the ability to change icons for folders on Samba shares, since it doesn't work
Summary: Disable the ability to change icons for folders on Samba shares, since it doe...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: git master
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords: investigated
Depends on:
Blocks:
 
Reported: 2009-09-02 08:20 UTC by Mihail Khiretskiy
Modified: 2020-04-11 09:33 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mihail Khiretskiy 2009-09-02 08:20:06 UTC
Version:           4.3.0 (using KDE 4.3.0)
Compiler:          gcc-4.3.2-r2 
OS:                Linux
Installed from:    Gentoo Packages

When I change icon for folder, which place on samba filesystem. In this directory appears file ".directory" (it is correctly), but folder not change icon.
Comment 1 Mihail Khiretskiy 2009-09-11 13:08:42 UTC
kdelibs-4.3.1/kdecore/services/kfoldermimetype.cpp contains the code:
// There are also other directories with 0 size, such as /proc, that may
// be mounted, but those are unlikely to contain .directory (and checking
// this would require KMountPoint from kio).
KDE_struct_stat buff;
if (KDE_stat( QFile::encodeName( _url.toLocalFile()), &buff ) == 0
    && S_ISDIR( buff.st_mode ) && buff.st_size == 0 ) {
  return KMimeTypePrivate::iconName( _url );
}
With this code kdelibs ignores folders located in mounted cifs filesystem, because size of this folder is 0.
Comment 2 Harald Sitter 2020-02-13 11:43:02 UTC
KIO probably is the place this needs dealing with. I've talked to another dev and we kinda think this is intentional regardless because we wouldn't want unnecessary reads on .directory for network resources really. If so the UI shouldn't allow you setting an icon though, allowing to set an icon but then not showing it is clearly a bug.
Comment 3 Nate Graham 2020-02-13 21:58:13 UTC
I agree that changing the icon should not be possible for Samba share locations, for the reasons you've indicated. And also that the feature should be disabled in the UI so you can't futilely try anyway.
Comment 4 Ahmad Samir 2020-04-11 09:33:39 UTC
Git commit a2335335ecfe4b211a2898594a21d52c79107b7a by Ahmad Samir.
Committed on 11/04/2020 at 09:33.
Pushed by ahmadsamir into branch 'master'.

[KPropertiesDialog] Disable changing remote dir icons

Summary:
Changing the icon of a dir on e.g. a samba share doesn't seem to have
an effect, this is intentional as reading .directory would impact network
resources negatively, see the bug report for more details. Change the code
to only show the KIconButton only for local dirs and desktop:/.

Test Plan:
make && ctest
And testing an sftp://, the button to change the icon isn't shown

Reviewers: #frameworks, dfaure, sitter

Reviewed By: dfaure

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D28679

M  +6    -3    src/widgets/kpropertiesdialog.cpp

https://commits.kde.org/kio/a2335335ecfe4b211a2898594a21d52c79107b7a