From 266edf06aa20ae85a667e9ad9a5aaf800295d7f1 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 10 Jan 2019 23:43:19 +0100 Subject: [PATCH] fixed sorting of last time used in keyring --- retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.cpp | 2 +- retroshare-gui/src/gui/NetworkDialog/pgpid_item_proxy.h | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.cpp b/retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.cpp index cd4ff009b..eb5ed41bd 100644 --- a/retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.cpp +++ b/retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.cpp @@ -144,7 +144,7 @@ QVariant pgpid_item_model::data(const QModelIndex &index, int role) const if (!rsPeers->getGPGDetails(*it, detail)) return QVariant(); //shit code end - if(role == Qt::EditRole) //some columns return raw data for editrole, used for proper filtering + if(role == Qt::EditRole) //some columns return raw data for editrole, used for proper filtering and sorting { switch(index.column()) { diff --git a/retroshare-gui/src/gui/NetworkDialog/pgpid_item_proxy.h b/retroshare-gui/src/gui/NetworkDialog/pgpid_item_proxy.h index f59e73a51..0260b815d 100644 --- a/retroshare-gui/src/gui/NetworkDialog/pgpid_item_proxy.h +++ b/retroshare-gui/src/gui/NetworkDialog/pgpid_item_proxy.h @@ -22,6 +22,7 @@ #define PGPID_ITEM_PROXY_H #include "util/cxx11retrocompat.h" +#include "pgpid_item_model.h" #include @@ -36,7 +37,10 @@ public: bool lessThan(const QModelIndex &left, const QModelIndex &right) const override { - return left.data(Qt::DisplayRole).toString().toUpper() < right.data(Qt::DisplayRole).toString().toUpper(); + if(left.column() == COLUMN_LAST_USED) + return left.data(Qt::EditRole).toUInt() < right.data(Qt::EditRole).toUInt(); + else + return left.data(Qt::DisplayRole).toString().toUpper() < right.data(Qt::DisplayRole).toString().toUpper(); } public slots: