summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configdialog.cpp27
-rw-r--r--configdialog.h14
-rw-r--r--keygendialog.cpp12
-rw-r--r--keygendialog.h14
-rw-r--r--main.cpp2
-rw-r--r--mainwindow.cpp192
-rw-r--r--mainwindow.h21
-rw-r--r--passworddialog.cpp14
-rw-r--r--passworddialog.h10
-rw-r--r--qprogressindicator.h12
-rw-r--r--singleapplication.h12
-rw-r--r--storemodel.h8
-rw-r--r--trayicon.cpp2
-rw-r--r--trayicon.h14
-rw-r--r--usersdialog.cpp20
-rw-r--r--usersdialog.h16
-rw-r--r--util.cpp4
-rw-r--r--util.h8
18 files changed, 200 insertions, 202 deletions
diff --git a/configdialog.cpp b/configdialog.cpp
index dcef8dc9..923e6825 100644
--- a/configdialog.cpp
+++ b/configdialog.cpp
@@ -1,10 +1,10 @@
#include "configdialog.h"
-#include "ui_configdialog.h"
-#include "mainwindow.h"
#include "keygendialog.h"
+#include "mainwindow.h"
+#include "ui_configdialog.h"
#include <QDebug>
-#include <QMessageBox>
#include <QDir>
+#include <QMessageBox>
#ifdef Q_OS_WIN
#include <windows.h>
#endif
@@ -203,7 +203,7 @@ void ConfigDialog::on_toolButtonPass_clicked() {
*/
void ConfigDialog::on_toolButtonStore_clicked() {
QString store = selectFolder();
- if (!store.isEmpty()) // TODO(annejan) call check
+ if (!store.isEmpty()) // TODO(annejan) call check
ui->storePath->setText(store);
}
@@ -451,7 +451,7 @@ void ConfigDialog::on_addButton_clicked() {
* @brief ConfigDialog::on_deleteButton_clicked
*/
void ConfigDialog::on_deleteButton_clicked() {
- QSet<int> selectedRows; // we use a set to prevent doubles
+ QSet<int> selectedRows; // we use a set to prevent doubles
QList<QTableWidgetItem *> itemList = ui->profileTable->selectedItems();
if (itemList.count() == 0) {
QMessageBox::warning(this, tr("No profile selected"),
@@ -459,13 +459,13 @@ void ConfigDialog::on_deleteButton_clicked() {
return;
}
QTableWidgetItem *item;
- foreach(item, itemList)
+ foreach (item, itemList)
selectedRows.insert(item->row());
// get a list, and sort it big to small
QList<int> rows = selectedRows.toList();
qSort(rows.begin(), rows.end());
// now actually do the removing:
- foreach(int row, rows)
+ foreach (int row, rows)
ui->profileTable->removeRow(row);
if (ui->profileTable->rowCount() < 1)
ui->deleteButton->setEnabled(false);
@@ -727,11 +727,14 @@ void ConfigDialog::setPasswordChars(QString pwChars) {
*/
bool ConfigDialog::usePwgen() { return ui->checkBoxUsePwgen->isChecked(); }
-bool ConfigDialog::avoidCapitals() { return ui->checkBoxAvoidCapitals->isChecked(); }
-bool ConfigDialog::avoidNumbers() { return ui->checkBoxAvoidNumbers->isChecked(); }
+bool ConfigDialog::avoidCapitals() {
+ return ui->checkBoxAvoidCapitals->isChecked();
+}
+bool ConfigDialog::avoidNumbers() {
+ return ui->checkBoxAvoidNumbers->isChecked();
+}
bool ConfigDialog::lessRandom() { return ui->checkBoxLessRandom->isChecked(); }
-
/**
* @brief ConfigDialog::useSymbols
* @return
@@ -861,7 +864,7 @@ void ConfigDialog::templateAllFields(bool templateAll) {
* @param alwaysOnTop
*/
void ConfigDialog::alwaysOnTop(bool alwaysOnTop) {
- ui->checkBoxAlwaysOnTop->setChecked(alwaysOnTop);
+ ui->checkBoxAlwaysOnTop->setChecked(alwaysOnTop);
}
/**
@@ -869,5 +872,5 @@ void ConfigDialog::alwaysOnTop(bool alwaysOnTop) {
* @return
*/
bool ConfigDialog::alwaysOnTop() {
- return ui->checkBoxAlwaysOnTop->isChecked();
+ return ui->checkBoxAlwaysOnTop->isChecked();
}
diff --git a/configdialog.h b/configdialog.h
index cd15d080..b48386ca 100644
--- a/configdialog.h
+++ b/configdialog.h
@@ -1,11 +1,11 @@
#ifndef CONFIGDIALOG_H_
#define CONFIGDIALOG_H_
+#include "mainwindow.h"
+#include <QCloseEvent>
#include <QDialog>
#include <QFileDialog>
#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);
@@ -86,10 +86,10 @@ class ConfigDialog : public QDialog {
bool alwaysOnTop();
void alwaysOnTop(bool alwaysOnTop);
- protected:
+protected:
void closeEvent(QCloseEvent *event);
- private slots:
+private slots:
void on_radioButtonNative_clicked();
void on_radioButtonPass_clicked();
void on_toolButtonGit_clicked();
@@ -107,7 +107,7 @@ class ConfigDialog : public QDialog {
void on_checkBoxUsePwgen_clicked();
void on_checkBoxUseTemplate_clicked();
- private:
+private:
QScopedPointer<Ui::ConfigDialog> ui;
void setGroupBoxState();
QString selectExecutable();
@@ -118,4 +118,4 @@ class ConfigDialog : public QDialog {
MainWindow *mainWindow;
};
-#endif // CONFIGDIALOG_H_
+#endif // CONFIGDIALOG_H_
diff --git a/keygendialog.cpp b/keygendialog.cpp
index 4fe2ad3f..0fcb302e 100644
--- a/keygendialog.cpp
+++ b/keygendialog.cpp
@@ -1,8 +1,8 @@
#include "keygendialog.h"
+#include "qprogressindicator.h"
+#include "ui_keygendialog.h"
#include <QDebug>
#include <QMessageBox>
-#include "ui_keygendialog.h"
-#include "qprogressindicator.h"
KeygenDialog::KeygenDialog(ConfigDialog *parent)
: QDialog(parent), ui(new Ui::KeygenDialog) {
@@ -56,7 +56,7 @@ void KeygenDialog::replace(QString key, QString value) {
QStringList clear;
QString expert = ui->plainTextEdit->toPlainText();
QStringList lines = expert.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
- foreach(QString line, lines) {
+ foreach (QString line, lines) {
line.replace(QRegExp(key + ":.*"), key + ": " + value);
if (key == "Passphrase")
line.replace("%no-protection", "Passphrase: " + value);
@@ -73,7 +73,7 @@ void KeygenDialog::no_protection(bool enable) {
QStringList clear;
QString expert = ui->plainTextEdit->toPlainText();
QStringList lines = expert.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
- foreach(QString line, lines) {
+ foreach (QString line, lines) {
bool remove = false;
if (!enable) {
if (line.indexOf("%no-protection") == 0)
@@ -93,7 +93,7 @@ void KeygenDialog::no_protection(bool enable) {
* @param r
*/
void KeygenDialog::done(int r) {
- if (QDialog::Accepted == r) { // ok was pressed
+ if (QDialog::Accepted == r) { // ok was pressed
ui->widget->setEnabled(false);
ui->buttonBox->setEnabled(false);
ui->checkBox->setEnabled(false);
@@ -116,7 +116,7 @@ void KeygenDialog::done(int r) {
this->show();
dialog->genKey(ui->plainTextEdit->toPlainText(), this);
- } else { // cancel, close or exc was pressed
+ } else { // cancel, close or exc was pressed
QDialog::done(r);
return;
}
diff --git a/keygendialog.h b/keygendialog.h
index 19d996ce..406cd6d2 100644
--- a/keygendialog.h
+++ b/keygendialog.h
@@ -1,9 +1,9 @@
#ifndef KEYGENDIALOG_H_
#define KEYGENDIALOG_H_
-#include <QDialog>
-#include <QCloseEvent>
#include "configdialog.h"
+#include <QCloseEvent>
+#include <QDialog>
namespace Ui {
class KeygenDialog;
@@ -12,21 +12,21 @@ class KeygenDialog;
class KeygenDialog : public QDialog {
Q_OBJECT
- public:
+public:
explicit KeygenDialog(ConfigDialog *parent = 0);
~KeygenDialog();
- protected:
+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);
void on_email_textChanged(const QString &arg1);
void on_name_textChanged(const QString &arg1);
- private:
+private:
Ui::KeygenDialog *ui;
void replace(QString, QString);
void done(int r);
@@ -34,4 +34,4 @@ class KeygenDialog : public QDialog {
ConfigDialog *dialog;
};
-#endif // KEYGENDIALOG_H_
+#endif // KEYGENDIALOG_H_
diff --git a/main.cpp b/main.cpp
index d65a9e37..9c9c065b 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,6 +1,6 @@
+#include "mainwindow.h"
#include <QApplication>
#include <QTranslator>
-#include "mainwindow.h"
int main(int argc, char *argv[]) {
// check for stupid apple psid or whatever flag
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 18de5fef..93196966 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -1,13 +1,13 @@
#include "mainwindow.h"
#include <QClipboard>
+#include <QCloseEvent>
#include <QDebug>
+#include <QFileInfo>
#include <QInputDialog>
+#include <QLabel>
#include <QMessageBox>
-#include <QTimer>
-#include <QFileInfo>
#include <QQueue>
-#include <QCloseEvent>
-#include <QLabel>
+#include <QTimer>
#ifdef Q_OS_WIN
#define WIN32_LEAN_AND_MEAN /*_KILLING_MACHINE*/
#define WIN32_EXTRA_LEAN
@@ -15,11 +15,11 @@
#include <winnetwk.h>
#undef DELETE
#endif
-#include "ui_mainwindow.h"
#include "configdialog.h"
-#include "usersdialog.h"
#include "keygendialog.h"
#include "passworddialog.h"
+#include "ui_mainwindow.h"
+#include "usersdialog.h"
#include "util.h"
/**
@@ -61,7 +61,8 @@ MainWindow::MainWindow(QWidget *parent)
ui->addButton->addAction(actionAddPassword);
ui->addButton->addAction(actionAddFolder);
- connect(actionAddPassword, SIGNAL(triggered()), this, SLOT(on_addButton_clicked()));
+ connect(actionAddPassword, SIGNAL(triggered()), this,
+ SLOT(on_addButton_clicked()));
connect(actionAddFolder, SIGNAL(triggered()), this, SLOT(addFolder()));
qsrand(QDateTime::currentDateTime().toTime_t());
@@ -106,20 +107,16 @@ QSettings &MainWindow::getSettings() {
return *settings;
}
-void MainWindow::changeEvent(QEvent *event)
-{
- QWidget::changeEvent(event);
- if (event->type() == QEvent::ActivationChange)
- {
- if(this->isActiveWindow())
- {
- ui->lineEdit->selectAll();
- ui->lineEdit->setFocus();
- }
+void MainWindow::changeEvent(QEvent *event) {
+ QWidget::changeEvent(event);
+ if (event->type() == QEvent::ActivationChange) {
+ if (this->isActiveWindow()) {
+ ui->lineEdit->selectAll();
+ ui->lineEdit->setFocus();
}
+ }
}
-
void MainWindow::mountWebDav() {
#ifdef Q_OS_WIN
char dst[20] = {0};
@@ -254,7 +251,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();
@@ -273,9 +270,9 @@ bool MainWindow::checkConfig() {
alwaysOnTop = settings.value("alwaysOnTop").toBool();
if (alwaysOnTop) {
- Qt::WindowFlags flags = windowFlags();
- this->setWindowFlags(flags | Qt::WindowStaysOnTopHint);
- this->show();
+ Qt::WindowFlags flags = windowFlags();
+ this->setWindowFlags(flags | Qt::WindowStaysOnTopHint);
+ this->show();
}
autoPull = settings.value("autoPull").toBool();
@@ -393,11 +390,13 @@ bool MainWindow::checkConfig() {
if (!useGit || (gitExecutable.isEmpty() && passExecutable.isEmpty())) {
ui->pushButton->hide();
ui->updateButton->hide();
- ui->horizontalSpacer->changeSize(0, 20, QSizePolicy::Maximum, QSizePolicy::Minimum);
+ ui->horizontalSpacer->changeSize(0, 20, QSizePolicy::Maximum,
+ QSizePolicy::Minimum);
} else {
ui->pushButton->show();
ui->updateButton->show();
- ui->horizontalSpacer->changeSize(24, 24, QSizePolicy::Minimum, QSizePolicy::Minimum);
+ ui->horizontalSpacer->changeSize(24, 24, QSizePolicy::Minimum,
+ QSizePolicy::Minimum);
}
startupPhase = false;
@@ -447,7 +446,7 @@ void MainWindow::config() {
d->autoPush(autoPush);
d->alwaysOnTop(alwaysOnTop);
if (startupPhase)
- d->wizard(); // does shit
+ d->wizard(); // does shit
if (d->exec()) {
if (d->result() == QDialog::Accepted) {
passExecutable = d->getPassPath();
@@ -530,12 +529,12 @@ void MainWindow::config() {
settings.setValue("alwaysOnTop", alwaysOnTop ? "true" : "false");
if (alwaysOnTop) {
- Qt::WindowFlags flags = windowFlags();
- this->setWindowFlags(flags | Qt::WindowStaysOnTopHint);
- this->show();
+ Qt::WindowFlags flags = windowFlags();
+ this->setWindowFlags(flags | Qt::WindowStaysOnTopHint);
+ this->show();
} else {
- this->setWindowFlags(Qt::Window);
- this->show();
+ this->setWindowFlags(Qt::Window);
+ this->show();
}
if (!profiles.isEmpty()) {
@@ -567,13 +566,15 @@ void MainWindow::config() {
config();
updateEnv();
if (!useGit || (gitExecutable.isEmpty() && passExecutable.isEmpty())) {
- ui->pushButton->hide();
- ui->updateButton->hide();
- ui->horizontalSpacer->changeSize(0, 20, QSizePolicy::Maximum, QSizePolicy::Minimum);
+ ui->pushButton->hide();
+ ui->updateButton->hide();
+ ui->horizontalSpacer->changeSize(0, 20, QSizePolicy::Maximum,
+ QSizePolicy::Minimum);
} else {
- ui->pushButton->show();
- ui->updateButton->show();
- ui->horizontalSpacer->changeSize(24, 24, QSizePolicy::Minimum, QSizePolicy::Minimum);
+ ui->pushButton->show();
+ ui->updateButton->show();
+ ui->horizontalSpacer->changeSize(24, 24, QSizePolicy::Minimum,
+ QSizePolicy::Minimum);
}
if (useTrayIcon && tray == NULL)
initTrayIcon();
@@ -662,7 +663,7 @@ void MainWindow::on_treeView_clicked(const QModelIndex &index) {
* @param index
*/
void MainWindow::on_treeView_doubleClicked(const QModelIndex &index) {
- // TODO: do nothing when clicked on folder
+ // TODO: do nothing when clicked on folder
QFileInfo fileOrFolder =
model.fileInfo(proxyModel.mapToSource(ui->treeView->currentIndex()));
QString file = "";
@@ -679,8 +680,6 @@ void MainWindow::on_treeView_doubleClicked(const QModelIndex &index) {
}
}
-
-
/**
* @brief MainWindow::executePass
* @param args
@@ -796,14 +795,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..
}
}
}
@@ -982,7 +981,8 @@ QString MainWindow::getGpgExecutable() { return gpgExecutable; }
void MainWindow::on_configButton_clicked() { config(); }
/**
- * @brief Executes when the string in the search box changes, collapses the TreeView
+ * @brief Executes when the string in the search box changes, collapses the
+ * TreeView
* @param arg1
*/
void MainWindow::on_lineEdit_textChanged(const QString &arg1) {
@@ -997,12 +997,11 @@ void MainWindow::on_lineEdit_textChanged(const QString &arg1) {
selectFirstFile();
}
-
/**
* @brief MainWindow::on_lineEdit_returnPressed
*/
void MainWindow::on_lineEdit_returnPressed() {
- qDebug() << "on_lineEdit_returnPressed";
+ qDebug() << "on_lineEdit_returnPressed";
selectFirstFile();
on_treeView_clicked(ui->treeView->currentIndex());
}
@@ -1080,7 +1079,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;
}
@@ -1147,20 +1146,21 @@ void MainWindow::setPassword(QString file, bool overwrite, bool isNew = false) {
*/
void MainWindow::on_addButton_clicked() {
// Check for active and selected encryption key
-// QList<UserInfo> users=listKeys();
-// UserInfo testuser;
-// bool noUserEnabled = false;
-// // Check if at least one active user is selected
-// for (int i = 0; i< users.length();i++) {
-// testuser = users[i];
-// noUserEnabled = users[i].enabled | noUserEnabled;
-// }
-// // Error if no user is enabled, so a password doesn't get saved
-// if (noUserEnabled==false) {
-// QMessageBox::critical(this, tr("Can not get key list"),
-// tr("No Key for encryption selected! \nPlease select a valid key pair in the users dialouge"));
-// return;
-// }
+ // QList<UserInfo> users=listKeys();
+ // UserInfo testuser;
+ // bool noUserEnabled = false;
+ // // Check if at least one active user is selected
+ // for (int i = 0; i< users.length();i++) {
+ // testuser = users[i];
+ // noUserEnabled = users[i].enabled | noUserEnabled;
+ // }
+ // // Error if no user is enabled, so a password doesn't get saved
+ // if (noUserEnabled==false) {
+ // QMessageBox::critical(this, tr("Can not get key list"),
+ // tr("No Key for encryption selected! \nPlease
+ // select a valid key pair in the users dialouge"));
+ // return;
+ // }
bool ok;
QString dir = getDir(ui->treeView->currentIndex(), usePass);
QString file = QInputDialog::getText(
@@ -1269,7 +1269,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)) {
@@ -1319,7 +1319,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;
@@ -1355,7 +1355,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;
@@ -1369,7 +1369,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;
@@ -1377,7 +1377,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;
@@ -1408,7 +1408,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;
@@ -1492,7 +1492,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;
@@ -1531,7 +1531,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);
}
@@ -1621,36 +1621,33 @@ void MainWindow::closeEvent(QCloseEvent *event) {
}
}
-bool MainWindow::eventFilter(QObject *obj, QEvent *event)
-{
- if (obj == ui->lineEdit && event->type() == QEvent::KeyPress)
- {
- QKeyEvent *key = static_cast<QKeyEvent *>(event);
- if(key->key() == Qt::Key_Down) {
- ui->treeView->setFocus();
- }
+bool MainWindow::eventFilter(QObject *obj, QEvent *event) {
+ if (obj == ui->lineEdit && event->type() == QEvent::KeyPress) {
+ QKeyEvent *key = static_cast<QKeyEvent *>(event);
+ if (key->key() == Qt::Key_Down) {
+ ui->treeView->setFocus();
}
- return QObject::eventFilter(obj, event);
+ }
+ return QObject::eventFilter(obj, event);
}
-void MainWindow::keyPressEvent(QKeyEvent * event) {
- switch (event->key()) {
- case Qt::Key_Delete:
- on_deleteButton_clicked();
- break;
- case Qt::Key_Return:
- case Qt::Key_Enter:
- on_treeView_clicked(ui->treeView->currentIndex());
- break;
- case Qt::Key_Escape:
- ui->lineEdit->clear();
- break;
- default:
- break;
- }
+void MainWindow::keyPressEvent(QKeyEvent *event) {
+ switch (event->key()) {
+ case Qt::Key_Delete:
+ on_deleteButton_clicked();
+ break;
+ case Qt::Key_Return:
+ case Qt::Key_Enter:
+ on_treeView_clicked(ui->treeView->currentIndex());
+ break;
+ case Qt::Key_Escape:
+ ui->lineEdit->clear();
+ break;
+ default:
+ break;
+ }
}
-
void MainWindow::on_copyPasswordButton_clicked() { copyPasswordToClipboard(); }
/**
@@ -1734,7 +1731,7 @@ void MainWindow::addFolder() {
QString newdir = QInputDialog::getText(
this, tr("New file"),
tr("New Folder: \n(Will be placed in %1 )")
- .arg(passStore + getDir(ui->treeView->currentIndex(), true)),
+ .arg(passStore + getDir(ui->treeView->currentIndex(), true)),
QLineEdit::Normal, "", &ok);
if (!ok || newdir.isEmpty())
return;
@@ -1763,7 +1760,7 @@ void MainWindow::editPassword() {
executeWrapper(gpgExecutable,
"-d --quiet --yes --no-encrypt-to --batch --use-agent \"" +
file + '"');
- process->waitForFinished(30000); // long wait (passphrase stuff)
+ process->waitForFinished(30000); // long wait (passphrase stuff)
if (process->exitStatus() == QProcess::NormalExit)
on_editButton_clicked();
}
@@ -1778,11 +1775,10 @@ QString MainWindow::generatePassword() {
if (usePwgen) {
waitFor(2);
// --secure goes first as it overrides --no-* otherwise
- QString args = QString("-1 ") +
- (lessRandom ? "" : "--secure ") +
+ QString args = QString("-1 ") + (lessRandom ? "" : "--secure ") +
(avoidCapitals ? "--no-capitalize " : "--capitalize ") +
- (avoidNumbers ? "--no-numerals " : "--numerals ") +
- (useSymbols ? "--symbols " : "") +
+ (avoidNumbers ? "--no-numerals " : "--numerals ") +
+ (useSymbols ? "--symbols " : "") +
QString::number(passwordLength);
currentAction = PWGEN;
executeWrapper(pwgenExecutable, args);
diff --git a/mainwindow.h b/mainwindow.h
index 3f642e8b..88679008 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -1,15 +1,15 @@
#ifndef MAINWINDOW_H_
#define MAINWINDOW_H_
-#include <QMainWindow>
-#include <QTreeView>
+#include "storemodel.h"
+#include "trayicon.h"
#include <QFileSystemModel>
+#include <QMainWindow>
#include <QProcess>
#include <QQueue>
#include <QSettings>
#include <QTimer>
-#include "storemodel.h"
-#include "trayicon.h"
+#include <QTreeView>
#if SINGLE_APP
#include "singleapplication.h"
#else
@@ -33,7 +33,7 @@ class MainWindow : public QMainWindow {
enum actionType { GPG, GIT, EDIT, DELETE, GPG_INTERNAL, PWGEN };
- public:
+public:
enum clipBoardType {
CLIPBOARD_NEVER = 0,
CLIPBOARD_ALWAYS = 1,
@@ -56,14 +56,13 @@ class MainWindow : public QMainWindow {
void config();
void executePassGitInit();
- protected:
+protected:
void closeEvent(QCloseEvent *event);
- void keyPressEvent(QKeyEvent * event);
+ void keyPressEvent(QKeyEvent *event);
void changeEvent(QEvent *event);
bool eventFilter(QObject *obj, QEvent *event);
-
- private slots:
+private slots:
void on_updateButton_clicked();
void on_pushButton_clicked();
void on_treeView_clicked(const QModelIndex &index);
@@ -90,7 +89,7 @@ class MainWindow : public QMainWindow {
void focusInput();
void copyPasswordToClipboard();
- private:
+private:
QAction *actionAddPassword;
QAction *actionAddFolder;
@@ -179,4 +178,4 @@ class MainWindow : public QMainWindow {
const QString &getClippedPassword();
};
-#endif // MAINWINDOW_H_
+#endif // MAINWINDOW_H_
diff --git a/passworddialog.cpp b/passworddialog.cpp
index 688bcefb..ac5230de 100644
--- a/passworddialog.cpp
+++ b/passworddialog.cpp
@@ -1,8 +1,8 @@
#include "passworddialog.h"
+#include "ui_passworddialog.h"
+#include <QDebug>
#include <QLabel>
#include <QLineEdit>
-#include <QDebug>
-#include "ui_passworddialog.h"
PasswordDialog::PasswordDialog(MainWindow *parent)
: QDialog(parent), ui(new Ui::PasswordDialog) {
@@ -43,7 +43,7 @@ void PasswordDialog::setPassword(QString password) {
if (token.startsWith(widget->objectName() + ':')) {
tokens.removeAt(j);
QString value = token.remove(0, widget->objectName().length() + 1);
- reinterpret_cast<QLineEdit*>(widget)->setText(value);
+ reinterpret_cast<QLineEdit *>(widget)->setText(value);
}
}
previous = widget;
@@ -56,7 +56,7 @@ void PasswordDialog::setPassword(QString password) {
QString field = token.left(colon);
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);
@@ -64,7 +64,7 @@ void PasswordDialog::setPassword(QString password) {
setTabOrder(previous, line);
previous = line;
tokens.removeAt(j);
- --j; // tokens.length() also got shortened by the remove..
+ --j; // tokens.length() also got shortened by the remove..
}
}
}
@@ -79,7 +79,7 @@ QString PasswordDialog::getPassword() {
if (item == NULL)
continue;
QWidget *widget = item->widget();
- QString text = reinterpret_cast<QLineEdit*>(widget)->text();
+ QString text = reinterpret_cast<QLineEdit *>(widget)->text();
if (text.isEmpty())
continue;
passFile += widget->objectName() + ":" + text + "\n";
@@ -91,7 +91,7 @@ QString PasswordDialog::getPassword() {
void PasswordDialog::setTemplate(QString rawFields) {
fields = rawFields.split('\n');
QWidget *previous = ui->checkBoxShow;
- foreach(QString field, fields) {
+ foreach (QString field, fields) {
if (field.isEmpty())
continue;
QLineEdit *line = new QLineEdit();
diff --git a/passworddialog.h b/passworddialog.h
index 3267cf40..3aedf1e2 100644
--- a/passworddialog.h
+++ b/passworddialog.h
@@ -1,8 +1,8 @@
#ifndef PASSWORDDIALOG_H_
#define PASSWORDDIALOG_H_
-#include <QDialog>
#include "mainwindow.h"
+#include <QDialog>
namespace Ui {
class PasswordDialog;
@@ -11,7 +11,7 @@ class PasswordDialog;
class PasswordDialog : public QDialog {
Q_OBJECT
- public:
+public:
explicit PasswordDialog(MainWindow *parent = 0);
~PasswordDialog();
void setPassword(QString);
@@ -21,11 +21,11 @@ class PasswordDialog : public QDialog {
void useTemplate(bool useTemplate);
void templateAll(bool templateAll);
- private slots:
+private slots:
void on_checkBoxShow_stateChanged(int arg1);
void on_createPasswordButton_clicked();
- private:
+private:
Ui::PasswordDialog *ui;
MainWindow *mainWindow;
QString passTemplate;
@@ -34,4 +34,4 @@ class PasswordDialog : public QDialog {
bool allFields;
};
-#endif // PASSWORDDIALOG_H_
+#endif // PASSWORDDIALOG_H_
diff --git a/qprogressindicator.h b/qprogressindicator.h
index 980ebd7d..b4a8b1b7 100644
--- a/qprogressindicator.h
+++ b/qprogressindicator.h
@@ -1,8 +1,8 @@
#ifndef QPROGRESSINDICATOR_H_
#define QPROGRESSINDICATOR_H_
-#include <QWidget>
#include <QColor>
+#include <QWidget>
/*!
\class QProgressIndicator
@@ -20,7 +20,7 @@ class QProgressIndicator : public QWidget {
setDisplayedWhenStopped)
Q_PROPERTY(QColor color READ color WRITE setColor)
- public:
+public:
explicit QProgressIndicator(QWidget *parent = 0);
/*! Returns the delay between animation steps.
@@ -53,7 +53,7 @@ class QProgressIndicator : public QWidget {
virtual QSize sizeHint() const;
int heightForWidth(int w) const;
- public slots:
+public slots:
/*! Starts the spin animation.
\sa stopAnimation isAnimated
*/
@@ -84,11 +84,11 @@ class QProgressIndicator : public QWidget {
*/
void setColor(const QColor &color);
- protected:
+protected:
virtual void timerEvent(QTimerEvent *event);
virtual void paintEvent(QPaintEvent *event);
- private:
+private:
int m_angle;
int m_timerId;
int m_delay;
@@ -96,4 +96,4 @@ class QProgressIndicator : public QWidget {
QColor m_color;
};
-#endif // QPROGRESSINDICATOR_H_
+#endif // QPROGRESSINDICATOR_H_
diff --git a/singleapplication.h b/singleapplication.h
index ad642446..bfe212ce 100644
--- a/singleapplication.h
+++ b/singleapplication.h
@@ -2,23 +2,23 @@</