QtPass 2.0.0
Developer documentation
Loading...
Searching...
No Matches
ExportPublicKeyDialog Class Reference

Dialog showing an ASCII-armored public GPG key for sharing. More...

#include <exportpublickeydialog.h>

Inheritance diagram for ExportPublicKeyDialog:
Collaboration diagram for ExportPublicKeyDialog:

Public Member Functions

 ExportPublicKeyDialog (const QString &keyId, const QString &armoredKey, QWidget *parent=nullptr)
 Construct an ExportPublicKeyDialog.
 ~ExportPublicKeyDialog () override
 Destroys the dialog and its generated UI.

Static Public Member Functions

static auto sanitizeKeyIdForFilename (const QString &keyId) -> QString
 Reduce a key identifier to a filesystem-safe token.

Private Slots

void on_copyButton_clicked ()
 Copy the armored key text to the system clipboard; the button reads "Copied!" for 1.5 s as feedback. Public keys are not secrets, so this bypasses ClipboardManager and its autoclear.
void on_saveButton_clicked ()
 Prompt for a destination and write the armored key to that file through a QSaveFile. The suggested name is <sanitizeKeyIdForFilename(keyId)>.asc, or public_key.asc when nothing of the key id survives. Failures are reported in a warning box.

Private Attributes

QScopedPointer< Ui::ExportPublicKeyDialog > ui
 Generated form (exportpublickeydialog.ui); owned.
QString m_keyId
 Key id as passed to the constructor; the basis of the suggested file name.
QString m_copyButtonOriginalText
 The copy button's label from the form, restored after the "Copied!" flash.

Detailed Description

Dialog showing an ASCII-armored public GPG key for sharing.

Displays the armored key text and offers Copy-to-Clipboard and Save-to-File actions so the user can hand the key to teammates.

Definition at line 27 of file exportpublickeydialog.h.

Constructor & Destructor Documentation

◆ ExportPublicKeyDialog()

ExportPublicKeyDialog::ExportPublicKeyDialog ( const QString & keyId,
const QString & armoredKey,
QWidget * parent = nullptr )
explicit

Construct an ExportPublicKeyDialog.

Parameters
keyIdGPG key identifier or fingerprint shown in the header and used as the default file name when saving.
armoredKeyASCII-armored public key text to display.
parentOptional parent widget.

Definition at line 22 of file exportpublickeydialog.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~ExportPublicKeyDialog()

ExportPublicKeyDialog::~ExportPublicKeyDialog ( )
overridedefault

Destroys the dialog and its generated UI.

Here is the call graph for this function:

Member Function Documentation

◆ on_copyButton_clicked

void ExportPublicKeyDialog::on_copyButton_clicked ( )
privateslot

Copy the armored key text to the system clipboard; the button reads "Copied!" for 1.5 s as feedback. Public keys are not secrets, so this bypasses ClipboardManager and its autoclear.

Definition at line 49 of file exportpublickeydialog.cpp.

Here is the caller graph for this function:

◆ on_saveButton_clicked

void ExportPublicKeyDialog::on_saveButton_clicked ( )
privateslot

Prompt for a destination and write the armored key to that file through a QSaveFile. The suggested name is <sanitizeKeyIdForFilename(keyId)>.asc, or public_key.asc when nothing of the key id survives. Failures are reported in a warning box.

Definition at line 57 of file exportpublickeydialog.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sanitizeKeyIdForFilename()

auto ExportPublicKeyDialog::sanitizeKeyIdForFilename ( const QString & keyId) -> QString
static

Reduce a key identifier to a filesystem-safe token.

Parameters
keyIdRaw identifier, possibly containing whitespace-separated IDs or characters not valid in a filename.
Returns
The first whitespace-separated token of keyId with anything outside [A-Za-z0-9_-] stripped. Empty if no characters survive.

Definition at line 36 of file exportpublickeydialog.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ m_copyButtonOriginalText

QString ExportPublicKeyDialog::m_copyButtonOriginalText
private

The copy button's label from the form, restored after the "Copied!" flash.

Definition at line 77 of file exportpublickeydialog.h.

◆ m_keyId

QString ExportPublicKeyDialog::m_keyId
private

Key id as passed to the constructor; the basis of the suggested file name.

Definition at line 74 of file exportpublickeydialog.h.

◆ ui

QScopedPointer<Ui::ExportPublicKeyDialog> ExportPublicKeyDialog::ui
private

Generated form (exportpublickeydialog.ui); owned.

Definition at line 71 of file exportpublickeydialog.h.


The documentation for this class was generated from the following files: