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

kgpg

Signals | Public Member Functions | Static Public Member Functions | Protected Slots | List of all members
GPGProc Class Reference

#include <gpgproc.h>

Inheritance diagram for GPGProc:
Inheritance graph
[legend]

Signals

void processExited ()
 
void readReady ()
 
- Signals inherited from KLineBufferedProcess
void lineReadyStandardError ()
 
void lineReadyStandardOutput ()
 

Public Member Functions

 GPGProc (QObject *parent=0, const QString &binary=QString())
 
 ~GPGProc ()
 
int readln (QString &line, const bool colons=false)
 
int readln (QStringList &l)
 
void resetProcess (const QString &binary=QString())
 
bool setCodec (const QByteArray &codec)
 
void start ()
 
- Public Member Functions inherited from KLineBufferedProcess
 KLineBufferedProcess (QObject *parent=0)
 
 ~KLineBufferedProcess ()
 
bool hasLineStandardError () const
 
bool hasLineStandardOutput () const
 
bool readLineStandardError (QByteArray *line)
 
bool readLineStandardOutput (QByteArray *line)
 

Static Public Member Functions

static QString getGpgHome (const QString &binary)
 
static QString getGpgStartupError (const QString &binary)
 
static int gpgVersion (const QString &vstr)
 
static QString gpgVersionString (const QString &binary)
 
static QString recode (QByteArray a, const bool colons=true, const QByteArray &codec=QByteArray())
 

Protected Slots

void finished ()
 
void received ()
 

Detailed Description

A interface to GnuPG handling UTF8 recoding correctly.

This class handles the GnuPG formatted UTF8 output correctly. GnuPG recodes some characters as \xnn where nn is the hex representation of the character. This can't be fixed up simply when using QString as QString already did it's own UTF8 conversion. Therefore we replace this sequences by their corresponding character so QString will work just fine.

As we know that GnuPG limits it's columns by QLatin1Char( ':' ) we skip \x3a. Since this is an ascii character (single byte) the replacement can be done later without problems after the line has been split into pieces.

Author
Rolf Eike Beer

Definition at line 36 of file gpgproc.h.

Constructor & Destructor Documentation

GPGProc::GPGProc ( QObject *  parent = 0,
const QString &  binary = QString() 
)
explicit

Constructor.

Parameters
parentparent object
binarypath to GnuPG binary or QString() to use the configured

Definition at line 154 of file gpgproc.cpp.

GPGProc::~GPGProc ( )

Destructor.

Definition at line 160 of file gpgproc.cpp.

Member Function Documentation

void GPGProc::finished ( )
protectedslot

Definition at line 198 of file gpgproc.cpp.

QString GPGProc::getGpgHome ( const QString &  binary)
static

find users GnuPG directory

Parameters
binaryname or path to GnuPG binary
Returns
path to directory

Use this function to find out where GnuPG would store it's configuration and data files. The returned path always ends with a '/'.

Definition at line 336 of file gpgproc.cpp.

QString GPGProc::getGpgStartupError ( const QString &  binary)
static

run GnuPG and check if it complains about anything

Parameters
binarythe GnuPG binary to run
Returns
the error message GnuPG gave out (if any)

Definition at line 317 of file gpgproc.cpp.

int GPGProc::gpgVersion ( const QString &  vstr)
static

parse GnuPG version string and return version as number

Parameters
vstrversion string
Returns
-1 if vstr is empty, -2 on parse error, parsed number on success

The version string must be in format A.B.C with A, B, and C numbers. The returned number is A * 65536 + B * 256 + C.

Definition at line 288 of file gpgproc.cpp.

QString GPGProc::gpgVersionString ( const QString &  binary)
static

get the GnuPG version string of the given binary

Parameters
binaryname or path to GnuPG binary
Returns
version string or empty string on error

This starts a GnuPG process and asks the binary for version information. The returned string is the version information without any leading text.

Definition at line 300 of file gpgproc.cpp.

void GPGProc::processExited ( )
signal

Emitted when the process has finished.

Parameters
pthe process that emitted the signal
int GPGProc::readln ( QString &  line,
const bool  colons = false 
)

Reads a line of text (excluding '\n').

Use readln() in response to a readReady() signal. You may use it multiple times if more than one line of data is available.

readln() never blocks.

Parameters
lineis used to store the line that was read.
colonsrecode also colons
Returns
the number of characters read, or -1 if no data is available.

Definition at line 203 of file gpgproc.cpp.

int GPGProc::readln ( QStringList &  l)

Reads a line of text and splits it into parts.

Use readln() in response to a readReady() signal. You may use it multiple times if more than one line of data is available.

readln() never blocks.

Parameters
lis used to store the parts of the line that was read.
Returns
the number of characters read, or -1 if no data is available.

Definition at line 214 of file gpgproc.cpp.

void GPGProc::readReady ( )
signal

Emitted when the process is ready for reading.

The signal is only emitted if at least one complete line of data is ready.

Parameters
pthe process that emitted the signal
void GPGProc::received ( )
protectedslot

Definition at line 193 of file gpgproc.cpp.

QString GPGProc::recode ( QByteArray  a,
const bool  colons = true,
const QByteArray &  codec = QByteArray() 
)
static

Recode a line from GnuPG encoding to UTF8.

Parameters
adata to recode
colonsrecode also colons
Returns
recoded string

Definition at line 238 of file gpgproc.cpp.

void GPGProc::resetProcess ( const QString &  binary = QString())

Reset the class to the state it had right after creation.

Parameters
binarypath to GnuPG binary or empty string to use the configured one

Definition at line 165 of file gpgproc.cpp.

bool GPGProc::setCodec ( const QByteArray &  codec)

sets the codec used to translate the incoming data

Parameters
codecthe name of the new codec
Returns
if the new codec has been accepted

The default codec is utf8. If the given codec is not known to QTextCodec the method will return false.

Definition at line 277 of file gpgproc.cpp.

void GPGProc::start ( )

Starts the process.

Definition at line 185 of file gpgproc.cpp.


The documentation for this class was generated from the following files:
  • gpgproc.h
  • gpgproc.cpp
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