diff options
| author | Kai Uwe Broulik <[email protected]> | 2018-08-20 11:49:25 +0200 |
|---|---|---|
| committer | Kai Uwe Broulik <[email protected]> | 2018-08-20 11:49:25 +0200 |
| commit | 9134951cb01b252b2ae1ac60f5cc9c2ef6868d4e (patch) | |
| tree | f3fbb7047f361f0a0b778dc1aa080d2a211c0816 /src/kitemviews/kfileitemlistwidget.cpp | |
| parent | 523c95bed0bf7284025c17a9583d3df6e116ae2b (diff) | |
Read UDS entry times directly and pretty-print on-demand
This avoids creating a QDateTime object with all the timezone processing that comes with it since we're only
interested in the actual pretty date once we show the role to the user.
Differential Revision: https://phabricator.kde.org/D14880
Diffstat (limited to 'src/kitemviews/kfileitemlistwidget.cpp')
| -rw-r--r-- | src/kitemviews/kfileitemlistwidget.cpp | 8 |
1 files changed, 7 insertions, 1 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 { |
