summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnne Jan Brouwer <annejan@noprotocol.com>2015-11-24 01:19:28 +0100
committerAnne Jan Brouwer <annejan@noprotocol.com>2015-11-24 01:19:28 +0100
commitd981b884c5ccdc0cb66d57ad3acdd7cf20db0f0d (patch)
tree9271afd9b0197baaa52da180b2fcdc88e1029783
parentf95524f688c425ceb8252b735c4578d9d82df9cc (diff)
Even more linting and one more tiny opti
-rw-r--r--configdialog.h54
-rw-r--r--keygendialog.cpp2
-rw-r--r--keygendialog.h6
-rw-r--r--mainwindow.cpp48
-rw-r--r--mainwindow.h4
-rw-r--r--passworddialog.h4
-rw-r--r--qprogressindicator.cpp (renamed from progressindicator.cpp)3
-rw-r--r--qprogressindicator.h (renamed from progressindicator.h)4
-rw-r--r--qtpass.pro8
-rw-r--r--singleapplication.h4
-rw-r--r--storemodel.h4
-rw-r--r--trayicon.h4
-rw-r--r--usersdialog.cpp4
-rw-r--r--usersdialog.h6
-rw-r--r--util.cpp4
-rw-r--r--util.h4
16 files changed, 81 insertions, 82 deletions
diff --git a/configdialog.h b/configdialog.h
index e6b38ba4..f24b6949 100644
--- a/configdialog.h
+++ b/configdialog.h
@@ -1,11 +1,11 @@
-#ifndef DIALOG_H
-#define DIALOG_H
+#ifndef CONFIGDIALOG_H_
+#define CONFIGDIALOG_H_
#include <QDialog>
#include <QFileDialog>
-#include "mainwindow.h"
#include <QTableWidgetItem>
#include <QCloseEvent>
+#include "mainwindow.h"
namespace Ui {
struct UserInfo;
@@ -16,7 +16,7 @@ class ConfigDialog;
class ConfigDialog : public QDialog {
Q_OBJECT
-public:
+ public:
explicit ConfigDialog(MainWindow *parent);
~ConfigDialog();
void setPassPath(QString);
@@ -24,15 +24,15 @@ public:
void setGpgPath(QString);
void setStorePath(QString);
void setProfiles(QHash<QString, QString>, QString);
- void usePass(bool);
+ void usePass(bool usePass);
void useClipboard(MainWindow::clipBoardType);
- void useAutoclear(bool);
- void setAutoclear(int);
- void useAutoclearPanel(bool);
- void setAutoclearPanel(int);
- void hidePassword(bool);
- void hideContent(bool);
- void addGPGId(bool);
+ void useAutoclear(bool useAutoclear);
+ void setAutoclear(int seconds);
+ void useAutoclearPanel(bool useAutoclearPanel);
+ void setAutoclearPanel(int seconds);
+ void hidePassword(bool hidePassword);
+ void hideContent(bool hideContent);
+ void addGPGId(bool addGPGId);
QString getPassPath();
QString getGitPath();
QString getGpgPath();
@@ -52,36 +52,36 @@ public:
bool useTrayIcon();
bool hideOnClose();
bool startMinimized();
- void useTrayIcon(bool);
- void hideOnClose(bool);
- void startMinimized(bool);
- void useGit(bool);
+ void useTrayIcon(bool useTrayIdon);
+ void hideOnClose(bool hideOnClose);
+ void startMinimized(bool startMinimized);
+ void useGit(bool useGit);
bool useGit();
QString getPwgenPath();
void setPwgenPath(QString);
- void usePwgen(bool);
- void useSymbols(bool);
- void setPasswordLength(int);
+ void usePwgen(bool usePwgen);
+ void useSymbols(bool useSymbols);
+ void setPasswordLength(int pwLen);
void setPasswordChars(QString);
bool usePwgen();
bool useSymbols();
int getPasswordLength();
QString getPasswordChars();
bool useTemplate();
- void useTemplate(bool);
+ void useTemplate(bool useTemplate);
QString getTemplate();
void setTemplate(QString);
- void templateAllFields(bool);
+ void templateAllFields(bool templateAllFields);
bool templateAllFields();
bool autoPull();
- void autoPull(bool);
+ void autoPull(bool autoPull);
bool autoPush();
- void autoPush(bool);
+ void autoPush(bool autoPush);
-protected:
+ protected:
void closeEvent(QCloseEvent *event);
-private slots:
+ private slots:
void on_radioButtonNative_clicked();
void on_radioButtonPass_clicked();
void on_toolButtonGit_clicked();
@@ -99,7 +99,7 @@ private slots:
void on_checkBoxUsePwgen_clicked();
void on_checkBoxUseTemplate_clicked();
-private:
+ private:
QScopedPointer<Ui::ConfigDialog> ui;
void setGroupBoxState();
QString selectExecutable();
@@ -110,4 +110,4 @@ private:
MainWindow *mainWindow;
};
-#endif // DIALOG_H
+#endif // CONFIGDIALOG_H_
diff --git a/keygendialog.cpp b/keygendialog.cpp
index c44cd087..4fe2ad3f 100644
--- a/keygendialog.cpp
+++ b/keygendialog.cpp
@@ -2,7 +2,7 @@
#include <QDebug>
#include <QMessageBox>
#include "ui_keygendialog.h"
-#include "progressindicator.h"
+#include "qprogressindicator.h"
KeygenDialog::KeygenDialog(ConfigDialog *parent)
: QDialog(parent), ui(new Ui::KeygenDialog) {
diff --git a/keygendialog.h b/keygendialog.h
index ab6c94f8..4beb148e 100644
--- a/keygendialog.h
+++ b/keygendialog.h
@@ -1,5 +1,5 @@
-#ifndef KEYGENDIALOG_H
-#define KEYGENDIALOG_H
+#ifndef KEYGENDIALOG_H_
+#define KEYGENDIALOG_H_
#include <QDialog>
#include <QCloseEvent>
@@ -19,7 +19,7 @@ class KeygenDialog : public QDialog {
protected:
void closeEvent(QCloseEvent *event);
- private slots:
+private slots:
void on_passphrase1_textChanged(const QString &arg1);
void on_passphrase2_textChanged(const QString &arg1);
void on_checkBox_stateChanged(int arg1);
diff --git a/mainwindow.cpp b/mainwindow.cpp
index fac1a4c2..d9fd01e5 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -1,10 +1,4 @@
#include "mainwindow.h"
-#include "ui_mainwindow.h"
-#include "configdialog.h"
-#include "usersdialog.h"
-#include "keygendialog.h"
-#include "passworddialog.h"
-#include "util.h"
#include <QClipboard>
#include <QDebug>
#include <QInputDialog>
@@ -21,6 +15,12 @@
#include <winnetwk.h>
#undef DELETE
#endif
+#include "ui_mainwindow.h"
+#include "configdialog.h"
+#include "usersdialog.h"
+#include "keygendialog.h"
+#include "passworddialog.h"
+#include "util.h"
/**
* @brief MainWindow::MainWindow
@@ -223,7 +223,7 @@ bool MainWindow::checkConfig() {
profile = settings.value("profile").toString();
settings.beginGroup("profiles");
QStringList keys = settings.childKeys();
- foreach (QString key, keys)
+ foreach(QString key, keys)
profiles[key] = settings.value(key).toString();
settings.endGroup();
@@ -295,7 +295,7 @@ bool MainWindow::checkConfig() {
freshStart = false;
- // TODO: this needs to be before we try to access the store,
+ // TODO(annejan): this needs to be before we try to access the store,
// but it would be better to do it after the Window is shown,
// as the long delay it can cause is irritating otherwise.
if (useWebDav)
@@ -400,7 +400,7 @@ void MainWindow::config() {
d->autoPull(autoPull);
d->autoPush(autoPush);
if (startupPhase)
- d->wizard(); // does shit
+ d->wizard(); // does shit
if (d->exec()) {
if (d->result() == QDialog::Accepted) {
passExecutable = d->getPassPath();
@@ -698,7 +698,7 @@ void MainWindow::readyRead(bool finished = false) {
pass->setReadOnly(true);
ui->formLayout->addRow(pass);
- for (int j = 0; j < tokens.length(); j++) {
+ for (int j = 0; j < tokens.length(); ++j) {
QString token = tokens.at(j);
if (token.contains(':')) {
int colon = token.indexOf(':');
@@ -706,14 +706,14 @@ void MainWindow::readyRead(bool finished = false) {
if (templateAllFields || passTemplate.contains(field)) {
QString value = token.right(token.length() - colon - 1);
if (!passTemplate.contains(field) && value.startsWith("//"))
- continue; // colon is probably from a url
+ continue; // colon is probably from a url
QLineEdit *line = new QLineEdit();
line->setObjectName(field);
line->setText(value);
line->setReadOnly(true);
ui->formLayout->addRow(new QLabel(field), line);
tokens.removeAt(j);
- j--; // tokens.length() also got shortened by the remove..
+ --j; // tokens.length() also got shortened by the remove..
}
}
}
@@ -743,7 +743,7 @@ void MainWindow::readyRead(bool finished = false) {
qDebug() << "Keygen Done";
keygen->close();
keygen = 0;
- // TODO some sanity checking ?
+ // TODO(annejan) some sanity checking ?
}
}
@@ -992,7 +992,7 @@ QString MainWindow::getRecipientString(QString for_file, QString separator,
QStringList recipients_list = getRecipientList(for_file);
if (count)
*count = recipients_list.size();
- foreach (const QString recipient, recipients_list)
+ foreach(const QString recipient, recipients_list)
recipients_str += separator + '"' + recipient + '"';
return recipients_str;
}
@@ -1156,7 +1156,7 @@ bool MainWindow::removeDir(const QString &dirName) {
QDir dir(dirName);
if (dir.exists(dirName)) {
- Q_FOREACH (QFileInfo info,
+ Q_FOREACH(QFileInfo info,
dir.entryInfoList(QDir::NoDotAndDotDot | QDir::System |
QDir::Hidden | QDir::AllDirs | QDir::Files,
QDir::DirsFirst)) {
@@ -1206,7 +1206,7 @@ QList<UserInfo> MainWindow::listKeys(QString keystring, bool secret) {
QStringList keys = QString(process->readAllStandardOutput())
.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
UserInfo current_user;
- foreach (QString key, keys) {
+ foreach(QString key, keys) {
QStringList props = key.split(':');
if (props.size() < 10)
continue;
@@ -1242,7 +1242,7 @@ void MainWindow::on_usersButton_clicked() {
return;
}
QList<UserInfo> secret_keys = listKeys("", true);
- foreach (const UserInfo &sec, secret_keys) {
+ foreach(const UserInfo &sec, secret_keys) {
for (QList<UserInfo>::iterator it = users.begin(); it != users.end(); ++it)
if (sec.key_id == it->key_id)
it->have_secret = true;
@@ -1256,7 +1256,7 @@ void MainWindow::on_usersButton_clicked() {
getRecipientString(dir.isEmpty() ? "" : dir, " ", &count);
if (!recipients.isEmpty())
selected_users = listKeys(recipients);
- foreach (const UserInfo &sel, selected_users) {
+ foreach(const UserInfo &sel, selected_users) {
for (QList<UserInfo>::iterator it = users.begin(); it != users.end(); ++it)
if (sel.key_id == it->key_id)
it->enabled = true;
@@ -1264,7 +1264,7 @@ void MainWindow::on_usersButton_clicked() {
if (count > selected_users.size()) {
// Some keys seem missing from keyring, add them separately
QStringList recipients = getRecipientList(dir.isEmpty() ? "" : dir);
- foreach (const QString recipient, recipients) {
+ foreach(const QString recipient, recipients) {
if (listKeys(recipient).size() < 1) {
UserInfo i;
i.enabled = true;
@@ -1295,7 +1295,7 @@ void MainWindow::on_usersButton_clicked() {
return;
}
bool secret_selected = false;
- foreach (const UserInfo &user, users) {
+ foreach(const UserInfo &user, users) {
if (user.enabled) {
gpgId.write((user.key_id + "\n").toUtf8());
secret_selected |= user.have_secret;
@@ -1379,7 +1379,7 @@ QStringList MainWindow::getSecretKeys() {
if (keys.size() == 0)
return names;
- foreach (const UserInfo &sec, keys)
+ foreach(const UserInfo &sec, keys)
names << sec.name;
return names;
@@ -1418,7 +1418,7 @@ void MainWindow::updateProfileBox() {
}
}
int index = ui->profileBox->findText(profile);
- if (index != -1) // -1 for not found
+ if (index != -1) // -1 for not found
ui->profileBox->setCurrentIndex(index);
}
@@ -1598,7 +1598,7 @@ void MainWindow::addFolder() {
newdir.prepend(dir);
// qDebug() << newdir;
QDir().mkdir(newdir);
- // TODO add to git?
+ // TODO(annejan) add to git?
}
/**
@@ -1608,7 +1608,7 @@ void MainWindow::editPassword() {
if (useGit && autoPull)
on_updateButton_clicked();
waitFor(30);
- // TODO move to editbutton stuff possibly?
+ // TODO(annejan) move to editbutton stuff possibly?
currentDir = getDir(ui->treeView->currentIndex(), false);
lastDecrypt = "Could not decrypt";
QString file = getFile(ui->treeView->currentIndex(), usePass);
diff --git a/mainwindow.h b/mainwindow.h
index 6b978a63..8afb9ff9 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -1,5 +1,5 @@
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
+#ifndef MAINWINDOW_H_
+#define MAINWINDOW_H_
#include <QMainWindow>
#include <QTreeView>
diff --git a/passworddialog.h b/passworddialog.h
index eeebdceb..3267cf40 100644
--- a/passworddialog.h
+++ b/passworddialog.h
@@ -1,5 +1,5 @@
-#ifndef PASSWORDDIALOG_H
-#define PASSWORDDIALOG_H
+#ifndef PASSWORDDIALOG_H_
+#define PASSWORDDIALOG_H_
#include <QDialog>
#include "mainwindow.h"
diff --git a/progressindicator.cpp b/qprogressindicator.cpp
index d1bb5fa2..a626a780 100644
--- a/progressindicator.cpp
+++ b/qprogressindicator.cpp
@@ -1,5 +1,4 @@
-#include "progressindicator.h"
-
+#include "qprogressindicator.h"
#include <QPainter>
QProgressIndicator::QProgressIndicator(QWidget *parent)
diff --git a/progressindicator.h b/qprogressindicator.h
index 1af289c1..5856b862 100644
--- a/progressindicator.h
+++ b/qprogressindicator.h
@@ -1,5 +1,5 @@
-#ifndef QPROGRESSINDICATOR_H
-#define QPROGRESSINDICATOR_H
+#ifndef QPROGRESSINDICATOR_H_
+#define QPROGRESSINDICATOR_H_
#include <QWidget>
#include <QColor>
diff --git a/qtpass.pro b/qtpass.pro
index fbf2c547..152815ed 100644
--- a/qtpass.pro
+++ b/qtpass.pro
@@ -27,9 +27,9 @@ SOURCES += main.cpp\
util.cpp \
usersdialog.cpp \
keygendialog.cpp \
- progressindicator.cpp \
trayicon.cpp \
- passworddialog.cpp
+ passworddialog.cpp \
+ qprogressindicator.cpp
HEADERS += mainwindow.h \
configdialog.h \
@@ -37,9 +37,9 @@ HEADERS += mainwindow.h \
util.h \
usersdialog.h \
keygendialog.h \
- progressindicator.h \
trayicon.h \
- passworddialog.h
+ passworddialog.h \
+ qprogressindicator.h
FORMS += mainwindow.ui \
configdialog.ui \
diff --git a/singleapplication.h b/singleapplication.h
index 6f9802c3..ad642446 100644
--- a/singleapplication.h
+++ b/singleapplication.h
@@ -1,5 +1,5 @@
-#ifndef SINGLEAPPLICATION_H
-#define SINGLEAPPLICATION_H
+#ifndef SINGLEAPPLICATION_H_
+#define SINGLEAPPLICATION_H_
#include <QApplication>
#include <QSharedMemory>
diff --git a/storemodel.h b/storemodel.h
index 7b3bc0a3..c489c0e8 100644
--- a/storemodel.h
+++ b/storemodel.h
@@ -1,5 +1,5 @@
-#ifndef STOREMODEL_H
-#define STOREMODEL_H
+#ifndef STOREMODEL_H_
+#define STOREMODEL_H_
#include <QSortFilterProxyModel>
#include <QFileSystemModel>
diff --git a/trayicon.h b/trayicon.h
index ab2ed84e..4eaacf0e 100644
--- a/trayicon.h
+++ b/trayicon.h
@@ -1,5 +1,5 @@
-#ifndef TRAYICON_H
-#define TRAYICON_H
+#ifndef TRAYICON_H_
+#define TRAYICON_H_
#include <QApplication>
#include <QMenu>
diff --git a/usersdialog.cpp b/usersdialog.cpp
index e6691e8e..424524ec 100644
--- a/usersdialog.cpp
+++ b/usersdialog.cpp
@@ -1,7 +1,7 @@
#include "usersdialog.h"
-#include "ui_usersdialog.h"
#include <QRegExp>
#include <QDebug>
+#include "ui_usersdialog.h"
UsersDialog::UsersDialog(QWidget *parent)
: QDialog(parent), ui(new Ui::UsersDialog) {
@@ -89,7 +89,7 @@ void UsersDialog::on_lineEdit_textChanged(const QString &filter) {
}
void UsersDialog::closeEvent(QCloseEvent *event) {
- // TODO save window size or somethign
+ // TODO(annejan) save window size or somethign
event->accept();
}
diff --git a/usersdialog.h b/usersdialog.h
index 2088265a..a88d38bd 100644
--- a/usersdialog.h
+++ b/usersdialog.h
@@ -1,5 +1,5 @@
-#ifndef USERSDIALOG_H
-#define USERSDIALOG_H
+#ifndef USERSDIALOG_H_
+#define USERSDIALOG_H_
#include <QDialog>
#include <QList>
@@ -36,7 +36,7 @@ class UsersDialog : public QDialog {
protected:
void closeEvent(QCloseEvent *event);
- private slots:
+private slots:
void itemChange(QListWidgetItem *item);
void on_clearButton_clicked();
void on_lineEdit_textChanged(const QString &filter);
diff --git a/util.cpp b/util.cpp
index 8fdfee98..bc9b6cef 100644
--- a/util.cpp
+++ b/util.cpp
@@ -18,7 +18,7 @@ void Util::initialiseEnvironment() {
if (!_envInitialised) {
_env = QProcessEnvironment::systemEnvironment();
#ifdef __APPLE__
- // TODO checks here
+ // TODO(annejan) checks here
QString path = _env.value("PATH");
if (!path.contains("/usr/local/MacGPG2/bin") &&
@@ -84,7 +84,7 @@ QString Util::findBinaryInPath(QString binary) {
}
#endif
- foreach (QString entry, entries) {
+ foreach(QString entry, entries) {
QScopedPointer<QFileInfo> qfi(new QFileInfo(entry.append(binary)));
#ifdef Q_OS_WIN
if (!qfi->exists())
diff --git a/util.h b/util.h
index 488800c2..e3ec61bc 100644
--- a/util.h
+++ b/util.h
@@ -1,5 +1,5 @@
-#ifndef UTIL_H
-#define UTIL_H
+#ifndef UTIL_H_
+#define UTIL_H_
#include <QString>
#include <QProcessEnvironment>