• 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 | List of all members
KGpgChangeKey Class Reference

#include <kgpgchangekey.h>

Inheritance diagram for KGpgChangeKey:
Inheritance graph
[legend]

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 KgpgCore::KgpgKeyOwnerTrust &trust)
 
void setParentWidget (QWidget *widget)
 
bool wasChanged ()
 

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).

Author
Rolf Eike Beer kde@o.nosp@m.pens.nosp@m.ource.nosp@m..sf-.nosp@m.tec.d.nosp@m.e

Definition at line 43 of file kgpgchangekey.h.

Constructor & Destructor Documentation

KGpgChangeKey::KGpgChangeKey ( KGpgKeyNode *  node,
QWidget *  widget 
)

Creates a change object for a given key node.

Parameters
nodepointer to key node to take care of
widgetparent 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.

void KGpgChangeKey::done ( int  result)
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).

void KGpgChangeKey::keyNeedsRefresh ( KGpgKeyNode *  node)
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
applyChangesif 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
disableif 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
datenew expiration date or QDateTime() if key should get unlimited lifetime

Definition at line 43 of file kgpgchangekey.cpp.

void KGpgChangeKey::setOwTrust ( const KgpgCore::KgpgKeyOwnerTrust &  trust)

Cache new owner trust.

Parameters
trustnew 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:
  • kgpgchangekey.h
  • kgpgchangekey.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:07:52 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
  • kremotecontrol
  • ktimer
  • kwallet
  • superkaramba
  • 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