Changeset View
Changeset View
Standalone View
Standalone View
src/filemetadataprovider.cpp
Show First 20 Lines • Show All 158 Lines • ▼ Show 20 Line(s) | |||||
159 | { | 159 | { | ||
160 | // TODO: Handle case if remote URLs are used properly. isDir() does | 160 | // TODO: Handle case if remote URLs are used properly. isDir() does | ||
161 | // not work, the modification date needs also to be adjusted... | 161 | // not work, the modification date needs also to be adjusted... | ||
162 | Q_ASSERT(m_fileItems.count() <= 1); | 162 | Q_ASSERT(m_fileItems.count() <= 1); | ||
163 | if (m_fileItems.count() == 1) { | 163 | if (m_fileItems.count() == 1) { | ||
164 | const KFileItem& item = m_fileItems.first(); | 164 | const KFileItem& item = m_fileItems.first(); | ||
165 | 165 | | |||
166 | if (item.isDir()) { | 166 | if (item.isDir()) { | ||
167 | bool isSizeUnknown = !item.isLocalFile(); | ||||
168 | if (!isSizeUnknown) { | ||||
167 | const int count = subDirectoriesCount(item.url().path()); | 169 | const int count = subDirectoriesCount(item.url().path()); | ||
168 | if (count == -1) { | 170 | isSizeUnknown = count == -1; | ||
169 | m_data.insert(QStringLiteral("kfileitem#size"), i18nc("unknown file size", "Unknown")); | 171 | if (!isSizeUnknown) { | ||
170 | } else { | | |||
171 | const QString itemCountString = i18ncp("@item:intable", "%1 item", "%1 items", count); | 172 | const QString itemCountString = i18ncp("@item:intable", "%1 item", "%1 items", count); | ||
172 | m_data.insert(QStringLiteral("kfileitem#size"), itemCountString); | 173 | m_data.insert(QStringLiteral("kfileitem#size"), itemCountString); | ||
173 | } | 174 | } | ||
175 | } | ||||
176 | if (isSizeUnknown) { | ||||
177 | m_data.insert(QStringLiteral("kfileitem#size"), i18nc("unknown file size", "Unknown")); | ||||
178 | } | ||||
174 | } else { | 179 | } else { | ||
175 | KFormat format; | 180 | KFormat format; | ||
176 | m_data.insert(QStringLiteral("kfileitem#size"), format.formatByteSize(item.size())); | 181 | m_data.insert(QStringLiteral("kfileitem#size"), format.formatByteSize(item.size())); | ||
177 | } | 182 | } | ||
178 | 183 | | |||
179 | m_data.insert(QStringLiteral("kfileitem#type"), item.mimeComment()); | 184 | m_data.insert(QStringLiteral("kfileitem#type"), item.mimeComment()); | ||
180 | m_data.insert(QStringLiteral("kfileitem#modified"), item.time(KFileItem::ModificationTime)); | 185 | m_data.insert(QStringLiteral("kfileitem#modified"), item.time(KFileItem::ModificationTime)); | ||
181 | QDateTime creationTime = item.time(KFileItem::CreationTime); | 186 | QDateTime creationTime = item.time(KFileItem::CreationTime); | ||
▲ Show 20 Lines • Show All 344 Lines • Show Last 20 Lines |