From c89c36674a48f63ebb61743db1ce029ae9d91c71 Mon Sep 17 00:00:00 2001 From: Anne Jan Brouwer Date: Fri, 16 Dec 2016 01:38:58 +0100 Subject: cleanup and autoupdates --- CHANGELOG.md | 2 + src/realpass.cpp | 140 +++++++++++++++++++++++-------------------- src/src.pro | 4 +- tests/auto/util/tst_util.cpp | 4 +- 4 files changed, 82 insertions(+), 68 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f970f10f..95d5250d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ **Closed issues:** +- pass working fine but qtprocess failure with qtpass [\#260](https://github.com/IJHack/QtPass/issues/260) - Feature: CTRL/CMD + Q closes the mainwindow [\#258](https://github.com/IJHack/QtPass/issues/258) - Pass environment not set-up correctly [\#250](https://github.com/IJHack/QtPass/issues/250) - Make fails - std c++11 not set [\#244](https://github.com/IJHack/QtPass/issues/244) @@ -23,6 +24,7 @@ **Merged pull requests:** +- \#239 reencrypting after a drag and drop action [\#261](https://github.com/IJHack/QtPass/pull/261) ([YoshiMan](https://github.com/YoshiMan)) - this if evaluetes ervery time to true [\#255](https://github.com/IJHack/QtPass/pull/255) ([YoshiMan](https://github.com/YoshiMan)) - executeing pass show before editpassword dialog shows up [\#254](https://github.com/IJHack/QtPass/pull/254) ([YoshiMan](https://github.com/YoshiMan)) - Minor fix for file names and git push [\#251](https://github.com/IJHack/QtPass/pull/251) ([tezeb](https://github.com/tezeb)) diff --git a/src/realpass.cpp b/src/realpass.cpp index 2baec515..b360dd2f 100644 --- a/src/realpass.cpp +++ b/src/realpass.cpp @@ -3,7 +3,6 @@ RealPass::RealPass() {} - /** * @brief RealPass::GitInit pass git init wrapper */ @@ -91,70 +90,83 @@ void RealPass::Init(QString path, const QList &users) { } executePass(PASS_INIT, args); } -void RealPass::Move(const QString src, const QString dest, const bool force) -{ - QFileInfo srcFileInfo= QFileInfo(src); - QFileInfo destFileInfo= QFileInfo(dest); - - // force mode? - // pass uses always the force mode, when call from eg. QT. so we have to check if this are to files - // and the user didnt want to move force - if(force == false && srcFileInfo.isFile() && destFileInfo.isFile()){ - return; - } - - QString passSrc = QDir(QtPassSettings::getPassStore()).relativeFilePath(QDir(src).absolutePath()); - QString passDest= QDir(QtPassSettings::getPassStore()).relativeFilePath(QDir(dest).absolutePath()); - - - // remove the .gpg because pass will not work - if(srcFileInfo.isFile() && srcFileInfo.suffix() == "gpg"){ - passSrc.replace(QRegExp("\\.gpg$"), ""); - } - if(destFileInfo.isFile() && destFileInfo.suffix() == "gpg"){ - passDest.replace(QRegExp("\\.gpg$"), ""); - } - - QStringList args; - args << "mv"; - if(force){ - args << "-f"; - } - args << passSrc; - args << passDest; - executePass(PASS_MOVE, args); -} +/** + * @brief RealPass::Move move a file (or folder) + * @param src source file or folder + * @param dest destination file or folder + * @param force overwrite + */ +void RealPass::Move(const QString src, const QString dest, const bool force) { + QFileInfo srcFileInfo = QFileInfo(src); + QFileInfo destFileInfo = QFileInfo(dest); + + // force mode? + // pass uses always the force mode, when call from eg. QT. so we have to check + // if this are to files + // and the user didnt want to move force + if (force == false && srcFileInfo.isFile() && destFileInfo.isFile()) { + return; + } + + QString passSrc = QDir(QtPassSettings::getPassStore()) + .relativeFilePath(QDir(src).absolutePath()); + QString passDest = QDir(QtPassSettings::getPassStore()) + .relativeFilePath(QDir(dest).absolutePath()); -void RealPass::Copy(const QString src, const QString dest, const bool force) -{ - QFileInfo srcFileInfo= QFileInfo(src); - QFileInfo destFileInfo= QFileInfo(dest); - // force mode? - // pass uses always the force mode, when call from eg. QT. so we have to check if this are to files - // and the user didnt want to move force - if(force == false && srcFileInfo.isFile() && destFileInfo.isFile()){ - return; - } - - QString passSrc = QDir(QtPassSettings::getPassStore()).relativeFilePath(QDir(src).absolutePath()); - QString passDest= QDir(QtPassSettings::getPassStore()).relativeFilePath(QDir(dest).absolutePath()); - - - // remove the .gpg because pass will not work - if(srcFileInfo.isFile() && srcFileInfo.suffix() == "gpg"){ - passSrc.replace(QRegExp("\\.gpg$"), ""); - } - if(destFileInfo.isFile() && destFileInfo.suffix() == "gpg"){ - passDest.replace(QRegExp("\\.gpg$"), ""); - } - QStringList args; - args << "cp"; - if(force){ - args << "-f"; - } - args << passSrc; - args << passDest; - executePass(PASS_COPY, args); + // remove the .gpg because pass will not work + if (srcFileInfo.isFile() && srcFileInfo.suffix() == "gpg") { + passSrc.replace(QRegExp("\\.gpg$"), ""); + } + if (destFileInfo.isFile() && destFileInfo.suffix() == "gpg") { + passDest.replace(QRegExp("\\.gpg$"), ""); + } + + QStringList args; + args << "mv"; + if (force) { + args << "-f"; + } + args << passSrc; + args << passDest; + executePass(PASS_MOVE, args); } +/** + * @brief RealPass::Copy copy a file (or folder) + * @param src source file or folder + * @param dest destination file or folder + * @param force overwrite + */ +void RealPass::Copy(const QString src, const QString dest, const bool force) { + QFileInfo srcFileInfo = QFileInfo(src); + QFileInfo destFileInfo = QFileInfo(dest); + // force mode? + // pass uses always the force mode, when call from eg. QT. so we have to check + // if this are to files + // and the user didnt want to move force + if (force == false && srcFileInfo.isFile() && destFileInfo.isFile()) { + return; + } + + QString passSrc = QDir(QtPassSettings::getPassStore()) + .relativeFilePath(QDir(src).absolutePath()); + QString passDest = QDir(QtPassSettings::getPassStore()) + .relativeFilePath(QDir(dest).absolutePath()); + + // remove the .gpg because pass will not work + if (srcFileInfo.isFile() && srcFileInfo.suffix() == "gpg") { + passSrc.replace(QRegExp("\\.gpg$"), ""); + } + if (destFileInfo.isFile() && destFileInfo.suffix() == "gpg") { + passDest.replace(QRegExp("\\.gpg$"), ""); + } + QStringList args; + args << "cp"; + if (force) { + args << "-f"; + } + args << passSrc; + args << passDest; + executePass(PASS_COPY, args); +} diff --git a/src/src.pro b/src/src.pro index afc16786..56a330b0 100644 --- a/src/src.pro +++ b/src/src.pro @@ -8,8 +8,8 @@ CONFIG += c++11 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG(debug, debug|release) { - QMAKE_CXXFLAGS += -g -c -Wall -fprofile-arcs -ftest-coverage -O0 - QMAKE_LFLAGS += -fprofile-arcs -ftest-coverage -O0 + QMAKE_CXXFLAGS += -g -c -Wall -coverage -O0 + QMAKE_LFLAGS += -coverage -O0 SUBDIRS += tests } diff --git a/tests/auto/util/tst_util.cpp b/tests/auto/util/tst_util.cpp index 7df884b8..22792ef7 100644 --- a/tests/auto/util/tst_util.cpp +++ b/tests/auto/util/tst_util.cpp @@ -53,8 +53,8 @@ void tst_util::initTestCase() {} void tst_util::cleanupTestCase() {} /** - * @brief tst_util::normalizeFolderPath test to check weather - * Util::normalizeFolderPath makes paths always end with a slash + * @brief tst_util::normalizeFolderPath test to check correct working + * of Util::normalizeFolderPath the paths should always end with a slash */ void tst_util::normalizeFolderPath() { QCOMPARE(Util::normalizeFolderPath("test"), QString("test/")); -- cgit v1.2.3