File: kgpgkeyserversearchtransaction.h

package info (click to toggle)
kgpg 4%3A18.08.3-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 12,168 kB
  • sloc: cpp: 18,911; xml: 159; makefile: 8; sh: 4
file content (73 lines) | stat: -rw-r--r-- 2,335 bytes parent folder | download
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
/*
 * Copyright (C) 2010 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 KGPGKEYSERVERSEARCHTRANSACTION_H
#define KGPGKEYSERVERSEARCHTRANSACTION_H

#include <QObject>
#include <QString>
#include <QStringList>

#include "kgpgkeyservertransaction.h"

/**
 * @brief base class for transactions downloading from key servers
 */
class KGpgKeyserverSearchTransaction: public KGpgKeyserverTransaction {
	Q_OBJECT

	Q_DISABLE_COPY(KGpgKeyserverSearchTransaction)
	/**
	 * @brief forbidden
	 */
	KGpgKeyserverSearchTransaction() = delete;

public:
	/**
	 * @brief construct a new search on the given keyserver
	 * @param parent object that owns the transaction
	 * @param keyserver keyserver to work with
	 * @param pattern the search pattern
	 * @param withProgress show a progress window with cancel button
	 * @param proxy http proxy to use
	 *
	 * You should call this from the childrens constructor to set up
	 * everything properly
	 */
	KGpgKeyserverSearchTransaction(QObject *parent, const QString &keyserver, const QString &pattern, const bool withProgress = false, const QString &proxy = QString());
    ~KGpgKeyserverSearchTransaction() override;

	void setPattern(const QString &pattern);

signals:
	/**
	 * @brief emitted every time a new key is completed
	 * @param lines the lines that belong to that key
	 */
	void newKey(QStringList lines);

protected:
	bool preStart() override;
	bool nextLine(const QString &line) override;
	/**
	 * @brief needed to submit the last search result
	 */
	void finish() override;

private:
	QStringList m_keyLines;		///< the lines belonging to one key
	int m_patternPos;
	bool m_pageEmpty;		///< if the current page of output is empty
};

#endif // KGPGUIDTRANSACTION_H