10#include <QRegularExpression>
40 dbg() <<
"Git pull failed with code:" << result;
65 executePass(
PASS_SHOW, {
"show", file},
"",
true);
80 QStringList args = {
"insert",
"-m"};
92 executePass(
PASS_REMOVE, {
"rm", (isDir ?
"-rf" :
"-f"), file});
105 QString dirWithoutPassdir =
107 QStringList args = {
"init",
"--path=" + dirWithoutPassdir};
108 foreach (
const UserInfo &user, users) {
123 QFileInfo srcFileInfo = QFileInfo(src);
124 QFileInfo destFileInfo = QFileInfo(dest);
129 if (!force && srcFileInfo.isFile() && destFileInfo.isFile()) {
134 .relativeFilePath(QDir(src).absolutePath());
136 .relativeFilePath(QDir(dest).absolutePath());
139 if (srcFileInfo.isFile() && srcFileInfo.suffix() ==
"gpg") {
142 if (destFileInfo.isFile() && destFileInfo.suffix() ==
"gpg") {
163 QFileInfo srcFileInfo = QFileInfo(src);
164 QFileInfo destFileInfo = QFileInfo(dest);
168 if (!force && srcFileInfo.isFile() && destFileInfo.isFile()) {
173 .relativeFilePath(QDir(src).absolutePath());
175 .relativeFilePath(QDir(dest).absolutePath());
178 if (srcFileInfo.isFile() && srcFileInfo.suffix() ==
"gpg") {
181 if (destFileInfo.isFile() && destFileInfo.suffix() ==
"gpg") {
202void RealPass::executePass(
PROCESS id,
const QStringList &args, QString input,
203 bool readStdout,
bool readStderr) {
205 std::move(input), readStdout, readStderr);
static auto executeBlocking(QString app, const QStringList &args, const QString &input=QString(), QString *process_out=nullptr, QString *process_err=nullptr) -> int
Executor::executeBlocking blocking version of the executor, takes input and presents it as stdin.
void executeWrapper(PROCESS id, const QString &app, const QStringList &args, bool readStdout=true, bool readStderr=true)
Execute external wrapper command.
static auto getPassStore(const QString &defaultValue=QVariant().toString()) -> QString
Get password store directory path.
static auto getPassExecutable(const QString &defaultValue=QVariant().toString()) -> QString
Get pass executable path.
void Init(QString path, const QList< UserInfo > &users) override
Initialize password store.
void OtpGenerate(QString file) override
Generate OTP code.
void Insert(QString file, QString newValue, bool overwrite=false) override
Insert new password.
void Show(QString file) override
Show decrypted password.
void Copy(const QString src, const QString dest, const bool force=false) override
Copy password file or directory.
void GitPull_b() override
Pull with rebase.
RealPass()
Construct a RealPass instance.
void Remove(QString file, bool isDir=false) override
Remove password or directory.
void GitInit() override
Initialize Git repository in password store.
void GitPull() override
Pull changes from remote.
void Move(const QString src, const QString dest, const bool force=false) override
Move password file or directory.
void GitPush() override
Push changes to remote.
static auto endsWithGpg() -> const QRegularExpression &
Returns a regex to match .gpg file extensions.
Debug utilities for QtPass.
#define dbg()
Simple debug macro that includes file and line number.
PROCESS
Identifies different subprocess operations used in QtPass.
Stores key info lines including validity, creation date and more.
bool enabled
UserInfo::enabled Whether this user/key is enabled for normal use. True when the key should be treate...
QString key_id
UserInfo::key_id hexadecimal representation of the GnuPG key identifier.