File: keyservers.h

package info (click to toggle)
kgpg 4:18.08.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 12,168 kB
  • sloc: cpp: 18,911; xml: 159; makefile: 8; sh: 4
file content (139 lines) | stat: -rw-r--r-- 3,653 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/*
 * Copyright (C) 2002 Jean-Baptiste Mardelle <bj@altern.org>
 * Copyright (C) 2007,2008,2009,2010,2012,2013 Rolf Eike Beer <kde@opensource.sf-tec.de>
 */

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef KEYSERVERS_H
#define KEYSERVERS_H

#include <QSortFilterProxyModel>

#include <QDialog>

#include "core/kgpgkey.h"
#include "model/kgpgsearchresultmodel.h"
#include "ui_searchres.h"
#include "ui_keyserver.h"

class KGpgKeyserverSearchTransaction;
class KeyListProxyModel;
class KGpgItemModel;

class keyServerWidget : public QWidget, public Ui::keyServerWidget
{
public:
    explicit keyServerWidget(QWidget *parent = nullptr)
      : QWidget(parent)
    {
        setupUi(this);
    }
};

class searchRes : public QWidget, public Ui::searchRes
{
public:
    explicit searchRes(QWidget *parent)
      : QWidget(parent)
    {
        setupUi(this);
    }
};

class KeyServer : public QDialog
{
	Q_OBJECT

public:
	explicit KeyServer(QWidget *parent = nullptr, KGpgItemModel *model = nullptr, const bool autoclose = false);
	~KeyServer();

	/**
	 * Returns the server list.
	 * The first item is the server configured in gpg.
	 */
	static QStringList getServerList();

	/**
	 * @brief import the given keys
	 * @param keys the key fingerprints or ids to import
	 * @param server the key server to use, if empty the default server is used
	 * @param proxy the proxy to use
	 *
	 * This will set up the underlying transaction to fetch the keys as well
	 * as it will take care of setting up everything so the user will get the
	 * results shown.
	 */
	void startImport(const QStringList &keys, QString server = QString(), const QString &proxy = QString());

signals:
	/**
	 * @brief emitted when importing keys succeeded
	 *
	 * This is only emitted when at least one key has been imported.
	 */
	void importFinished(QStringList);

	/**
	 * @brief importing failed
	 *
	 * This is emitted when key importing is finished and importFinished() is
	 * _not_ emitted. The main usage is to properly clean up the object when
	 * using startImport().
	 */
	void importFailed();

public slots:
	void slotImport();

	void slotExport(const QStringList &keyIds);

	void slotSetText(const QString &text);
	void slotTextChanged(const QString &text);
	void slotSetExportAttribute(const QString &attr);
	void slotEnableProxyI(const bool on);
	void slotEnableProxyE(const bool on);
	void slotSetKeyserver(const QString &server);

	void transferKeyID();
	void slotPreImport();
	void slotPreExport();

	void slotOk();
	void handleQuit();

private slots:
	void slotDownloadKeysFinished(int resultcode);
	void slotUploadKeysFinished(int resultcode);

	void slotSearchResult(int result);
	void slotSearch();
	void slotSetFilterString(const QString &expression);
	void slotUpdateLabelOnFilterChange();

private:
	QString m_readmessage;

	QDialog *m_dialogserver;
	KGpgKeyserverSearchTransaction *m_searchproc;

	keyServerWidget *page;
	searchRes *m_listpop;

	bool m_autoclose;
	QString expattr;

	KGpgSearchResultModel m_resultmodel;

	KeyListProxyModel *m_itemmodel;
};

#endif // KEYSERVERS_H