Application-level glue between the pass backends and whatever shows their results: turns the backends' completion signals into UI-neutral signals (formatted output, status messages, "the operation is over"), owns the ClipboardManager, migrates the settings of older versions on start-up and renders QR codes. It knows nothing about the main window; the window connects to the signals below.
More...
#include <qtpass.h>
|
| void | showTextAsQRCode (const QString &text) |
| | Render text as a QR code with qrencode and show it in a popup at the cursor; failures are reported through statusMessage().
|
|
| void | outputReady (const QString &html) |
| | Formatted output (see formatOutput()) or an error rendered in colour, ready for the text browser.
|
| void | operationFinished () |
| | A backend operation is over, successfully or not; the interface can be enabled again.
|
| void | statusMessage (const QString &message, int timeout) |
| | A short message for the status bar.
|
| void | pushRequested () |
| | The store changed and the settings ask for an automatic push.
|
| void | entryInserted () |
| | An entry was written; the view of the current entry is stale.
|
|
| | QtPass (QObject *parent=nullptr) |
| | Construct the glue and connect it to both pass backends.
|
| | ~QtPass () override |
| | Destroy the QtPass instance and clean up signal connections.
|
| void | init () |
| | Resolve the password store and the executables and migrate the settings of an older version (fresh-install defaults, the native-OTP switch). Whether the resulting configuration is usable is the caller's question: see Util::configIsValid().
|
| auto | clipboard () -> ClipboardManager & |
| | The clipboard handling for this application instance.
|
|
| static auto | formatOutput (QString output, const QString &prefix=QString(), const QString &postfix=QString()) -> QString |
| | Turn a process' plain-text output into the HTML the text browser shows: http(s) URLs become links, everything else is escaped, line breaks become <br />.
|
| static QDialog * | createQRCodePopup (const QPixmap &image) |
| | Create a frameless popup dialog, placed at the cursor, showing the given QR code. Split out of showTextAsQRCode() so tests can inspect the dialog without running qrencode.
|
|
| void | processErrorExit (int exitCode, const QString &error) |
| | Slot for Pass::processErrorExit: report the error in red and emit operationFinished().
|
| void | processFinished (const QString &output, const QString &errout) |
| | Slot for Pass::finishedGitPull / finishedGitPush and the common tail of the other slots: emit the stdout as formatted output (if any), the stderr as grey chatter, then operationFinished().
|
| void | passStoreChanged (const QString &output, const QString &errout) |
| | Slot for the backend signals that change the store on disk (git init, remove, init, move, copy): processFinished() followed by doGitPush().
|
| void | doGitPush () |
| | Emit pushRequested() when the settings ask for automatic push.
|
| void | finishedInsert (const QString &output, const QString &errout) |
| | Slot for Pass::finishedInsert: like passStoreChanged(), then emit entryInserted() so the window refreshes the shown entry.
|
| void | onKeyGenerationComplete (const QString &output, const QString &errout) |
| | Slot for Pass::finishedGenerateGPGKeys: a status message followed by processFinished(). The KeygenDialog listens to the same signal and closes itself.
|
|
| void | connectPassSignalHandlers (Pass *pass) |
| | Connect the completion signals of one backend to the slots that turn them into output, status and "finished" signals. Both backends are wired up at construction because the active one can change through the configuration dialog.
|
| void | reportError (int exitCode, const QString &error) |
| | Show a process' stderr in colour through outputReady(): red for a failure, dark grey for the chatter a successful command prints (see issue #111). Nothing is shown for empty output.
|
Application-level glue between the pass backends and whatever shows their results: turns the backends' completion signals into UI-neutral signals (formatted output, status messages, "the operation is over"), owns the ClipboardManager, migrates the settings of older versions on start-up and renders QR codes. It knows nothing about the main window; the window connects to the signals below.
Definition at line 28 of file qtpass.h.
◆ QtPass()
| QtPass::QtPass |
( |
QObject * | parent = nullptr | ) |
|
|
explicit |
Construct the glue and connect it to both pass backends.
- Parameters
-
Definition at line 22 of file qtpass.cpp.
◆ ~QtPass()
Destroy the QtPass instance and clean up signal connections.
◆ clipboard()
The clipboard handling for this application instance.
- Returns
- The manager; lives as long as this object.
Definition at line 54 of file qtpass.h.
◆ connectPassSignalHandlers()
| void QtPass::connectPassSignalHandlers |
( |
Pass * | pass | ) |
|
|
private |
Connect the completion signals of one backend to the slots that turn them into output, status and "finished" signals. Both backends are wired up at construction because the active one can change through the configuration dialog.
- Parameters
-
| pass | The backend to listen to. |
Definition at line 84 of file qtpass.cpp.
◆ createQRCodePopup()
| QDialog * QtPass::createQRCodePopup |
( |
const QPixmap & | image | ) |
|
|
static |
Create a frameless popup dialog, placed at the cursor, showing the given QR code. Split out of showTextAsQRCode() so tests can inspect the dialog without running qrencode.
- Parameters
-
| image | Pixmap containing the rendered QR code. |
- Returns
- Pointer to a QDialog showing the image; it deletes itself on close, the caller shows it.
Definition at line 201 of file qtpass.cpp.
◆ doGitPush
| void QtPass::doGitPush |
( |
| ) |
|
|
privateslot |
◆ entryInserted
| void QtPass::entryInserted |
( |
| ) |
|
|
signal |
An entry was written; the view of the current entry is stale.
◆ finishedInsert
| void QtPass::finishedInsert |
( |
const QString & | output, |
|
|
const QString & | errout ) |
|
privateslot |
◆ formatOutput()
| auto QtPass::formatOutput |
( |
QString | output, |
|
|
const QString & | prefix = QString(), |
|
|
const QString & | postfix = QString() ) -> QString |
|
static |
Turn a process' plain-text output into the HTML the text browser shows: http(s) URLs become links, everything else is escaped, line breaks become <br />.
- Parameters
-
| output | Plain text from a process. |
| prefix | HTML placed before the converted output. |
| postfix | HTML placed after it. |
- Returns
- The HTML.
Definition at line 142 of file qtpass.cpp.
◆ init()
Resolve the password store and the executables and migrate the settings of an older version (fresh-install defaults, the native-OTP switch). Whether the resulting configuration is usable is the caller's question: see Util::configIsValid().
Definition at line 31 of file qtpass.cpp.
◆ onKeyGenerationComplete
| void QtPass::onKeyGenerationComplete |
( |
const QString & | output, |
|
|
const QString & | errout ) |
|
privateslot |
◆ operationFinished
| void QtPass::operationFinished |
( |
| ) |
|
|
signal |
A backend operation is over, successfully or not; the interface can be enabled again.
◆ outputReady
| void QtPass::outputReady |
( |
const QString & | html | ) |
|
|
signal |
Formatted output (see formatOutput()) or an error rendered in colour, ready for the text browser.
- Parameters
-
◆ passStoreChanged
| void QtPass::passStoreChanged |
( |
const QString & | output, |
|
|
const QString & | errout ) |
|
privateslot |
Slot for the backend signals that change the store on disk (git init, remove, init, move, copy): processFinished() followed by doGitPush().
- Parameters
-
| output | stdout of the process. |
| errout | stderr of the process. |
Definition at line 124 of file qtpass.cpp.
◆ processErrorExit
| void QtPass::processErrorExit |
( |
int | exitCode, |
|
|
const QString & | error ) |
|
privateslot |
◆ processFinished
| void QtPass::processFinished |
( |
const QString & | output, |
|
|
const QString & | errout ) |
|
privateslot |
Slot for Pass::finishedGitPull / finishedGitPush and the common tail of the other slots: emit the stdout as formatted output (if any), the stderr as grey chatter, then operationFinished().
- Parameters
-
| output | stdout of the process. |
| errout | stderr of the process. |
Definition at line 114 of file qtpass.cpp.
◆ pushRequested
| void QtPass::pushRequested |
( |
| ) |
|
|
signal |
The store changed and the settings ask for an automatic push.
◆ reportError()
| void QtPass::reportError |
( |
int | exitCode, |
|
|
const QString & | error ) |
|
private |
Show a process' stderr in colour through outputReady(): red for a failure, dark grey for the chatter a successful command prints (see issue #111). Nothing is shown for empty output.
- Parameters
-
| exitCode | The process exit code; 0 selects grey. |
| error | The stderr text. |
Definition at line 98 of file qtpass.cpp.
◆ showTextAsQRCode
| void QtPass::showTextAsQRCode |
( |
const QString & | text | ) |
|
|
slot |
Render text as a QR code with qrencode and show it in a popup at the cursor; failures are reported through statusMessage().
- Parameters
-
| text | Text to convert into a QR code. |
Definition at line 157 of file qtpass.cpp.
◆ statusMessage
| void QtPass::statusMessage |
( |
const QString & | message, |
|
|
int | timeout ) |
|
signal |
A short message for the status bar.
- Parameters
-
| message | The text. |
| timeout | Milliseconds to keep it, as QStatusBar::showMessage(). |
◆ m_clipboard
The clipboard handling for this application instance, exposed through clipboard(); parented to this object.
Definition at line 118 of file qtpass.h.
The documentation for this class was generated from the following files: