• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeutils API Reference
  • KDE Home
  • Contact Us
 

kgpg

  • sources
  • kde-4.14
  • kdeutils
  • kgpg
  • transactions
kgpgkeyservergettransaction.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009,2012 Rolf Eike Beer <kde@opensource.sf-tec.de>
3  */
4 
5 /***************************************************************************
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 ***************************************************************************/
13 
14 #include "kgpgkeyservergettransaction.h"
15 
16 #include "gpgproc.h"
17 
18 KGpgKeyserverGetTransaction::KGpgKeyserverGetTransaction(QObject *parent, const QString &keyserver, const QStringList &keys, const bool withProgress, const QString &proxy)
19  : KGpgKeyserverTransaction(parent, keyserver, withProgress, proxy)
20 {
21  m_cmdpos = addArgument(QString());
22  setKeyIds(keys);
23 }
24 
25 KGpgKeyserverGetTransaction::~KGpgKeyserverGetTransaction()
26 {
27 }
28 
29 bool
30 KGpgKeyserverGetTransaction::preStart()
31 {
32  GPGProc *proc = getProcess();
33  QStringList args(proc->program());
34 
35  int num = args.count();
36  while (num > m_cmdpos)
37  args.removeAt(--num);
38 
39  args << getGpgCommand() << m_keys;
40 
41  proc->setProgram(args);
42 
43  setSuccess(TS_MSG_SEQUENCE);
44 
45  return KGpgKeyserverTransaction::preStart();
46 }
47 
48 bool
49 KGpgKeyserverGetTransaction::nextLine(const QString &line)
50 {
51  m_log.append(line);
52 
53  setSuccess(TS_OK);
54 
55  return false;
56 }
57 
58 const QStringList &
59 KGpgKeyserverGetTransaction::getLog() const
60 {
61  return m_log;
62 }
63 
64 void
65 KGpgKeyserverGetTransaction::setKeyIds(const QStringList &keys)
66 {
67  m_keys = keys;
68 }
69 
70 KGpgReceiveKeys::KGpgReceiveKeys(QObject *parent, const QString &keyserver, const QStringList &keys, const bool withProgress, const QString &proxy)
71  : KGpgKeyserverGetTransaction(parent, keyserver, keys, withProgress, proxy)
72 {
73 }
74 
75 KGpgReceiveKeys::~KGpgReceiveKeys()
76 {
77 }
78 
79 QString
80 KGpgReceiveKeys::getGpgCommand() const
81 {
82  return QLatin1String( "--recv-keys" );
83 }
84 
85 KGpgRefreshKeys::KGpgRefreshKeys(QObject *parent, const QString &keyserver, const QStringList &keys, const bool withProgress, const QString &proxy)
86  : KGpgKeyserverGetTransaction(parent, keyserver, keys, withProgress, proxy)
87 {
88 }
89 
90 KGpgRefreshKeys::~KGpgRefreshKeys()
91 {
92 }
93 
94 QString
95 KGpgRefreshKeys::getGpgCommand() const
96 {
97  return QLatin1String( "--refresh-keys" );
98 }
99 
100 #include "kgpgkeyservergettransaction.moc"
GPGProc
A interface to GnuPG handling UTF8 recoding correctly.
Definition: gpgproc.h:36
KGpgTransaction::addArgument
int addArgument(const QString &arg)
add a command line argument to gpg process
Definition: kgpgtransaction.cpp:562
KGpgKeyserverGetTransaction::preStart
virtual bool preStart()
Called before the gpg process is started.
Definition: kgpgkeyservergettransaction.cpp:30
KGpgTransaction::TS_OK
everything went fine
Definition: kgpgtransaction.h:60
KGpgRefreshKeys::KGpgRefreshKeys
KGpgRefreshKeys(QObject *parent, const QString &keyserver, const QStringList &keys, const bool withProgress=false, const QString &proxy=QString())
construct a new transaction for the given keyserver
Definition: kgpgkeyservergettransaction.cpp:85
KGpgKeyserverGetTransaction::setKeyIds
void setKeyIds(const QStringList &keys)
Definition: kgpgkeyservergettransaction.cpp:65
KGpgKeyserverGetTransaction::nextLine
virtual bool nextLine(const QString &line)
Called for every line the gpg process writes.
Definition: kgpgkeyservergettransaction.cpp:49
KGpgReceiveKeys::~KGpgReceiveKeys
virtual ~KGpgReceiveKeys()
Definition: kgpgkeyservergettransaction.cpp:75
KGpgTransaction::getProcess
GPGProc * getProcess()
get a reference to the gpg process object
Definition: kgpgtransaction.cpp:556
KGpgKeyserverGetTransaction::getLog
const QStringList & getLog() const
Definition: kgpgkeyservergettransaction.cpp:59
QList::count
int count(const T &value) const
QList::append
void append(const T &value)
KGpgKeyserverGetTransaction::getGpgCommand
virtual QString getGpgCommand() const =0
QObject
KGpgRefreshKeys::getGpgCommand
virtual QString getGpgCommand() const
Definition: kgpgkeyservergettransaction.cpp:95
gpgproc.h
KGpgKeyserverGetTransaction
base class for transactions downloading from key servers
Definition: kgpgkeyservergettransaction.h:26
QString
KGpgTransaction::TS_MSG_SEQUENCE
unexpected sequence of GnuPG messages
Definition: kgpgtransaction.h:62
KGpgKeyserverGetTransaction::~KGpgKeyserverGetTransaction
virtual ~KGpgKeyserverGetTransaction()
Definition: kgpgkeyservergettransaction.cpp:25
QStringList
kgpgkeyservergettransaction.h
QLatin1String
KGpgTransaction::setSuccess
void setSuccess(const int v)
set the success value that will be returned with the done signal
Definition: kgpgtransaction.cpp:448
KGpgReceiveKeys::KGpgReceiveKeys
KGpgReceiveKeys(QObject *parent, const QString &keyserver, const QStringList &keys, const bool withProgress=false, const QString &proxy=QString())
construct a new transaction for the given keyserver
Definition: kgpgkeyservergettransaction.cpp:70
KGpgKeyserverTransaction::preStart
virtual bool preStart()
Called before the gpg process is started.
Definition: kgpgkeyservertransaction.cpp:68
KGpgKeyserverTransaction
base class for transactions involving key servers
Definition: kgpgkeyservertransaction.h:27
KGpgRefreshKeys::~KGpgRefreshKeys
virtual ~KGpgRefreshKeys()
Definition: kgpgkeyservergettransaction.cpp:90
QObject::parent
QObject * parent() const
KGpgReceiveKeys::getGpgCommand
virtual QString getGpgCommand() const
Definition: kgpgkeyservergettransaction.cpp:80
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:42:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kgpg

Skip menu "kgpg"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • ktimer
  • kwallet
  • sweeper

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal