kgpg
#include <gpgproc.h>
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.
Constructor & Destructor Documentation
Constructor.
- Parameters
-
parent parent object binary path 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
|
protectedslot |
Definition at line 198 of file gpgproc.cpp.
find users GnuPG directory
- Parameters
-
binary name 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.
run GnuPG and check if it complains about anything
- Parameters
-
binary the GnuPG binary to run
- Returns
- the error message GnuPG gave out (if any)
Definition at line 317 of file gpgproc.cpp.
|
static |
parse GnuPG version string and return version as number
- Parameters
-
vstr version 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.
get the GnuPG version string of the given binary
- Parameters
-
binary name 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.
|
signal |
Emitted when the process has finished.
- Parameters
-
p the 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
-
line is used to store the line that was read. colons recode 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
-
l is 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.
|
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
-
p the process that emitted the signal
|
protectedslot |
Definition at line 193 of file gpgproc.cpp.
|
static |
Recode a line from GnuPG encoding to UTF8.
- Parameters
-
a data to recode colons recode also colons
- Returns
- recoded string
Definition at line 238 of file gpgproc.cpp.
Reset the class to the state it had right after creation.
- Parameters
-
binary path 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
-
codec the 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:
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.