Merge pull request #1457 from csoler/v0.6-ImprovedGUI

fixed sorting of last time used in keyring
This commit is contained in:
csoler 2019-01-10 23:45:06 +01:00 committed by GitHub
commit 343ccaa1c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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)) if (!rsPeers->getGPGDetails(*it, detail))
return QVariant(); return QVariant();
//shit code end //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()) switch(index.column())
{ {

View file

@ -22,6 +22,7 @@
#define PGPID_ITEM_PROXY_H #define PGPID_ITEM_PROXY_H
#include "util/cxx11retrocompat.h" #include "util/cxx11retrocompat.h"
#include "pgpid_item_model.h"
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
@ -36,6 +37,9 @@ public:
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override bool lessThan(const QModelIndex &left, const QModelIndex &right) const override
{ {
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(); return left.data(Qt::DisplayRole).toString().toUpper() < right.data(Qt::DisplayRole).toString().toUpper();
} }