summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortezeb <tezeb+github@outoftheblue.pl>2017-01-03 22:08:14 +0100
committertezeb <tezeb+github@outoftheblue.pl>2017-01-03 22:08:14 +0100
commitf20d2515b308956e6a42e463d4685a258a66e724 (patch)
treeebf94c321108b6bf03d51a729e8a8e4d23bc0cfe /src
parent055a96512ce66db1d3194e2e1df0f66f8ed65058 (diff)
coding style updated
Diffstat (limited to 'src')
-rw-r--r--src/imitatepass.cpp142
-rw-r--r--src/mainwindow.ui4
-rw-r--r--src/pass.cpp59
3 files changed, 98 insertions, 107 deletions
diff --git a/src/imitatepass.cpp b/src/imitatepass.cpp
index 3b3bdc67..1a7f0331 100644
--- a/src/imitatepass.cpp
+++ b/src/imitatepass.cpp
@@ -9,7 +9,6 @@
*/
ImitatePass::ImitatePass() {}
-
/**
* @brief ImitatePass::GitInit git init wrapper
*/
@@ -20,9 +19,7 @@ void ImitatePass::GitInit() {
/**
* @brief ImitatePass::GitPull git init wrapper
*/
-void ImitatePass::GitPull() {
- executeGit(GIT_PULL,{"pull"});
-}
+void ImitatePass::GitPull() { executeGit(GIT_PULL, {"pull"}); }
/**
* @brief ImitatePass::GitPull_b git pull wrapper
@@ -35,8 +32,8 @@ void ImitatePass::GitPull_b() {
* @brief ImitatePass::GitPush git init wrapper
*/
void ImitatePass::GitPush() {
- if(QtPassSettings::isUseGit()){
- executeGit(GIT_PUSH, {"push"});
+ if (QtPassSettings::isUseGit()) {
+ executeGit(GIT_PUSH, {"push"});
}
}
@@ -76,8 +73,7 @@ void ImitatePass::Insert(QString file, QString newValue, bool overwrite) {
if (overwrite)
args.append("--yes");
args.append("-");
- executeGpg(PASS_INSERT, args,
- newValue);
+ executeGpg(PASS_INSERT, args, newValue);
if (!QtPassSettings::isUseWebDav() && QtPassSettings::isUseGit()) {
// TODO(bezet) why not?
if (!overwrite)
@@ -299,78 +295,78 @@ void ImitatePass::reencryptPath(QString dir) {
emit endReencryptPath();
}
-void ImitatePass::Move(const QString src, const QString dest, const bool force)
-{
- QFileInfo destFileInfo(dest);
- if (QtPassSettings::isUseGit()) {
- QStringList args;
- args << "mv";
- if(force){
- args << "-f";
- }
- args << src;
- args << dest;
- executeGit(GIT_MOVE, args);
+void ImitatePass::Move(const QString src, const QString dest,
+ const bool force) {
+ QFileInfo destFileInfo(dest);
+ if (QtPassSettings::isUseGit()) {
+ QStringList args;
+ args << "mv";
+ if (force) {
+ args << "-f";
+ }
+ args << src;
+ args << dest;
+ executeGit(GIT_MOVE, args);
- QString message=QString("moved from %1 to %2 using QTPass.");
- message= message.arg(src).arg(dest);
- GitCommit("", message);
- if(QtPassSettings::isAutoPush()){
- GitPush();
- }
+ QString message = QString("moved from %1 to %2 using QTPass.");
+ message = message.arg(src).arg(dest);
+ GitCommit("", message);
+ if (QtPassSettings::isAutoPush()) {
+ GitPush();
+ }
- } else {
- QDir qDir;
- QFileInfo srcFileInfo(src);
- QString destCopy = dest;
- if(srcFileInfo.isFile() && destFileInfo.isDir()){
- destCopy = destFileInfo.absoluteFilePath() + QDir::separator() + srcFileInfo.fileName();
- }
- if(force){
- qDir.remove(destCopy);
- }
- qDir.rename(src, destCopy);
+ } else {
+ QDir qDir;
+ QFileInfo srcFileInfo(src);
+ QString destCopy = dest;
+ if (srcFileInfo.isFile() && destFileInfo.isDir()) {
+ destCopy = destFileInfo.absoluteFilePath() + QDir::separator() +
+ srcFileInfo.fileName();
}
- // reecrypt all files under the new folder
- if(destFileInfo.isDir()){
- reencryptPath(destFileInfo.absoluteFilePath());
- }else if(destFileInfo.isFile()){
- reencryptPath(destFileInfo.dir().path());
+ if (force) {
+ qDir.remove(destCopy);
}
+ qDir.rename(src, destCopy);
+ }
+ // reecrypt all files under the new folder
+ if (destFileInfo.isDir()) {
+ reencryptPath(destFileInfo.absoluteFilePath());
+ } else if (destFileInfo.isFile()) {
+ reencryptPath(destFileInfo.dir().path());
+ }
}
+void ImitatePass::Copy(const QString src, const QString dest,
+ const bool force) {
+ QFileInfo destFileInfo(dest);
+ if (QtPassSettings::isUseGit()) {
+ QStringList args;
+ args << "cp";
+ if (force) {
+ args << "-f";
+ }
+ args << src;
+ args << dest;
+ executeGit(GIT_COPY, args);
-void ImitatePass::Copy(const QString src, const QString dest, const bool force)
-{
- QFileInfo destFileInfo(dest);
- if (QtPassSettings::isUseGit()) {
- QStringList args;
- args << "cp";
- if(force){
- args << "-f";
- }
- args << src;
- args << dest;
- executeGit(GIT_COPY, args);
-
- QString message=QString("copied from %1 to %2 using QTPass.");
- message= message.arg(src).arg(dest);
- GitCommit("", message);
- if(QtPassSettings::isAutoPush()){
- GitPush();
- }
-
- } else {
- QDir qDir;
- if(force){
- qDir.remove(dest);
- }
- QFile::copy(src, dest);
+ QString message = QString("copied from %1 to %2 using QTPass.");
+ message = message.arg(src).arg(dest);
+ GitCommit("", message);
+ if (QtPassSettings::isAutoPush()) {
+ GitPush();
}
- // reecrypt all files under the new folder
- if(destFileInfo.isDir()){
- reencryptPath(destFileInfo.absoluteFilePath());
- }else if(destFileInfo.isFile()){
- reencryptPath(destFileInfo.dir().path());
+
+ } else {
+ QDir qDir;
+ if (force) {
+ qDir.remove(dest);
}
+ QFile::copy(src, dest);
+ }
+ // reecrypt all files under the new folder
+ if (destFileInfo.isDir()) {
+ reencryptPath(destFileInfo.absoluteFilePath());
+ } else if (destFileInfo.isFile()) {
+ reencryptPath(destFileInfo.dir().path());
+ }
}
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 6c2096bb..65869354 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -448,7 +448,7 @@ p, li { white-space: pre-wrap; }
<string/>
</property>
<property name="pixmap">
- <pixmap resource="resources.qrc">:/artwork/icon.ico</pixmap>
+ <pixmap resource="../resources.qrc">:/artwork/icon.ico</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
@@ -496,7 +496,7 @@ p, li { white-space: pre-wrap; }
<tabstop>profileBox</tabstop>
</tabstops>
<resources>
- <include location="resources.qrc"/>
+ <include location="../resources.qrc"/>
</resources>
<connections/>
<slots>
diff --git a/src/pass.cpp b/src/pass.cpp
index 65651c8a..785072e6 100644
--- a/src/pass.cpp
+++ b/src/pass.cpp
@@ -20,15 +20,13 @@ Pass::Pass() : wrapperRunning(false), env(QProcess::systemEnvironment()) {
connect(&exec, &Executor::starting, this, &Pass::startingExecuteWrapper);
}
-void Pass::executeWrapper(int id, const QString &app,
- const QStringList &args, bool readStdout,
- bool readStderr) {
+void Pass::executeWrapper(int id, const QString &app, const QStringList &args,
+ bool readStdout, bool readStderr) {
executeWrapper(id, app, args, QString(), readStdout, readStderr);
}
-void Pass::executeWrapper(int id, const QString &app,
- const QStringList &args, QString input,
- bool readStdout, bool readStderr) {
+void Pass::executeWrapper(int id, const QString &app, const QStringList &args,
+ QString input, bool readStdout, bool readStderr) {
QString d;
for (auto &i : args)
d += " " + i;
@@ -37,21 +35,21 @@ void Pass::executeWrapper(int id, const QString &app,
readStderr);
}
-void Pass::init(){
- #ifdef __APPLE__
- // If it exists, add the gpgtools to PATH
- if (QFile("/usr/local/MacGPG2/bin").exists())
- env.replaceInStrings("PATH=", "PATH=/usr/local/MacGPG2/bin:");
- // Add missing /usr/local/bin
- if (env.filter("/usr/local/bin").isEmpty())
- env.replaceInStrings("PATH=", "PATH=/usr/local/bin:");
- #endif
+void Pass::init() {
+#ifdef __APPLE__
+ // If it exists, add the gpgtools to PATH
+ if (QFile("/usr/local/MacGPG2/bin").exists())
+ env.replaceInStrings("PATH=", "PATH=/usr/local/MacGPG2/bin:");
+ // Add missing /usr/local/bin
+ if (env.filter("/usr/local/bin").isEmpty())
+ env.replaceInStrings("PATH=", "PATH=/usr/local/bin:");
+#endif
- if (!QtPassSettings::getGpgHome().isEmpty()) {
- QDir absHome(QtPassSettings::getGpgHome());
- absHome.makeAbsolute();
- env << "GNUPGHOME=" + absHome.path();
- }
+ if (!QtPassSettings::getGpgHome().isEmpty()) {
+ QDir absHome(QtPassSettings::getGpgHome());
+ absHome.makeAbsolute();
+ env << "GNUPGHOME=" + absHome.path();
+ }
}
/**
@@ -281,10 +279,9 @@ QString Pass::getRecipientString(QString for_file, QString separator,
* @param args
*/
void Pass::executePass(int id, const QStringList &args, QString input,
- bool readStdout ,bool readStderr)
-{
- executeWrapper(id, QtPassSettings::getPassExecutable(), args , input,
- readStdout, readStderr);
+ bool readStdout, bool readStderr) {
+ executeWrapper(id, QtPassSettings::getPassExecutable(), args, input,
+ readStdout, readStderr);
}
/**
@@ -292,18 +289,16 @@ void Pass::executePass(int id, const QStringList &args, QString input,
* @param args
*/
void Pass::executeGpg(int id, const QStringList &args, QString input,
- bool readStdout,bool readStderr)
-{
- executeWrapper(id, QtPassSettings::getGpgExecutable(), args, input,
- readStdout, readStderr);
+ bool readStdout, bool readStderr) {
+ executeWrapper(id, QtPassSettings::getGpgExecutable(), args, input,
+ readStdout, readStderr);
}
/**
* @brief Pass::executeGit easy wrapper for running git commands
* @param args
*/
void Pass::executeGit(int id, const QStringList &args, QString input,
- bool readStdout,bool readStderr)
-{
- executeWrapper(id, QtPassSettings::getGitExecutable(), args, input,
- readStdout, readStderr);
+ bool readStdout, bool readStderr) {
+ executeWrapper(id, QtPassSettings::getGitExecutable(), args, input,
+ readStdout, readStderr);
}