summaryrefslogtreecommitdiff
path: root/models/FoxLog.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2019-06-02 22:17:11 +0200
committerChristoph Berg <myon@debian.org>2019-06-02 22:17:11 +0200
commit851b658298afb9bafeda98ffbfa2ade612c656be (patch)
tree826d54e9dac4ce15fdd1b6af3360eeba7993a7d2 /models/FoxLog.cpp
parentb7238399ea4f1ca51d8f7b8f9220af3da0913edf (diff)
New upstream version 2.1.0~rc6+repackupstream/2.1.0_rc6+repack
Diffstat (limited to 'models/FoxLog.cpp')
-rw-r--r--models/FoxLog.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/models/FoxLog.cpp b/models/FoxLog.cpp
index 773a5308..debb08af 100644
--- a/models/FoxLog.cpp
+++ b/models/FoxLog.cpp
@@ -21,6 +21,23 @@ class FoxLog::impl final
public:
impl (Configuration const * configuration);
+ QVariant data (QModelIndex const& index, int role) const
+ {
+ auto value = QSqlTableModel::data (index, role);
+ if (index.column () == fieldIndex ("when")
+ && (Qt::DisplayRole == role || Qt::EditRole == role))
+ {
+ auto t = QDateTime::fromMSecsSinceEpoch (value.toULongLong () * 1000ull, Qt::UTC);
+ if (Qt::DisplayRole == role)
+ {
+ QLocale locale;
+ return locale.toString (t, locale.dateFormat (QLocale::ShortFormat) + " hh:mm:ss");
+ }
+ value = t;
+ }
+ return value;
+ }
+
Configuration const * configuration_;
QSqlQuery mutable dupe_query_;
QSqlQuery mutable export_query_;