• 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
kgpgsendkeys.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 "kgpgsendkeys.h"
15 
16 #include "gpgproc.h"
17 
18 KGpgSendKeys::KGpgSendKeys(QObject *parent, const QString &keyserver, const QStringList &keys, const QString &attropt, const bool withProgress, const QString &proxy)
19  : KGpgKeyserverTransaction(parent, keyserver, withProgress, proxy)
20 {
21  addArgument(QLatin1String( "--export-options" ));
22  m_attrpos = addArgument(QString());
23  addArgument(QLatin1String( "--send-keys" ));
24  setAttributeOptions(attropt);
25  setKeyIds(keys);
26 
27  getProcess()->setOutputChannelMode(KProcess::MergedChannels);
28 }
29 
30 KGpgSendKeys::~KGpgSendKeys()
31 {
32 }
33 
34 bool
35 KGpgSendKeys::preStart()
36 {
37  GPGProc *proc = getProcess();
38  QStringList args(proc->program());
39 
40  int num = args.count();
41  while (num > m_attrpos + 2)
42  args.removeAt(--num);
43 
44  args << m_keys;
45 
46  proc->setProgram(args);
47 
48  setSuccess(TS_MSG_SEQUENCE);
49 
50  return KGpgKeyserverTransaction::preStart();
51 }
52 
53 bool
54 KGpgSendKeys::nextLine(const QString &line)
55 {
56  m_log.append(line);
57  setSuccess(TS_OK);
58 
59  return false;
60 }
61 
62 const QStringList &
63 KGpgSendKeys::getLog() const
64 {
65  return m_log;
66 }
67 
68 void
69 KGpgSendKeys::setKeyIds(const QStringList &keys)
70 {
71  m_keys = keys;
72 }
73 
74 void
75 KGpgSendKeys::setAttributeOptions(const QString &opt)
76 {
77  if (opt.isEmpty())
78  m_attributeopt = QLatin1String( "no-export-attributes" );
79  else
80  m_attributeopt = opt;
81 
82  replaceArgument(m_attrpos, m_attributeopt);
83 }
84 
85 #include "kgpgsendkeys.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
KGpgTransaction::TS_OK
everything went fine
Definition: kgpgtransaction.h:60
KGpgSendKeys::nextLine
virtual bool nextLine(const QString &line)
Called for every line the gpg process writes.
Definition: kgpgsendkeys.cpp:54
KGpgSendKeys::setKeyIds
void setKeyIds(const QStringList &keys)
Definition: kgpgsendkeys.cpp:69
KGpgSendKeys::preStart
virtual bool preStart()
Called before the gpg process is started.
Definition: kgpgsendkeys.cpp:35
KGpgTransaction::replaceArgument
void replaceArgument(const int pos, const QString &arg)
replace the argument at the given position
Definition: kgpgtransaction.cpp:582
KGpgSendKeys::setAttributeOptions
void setAttributeOptions(const QString &opt)
set which attributes are exported
Definition: kgpgsendkeys.cpp:75
KGpgTransaction::getProcess
GPGProc * getProcess()
get a reference to the gpg process object
Definition: kgpgtransaction.cpp:556
QList::count
int count(const T &value) const
QList::append
void append(const T &value)
QObject
QString::isEmpty
bool isEmpty() const
gpgproc.h
KGpgSendKeys::~KGpgSendKeys
virtual ~KGpgSendKeys()
Definition: kgpgsendkeys.cpp:30
QString
KGpgTransaction::TS_MSG_SEQUENCE
unexpected sequence of GnuPG messages
Definition: kgpgtransaction.h:62
QStringList
QLatin1String
KGpgTransaction::setSuccess
void setSuccess(const int v)
set the success value that will be returned with the done signal
Definition: kgpgtransaction.cpp:448
kgpgsendkeys.h
KGpgSendKeys::getLog
const QStringList & getLog() const
Definition: kgpgsendkeys.cpp:63
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
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