summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAnne Jan Brouwer <brouwer@annejan.com>2023-01-31 13:00:12 +0100
committerAnne Jan Brouwer <brouwer@annejan.com>2023-01-31 13:00:12 +0100
commit32182959224abd80541f238df2e27119a52810ce (patch)
tree37d4f1ffb1450bb30ed34622d282e3293546832d /src
parent9ce95b92cdc59f3a3703593dd49ae6b603653c25 (diff)
Some automatic fixes
Diffstat (limited to 'src')
-rw-r--r--src/imitatepass.cpp13
-rw-r--r--src/keygendialog.cpp17
-rw-r--r--src/mainwindow.cpp15
-rw-r--r--src/pass.cpp6
-rw-r--r--src/qtpass.cpp12
-rw-r--r--src/storemodel.cpp2
-rw-r--r--src/usersdialog.cpp14
7 files changed, 49 insertions, 30 deletions
diff --git a/src/imitatepass.cpp b/src/imitatepass.cpp
index 2140505b..1cdb8575 100644
--- a/src/imitatepass.cpp
+++ b/src/imitatepass.cpp
@@ -127,9 +127,9 @@ void ImitatePass::Insert(QString file, QString newValue, bool overwrite) {
*/
void ImitatePass::GitCommit(const QString &file, const QString &msg) {
if (file.isEmpty())
- executeGit(GIT_COMMIT, {"commit", "-m", msg});
+ executeGit(GIT_COMMIT, {"commit", "-m", msg});
else
- executeGit(GIT_COMMIT, {"commit", "-m", msg, "--", pgit(file)});
+ executeGit(GIT_COMMIT, {"commit", "-m", msg, "--", pgit(file)});
}
/**
@@ -268,9 +268,11 @@ void ImitatePass::reencryptPath(const QString &dir) {
QStringList actualKeys;
keys += err;
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
- QStringList key = keys.split(QRegularExpression("[\r\n]"), Qt::SkipEmptyParts);
+ QStringList key =
+ keys.split(QRegularExpression("[\r\n]"), Qt::SkipEmptyParts);
#else
- QStringList key = keys.split(QRegularExpression("[\r\n]"), QString::SkipEmptyParts);
+ QStringList key =
+ keys.split(QRegularExpression("[\r\n]"), QString::SkipEmptyParts);
#endif
QListIterator<QString> itr(key);
while (itr.hasNext()) {
@@ -404,7 +406,8 @@ void ImitatePass::Move(const QString src, const QString dest,
QString relSrc = QDir(QtPassSettings::getPassStore()).relativeFilePath(src);
relSrc.replace(QRegularExpression("\\.gpg$"), "");
- QString relDest = QDir(QtPassSettings::getPassStore()).relativeFilePath(destFile);
+ QString relDest =
+ QDir(QtPassSettings::getPassStore()).relativeFilePath(destFile);
relDest.replace(QRegularExpression("\\.gpg$"), "");
QString message = QString("Moved for %1 to %2 using QtPass.");
message = message.arg(relSrc).arg(relDest);
diff --git a/src/keygendialog.cpp b/src/keygendialog.cpp
index a7661865..f0df77b3 100644
--- a/src/keygendialog.cpp
+++ b/src/keygendialog.cpp
@@ -85,9 +85,11 @@ void KeygenDialog::replace(const QString &key, const QString &value) {
QStringList clear;
QString expert = ui->plainTextEdit->toPlainText();
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
- QStringList lines = expert.split(QRegularExpression("[\r\n]"), Qt::SkipEmptyParts);
+ QStringList lines =
+ expert.split(QRegularExpression("[\r\n]"), Qt::SkipEmptyParts);
#else
- QStringList lines = expert.split(QRegularExpression("[\r\n]"), QString::SkipEmptyParts);
+ QStringList lines =
+ expert.split(QRegularExpression("[\r\n]"), QString::SkipEmptyParts);
#endif
foreach (QString line, lines) {
line.replace(QRegularExpression(key + ":.*"), key + ": " + value);
@@ -107,9 +109,11 @@ void KeygenDialog::no_protection(bool enable) {
QStringList clear;
QString expert = ui->plainTextEdit->toPlainText();
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
- QStringList lines = expert.split(QRegularExpression("[\r\n]"), Qt::SkipEmptyParts);
+ QStringList lines =
+ expert.split(QRegularExpression("[\r\n]"), Qt::SkipEmptyParts);
#else
- QStringList lines = expert.split(QRegularExpression("[\r\n]"), QString::SkipEmptyParts);
+ QStringList lines =
+ expert.split(QRegularExpression("[\r\n]"), QString::SkipEmptyParts);
#endif
foreach (QString line, lines) {
bool remove = false;
@@ -141,7 +145,10 @@ void KeygenDialog::done(int r) {
}
// check email
- QRegularExpression mailre(QRegularExpression::anchoredPattern(R"(\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b)"), QRegularExpression::CaseInsensitiveOption);
+ QRegularExpression mailre(
+ QRegularExpression::anchoredPattern(
+ R"(\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b)"),
+ QRegularExpression::CaseInsensitiveOption);
if (!mailre.match(ui->email->text()).hasMatch()) {
QMessageBox::critical(
this, tr("Invalid email"),
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 6e7dcffb..60b3d0ca 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -404,7 +404,7 @@ void MainWindow::passShowHandler(const QString &p_output) {
// show what is needed:
if (QtPassSettings::isHideContent()) {
output = "***" + tr("Content hidden") + "***";
- } else if (! QtPassSettings::isDisplayAsIs()) {
+ } else if (!QtPassSettings::isDisplayAsIs()) {
if (!password.isEmpty()) {
// set the password, it is hidden if needed in addToGridLayout
addToGridLayout(0, tr("Password"), password);
@@ -1048,7 +1048,7 @@ void MainWindow::renamePassword() {
QString filePath = QFileInfo(file).path();
QString fileName = QFileInfo(file).fileName();
if (fileName.endsWith(".gpg", Qt::CaseInsensitive))
- fileName.chop(4);
+ fileName.chop(4);
QString newName =
QInputDialog::getText(this, tr("Rename file"), tr("Rename File To: "),
@@ -1126,9 +1126,11 @@ void MainWindow::addToGridLayout(int position, const QString &field,
}
// set the echo mode to password, if the field is "password"
- const QString lineStyle = QtPassSettings::isUseMonospace()
- ? "border-style: none; background: transparent; font-family: monospace;"
- : "border-style: none; background: transparent;";
+ const QString lineStyle =
+ QtPassSettings::isUseMonospace()
+ ? "border-style: none; background: transparent; font-family: "
+ "monospace;"
+ : "border-style: none; background: transparent;";
if (QtPassSettings::isHidePassword() && trimmedField == tr("Password")) {
@@ -1156,7 +1158,8 @@ void MainWindow::addToGridLayout(int position, const QString &field,
QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
line->setObjectName(trimmedField);
trimmedValue.replace(
- QRegularExpression("((?:https?|ftp|ssh|sftp|ftps|webdav|webdavs)://\\S+)"),
+ QRegularExpression(
+ "((?:https?|ftp|ssh|sftp|ftps|webdav|webdavs)://\\S+)"),
R"(<a href="\1">\1</a>)");
line->setText(trimmedValue);
line->setReadOnly(true);
diff --git a/src/pass.cpp b/src/pass.cpp
index d2ca1e85..f52c27a5 100644
--- a/src/pass.cpp
+++ b/src/pass.cpp
@@ -140,9 +140,11 @@ QList<UserInfo> Pass::listKeys(QStringList keystrings, bool secret) {
0)
return users;
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
- QStringList keys = p_out.split(QRegularExpression("[\r\n]"), Qt::SkipEmptyParts);
+ QStringList keys =
+ p_out.split(QRegularExpression("[\r\n]"), Qt::SkipEmptyParts);
#else
- QStringList keys = p_out.split(QRegularExpression("[\r\n]"), QString::SkipEmptyParts);
+ QStringList keys =
+ p_out.split(QRegularExpression("[\r\n]"), QString::SkipEmptyParts);
#endif
UserInfo current_user;
foreach (QString key, keys) {
diff --git a/src/qtpass.cpp b/src/qtpass.cpp
index 7590d711..6583ccab 100644
--- a/src/qtpass.cpp
+++ b/src/qtpass.cpp
@@ -277,9 +277,9 @@ void QtPass::processErrorExit(int exitCode, const QString &p_error) {
output = "<span style=\"color: red;\">" + error + "</span><br />";
}
- output.replace(
- QRegularExpression("((?:https?|ftp|ssh|sftp|ftps|webdav|webdavs)://\\S+)"),
- R"(<a href="\1">\1</a>)");
+ output.replace(QRegularExpression(
+ "((?:https?|ftp|ssh|sftp|ftps|webdav|webdavs)://\\S+)"),
+ R"(<a href="\1">\1</a>)");
output.replace(QRegularExpression("\n"), "<br />");
m_mainWindow->flashText(output, false, true);
@@ -339,9 +339,9 @@ void QtPass::showInTextBrowser(QString output, QString prefix,
output.replace(QRegularExpression(">"), "&gt;");
output.replace(QRegularExpression(" "), "&nbsp;");
- output.replace(
- QRegularExpression("((?:https?|ftp|ssh|sftp|ftps|webdav|webdavs)://\\S+)"),
- R"(<a href="\1">\1</a>)");
+ output.replace(QRegularExpression(
+ "((?:https?|ftp|ssh|sftp|ftps|webdav|webdavs)://\\S+)"),
+ R"(<a href="\1">\1</a>)");
output.replace(QRegularExpression("\n"), "<br />");
output = prefix + output + postfix;
diff --git a/src/storemodel.cpp b/src/storemodel.cpp
index a5bfda55..5b37f8e9 100644
--- a/src/storemodel.cpp
+++ b/src/storemodel.cpp
@@ -2,9 +2,9 @@
#include "qtpasssettings.h"
#include <QDebug>
-#include <QRegularExpression>
#include <QMessageBox>
#include <QMimeData>
+#include <QRegularExpression>
#include <utility>
QDataStream &
diff --git a/src/usersdialog.cpp b/src/usersdialog.cpp
index b89da883..517b6dc8 100644
--- a/src/usersdialog.cpp
+++ b/src/usersdialog.cpp
@@ -136,7 +136,9 @@ void UsersDialog::itemChange(QListWidgetItem *item) {
* @param filter
*/
void UsersDialog::populateList(const QString &filter) {
- QRegularExpression nameFilter(QRegularExpression::wildcardToRegularExpression("*" + filter + "*"), QRegularExpression::CaseInsensitiveOption);
+ QRegularExpression nameFilter(
+ QRegularExpression::wildcardToRegularExpression("*" + filter + "*"),
+ QRegularExpression::CaseInsensitiveOption);
ui->listWidget->clear();
if (!m_userList.isEmpty()) {
for (auto &user : m_userList) {
@@ -149,12 +151,14 @@ void UsersDialog::populateList(const QString &filter) {
continue;
QString userText = user.name + "\n" + user.key_id;
if (user.created.toSecsSinceEpoch() > 0) {
- userText += " " + tr("created") + " " +
- QLocale::system().toString(user.created, QLocale::ShortFormat);
+ userText +=
+ " " + tr("created") + " " +
+ QLocale::system().toString(user.created, QLocale::ShortFormat);
}
if (user.expiry.toSecsSinceEpoch() > 0)
- userText += " " + tr("expires") + " " +
- QLocale::system().toString(user.expiry, QLocale::ShortFormat);
+ userText +=
+ " " + tr("expires") + " " +
+ QLocale::system().toString(user.expiry, QLocale::ShortFormat);
auto *item = new QListWidgetItem(userText, ui->listWidget);
item->setCheckState(user.enabled ? Qt::Checked : Qt::Unchecked);
item->setData(Qt::UserRole, QVariant::fromValue(&user));