Changeset View
Changeset View
Standalone View
Standalone View
src/kitemviews/kfileitemlistwidget.cpp
Show All 15 Lines | |||||
16 | * Free Software Foundation, Inc., * | 16 | * Free Software Foundation, Inc., * | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * | ||
18 | ***************************************************************************/ | 18 | ***************************************************************************/ | ||
19 | 19 | | |||
20 | #include "kfileitemlistwidget.h" | 20 | #include "kfileitemlistwidget.h" | ||
21 | #include "kfileitemmodel.h" | 21 | #include "kfileitemmodel.h" | ||
22 | #include "kitemlistview.h" | 22 | #include "kitemlistview.h" | ||
23 | 23 | | |||
24 | #include "dolphin_detailsmodesettings.h" | ||||
25 | | ||||
24 | #include <KFormat> | 26 | #include <KFormat> | ||
25 | #include <KLocalizedString> | 27 | #include <KLocalizedString> | ||
26 | 28 | | |||
27 | #include <QMimeDatabase> | 29 | #include <QMimeDatabase> | ||
28 | 30 | | |||
29 | KFileItemListWidgetInformant::KFileItemListWidgetInformant() : | 31 | KFileItemListWidgetInformant::KFileItemListWidgetInformant() : | ||
30 | KStandardItemListWidgetInformant() | 32 | KStandardItemListWidgetInformant() | ||
31 | { | 33 | { | ||
Show All 27 Lines | 60 | { | |||
59 | QString text; | 61 | QString text; | ||
60 | const QVariant roleValue = values.value(role); | 62 | const QVariant roleValue = values.value(role); | ||
61 | 63 | | |||
62 | // Implementation note: In case if more roles require a custom handling | 64 | // Implementation note: In case if more roles require a custom handling | ||
63 | // use a hash + switch for a linear runtime. | 65 | // use a hash + switch for a linear runtime. | ||
64 | 66 | | |||
65 | if (role == "size") { | 67 | if (role == "size") { | ||
66 | if (values.value("isDir").toBool()) { | 68 | if (values.value("isDir").toBool()) { | ||
67 | // The item represents a directory. Show the number of sub directories | 69 | // The item represents a directory. Show the number of sub directories | ||
68 | // instead of the file size of the directory. | 70 | // instead of the file size of the directory. | ||
elvisangelaccio: Please fix this comment (or drop it). | |||||
69 | if (!roleValue.isNull()) { | 71 | if (!roleValue.isNull()) { | ||
70 | const int count = roleValue.toInt(); | 72 | const int count = values.value("count").toInt(); | ||
71 | if (count < 0) { | 73 | if (count < 0) { | ||
72 | text = i18nc("@item:intable", "Unknown"); | 74 | text = i18nc("@item:intable", "Unknown"); | ||
73 | } else { | 75 | } else { | ||
76 | if (DetailsModeSettings::recursiveDirectorySizeLimit() > 0) { | ||||
77 | const KIO::filesize_t size = roleValue.value<KIO::filesize_t>(); | ||||
78 | text = KFormat().formatByteSize(size); | ||||
79 | } else { | ||||
74 | text = i18ncp("@item:intable", "%1 item", "%1 items", count); | 80 | text = i18ncp("@item:intable", "%1 item", "%1 items", count); | ||
75 | } | 81 | } | ||
76 | } | 82 | } | ||
83 | } | ||||
77 | } else { | 84 | } else { | ||
78 | const KIO::filesize_t size = roleValue.value<KIO::filesize_t>(); | 85 | const KIO::filesize_t size = roleValue.value<KIO::filesize_t>(); | ||
79 | text = KFormat().formatByteSize(size); | 86 | text = KFormat().formatByteSize(size); | ||
80 | } | 87 | } | ||
81 | } else if (role == "modificationtime" || role == "creationtime" || role == "accesstime") { | 88 | } else if (role == "modificationtime" || role == "creationtime" || role == "accesstime") { | ||
82 | bool ok; | 89 | bool ok; | ||
83 | const long long time = roleValue.toLongLong(&ok); | 90 | const long long time = roleValue.toLongLong(&ok); | ||
84 | if (ok && time != -1) { | 91 | if (ok && time != -1) { | ||
▲ Show 20 Lines • Show All 84 Lines • Show Last 20 Lines |
Please fix this comment (or drop it).