QtPass  1.2.0-pre
Multi-platform GUI for pass, the standard unix password manager.
pass.h
Go to the documentation of this file.
1 #ifndef PASS_H
2 #define PASS_H
3 
4 #include "datahelpers.h"
5 #include "enums.h"
6 #include "executor.h"
7 #include <QDebug>
8 #include <QDir>
9 #include <QList>
10 #include <QProcess>
11 #include <QQueue>
12 #include <QString>
13 
18 class Pass : public QObject {
19  Q_OBJECT
20 
21  bool wrapperRunning;
22  QStringList env;
23 
24 protected:
26 
28 
29 public:
30  Pass();
31  void init();
32 
33  virtual ~Pass() {}
34  virtual void GitInit() = 0;
35  virtual void GitPull() = 0;
36  virtual void GitPull_b() = 0;
37  virtual void GitPush() = 0;
38  virtual void Show(QString file) = 0;
39  virtual void Insert(QString file, QString value, bool force) = 0;
40  virtual void Remove(QString file, bool isDir) = 0;
41  virtual void Move(const QString srcDir, const QString dest,
42  const bool force = false) = 0;
43  virtual void Copy(const QString srcDir, const QString dest,
44  const bool force = false) = 0;
45  virtual void Init(QString path, const QList<UserInfo> &users) = 0;
46  virtual QString Generate_b(int length, const QString &charset);
47 
48  void GenerateGPGKeys(QString batch);
49  QList<UserInfo> listKeys(QString keystring = "", bool secret = false);
50  void updateEnv();
51  static QStringList getRecipientList(QString for_file);
52  // TODO(bezet): getRecipientString is useless, refactor
53  static QString getRecipientString(QString for_file, QString separator = " ",
54  int *count = NULL);
55 
56 protected:
57  void executeWrapper(PROCESS id, const QString &app, const QStringList &args,
58  bool readStdout = true, bool readStderr = true);
59 
60  virtual void executeWrapper(PROCESS id, const QString &app,
61  const QStringList &args, QString input,
62  bool readStdout = true, bool readStderr = true);
63 
64 protected slots:
65  virtual void finished(int id, int exitCode, const QString &out,
66  const QString &err);
67 
68 signals:
69  void error(QProcess::ProcessError);
71  void statusMsg(QString, int);
72  void critical(QString, QString);
73 
74  void processErrorExit(int exitCode, const QString &err);
75 
76  void finishedAny(const QString &, const QString &);
77  void finishedGitInit(const QString &, const QString &);
78  void finishedGitPull(const QString &, const QString &);
79  void finishedGitPush(const QString &, const QString &);
80  void finishedShow(const QString &);
81  void finishedInsert(const QString &, const QString &);
82  void finishedRemove(const QString &, const QString &);
83  void finishedInit(const QString &, const QString &);
84  void finishedMove(const QString &, const QString &);
85  void finishedCopy(const QString &, const QString &);
86  void finishedGenerate(const QString &, const QString &);
87  void finishedGenerateGPGKeys(const QString &, const QString &);
88 };
89 
90 #endif // PASS_H
void finishedMove(const QString &, const QString &)
virtual void Copy(const QString srcDir, const QString dest, const bool force=false)=0
void finishedCopy(const QString &, const QString &)
virtual ~Pass()
Definition: pass.h:33
void GenerateGPGKeys(QString batch)
Pass::GenerateGPGKeys internal gpg keypair generator . .
Definition: pass.cpp:112
void finishedGenerateGPGKeys(const QString &, const QString &)
PROCESS
Definition: enums.h:16
void finishedGitPush(const QString &, const QString &)
void error(QProcess::ProcessError)
QList< UserInfo > listKeys(QString keystring="", bool secret=false)
Pass::listKeys list users.
Definition: pass.cpp:126
virtual void Move(const QString srcDir, const QString dest, const bool force=false)=0
void finishedInsert(const QString &, const QString &)
Executes external commands for handleing password, git and other data.
Definition: executor.h:12
Enums::PROCESS PROCESS
Definition: pass.h:27
Pass()
Pass::Pass wrapper for using either pass or the pass imitation.
Definition: pass.cpp:14
void finishedRemove(const QString &, const QString &)
void finishedGenerate(const QString &, const QString &)
virtual void GitInit()=0
Acts as an abstraction for pass or pass imitation.
Definition: pass.h:18
Executor exec
Definition: pass.h:25
virtual void Remove(QString file, bool isDir)=0
void finishedGitPull(const QString &, const QString &)
virtual void Show(QString file)=0
void critical(QString, QString)
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:170
void finishedAny(const QString &, const QString &)
virtual QString Generate_b(int length, const QString &charset)
Pass::Generate use either pwgen or internal password generator.
Definition: pass.cpp:65
static QString getRecipientString(QString for_file, QString separator=" ", int *count=NULL)
Pass::getRecipientString formated string for use with GPG.
Definition: pass.cpp:275
virtual void GitPull_b()=0
void init()
Definition: pass.cpp:41
static QStringList getRecipientList(QString for_file)
Pass::getRecipientList return list of gpg-id&#39;s to encrypt for.
Definition: pass.cpp:239
virtual void GitPush()=0
void statusMsg(QString, int)
virtual void GitPull()=0
void finishedInit(const QString &, const QString &)
void executeWrapper(PROCESS id, const QString &app, const QStringList &args, bool readStdout=true, bool readStderr=true)
Definition: pass.cpp:27
void updateEnv()
Pass::updateEnv update the execution environment (used when switching profiles)
Definition: pass.cpp:218
void finishedShow(const QString &)
virtual void Insert(QString file, QString value, bool force)=0
void finishedGitInit(const QString &, const QString &)
void startingExecuteWrapper()
virtual void Init(QString path, const QList< UserInfo > &users)=0
void processErrorExit(int exitCode, const QString &err)