Kerberos: add kerberos_inject_longterm_key() helper function
[wireshark-sm.git] / ui / qt / models / interface_tree_cache_model.h
blob1c33081d9cacac4170f2ab5da79ec2ec05c0624b
1 /** @file
3 * Model caching interface changes before sending them to global storage
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #ifndef INTERFACE_TREE_CACHE_MODEL_H_
13 #define INTERFACE_TREE_CACHE_MODEL_H_
15 #include <ui/qt/models/interface_tree_model.h>
17 #include <QMap>
18 #include <QAbstractItemModel>
19 #include <QIdentityProxyModel>
21 class InterfaceTreeCacheModel : public QIdentityProxyModel
23 Q_OBJECT
25 public:
26 explicit InterfaceTreeCacheModel(QObject *parent);
27 ~InterfaceTreeCacheModel();
29 int rowCount(const QModelIndex &parent = QModelIndex()) const;
30 QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const;
32 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
33 Qt::ItemFlags flags(const QModelIndex &index) const;
35 QVariant getColumnContent(int idx, int col, int role = Qt::DisplayRole);
37 #ifdef HAVE_LIBPCAP
38 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
40 void reset(int row);
41 void save();
43 void addDevice(const interface_t * newDevice);
44 void deleteDevice(const QModelIndex &index);
45 #endif
47 #ifdef HAVE_PCAP_REMOTE
48 bool isRemote(const QModelIndex &index) const;
49 #endif
51 private:
52 InterfaceTreeModel * sourceModel;
54 #ifdef HAVE_LIBPCAP
55 QList<interface_t> newDevices;
57 void saveNewDevices();
58 #endif
59 QMap<int, QSharedPointer<QMap<InterfaceTreeColumns, QVariant> > > * storage;
60 QList<InterfaceTreeColumns> editableColumns;
61 QList<InterfaceTreeColumns> checkableColumns;
63 #ifdef HAVE_LIBPCAP
64 const interface_t * lookup(const QModelIndex &index) const;
65 #endif
67 bool changeIsAllowed(InterfaceTreeColumns col) const;
68 bool isAvailableField(const QModelIndex &index) const;
69 bool isAllowedToBeEdited(const QModelIndex &index) const;
72 #endif /* INTERFACE_TREE_CACHE_MODEL_H_ */