summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAnne Jan Brouwer <brouwer@annejan.com>2018-10-11 13:57:19 +0200
committerAnne Jan Brouwer <brouwer@annejan.com>2018-10-11 13:57:19 +0200
commit6315d1e9371864f0ed6b3854a4b50561b062befe (patch)
tree757628b1e101e182cd63b3e2c6d475ad7a1000d3 /src
parent5f7046e495db863f17d42f61c5feb9d405055a13 (diff)
Some cleanup with help of Clang-Tidy and Clazy (part 1 of x)
Diffstat (limited to 'src')
-rw-r--r--src/configdialog.cpp14
-rw-r--r--src/executor.cpp5
-rw-r--r--src/qtpass.cpp5
-rw-r--r--src/qtpasssettings.cpp12
-rw-r--r--src/realpass.cpp4
-rw-r--r--src/util.cpp4
-rw-r--r--src/util.h2
7 files changed, 27 insertions, 19 deletions
diff --git a/src/configdialog.cpp b/src/configdialog.cpp
index ae07ad2c..4d126ed2 100644
--- a/src/configdialog.cpp
+++ b/src/configdialog.cpp
@@ -39,7 +39,7 @@ ConfigDialog::ConfigDialog(MainWindow *parent)
ui->checkBoxHideContent->setChecked(QtPassSettings::isHideContent());
ui->checkBoxAddGPGId->setChecked(QtPassSettings::isAddGPGId(true));
- if (QSystemTrayIcon::isSystemTrayAvailable() == true) {
+ if (QSystemTrayIcon::isSystemTrayAvailable()) {
ui->checkBoxHideOnClose->setChecked(QtPassSettings::isHideOnClose());
ui->checkBoxStartMinimized->setChecked(QtPassSettings::isStartMinimized());
} else {
@@ -238,7 +238,7 @@ QStringList ConfigDialog::getSecretKeys() {
QList<UserInfo> keys = QtPassSettings::getPass()->listKeys("", true);
QStringList names;
- if (keys.size() == 0)
+ if (keys.empty())
return names;
foreach (const UserInfo &sec, keys)
@@ -266,8 +266,8 @@ QString ConfigDialog::selectExecutable() {
dialog.setOption(QFileDialog::ReadOnly);
if (dialog.exec())
return dialog.selectedFiles().first();
- else
- return QString();
+
+ return QString();
}
/**
@@ -281,8 +281,8 @@ QString ConfigDialog::selectFolder() {
dialog.setOption(QFileDialog::ShowDirsOnly);
if (dialog.exec())
return dialog.selectedFiles().first();
- else
- return QString();
+
+ return QString();
}
/**
@@ -615,7 +615,7 @@ void ConfigDialog::wizard() {
* @param useSystray
*/
void ConfigDialog::useTrayIcon(bool useSystray) {
- if (QSystemTrayIcon::isSystemTrayAvailable() == true) {
+ if (QSystemTrayIcon::isSystemTrayAvailable()) {
ui->checkBoxUseTrayIcon->setChecked(useSystray);
ui->checkBoxHideOnClose->setEnabled(useSystray);
ui->checkBoxStartMinimized->setEnabled(useSystray);
diff --git a/src/executor.cpp b/src/executor.cpp
index cd20f11c..d536068c 100644
--- a/src/executor.cpp
+++ b/src/executor.cpp
@@ -155,10 +155,9 @@ int Executor::executeBlocking(QString app, const QStringList &args,
if (process_err != Q_NULLPTR)
*process_err = perr;
return internal.exitCode();
- } else {
- // TODO(bezet): emit error() ?
- return -1; // QProcess error code + qDebug error?
}
+ // TODO(bezet): emit error() ?
+ return -1; // QProcess error code + qDebug error?
}
/**
diff --git a/src/qtpass.cpp b/src/qtpass.cpp
index 2239e86d..fda99cad 100644
--- a/src/qtpass.cpp
+++ b/src/qtpass.cpp
@@ -23,6 +23,7 @@ QtPass::QtPass() : clippedText(QString()), freshStart(true) {
if (!setup()) {
// no working config so this should quit without config anything
QApplication::quit();
+ {}
}
setClipboardTimer();
@@ -273,7 +274,7 @@ void QtPass::processErrorExit(int exitCode, const QString &p_error) {
output.replace(
QRegExp("((?:https?|ftp|ssh|sftp|ftps|webdav|webdavs)://\\S+)"),
- "<a href=\"\\1\">\\1</a>");
+ R"(<a href="\1">\1</a>)");
output.replace(QRegExp("\n"), "<br />");
m_mainWindow->flashText(output, false, true);
@@ -335,7 +336,7 @@ void QtPass::showInTextBrowser(QString output, QString prefix,
output.replace(
QRegExp("((?:https?|ftp|ssh|sftp|ftps|webdav|webdavs)://\\S+)"),
- "<a href=\"\\1\">\\1</a>");
+ R"(<a href="\1">\1</a>)");
output.replace(QRegExp("\n"), "<br />");
output = prefix + output + postfix;
diff --git a/src/qtpasssettings.cpp b/src/qtpasssettings.cpp
index fadb37fc..77be99ad 100644
--- a/src/qtpasssettings.cpp
+++ b/src/qtpasssettings.cpp
@@ -531,5 +531,13 @@ void QtPassSettings::setTemplateAllFields(const bool &templateAllFields) {
templateAllFields);
}
-RealPass *QtPassSettings::getRealPass() { if (realPass.isNull()) realPass.reset(new RealPass()); return realPass.data(); }
-ImitatePass *QtPassSettings::getImitatePass() { if (imitatePass.isNull()) imitatePass.reset(new ImitatePass()); return imitatePass.data(); }
+RealPass *QtPassSettings::getRealPass() {
+ if (realPass.isNull())
+ realPass.reset(new RealPass());
+ return realPass.data();
+}
+ImitatePass *QtPassSettings::getImitatePass() {
+ if (imitatePass.isNull())
+ imitatePass.reset(new ImitatePass());
+ return imitatePass.data();
+}
diff --git a/src/realpass.cpp b/src/realpass.cpp
index 476757ee..071f618b 100644
--- a/src/realpass.cpp
+++ b/src/realpass.cpp
@@ -104,7 +104,7 @@ void RealPass::Move(const QString src, const QString dest, const bool force) {
// 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()) {
+ if (!force && srcFileInfo.isFile() && destFileInfo.isFile()) {
return;
}
@@ -144,7 +144,7 @@ void RealPass::Copy(const QString src, const QString dest, const bool force) {
// 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()) {
+ if (!force && srcFileInfo.isFile() && destFileInfo.isFile()) {
return;
}
diff --git a/src/util.cpp b/src/util.cpp
index ac69bae7..db8478e4 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -149,9 +149,9 @@ QString Util::getDir(const QModelIndex &index, bool forPass,
return filePath;
}
-void Util::copyDir(const QString src, const QString dest) {
+void Util::copyDir(const QString &src, const QString &dest) {
QDir srcDir(src);
- if (srcDir.exists() == false) {
+ if (!srcDir.exists()) {
return;
}
srcDir.mkpath(dest);
diff --git a/src/util.h b/src/util.h
index b65d7099..f0dca51f 100644
--- a/src/util.h
+++ b/src/util.h
@@ -21,7 +21,7 @@ public:
static QString getDir(const QModelIndex &index, bool forPass,
const QFileSystemModel &model,
const StoreModel &storeModel);
- static void copyDir(const QString src, const QString dest);
+ static void copyDir(const QString &src, const QString &dest);
private:
static void initialiseEnvironment();