kgpg
#include <kgpgchangekey.h>
Signals | |
void | done (int result) |
void | keyNeedsRefresh (KGpgKeyNode *node) |
Public Member Functions | |
KGpgChangeKey (KGpgKeyNode *node, QWidget *widget) | |
~KGpgChangeKey () | |
bool | apply () |
void | selfdestruct (const bool applyChanges) |
void | setDisable (const bool disable) |
void | setExpiration (const QDateTime &date) |
void | setOwTrust (const gpgme_validity_t trust) |
void | setParentWidget (QWidget *widget) |
bool | wasChanged () |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
virtual | ~QObject () |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const QObject *receiver, const char *method) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
Additional Inherited Members | |
Static Public Member Functions inherited from QObject | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Protected Member Functions inherited from QObject | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Static Protected Member Functions inherited from QObject | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
Properties inherited from QObject | |
objectName | |
Detailed Description
A class for changing several properties of a key at once.
This class can enable or disable a key and at the same time change owner trust and expiration. It may also run in "detached" mode, i.e. the creator may be destroyed and the class will finish it's operation and delete itself when done.
The class may be reused, i.e. if one change operation finished another one can be started (for the same key). It does not take care of any locking, the caller must prevent calls to this object while it works.
None of the functions in this object block so it's safe to be called from the main application thread (e.g. it will not freeze the GUI).
Definition at line 44 of file kgpgchangekey.h.
Constructor & Destructor Documentation
KGpgChangeKey::KGpgChangeKey | ( | KGpgKeyNode * | node, |
QWidget * | widget | ||
) |
Creates a change object for a given key node.
- Parameters
-
node pointer to key node to take care of widget parent widget for password dialogs
KGpgChangeKey stores a copy of the key object of the node internally to track changes it made. Once everything is finished the caller get notified that this node needs refresh.
The widget parameter will not be used to parent this object as it may need to run even after the parent window was closed. This widget will be used as parent for the transactions so that they can show a passphrase prompt with correct widget inheritance, otherwise the modal passphrase dialog may be blocked by the modal key info dialog. Do not forget to call setParentWidget() if you destroy the parent widget while this still needs to run.
Definition at line 23 of file kgpgchangekey.cpp.
KGpgChangeKey::~KGpgChangeKey | ( | ) |
Destroys the object.
Definition at line 38 of file kgpgchangekey.cpp.
Member Function Documentation
bool KGpgChangeKey::apply | ( | ) |
Apply all cached changes to the key.
- Returns
- true if started successfully or false if already running (this should never happen).
It is save to call this function if there were no changes to the key. It will detect this case and will exit immediately.
The done() signal is emitted when this function has done all the work. It is also emitted if the function was called without work to do. This case is not considered an error.
Definition at line 58 of file kgpgchangekey.cpp.
|
signal |
This signal gets emitted every time apply() has done all of it's work.
The result argument will be 0 if everything went fine. If no work had to be done that was fine, too. If anything goes wrong it will be a logic or of every change that caused trouble which can be expiration date (1), owner trust (2), or disable (4).
|
signal |
This signal get's emitted if apply finishes in detached mode.
When the class is in detached mode (i.e. selfdestruct() was called) and the key operation finishes this signal is emitted. If apply() finishes and the object is not in detached mode only done() is emitted.
The reason for this behaviour is that if the owner is around he can take care of noticing it's parent when it's the best time (e.g. on dialog close). If the owner is gone we need to inform his parent about the change ourself. When the owner is around we usually don't want to refresh the key immediately as the user might do another change and we want to avoid useless refreshes as they are rather expensive.
void KGpgChangeKey::selfdestruct | ( | const bool | applyChanges | ) |
Tell the object to remove itself once all work is done.
- Parameters
-
applyChanges if pending changes should be applied or dropped
This function may safely be called whether apply() is running or not. If applyChanges is set to yes apply() is called and the object deletes itself once all changes are done. If apply() already runs it is noticed to destruct afterwards. If applyChanges is set to false and apply() is not running or if no work has to be done the object is destroyed the next time the event loop runs.
Definition at line 167 of file kgpgchangekey.cpp.
void KGpgChangeKey::setDisable | ( | const bool | disable | ) |
Cache new disable flag.
- Parameters
-
disable if the key should become disabled or not
Definition at line 48 of file kgpgchangekey.cpp.
void KGpgChangeKey::setExpiration | ( | const QDateTime & | date | ) |
Cache new expiration date.
- Parameters
-
date new expiration date or QDateTime() if key should get unlimited lifetime
Definition at line 43 of file kgpgchangekey.cpp.
void KGpgChangeKey::setOwTrust | ( | const gpgme_validity_t | trust | ) |
Cache new owner trust.
- Parameters
-
trust new owner trust level
Definition at line 53 of file kgpgchangekey.cpp.
void KGpgChangeKey::setParentWidget | ( | QWidget * | widget | ) |
set a new parent widget for the transactions
Definition at line 181 of file kgpgchangekey.cpp.
bool KGpgChangeKey::wasChanged | ( | ) |
Checks if the cached values differ from those of the key.
- Returns
- true if the cached values differ from the stored key
This compares the cached values to those of the stored key. If you change one value forth and back this function would return false at the end.
Definition at line 153 of file kgpgchangekey.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.