15#include "keylistmodelinterface.h"
16#include "kleo_export.h"
18#include <Libkleo/KeyGroup>
20#include <QAbstractItemModel>
32class KLEO_EXPORT DragHandler
35 virtual ~DragHandler()
38 virtual QMimeData *mimeData(
const QModelIndexList &indexes)
const = 0;
43class KLEO_EXPORT AbstractKeyListModel :
public QAbstractItemModel,
public KeyListModelInterface
54 Q_DECLARE_FLAGS(ItemTypes, ItemType)
56 explicit AbstractKeyListModel(
QObject *parent =
nullptr);
57 ~AbstractKeyListModel()
override;
59 static AbstractKeyListModel *createFlatKeyListModel(
QObject *parent =
nullptr);
60 static AbstractKeyListModel *createHierarchicalKeyListModel(
QObject *parent =
nullptr);
62 GpgME::Key key(
const QModelIndex &idx)
const override;
65 KeyGroup group(
const QModelIndex &idx)
const override;
68 QModelIndex index(
const GpgME::Key &key)
const override;
69 QModelIndex index(
const GpgME::Key &key,
int col)
const;
72 QModelIndex index(
const KeyGroup &group)
const override;
73 QModelIndex index(
const KeyGroup &group,
int col)
const;
75 void setDragHandler(
const std::shared_ptr<DragHandler> &dragHandler);
78 void rowAboutToBeMoved(
const QModelIndex &old_parent,
int old_row);
79 void rowMoved(
const QModelIndex &new_parent,
int new_row);
83 void setKeys(
const std::vector<GpgME::Key> &keys,
const std::vector<GpgME::Key::Origin> &extraOrigins = {});
85 void useKeyCache(
bool value, Kleo::KeyList::Options options);
88 void removeKey(
const GpgME::Key &key);
90 void setGroups(
const std::vector<KeyGroup> &groups);
92 bool removeGroup(
const Kleo::KeyGroup &group);
97 int columnCount(
const QModelIndex &pidx)
const override;
106 int toolTipOptions()
const;
108 void setToolTipOptions(
int opts);
115 void setRemarkKeys(
const std::vector<GpgME::Key> &remarkKeys);
116 std::vector<GpgME::Key> remarkKeys()
const;
120 QMimeData *mimeData(
const QModelIndexList &indexes)
const override;
123 bool modelResetInProgress();
126 QVariant data(
const GpgME::Key &key,
int row,
int column,
int role)
const;
127 QVariant data(
const KeyGroup &group,
int column,
int role)
const;
129 virtual GpgME::Key doMapToKey(
const QModelIndex &index)
const = 0;
130 virtual QModelIndex doMapFromKey(
const GpgME::Key &key,
int column)
const = 0;
132 virtual void doRemoveKey(
const GpgME::Key &key) = 0;
134 virtual KeyGroup doMapToGroup(
const QModelIndex &index)
const = 0;
135 virtual QModelIndex doMapFromGroup(
const KeyGroup &group,
int column)
const = 0;
136 virtual void doSetGroups(
const std::vector<KeyGroup> &groups) = 0;
137 virtual QModelIndex doAddGroup(
const KeyGroup &group) = 0;
138 virtual bool doSetGroupData(
const QModelIndex &index,
const KeyGroup &group) = 0;
139 virtual bool doRemoveGroup(
const KeyGroup &group) = 0;
141 virtual void doClear(ItemTypes types) = 0;
148Q_DECLARE_OPERATORS_FOR_FLAGS(AbstractKeyListModel::ItemTypes)
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const=0
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:14 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.