Changeset View
Changeset View
Standalone View
Standalone View
smb/kio_smb_browse.cpp
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Line(s) | 80 | if (!S_ISDIR(st.st_mode)) { | |||
---|---|---|---|---|---|
87 | // - S_IXGRP = DOS system: This file has a specific purpose required by the operating system. | 87 | // - S_IXGRP = DOS system: This file has a specific purpose required by the operating system. | ||
88 | // - S_IXOTH = DOS hidden: This file has been marked to be invisible to the user, unless the operating system is explicitly set to show it. | 88 | // - S_IXOTH = DOS hidden: This file has been marked to be invisible to the user, unless the operating system is explicitly set to show it. | ||
89 | // Only hiding has backing through KIO right now. | 89 | // Only hiding has backing through KIO right now. | ||
90 | if (st.st_mode & S_IXOTH) { // DOS hidden | 90 | if (st.st_mode & S_IXOTH) { // DOS hidden | ||
91 | udsentry.fastInsert(KIO::UDSEntry::UDS_HIDDEN, true); | 91 | udsentry.fastInsert(KIO::UDSEntry::UDS_HIDDEN, true); | ||
92 | } | 92 | } | ||
93 | } | 93 | } | ||
94 | 94 | | |||
95 | udsentry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, st.st_mode & S_IFMT); | | |||
96 | udsentry.fastInsert(KIO::UDSEntry::UDS_SIZE, st.st_size); | | |||
97 | | ||||
98 | // UID and GID **must** not be mapped. The values returned by libsmbclient are | 95 | // UID and GID **must** not be mapped. The values returned by libsmbclient are | ||
99 | // simply the getuid/getgid of the process. They mean absolutely nothing. | 96 | // simply the getuid/getgid of the process. They mean absolutely nothing. | ||
100 | // Also see libsmb_stat.c. | 97 | // Also see libsmb_stat.c. | ||
101 | // Related: https://bugs.kde.org/show_bug.cgi?id=212801 | 98 | // Related: https://bugs.kde.org/show_bug.cgi?id=212801 | ||
102 | 99 | | |||
103 | udsentry.fastInsert(KIO::UDSEntry::UDS_ACCESS, st.st_mode & 07777); | 100 | // POSIX Access mode must not be mapped either! | ||
101 | // It's meaningless for smb shares and downright disadvantagous. | ||||
102 | // The mode attributes outside the ones used and document above are | ||||
103 | // useless. The only one actively set is readonlyness. | ||||
104 | // | ||||
105 | // BUT the READONLY attribute does nothing on NT systems: | ||||
106 | // https://support.microsoft.com/en-us/help/326549/you-cannot-view-or-change-the-read-only-or-the-system-attributes-of-fo | ||||
107 | // The Read-only and System attributes is only used by Windows Explorer to determine | ||||
108 | // whether the folder is a special folder, such as a system folder that has its view | ||||
109 | // customized by Windows (for example, My Documents, Favorites, Fonts, Downloaded Program Files), | ||||
110 | // or a folder that you customized by using the Customize tab of the folder's Properties dialog box. | ||||
111 | // | ||||
112 | // As such respecting it on a KIO level is actually wrong as it doesn't indicate actual | ||||
113 | // readonlyness since the 90s and causes us to show readonly UI states when in fact | ||||
114 | // the directory is perfectly writable. | ||||
115 | // https://bugs.kde.org/show_bug.cgi?id=414482 | ||||
116 | // | ||||
117 | // Should we ever want to parse desktop.ini like we do .directory we'd only want to when a | ||||
118 | // dir is readonly as per the above microsoft support article. | ||||
119 | // Also see: | ||||
120 | // https://docs.microsoft.com/en-us/windows/win32/shell/how-to-customize-folders-with-desktop-ini | ||||
121 | udsentry.fastInsert(KIO::UDSEntry::UDS_ACCESS, -1); | ||||
122 | | ||||
123 | udsentry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, st.st_mode & S_IFMT); | ||||
124 | udsentry.fastInsert(KIO::UDSEntry::UDS_SIZE, st.st_size); | ||||
104 | udsentry.fastInsert(KIO::UDSEntry::UDS_MODIFICATION_TIME, st.st_mtime); | 125 | udsentry.fastInsert(KIO::UDSEntry::UDS_MODIFICATION_TIME, st.st_mtime); | ||
105 | udsentry.fastInsert(KIO::UDSEntry::UDS_ACCESS_TIME, st.st_atime); | 126 | udsentry.fastInsert(KIO::UDSEntry::UDS_ACCESS_TIME, st.st_atime); | ||
106 | // No, st_ctime is not UDS_CREATION_TIME... | 127 | // No, st_ctime is not UDS_CREATION_TIME... | ||
107 | } | 128 | } | ||
108 | 129 | | |||
109 | return cacheStatErr; | 130 | return cacheStatErr; | ||
110 | } | 131 | } | ||
111 | 132 | | |||
▲ Show 20 Lines • Show All 585 Lines • Show Last 20 Lines |