QtPass 2.0.0
Developer documentation
Loading...
Searching...
No Matches
importkeydialog.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Anne Jan Brouwer
2// SPDX-License-Identifier: GPL-3.0-or-later
8#ifndef SRC_IMPORTKEYDIALOG_H_
9#define SRC_IMPORTKEYDIALOG_H_
10
11#include <QDialog>
12#include <QScopedPointer>
13#include <QString>
14
15namespace Ui {
16class ImportKeyDialog;
17}
18
27class ImportKeyDialog : public QDialog {
28 Q_OBJECT
29
30public:
36 explicit ImportKeyDialog(const QString &gpgExe, QWidget *parent = nullptr);
38 ~ImportKeyDialog() override;
39
45 auto importedKeyId() const -> QString;
46
57 static auto parseGpgImportOutput(const QString &output) -> QString;
58
59private slots:
67
73
79
85
86private:
88 QScopedPointer<Ui::ImportKeyDialog> ui;
93 QString m_gpgExe;
94
102 auto importFromString(const QString &input) -> bool;
108 void showError(const QString &message);
113 void showSuccess(const QString &keyId);
114};
115#endif // SRC_IMPORTKEYDIALOG_H_
~ImportKeyDialog() override
Destroys the dialog and its generated UI.
static auto parseGpgImportOutput(const QString &output) -> QString
Parse GPG import output to extract a key id or fingerprint.
void showError(const QString &message)
Shows message in a plain-text warning box (gpg's stderr quotes user IDs, which must not be read as ma...
auto importedKeyId() const -> QString
Get the imported key id on success.
QString m_importedKeyId
Key id or fingerprint of the last successful import; empty until then. Read back through importedKeyI...
void on_fileButton_clicked()
"From file" button: picks a file, reads it as a regular file of at most 16 MiB, requires the -----BEG...
ImportKeyDialog(const QString &gpgExe, QWidget *parent=nullptr)
Construct an ImportKeyDialog.
QString m_gpgExe
Path of the gpg binary to run; empty means plain gpg on PATH.
void on_pasteButton_clicked()
"From clipboard" button: replaces the input field with the clipboard text, unless the clipboard is em...
void showSuccess(const QString &keyId)
Shows the "imported, now verify the fingerprint" information box.
QScopedPointer< Ui::ImportKeyDialog > ui
Generated form (importkeydialog.ui); owned.
auto importFromString(const QString &input) -> bool
Feeds input to gpg --status-fd 1 --import --batch --yes via Executor::executeBlocking() and records t...
void on_importButton_clicked()
"Import" button: runs importFromString() on the trimmed input and closes the dialog with accept() on ...
void on_inputTextEdit_textChanged()
Enables the Import button only while the input field holds non-blank text.