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

Allow setting groups of keys

GnuPG-bug-id: 5175, 5238
parent d649b946
......@@ -200,6 +200,12 @@ QList<QModelIndex> AbstractKeyListModel::addKeys(const std::vector<Key> &keys)
return doAddKeys(sorted);
}
void AbstractKeyListModel::setGroups(const std::vector<KeyGroup> &groups)
{
clear(Groups);
doSetGroups(groups);
}
void AbstractKeyListModel::clear(ItemTypes types)
{
beginResetModel();
......@@ -484,6 +490,7 @@ private:
KeyGroup doMapToGroup(const QModelIndex &index) const override;
QModelIndex doMapFromGroup(const KeyGroup &group, int column) const override;
void doSetGroups(const std::vector<KeyGroup> &groups) override;
void doClear(ItemTypes types) override
{
......@@ -521,6 +528,7 @@ private:
KeyGroup doMapToGroup(const QModelIndex &index) const override;
QModelIndex doMapFromGroup(const KeyGroup &group, int column) const override;
void doSetGroups(const std::vector<KeyGroup> &groups) override;
void doClear(ItemTypes types) override
{
......@@ -645,6 +653,11 @@ QModelIndex FlatKeyListModel::doMapFromGroup(const KeyGroup &group, int column)
return QModelIndex();
}
void FlatKeyListModel::doSetGroups(const std::vector<KeyGroup> &groups)
{
Q_ASSERT(!"not implemented");
}
HierarchicalKeyListModel::HierarchicalKeyListModel(QObject *p)
: AbstractKeyListModel(p),
mKeysByFingerprint(),
......@@ -1069,6 +1082,11 @@ QModelIndex HierarchicalKeyListModel::doMapFromGroup(const KeyGroup &group, int
return QModelIndex();
}
void HierarchicalKeyListModel::doSetGroups(const std::vector<KeyGroup> &groups)
{
Q_ASSERT(!"not implemented");
}
void AbstractKeyListModel::useKeyCache(bool value, bool secretOnly)
{
d->m_secretOnly = secretOnly;
......
......@@ -71,6 +71,8 @@ public Q_SLOTS:
QList<QModelIndex> addKeys(const std::vector<GpgME::Key> &keys);
void removeKey(const GpgME::Key &key);
void setGroups(const std::vector<KeyGroup> &groups);
void clear(ItemTypes types = All);
public:
......@@ -105,6 +107,7 @@ private:
virtual KeyGroup doMapToGroup(const QModelIndex &index) const = 0;
virtual QModelIndex doMapFromGroup(const KeyGroup &group, int column) const = 0;
virtual void doSetGroups(const std::vector<KeyGroup> &groups) = 0;
virtual void doClear(ItemTypes types) = 0;
......
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