Commit e72bcabf authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Allow retrieval of match contexts from key filter model

GnuPG-bug-id: 5388
parent 2cc77323
...@@ -94,3 +94,6 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(KeyFilter::MatchContexts) ...@@ -94,3 +94,6 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(KeyFilter::MatchContexts)
} }
#include <QObject>
Q_DECLARE_METATYPE(Kleo::KeyFilter::MatchContexts)
...@@ -333,9 +333,12 @@ QVariant Model::data(const QModelIndex &idx, int role) const ...@@ -333,9 +333,12 @@ QVariant Model::data(const QModelIndex &idx, int role) const
case Qt::ToolTipRole: /* Most useless tooltip ever. */ case Qt::ToolTipRole: /* Most useless tooltip ever. */
return filter->name(); return filter->name();
case Qt::UserRole: case KeyFilterManager::FilterIdRole:
return filter->id(); return filter->id();
case KeyFilterManager::FilterMatchContextsRole:
return QVariant::fromValue(filter->availableMatchContexts());
default: default:
return QVariant(); return QVariant();
} }
......
...@@ -34,6 +34,12 @@ namespace Kleo ...@@ -34,6 +34,12 @@ namespace Kleo
class KLEO_EXPORT KeyFilterManager : public QObject class KLEO_EXPORT KeyFilterManager : public QObject
{ {
Q_OBJECT Q_OBJECT
public:
enum ModelRoles {
FilterIdRole = Qt::UserRole,
FilterMatchContextsRole,
};
protected: protected:
explicit KeyFilterManager(QObject *parent = nullptr); explicit KeyFilterManager(QObject *parent = nullptr);
~KeyFilterManager(); ~KeyFilterManager();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment