diff options
Diffstat (limited to 'src/kitemviews')
| -rw-r--r-- | src/kitemviews/kfileitemlistwidget.cpp | 8 | ||||
| -rw-r--r-- | src/kitemviews/kfileitemmodel.cpp | 24 | ||||
| -rw-r--r-- | src/kitemviews/kfileitemmodelrolesupdater.cpp | 11 | ||||
| -rw-r--r-- | src/kitemviews/private/kdirectorycontentscounterworker.h | 4 | ||||
| -rw-r--r-- | src/kitemviews/private/kitemlistviewlayouter.cpp | 2 |
5 files changed, 25 insertions, 24 deletions
diff --git a/src/kitemviews/kfileitemlistwidget.cpp b/src/kitemviews/kfileitemlistwidget.cpp index e548e7519..40b8ccf37 100644 --- a/src/kitemviews/kfileitemlistwidget.cpp +++ b/src/kitemviews/kfileitemlistwidget.cpp @@ -78,7 +78,13 @@ QString KFileItemListWidgetInformant::roleText(const QByteArray& role, const KIO::filesize_t size = roleValue.value<KIO::filesize_t>(); text = KFormat().formatByteSize(size); } - } else if (role == "modificationtime" || role == "creationtime" || role == "accesstime" || role == "deletiontime" || role == "imageDateTime") { + } else if (role == "modificationtime" || role == "creationtime" || role == "accesstime") { + bool ok; + const long long time = roleValue.toLongLong(&ok); + if (ok && time != -1) { + return QLocale().toString(QDateTime::fromSecsSinceEpoch(time), QLocale::ShortFormat); + } + } else if (role == "deletiontime" || role == "imageDateTime") { const QDateTime dateTime = roleValue.toDateTime(); text = QLocale().toString(dateTime, QLocale::ShortFormat); } else { diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index d2c8429ac..d9c1e6bfb 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -1563,26 +1563,26 @@ QHash<QByteArray, QVariant> KFileItemModel::retrieveData(const KFileItem& item, } if (m_requestRole[ModificationTimeRole]) { - // Don't use KFileItem::timeString() as this is too expensive when - // having several thousands of items. Instead the formatting of the - // date-time will be done on-demand by the view when the date will be shown. - const QDateTime dateTime = item.time(KFileItem::ModificationTime); + // Don't use KFileItem::timeString() or KFileItem::time() as this is too expensive when + // having several thousands of items. Instead read the raw number from UDSEntry directly + // and the formatting of the date-time will be done on-demand by the view when the date will be shown. + const long long dateTime = item.entry().numberValue(KIO::UDSEntry::UDS_MODIFICATION_TIME, -1); data.insert(sharedValue("modificationtime"), dateTime); } if (m_requestRole[CreationTimeRole]) { - // Don't use KFileItem::timeString() as this is too expensive when - // having several thousands of items. Instead the formatting of the - // date-time will be done on-demand by the view when the date will be shown. - const QDateTime dateTime = item.time(KFileItem::CreationTime); + // Don't use KFileItem::timeString() or KFileItem::time() as this is too expensive when + // having several thousands of items. Instead read the raw number from UDSEntry directly + // and the formatting of the date-time will be done on-demand by the view when the date will be shown. + const long long dateTime = item.entry().numberValue(KIO::UDSEntry::UDS_CREATION_TIME, -1); data.insert(sharedValue("creationtime"), dateTime); } if (m_requestRole[AccessTimeRole]) { - // Don't use KFileItem::timeString() as this is too expensive when - // having several thousands of items. Instead the formatting of the - // date-time will be done on-demand by the view when the date will be shown. - const QDateTime dateTime = item.time(KFileItem::AccessTime); + // Don't use KFileItem::timeString() or KFileItem::time() as this is too expensive when + // having several thousands of items. Instead read the raw number from UDSEntry directly + // and the formatting of the date-time will be done on-demand by the view when the date will be shown. + const long long dateTime = item.entry().numberValue(KIO::UDSEntry::UDS_ACCESS_TIME, -1); data.insert(sharedValue("accesstime"), dateTime); } diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp index abc5f176a..f4d69dec2 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.cpp +++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp @@ -495,14 +495,9 @@ void KFileItemModelRolesUpdater::slotGotPreview(const KFileItem& item, const QPi QPixmap scaledPixmap = pixmap; - const QString mimeType = item.mimetype(); - const int slashIndex = mimeType.indexOf(QLatin1Char('/')); - const bool isFontPreview = mimeType.rightRef(slashIndex).contains(QLatin1String("font")); - const bool isFolderPreview = item.isDir(); - const bool isWindowsExePreview = mimeType == QLatin1String("application/x-ms-dos-executable") || - mimeType == QLatin1String("application/x-msdownload"); - - if (!isFolderPreview && !isFontPreview && !isWindowsExePreview) { + if (!pixmap.hasAlpha() + && m_iconSize.width() > KIconLoader::SizeSmallMedium + && m_iconSize.height() > KIconLoader::SizeSmallMedium) { if (m_enlargeSmallPreviews) { KPixmapModifier::applyFrame(scaledPixmap, m_iconSize); } else { diff --git a/src/kitemviews/private/kdirectorycontentscounterworker.h b/src/kitemviews/private/kdirectorycontentscounterworker.h index 2460a0e1f..b40da6e87 100644 --- a/src/kitemviews/private/kdirectorycontentscounterworker.h +++ b/src/kitemviews/private/kdirectorycontentscounterworker.h @@ -17,8 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ***************************************************************************/ -#ifndef KDIRECTORYCONTENTENTSCOUNTERWORKER_H -#define KDIRECTORYCONTENTENTSCOUNTERWORKER_H +#ifndef KDIRECTORYCONTENTSCOUNTERWORKER_H +#define KDIRECTORYCONTENTSCOUNTERWORKER_H #include <QMetaType> #include <QObject> diff --git a/src/kitemviews/private/kitemlistviewlayouter.cpp b/src/kitemviews/private/kitemlistviewlayouter.cpp index c765cdcfe..56e0f338f 100644 --- a/src/kitemviews/private/kitemlistviewlayouter.cpp +++ b/src/kitemviews/private/kitemlistviewlayouter.cpp @@ -17,9 +17,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ***************************************************************************/ +#include "kitemlistviewlayouter.h" #include "dolphindebug.h" #include "kitemlistsizehintresolver.h" -#include "kitemlistviewlayouter.h" #include "kitemviews/kitemmodelbase.h" // #define KITEMLISTVIEWLAYOUTER_DEBUG |
