┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews
diff options
context:
space:
mode:
Diffstat (limited to 'src/kitemviews')
-rw-r--r--src/kitemviews/kfileitemlistview.cpp2
-rw-r--r--src/kitemviews/kfileitemlistwidget.cpp8
-rw-r--r--src/kitemviews/kfileitemmodel.cpp24
-rw-r--r--src/kitemviews/kfileitemmodelrolesupdater.cpp15
-rw-r--r--src/kitemviews/kitemlistview.h2
-rw-r--r--src/kitemviews/private/kdirectorycontentscounterworker.h4
-rw-r--r--src/kitemviews/private/kitemlistviewlayouter.cpp2
-rw-r--r--src/kitemviews/private/kpixmapmodifier.h2
8 files changed, 30 insertions, 29 deletions
diff --git a/src/kitemviews/kfileitemlistview.cpp b/src/kitemviews/kfileitemlistview.cpp
index 3c1ef1b98..b1d3da643 100644
--- a/src/kitemviews/kfileitemlistview.cpp
+++ b/src/kitemviews/kfileitemlistview.cpp
@@ -35,7 +35,7 @@
namespace {
// If the visible index range changes, KFileItemModelRolesUpdater is not
- // informed immediatetly, but with a short delay. This ensures that scrolling
+ // informed immediately, but with a short delay. This ensures that scrolling
// always feels smooth and is not interrupted by icon loading (which can be
// quite expensive if a disk access is required to determine the final icon).
const int ShortInterval = 50;
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 8503cc8bc..fd0a88fb6 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..1d45e44c5 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 {
@@ -526,7 +521,7 @@ void KFileItemModelRolesUpdater::slotGotPreview(const KFileItem& item, const QPi
scaledPixmap);
scaledPixmap = largeFrame;
} else {
- // The image must be shrinked as it is too large to fit into
+ // The image must be shrunk as it is too large to fit into
// the available icon size
KPixmapModifier::applyFrame(scaledPixmap, m_iconSize);
}
@@ -1153,7 +1148,7 @@ QList<int> KFileItemModelRolesUpdater::indexesToResolve() const
// We need a reasonable upper limit for number of items to resolve after
// and before the visible range. m_maximumVisibleItems can be quite large
- // when using Compace View.
+ // when using Compact View.
const int readAheadItems = qMin(ReadAheadPages * m_maximumVisibleItems, ResolveAllItemsLimit / 2);
// Add items after the visible range.
diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h
index 8320883f1..3a4a469bb 100644
--- a/src/kitemviews/kitemlistview.h
+++ b/src/kitemviews/kitemlistview.h
@@ -210,7 +210,7 @@ public:
/**
* If set to true, items having child-items can be expanded to show the child-items as
- * part of the view. Per default the expanding of items is is disabled. If expanding of
+ * part of the view. Per default the expanding of items is disabled. If expanding of
* items is enabled, the methods KItemModelBase::setExpanded(), KItemModelBase::isExpanded(),
* KItemModelBase::isExpandable() and KItemModelBase::expandedParentsCount()
* must be reimplemented. The view-implementation
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
diff --git a/src/kitemviews/private/kpixmapmodifier.h b/src/kitemviews/private/kpixmapmodifier.h
index e48abf515..3f7747b55 100644
--- a/src/kitemviews/private/kpixmapmodifier.h
+++ b/src/kitemviews/private/kpixmapmodifier.h
@@ -45,7 +45,7 @@ public:
/**
* return and paint a frame round an icon
* @arg framesize is in device-independent pixels
- * @return is in device-indepent pixels
+ * @return is in device-independent pixels
*/
static QSize sizeInsideFrame(const QSize& frameSize);