File indexing completed on 2024-05-05 10:13:49
0001 /* 0002 SPDX-FileCopyrightText: 2014-2022 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 GPGSERVERMODEL_H 0007 #define GPGSERVERMODEL_H 0008 0009 #include <QStringListModel> 0010 0011 /** 0012 * @brief model holding the configured GnuPG key servers 0013 */ 0014 class GpgServerModel: public QStringListModel { 0015 Q_OBJECT 0016 public: 0017 explicit GpgServerModel(QObject *parent = nullptr); 0018 ~GpgServerModel() override = default; 0019 0020 void setDefault(const QString &server); 0021 void setDefault(const int index); 0022 0023 /** 0024 * @brief returns the row of the current default keyserver 0025 */ 0026 int defaultRow() const; 0027 0028 /** 0029 * @brief returns the URL of the default server 0030 * @retval QString() if no default server is selected 0031 */ 0032 QString defaultServer() const; 0033 0034 QVariant data(const QModelIndex &index, int role) const override; 0035 0036 private Q_SLOTS: 0037 void slotRowsRemoved(const QModelIndex &, int start, int end); 0038 0039 private: 0040 int m_defaultRow; 0041 }; 0042 0043 #endif