File indexing completed on 2021-12-21 14:36:55

0001 /*
0002     SPDX-FileCopyrightText: 2002 Jean-Baptiste Mardelle <bj@altern.org>
0003     SPDX-FileCopyrightText: 2007, 2008, 2009, 2010, 2011, 2012, 2013 Rolf Eike Beer <kde@opensource.sf-tec.de>
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef SELECTPUBLICKEYDIALOG_H
0008 #define SELECTPUBLICKEYDIALOG_H
0009 
0010 #include "core/kgpgkey.h"
0011 
0012 #include <QDialog>
0013 #include <QKeySequence>
0014 #include <QUrl>
0015 
0016 #include <QVBoxLayout>
0017 
0018 class QCheckBox;
0019 class QTableView;
0020 
0021 class QLineEdit;
0022 
0023 
0024 class SelectKeyProxyModel;
0025 class KGpgItemModel;
0026 
0027 /**
0028  * @brief shows a dialog to select a public key for encryption
0029  */
0030 class KgpgSelectPublicKeyDlg : public QDialog
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035     /* TODO: the goDefaultKey shortcut should be stored in a way it can be accessed from everywhere. So we don't have to pass it as an argument.
0036      */
0037 
0038     KgpgSelectPublicKeyDlg(QWidget *parent, KGpgItemModel *model, const QKeySequence &goDefaultKey, const bool hideasciioption, const QList<QUrl> &files = QList<QUrl>());
0039 
0040     QStringList selectedKeys() const;
0041     QString getCustomOptions() const;
0042     bool getSymmetric() const;
0043     bool getUntrusted() const;
0044     bool getHideId() const;
0045     bool getArmor() const;
0046     /**
0047      * @brief return the files passed in the constructor
0048      */
0049     const QList<QUrl> &getFiles() const;
0050 
0051     QWidget *optionsbox;
0052 
0053 private Q_SLOTS:
0054     void slotOk();
0055     void slotSelectionChanged();
0056     void slotSymmetric(const bool state);
0057     void slotUntrusted(const bool state);
0058     void slotGotoDefaultKey();
0059 
0060 private:
0061     void toggleDetails();
0062 private:
0063     QCheckBox *m_cbarmor;
0064     QCheckBox *m_cbuntrusted;
0065     QCheckBox *m_cbhideid;
0066     QCheckBox *m_cbsymmetric;
0067 
0068     QPushButton *m_okButton;
0069     QPushButton *m_detailsButton;
0070 
0071     QWidget *m_searchbar;
0072     QLineEdit *m_customoptions;
0073     QTableView *m_keyslist;
0074     QLineEdit *m_searchlineedit;
0075     SelectKeyProxyModel *iproxy;
0076     KGpgItemModel *imodel;
0077     const QList<QUrl> m_files;
0078 
0079     bool m_hideasciioption;
0080 };
0081 
0082 #endif // SELECTPUBLICKEYDIALOG_H