Line data Source code
1 : // SPDX-FileCopyrightText: 2016 Anne Jan Brouwer
2 : // SPDX-License-Identifier: GPL-3.0-or-later
3 : #ifndef SRC_STOREMODEL_H_
4 : #define SRC_STOREMODEL_H_
5 :
6 : #include <QSortFilterProxyModel>
7 :
8 : /*!
9 : \class StoreModel
10 : \brief The QSortFilterProxyModel for handling filesystem searches.
11 : */
12 : class QFileSystemModel;
13 : class StoreModel : public QSortFilterProxyModel {
14 0 : Q_OBJECT
15 :
16 : private:
17 : QFileSystemModel *fs;
18 : QString store;
19 :
20 : public:
21 : StoreModel();
22 :
23 : [[nodiscard]] auto filterAcceptsRow(int, const QModelIndex &) const
24 : -> bool override;
25 : [[nodiscard]] auto ShowThis(const QModelIndex) const -> bool;
26 : void setModelAndStore(QFileSystemModel *sourceModel, QString passStore);
27 : [[nodiscard]] auto data(const QModelIndex &index, int role) const
28 : -> QVariant override;
29 : [[nodiscard]] auto lessThan(const QModelIndex &source_left,
30 : const QModelIndex &source_right) const
31 : -> bool override;
32 :
33 : // QAbstractItemModel interface
34 : public:
35 : [[nodiscard]] auto supportedDropActions() const -> Qt::DropActions override;
36 : [[nodiscard]] auto supportedDragActions() const -> Qt::DropActions override;
37 : [[nodiscard]] auto flags(const QModelIndex &index) const
38 : -> Qt::ItemFlags override;
39 : [[nodiscard]] auto mimeTypes() const -> QStringList override;
40 : [[nodiscard]] auto mimeData(const QModelIndexList &indexes) const
41 : -> QMimeData * override;
42 : auto canDropMimeData(const QMimeData *data, Qt::DropAction action, int row,
43 : int column, const QModelIndex &parent) const
44 : -> bool override;
45 : auto dropMimeData(const QMimeData *data, Qt::DropAction action, int row,
46 : int column, const QModelIndex &parent) -> bool override;
47 : };
48 : /*!
49 : \struct dragAndDropInfo
50 : \brief holds values to share beetween drag and drop on the passwordstorage
51 : view
52 : */
53 0 : struct dragAndDropInfoPasswordStore {
54 : bool isDir;
55 : bool isFile;
56 : QString path;
57 : };
58 :
59 : #endif // SRC_STOREMODEL_H_
|