File indexing completed on 2024-06-23 05:14:05

0001 /* -*- mode: c++; c-basic-offset:4 -*-
0002     dialogs/lookupcertificatesdialog.h
0003 
0004     This file is part of Kleopatra, the KDE keymanager
0005     SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include <QDialog>
0013 
0014 #include <utils/pimpl_ptr.h>
0015 
0016 #include <vector>
0017 
0018 namespace GpgME
0019 {
0020 class Key;
0021 }
0022 
0023 namespace Kleo
0024 {
0025 namespace Dialogs
0026 {
0027 
0028 class LookupCertificatesDialog : public QDialog
0029 {
0030     Q_OBJECT
0031 public:
0032     enum QueryMode {
0033         AnyQuery, //< any query is allowed
0034         EmailQuery, //< only email queries are allowed
0035     };
0036 
0037     explicit LookupCertificatesDialog(QWidget *parent = nullptr, Qt::WindowFlags f = {});
0038     ~LookupCertificatesDialog() override;
0039 
0040     void setQueryMode(QueryMode mode);
0041     QueryMode queryMode() const;
0042 
0043     void setCertificates(const std::vector<GpgME::Key> &certs);
0044     std::vector<GpgME::Key> selectedCertificates() const;
0045 
0046     void setPassive(bool passive);
0047     bool isPassive() const;
0048     void setSearchText(const QString &text);
0049     QString searchText() const;
0050     void showInformation(const QString &message);
0051 
0052 Q_SIGNALS:
0053     void searchTextChanged(const QString &text);
0054     void saveAsRequested(const std::vector<GpgME::Key> &certs);
0055     void importRequested(const std::vector<GpgME::Key> &certs);
0056     void detailsRequested(const GpgME::Key &certs);
0057 
0058 public Q_SLOTS:
0059     void accept() override;
0060 
0061 private:
0062     class Private;
0063     kdtools::pimpl_ptr<Private> d;
0064     Q_PRIVATE_SLOT(d, void slotSearchTextChanged())
0065     Q_PRIVATE_SLOT(d, void slotSearchClicked())
0066     Q_PRIVATE_SLOT(d, void slotSelectionChanged())
0067     Q_PRIVATE_SLOT(d, void slotDetailsClicked())
0068     Q_PRIVATE_SLOT(d, void slotSaveAsClicked())
0069 };
0070 
0071 }
0072 }