QtPass 1.4.0
Multi-platform GUI for pass, the standard unix password manager.
Loading...
Searching...
No Matches
imitatepass.h
Go to the documentation of this file.
1#ifndef IMITATEPASS_H
2#define IMITATEPASS_H
3
4#include "pass.h"
5#include "simpletransaction.h"
6
11class ImitatePass : public Pass, private simpleTransaction {
12 Q_OBJECT
13
14 bool verifyGpgIdFile(const QString &file);
15 bool removeDir(const QString &dirName);
16
17 void GitCommit(const QString &file, const QString &msg);
18
19 void executeGit(PROCESS id, const QStringList &args,
20 QString input = QString(), bool readStdout = true,
21 bool readStderr = true);
22 void executeGpg(PROCESS id, const QStringList &args,
23 QString input = QString(), bool readStdout = true,
24 bool readStderr = true);
25
26 class transactionHelper {
27 simpleTransaction *m_transaction;
28 PROCESS m_result;
29
30 public:
31 transactionHelper(simpleTransaction *trans, PROCESS result)
32 : m_transaction(trans), m_result(result) {
33 m_transaction->transactionStart();
34 }
35 ~transactionHelper() { m_transaction->transactionEnd(m_result); }
36 };
37
38protected:
39 virtual void finished(int id, int exitCode, const QString &out,
40 const QString &err) Q_DECL_OVERRIDE;
41
42 virtual void executeWrapper(PROCESS id, const QString &app,
43 const QStringList &args, QString input,
44 bool readStdout = true,
45 bool readStderr = true) Q_DECL_OVERRIDE;
46
47public:
49 virtual ~ImitatePass() {}
50 virtual void GitInit() Q_DECL_OVERRIDE;
51 virtual void GitPull() Q_DECL_OVERRIDE;
52 virtual void GitPull_b() Q_DECL_OVERRIDE;
53 virtual void GitPush() Q_DECL_OVERRIDE;
54 virtual void Show(QString file) Q_DECL_OVERRIDE;
55 virtual void OtpGenerate(QString file) Q_DECL_OVERRIDE;
56 virtual void Insert(QString file, QString newValue,
57 bool overwrite = false) Q_DECL_OVERRIDE;
58 virtual void Remove(QString file, bool isDir = false) Q_DECL_OVERRIDE;
59 virtual void Init(QString path, const QList<UserInfo> &users) Q_DECL_OVERRIDE;
60
61 void reencryptPath(const QString &dir);
62signals:
65
66 // Pass interface
67public:
68 void Move(const QString src, const QString dest,
69 const bool force = false) Q_DECL_OVERRIDE;
70 void Copy(const QString src, const QString dest,
71 const bool force = false) Q_DECL_OVERRIDE;
72};
73
74#endif // IMITATEPASS_H
Imitates pass features when pass is not enabled or available.
Definition: imitatepass.h:11
virtual void OtpGenerate(QString file) Q_DECL_OVERRIDE
ImitatePass::OtpGenerate generates an otp code.
Definition: imitatepass.cpp:75
virtual void Show(QString file) Q_DECL_OVERRIDE
ImitatePass::Show shows content of file.
Definition: imitatepass.cpp:65
ImitatePass()
ImitatePass::ImitatePass for situaions when pass is not available we imitate the behavior of pass htt...
virtual void GitPush() Q_DECL_OVERRIDE
ImitatePass::GitPush git init wrapper.
Definition: imitatepass.cpp:56
void Copy(const QString src, const QString dest, const bool force=false) Q_DECL_OVERRIDE
virtual void executeWrapper(PROCESS id, const QString &app, const QStringList &args, QString input, bool readStdout=true, bool readStderr=true) Q_DECL_OVERRIDE
executeWrapper overrided so that every execution is a transaction
virtual void GitInit() Q_DECL_OVERRIDE
ImitatePass::GitInit git init wrapper.
Definition: imitatepass.cpp:37
virtual void GitPull_b() Q_DECL_OVERRIDE
ImitatePass::GitPull_b git pull wrapper.
Definition: imitatepass.cpp:49
virtual void Insert(QString file, QString newValue, bool overwrite=false) Q_DECL_OVERRIDE
ImitatePass::Insert create new file with encrypted content.
Definition: imitatepass.cpp:91
virtual void GitPull() Q_DECL_OVERRIDE
ImitatePass::GitPull git init wrapper.
Definition: imitatepass.cpp:44
void endReencryptPath()
virtual void Remove(QString file, bool isDir=false) Q_DECL_OVERRIDE
ImitatePass::Remove custom implementation of "pass remove".
void Move(const QString src, const QString dest, const bool force=false) Q_DECL_OVERRIDE
virtual void Init(QString path, const QList< UserInfo > &users) Q_DECL_OVERRIDE
ImitatePass::Init initialize pass repository.
void startReencryptPath()
void reencryptPath(const QString &dir)
ImitatePass::reencryptPath reencrypt all files under the chosen directory.
virtual ~ImitatePass()
Definition: imitatepass.h:49
Acts as an abstraction for pass or pass imitation.
Definition: pass.h:18
virtual void finished(int id, int exitCode, const QString &out, const QString &err)
Pass::processFinished reemits specific signal based on what process has finished.
Definition: pass.cpp:195
void transactionEnd(Enums::PROCESS)
transactionEnd marks end of transaction
void transactionStart()
transactionStart this function is used to mark start of the sequence of processes that shall be treat...
PROCESS
Definition: enums.h:16
Stores key info lines including validity, creation date and more.
Definition: userinfo.h:11