fixed sorting of last time used in keyring

This commit is contained in:
csoler 2019-01-10 23:43:19 +01:00
parent b7340ef7ee
commit 266edf06aa
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
2 changed files with 6 additions and 2 deletions

View File

@ -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())
{

View File

@ -22,6 +22,7 @@
#define PGPID_ITEM_PROXY_H
#include "util/cxx11retrocompat.h"
#include "pgpid_item_model.h"
#include <QSortFilterProxyModel>
@ -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: