File indexing completed on 2024-10-06 08:17:41

0001 /*
0002     SPDX-FileCopyrightText: 2008 Rolf Eike Beer <kde@opensource.sf-tec.de>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 #ifndef KEYTREEVIEW_H
0007 #define KEYTREEVIEW_H
0008 
0009 #include <QTreeView>
0010 
0011 #include <QUrl>
0012 #include <vector>
0013 
0014 #include "core/kgpgkey.h"
0015 
0016 class QDragMoveEvent;
0017 class QDropEvent;
0018 
0019 class KGpgNode;
0020 class KeyListProxyModel;
0021 class KConfigGroup;
0022 
0023 class KeyTreeView: public QTreeView
0024 {
0025     Q_OBJECT
0026 private:
0027     KeyListProxyModel *m_proxy;
0028 
0029 public:
0030     explicit KeyTreeView(QWidget *parent = nullptr, KeyListProxyModel *model = nullptr);
0031 
0032     std::vector<KGpgNode *> selectedNodes(bool *psame = nullptr, KgpgCore::KgpgItemType *pt = nullptr) const;
0033     KGpgNode *selectedNode() const;
0034 
0035     void restoreLayout(KConfigGroup &cg);
0036     void saveLayout(KConfigGroup &cg) const;
0037 
0038     bool isEditing() const;
0039 
0040 Q_SIGNALS:
0041     void importDrop(const QList<QUrl> &urls);
0042     void returnPressed();
0043 
0044 public Q_SLOTS:
0045     void selectNode(KGpgNode *nd);
0046     void resizeColumnsToContents();
0047 
0048 protected:
0049         virtual void contentsDragMoveEvent(QDragMoveEvent *e);
0050         virtual void contentsDropEvent(QDropEvent *e);
0051         void startDrag(Qt::DropActions) override;
0052         void keyPressEvent(QKeyEvent *event) override;
0053 };
0054 
0055 #endif