QtPass 2.0.0
Developer documentation
Loading...
Searching...
No Matches
qtpass.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2018 Anne Jan Brouwer
2// SPDX-License-Identifier: GPL-3.0-or-later
8#ifndef SRC_QTPASS_H_
9#define SRC_QTPASS_H_
10
11#include "clipboardmanager.h"
12#include <QDialog>
13#include <QObject>
14#include <QPixmap>
15#include <QPointer>
16
17class Pass;
18
29class QtPass : public QObject {
30 Q_OBJECT
31
32public:
37 explicit QtPass(QObject *parent = nullptr);
41 ~QtPass() override;
42
49 void init();
50
55 auto clipboard() -> ClipboardManager & { return m_clipboard; }
56
69 static auto formatOutput(QString output, const QString &prefix = QString(),
70 const QString &postfix = QString(),
71 bool links = true) -> QString;
72
81 static QDialog *createQRCodePopup(const QPixmap &image);
82
83public slots:
89 void showTextAsQRCode(const QString &text);
94 void closeQRCode();
95
96signals:
102 void outputReady(const QString &html);
113 void statusMessage(const QString &message, int timeout);
122
123private:
130 QPointer<QDialog> m_qrPopup;
131
140
148 void reportError(int exitCode, const QString &error);
149
150private slots:
157 void processErrorExit(int exitCode, const QString &error);
158
166 void processFinished(const QString &output, const QString &errout);
167
175 void passStoreChanged(const QString &output, const QString &errout);
176
178 void doGitPush();
179
186 void finishedInsert(const QString &output, const QString &errout);
187
195 void onKeyGenerationComplete(const QString &output, const QString &errout);
196};
197
198#endif // SRC_QTPASS_H_
Puts secrets on the system clipboard and takes them off again.
Abstract base class for password store operations.
Definition pass.h:77
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.
ClipboardManager m_clipboard
The clipboard handling for this application instance, exposed through clipboard(); parented to this o...
Definition qtpass.h:128
static auto formatOutput(QString output, const QString &prefix=QString(), const QString &postfix=QString(), bool links=true) -> QString
Turn a process' plain-text output into the HTML the text browser shows: http(s) URLs become links,...
Definition qtpass.cpp:146
void entryInserted()
An entry was written; the view of the current entry is stale.
void processFinished(const QString &output, const QString &errout)
Slot for Pass::finishedGitPull / finishedGitPush and the common tail of the other slots: emit the std...
Definition qtpass.cpp:118
void pushRequested()
The store changed and the settings ask for an automatic push.
void connectPassSignalHandlers(Pass *pass)
Connect the completion signals of one backend to the slots that turn them into output,...
Definition qtpass.cpp:88
void outputReady(const QString &html)
Formatted output (see formatOutput()) or an error rendered in colour, ready for the text browser.
void finishedInsert(const QString &output, const QString &errout)
Slot for Pass::finishedInsert: like passStoreChanged(), then emit entryInserted() so the window refre...
Definition qtpass.cpp:133
void reportError(int exitCode, const QString &error)
Show a process' stderr in colour through outputReady(): red for a failure, dark grey for the chatter ...
Definition qtpass.cpp:102
void onKeyGenerationComplete(const QString &output, const QString &errout)
Slot for Pass::finishedGenerateGPGKeys: a status message followed by processFinished()....
Definition qtpass.cpp:139
void passStoreChanged(const QString &output, const QString &errout)
Slot for the backend signals that change the store on disk (git init, remove, init,...
Definition qtpass.cpp:128
auto clipboard() -> ClipboardManager &
The clipboard handling for this application instance.
Definition qtpass.h:55
void init()
Resolve the password store and the executables and migrate the settings of an older version (fresh-in...
Definition qtpass.cpp:31
QtPass(QObject *parent=nullptr)
Construct the glue and connect it to both pass backends.
Definition qtpass.cpp:22
void closeQRCode()
Close the QR code popup showTextAsQRCode() has open, if any: the autoclear of the panel takes the cod...
Definition qtpass.cpp:228
void doGitPush()
Emit pushRequested() when the settings ask for automatic push.
Definition qtpass.cpp:167
static QDialog * createQRCodePopup(const QPixmap &image)
Create a frameless popup dialog, placed at the cursor, showing the given QR code. Split out of showTe...
Definition qtpass.cpp:234
~QtPass() override
Destroy the QtPass instance and clean up signal connections.
QPointer< QDialog > m_qrPopup
The QR code popup while showTextAsQRCode() has it open.
Definition qtpass.h:130
void processErrorExit(int exitCode, const QString &error)
Slot for Pass::processErrorExit: report the error in red and emit operationFinished().
Definition qtpass.cpp:113
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 th...
Definition qtpass.cpp:184
ClipboardManager, which puts secrets on the clipboard and removes them again, and the MIME data that ...