8#ifndef SRC_KEYGENDIALOG_H_
9#define SRC_KEYGENDIALOG_H_
12#include <QScopedPointer>
15#include "qprogressindicator.h"
52 QWidget *parent =
nullptr);
66 const QString &passphrase);
77 [[nodiscard]]
static auto isBatchValue(
const QString &value) -> bool;
139 void replace(const QString &key, const QString &value);
148 void done(
int r) override;
static QString applyPassphrase(const QString &batch, const QString &passphrase)
Splice a passphrase into a GPG batch template.
void replace(const QString &key, const QString &value)
Rewrites every <key>: ... line of the batch template to carry value. Values that fail isBatchValue() ...
std::unique_ptr< QProgressIndicator > m_progressIndicator
Spinner shown while gpg works; created lazily on the first attempt, reused (hidden) across retries.
KeygenDialog(const QString &gpgExe, Pass *pass, QWidget *parent=nullptr)
Construct a KeygenDialog.
void setExpertMode(bool checked)
Enable or disable expert mode (the editable batch template).
void setNoPassphrase(bool checked)
Ticking "no passphrase" clears and disables the passphrase fields and makes OK available; unticking i...
void on_passphrase1_textChanged(const QString &arg1)
First passphrase field edited: re-evaluates whether OK may be enabled. The text itself stays out of t...
void generationFailed(const QString &error)
Stops and hides the progress indicator, re-enables the form under the usual OK rule and shows error i...
void done(int r) override
On Accepted, validates the form (passphrase chosen, no line breaks, name of 5+ characters,...
QMetaObject::Connection m_failed
Connection to Pass::generateGPGKeysFailed, live only during an attempt.
void startGeneration(const QString &batch)
Connects to the backend's finished/failed signals for this one attempt and calls Pass::GenerateGPGKey...
void on_email_textChanged(const QString &arg1)
Mirrors the e-mail field into the template's Name-Email: line.
QScopedPointer< Ui::KeygenDialog > ui
Generated form (keygendialog.ui); owned.
~KeygenDialog() override
Destroys the dialog and its generated UI.
void updateOkState()
OK is available when a passphrase is typed twice the same, or when no passphrase was asked for explic...
Pass * m_pass
Backend that runs gpg; not owned, may be nullptr.
void on_name_textChanged(const QString &arg1)
Mirrors the name field into the template's Name-Real: line.
QMetaObject::Connection m_finished
Connection to Pass::finishedGenerateGPGKeys, live only during an attempt.
auto passphraseChosen() const -> bool
Whether the passphrase question has an answer: typed twice the same, or waived with the checkbox....
void on_passphrase2_textChanged(const QString &arg1)
Confirmation field edited: same as on_passphrase1_textChanged().
static auto isBatchValue(const QString &value) -> bool
Whether value can go into a GPG batch line as one value.
Abstract base class for password store operations.