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
16class Pass;
17
28class QtPass : public QObject {
29 Q_OBJECT
30
31public:
36 explicit QtPass(QObject *parent = nullptr);
40 ~QtPass() override;
41
48 void init();
49
54 auto clipboard() -> ClipboardManager & { return m_clipboard; }
55
65 static auto formatOutput(QString output, const QString &prefix = QString(),
66 const QString &postfix = QString()) -> QString;
67
76 static QDialog *createQRCodePopup(const QPixmap &image);
77
78public slots:
84 void showTextAsQRCode(const QString &text);
85
86signals:
92 void outputReady(const QString &html);
103 void statusMessage(const QString &message, int timeout);
112
113private:
119
128
136 void reportError(int exitCode, const QString &error);
137
138private slots:
145 void processErrorExit(int exitCode, const QString &error);
146
154 void processFinished(const QString &output, const QString &errout);
155
163 void passStoreChanged(const QString &output, const QString &errout);
164
166 void doGitPush();
167
174 void finishedInsert(const QString &output, const QString &errout);
175
183 void onKeyGenerationComplete(const QString &output, const QString &errout);
184};
185
186#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:75
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:118
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,...
Definition qtpass.cpp:142
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:114
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:84
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:129
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:98
void onKeyGenerationComplete(const QString &output, const QString &errout)
Slot for Pass::finishedGenerateGPGKeys: a status message followed by processFinished()....
Definition qtpass.cpp:135
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:124
auto clipboard() -> ClipboardManager &
The clipboard handling for this application instance.
Definition qtpass.h:54
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 doGitPush()
Emit pushRequested() when the settings ask for automatic push.
Definition qtpass.cpp:151
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:201
~QtPass() override
Destroy the QtPass instance and clean up signal connections.
void processErrorExit(int exitCode, const QString &error)
Slot for Pass::processErrorExit: report the error in red and emit operationFinished().
Definition qtpass.cpp:109
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:157
ClipboardManager, which puts secrets on the clipboard and removes them again, and the MIME data that ...