QtPass  1.2.0
Multi-platform GUI for pass, the standard unix password manager.
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 
11 class ImitatePass : public Pass, private simpleTransaction {
12  Q_OBJECT
13 
14  bool removeDir(const QString &dirName);
15 
16  void GitCommit(const QString &file, const QString &msg);
17 
18  void executeGit(PROCESS id, const QStringList &args,
19  QString input = QString(), bool readStdout = true,
20  bool readStderr = true);
21  void executeGpg(PROCESS id, const QStringList &args,
22  QString input = QString(), bool readStdout = true,
23  bool readStderr = true);
24 
25  class transactionHelper {
26  simpleTransaction *m_transaction;
27  PROCESS m_result;
28 
29  public:
30  transactionHelper(simpleTransaction *trans, PROCESS result)
31  : m_transaction(trans), m_result(result) {
32  m_transaction->transactionStart();
33  }
34  ~transactionHelper() { m_transaction->transactionEnd(m_result); }
35  };
36 
37 protected:
38  virtual void finished(int id, int exitCode, const QString &out,
39  const QString &err) Q_DECL_OVERRIDE;
40 
41  virtual void executeWrapper(PROCESS id, const QString &app,
42  const QStringList &args, QString input,
43  bool readStdout = true,
44  bool readStderr = true) Q_DECL_OVERRIDE;
45 
46 public:
47  ImitatePass();
48  virtual ~ImitatePass() {}
49  virtual void GitInit() Q_DECL_OVERRIDE;
50  virtual void GitPull() Q_DECL_OVERRIDE;
51  virtual void GitPull_b() Q_DECL_OVERRIDE;
52  virtual void GitPush() Q_DECL_OVERRIDE;
53  virtual void Show(QString file) Q_DECL_OVERRIDE;
54  virtual void Insert(QString file, QString value,
55  bool overwrite = false) Q_DECL_OVERRIDE;
56  virtual void Remove(QString file, bool isDir = false) Q_DECL_OVERRIDE;
57  virtual void Init(QString path, const QList<UserInfo> &list) Q_DECL_OVERRIDE;
58 
59  void reencryptPath(QString dir);
60 signals:
61  void startReencryptPath();
62  void endReencryptPath();
63 
64  // Pass interface
65 public:
66  void Move(const QString src, const QString dest,
67  const bool force = false) Q_DECL_OVERRIDE;
68  void Copy(const QString src, const QString dest,
69  const bool force = false) Q_DECL_OVERRIDE;
70 };
71 
72 #endif // IMITATEPASS_H
void reencryptPath(QString dir)
ImitatePass::reencryptPath reencrypt all files under the chosen directory.
virtual void Init(QString path, const QList< UserInfo > &list) Q_DECL_OVERRIDE
ImitatePass::Init initialize pass repository.
virtual void finished(int id, int exitCode, const QString &out, const QString &err) Q_DECL_OVERRIDE
ImitatePass::finished this function is overloaded to ensure identical behaviour to RealPass ie...
virtual void GitInit() Q_DECL_OVERRIDE
ImitatePass::GitInit git init wrapper.
Definition: imitatepass.cpp:17
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
PROCESS
Definition: enums.h:16
virtual ~ImitatePass()
Definition: imitatepass.h:48
ImitatePass()
ImitatePass::ImitatePass for situaions when pass is not available we imitate the behavior of pass htt...
Definition: imitatepass.cpp:12
virtual void Remove(QString file, bool isDir=false) Q_DECL_OVERRIDE
ImitatePass::Remove custom implementation of "pass remove".
virtual void Insert(QString file, QString value, bool overwrite=false) Q_DECL_OVERRIDE
ImitatePass::Insert create new file with encrypted content.
Definition: imitatepass.cpp:60
void Move(const QString src, const QString dest, const bool force=false) Q_DECL_OVERRIDE
Acts as an abstraction for pass or pass imitation.
Definition: pass.h:18
virtual void GitPull() Q_DECL_OVERRIDE
ImitatePass::GitPull git init wrapper.
Definition: imitatepass.cpp:24
void startReencryptPath()
virtual void GitPush() Q_DECL_OVERRIDE
ImitatePass::GitPush git init wrapper.
Definition: imitatepass.cpp:36
Imitates pass features when pass is not enabled or available.
Definition: imitatepass.h:11
void transactionStart()
transactionStart this function is used to mark start of the sequence of processes that shall be treat...
virtual void Show(QString file) Q_DECL_OVERRIDE
ImitatePass::Show shows content of file.
Definition: imitatepass.cpp:46
virtual void GitPull_b() Q_DECL_OVERRIDE
ImitatePass::GitPull_b git pull wrapper.
Definition: imitatepass.cpp:29
void Copy(const QString src, const QString dest, const bool force=false) Q_DECL_OVERRIDE
void transactionEnd(Enums::PROCESS)
transactionEnd marks end of transaction
void endReencryptPath()