summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configdialog.cpp14
-rw-r--r--debughelper.h9
-rw-r--r--deselectabletreeview.h1
-rw-r--r--imitatepass.cpp6
-rw-r--r--keygendialog.cpp2
-rw-r--r--mainwindow.cpp25
-rw-r--r--pass.cpp15
-rw-r--r--passworddialog.cpp2
-rw-r--r--qtpass.pro3
-rw-r--r--singleapplication.cpp9
-rw-r--r--usersdialog.cpp2
-rw-r--r--util.cpp4
12 files changed, 53 insertions, 39 deletions
diff --git a/configdialog.cpp b/configdialog.cpp
index 76e81eb4..1ae22491 100644
--- a/configdialog.cpp
+++ b/configdialog.cpp
@@ -3,7 +3,7 @@
#include "mainwindow.h"
#include "qtpasssettings.h"
#include "ui_configdialog.h"
-#include <QDebug>
+#include "debughelper.h"
#include <QDir>
#include <QMessageBox>
#ifdef Q_OS_WIN
@@ -419,7 +419,7 @@ void ConfigDialog::genKey(QString batch, QDialog *dialog) {
*/
void ConfigDialog::setProfiles(QHash<QString, QString> profiles,
QString profile) {
- // qDebug() << profiles;
+ // dbg()<< profiles;
if (profiles.contains("")) {
profiles.remove("");
// remove weird "" key value pairs
@@ -433,7 +433,7 @@ void ConfigDialog::setProfiles(QHash<QString, QString> profiles,
if (!i.value().isEmpty() && !i.key().isEmpty()) {
ui->profileTable->setItem(n, 0, new QTableWidgetItem(i.key()));
ui->profileTable->setItem(n, 1, new QTableWidgetItem(i.value()));
- // qDebug() << "naam:" + i.key();
+ // dbg()<< "naam:" + i.key();
if (i.key() == profile)
ui->profileTable->selectRow(n);
}
@@ -453,7 +453,7 @@ QHash<QString, QString> ConfigDialog::getProfiles() {
if (0 != pathItem) {
QTableWidgetItem *item = ui->profileTable->item(i, 0);
if (item == 0) {
- qDebug() << "empty name, should fix in frontend";
+ dbg()<< "empty name, should fix in frontend";
continue;
}
profiles.insert(item->text(), pathItem->text());
@@ -528,7 +528,7 @@ void ConfigDialog::wizard() {
}
QStringList names = mainWindow->getSecretKeys();
- qDebug() << names;
+ dbg()<< names;
if (QFile(gpg).exists() && names.empty()) {
KeygenDialog d(this);
if (!d.exec())
@@ -556,7 +556,7 @@ void ConfigDialog::wizard() {
}
if (!QFile(QDir(passStore).filePath(".gpg-id")).exists()) {
- qDebug() << ".gpg-id file does not exist";
+ dbg()<< ".gpg-id file does not exist";
if (!clean) {
criticalMessage(tr("Password store not initialised"),
@@ -572,7 +572,7 @@ void ConfigDialog::wizard() {
passStore = ui->storePath->text();
}
if (!QFile(passStore + ".gpg-id").exists()) {
- qDebug() << ".gpg-id file still does not exist :/";
+ dbg()<< ".gpg-id file still does not exist :/";
// appears not to be store
// init yes / no ?
mainWindow->userDialog(passStore);
diff --git a/debughelper.h b/debughelper.h
new file mode 100644
index 00000000..be64a422
--- /dev/null
+++ b/debughelper.h
@@ -0,0 +1,9 @@
+#ifndef DEBUG_H
+#define DEBUG_H
+
+#include <QDebug>
+
+// this is soooooo ugly...
+#define dbg() qDebug() << __FILE__ ":" << __LINE__
+
+#endif // DEBUG_H
diff --git a/deselectabletreeview.h b/deselectabletreeview.h
index fa4f6481..d8339d15 100644
--- a/deselectabletreeview.h
+++ b/deselectabletreeview.h
@@ -1,6 +1,5 @@
#ifndef DESELECTABLETREEVIEW_H
#define DESELECTABLETREEVIEW_H
-#include "QDebug"
#include "QMouseEvent"
#include "QTreeView"
#include "mainwindow.h"
diff --git a/imitatepass.cpp b/imitatepass.cpp
index 4e39bba8..ace52ff7 100644
--- a/imitatepass.cpp
+++ b/imitatepass.cpp
@@ -229,8 +229,8 @@ void ImitatePass::reencryptPath(QString dir) {
}
actualKeys.sort();
if (actualKeys != gpgId) {
- // qDebug() << actualKeys << gpgId << getRecipientList(fileName);
- qDebug() << "reencrypt " << fileName << " for " << gpgId;
+ // dbg()<< actualKeys << gpgId << getRecipientList(fileName);
+ dbg()<< "reencrypt " << fileName << " for " << gpgId;
QString local_lastDecrypt = "Could not decrypt";
emit lastDecrypt(local_lastDecrypt);
executeWrapper(QtPassSettings::getGpgExecutable(),
@@ -272,7 +272,7 @@ void ImitatePass::reencryptPath(QString dir) {
}
} else {
- qDebug() << "Decrypt error on re-encrypt";
+ dbg()<< "Decrypt error on re-encrypt";
}
}
}
diff --git a/keygendialog.cpp b/keygendialog.cpp
index ed973fcb..d1c16a74 100644
--- a/keygendialog.cpp
+++ b/keygendialog.cpp
@@ -1,7 +1,7 @@
#include "keygendialog.h"
#include "qprogressindicator.h"
#include "ui_keygendialog.h"
-#include <QDebug>
+#include "debughelper.h"
#include <QMessageBox>
/**
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 24925f4c..92deb47c 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -1,7 +1,7 @@
#include "mainwindow.h"
+#include "debughelper.h"
#include <QClipboard>
#include <QCloseEvent>
-#include <QDebug>
#include <QFileInfo>
#include <QInputDialog>
#include <QLabel>
@@ -280,11 +280,11 @@ bool MainWindow::checkConfig() {
destroyTrayIcon();
}
- // qDebug() << version;
+ // dbg()<< version;
// Config updates
if (version.isEmpty()) {
- qDebug() << "assuming fresh install";
+ dbg() << "assuming fresh install";
if (QtPassSettings::getAutoclearSeconds() < 5)
QtPassSettings::setAutoclearSeconds(10);
if (QtPassSettings::getAutoclearPanelSeconds() < 5)
@@ -296,7 +296,7 @@ bool MainWindow::checkConfig() {
QtPassSettings::setPassTemplate("login\nurl");
} else {
// QStringList ver = version.split(".");
- // qDebug() << ver;
+ // dbg()<< ver;
// if (ver[0] == "0" && ver[1] == "8") {
//// upgrade to 0.9
// }
@@ -644,7 +644,7 @@ void MainWindow::deselect() {
* @brief MainWindow::executePassGitInit git init wrapper
*/
void MainWindow::executePassGitInit() {
- qDebug() << "Pass git init called";
+ dbg() << "Pass git init called";
pass->GitInit();
}
@@ -901,7 +901,7 @@ void MainWindow::on_lineEdit_textChanged(const QString &arg1) {
* Select the first possible file in the tree
*/
void MainWindow::on_lineEdit_returnPressed() {
- qDebug() << "on_lineEdit_returnPressed";
+ dbg() << "on_lineEdit_returnPressed";
selectFirstFile();
on_treeView_clicked(ui->treeView->currentIndex());
}
@@ -1201,7 +1201,7 @@ void MainWindow::generateKeyPair(QString batch, QDialog *keygenWindow) {
* select a more appropriate one to view too
*/
void MainWindow::updateProfileBox() {
- // qDebug() << profiles.size();
+ // dbg()<< profiles.size();
if (QtPassSettings::getProfiles().isEmpty()) {
ui->profileBox->hide();
} else {
@@ -1248,16 +1248,16 @@ void MainWindow::on_profileBox_currentIndexChanged(QString name) {
*/
void MainWindow::initTrayIcon() {
if (tray != NULL) {
- qDebug() << "Creating tray icon again?";
+ dbg() << "Creating tray icon again?";
return;
}
if (QSystemTrayIcon::isSystemTrayAvailable() == true) {
// Setup tray icon
this->tray = new TrayIcon(this);
if (tray == NULL)
- qDebug() << "Allocating tray icon failed.";
+ dbg() << "Allocating tray icon failed.";
} else {
- qDebug() << "No tray icon for this OS possibly also not show options?";
+ dbg() << "No tray icon for this OS possibly also not show options?";
}
}
@@ -1266,7 +1266,7 @@ void MainWindow::initTrayIcon() {
*/
void MainWindow::destroyTrayIcon() {
if (tray == NULL) {
- qDebug() << "Destroy non existing tray icon?";
+ dbg() << "Destroy non existing tray icon?";
return;
}
delete this->tray;
@@ -1411,9 +1411,8 @@ void MainWindow::addFolder() {
if (!ok || newdir.isEmpty())
return;
newdir.prepend(dir);
- // qDebug() << newdir;
+ // dbg()<< newdir;
QDir().mkdir(newdir);
- // TODO(annejan) add to git?
}
/**
diff --git a/pass.cpp b/pass.cpp
index 990f9c32..abbed7d4 100644
--- a/pass.cpp
+++ b/pass.cpp
@@ -1,4 +1,5 @@
#include "pass.h"
+#include "debughelper.h"
#include "qtpasssettings.h"
#include "util.h"
#include <QTextCodec>
@@ -232,10 +233,12 @@ void Pass::updateEnv() {
QStringList store = env.filter("PASSWORD_STORE_DIR");
// put PASSWORD_STORE_DIR in env
if (store.isEmpty()) {
- // qDebug() << "Added PASSWORD_STORE_DIR";
+ // dbg()<< "Added
+ // PASSWORD_STORE_DIR";
env.append("PASSWORD_STORE_DIR=" + QtPassSettings::getPassStore());
} else {
- // qDebug() << "Update PASSWORD_STORE_DIR with " + passStore;
+ // dbg()<< "Update
+ // PASSWORD_STORE_DIR with " + passStore;
env.replaceInStrings(store.first(), "PASSWORD_STORE_DIR=" +
QtPassSettings::getPassStore());
}
@@ -245,14 +248,16 @@ void Pass::updateEnv() {
* @brief Pass::resetPasswordStoreDir probably temporary helper
*/
void Pass::resetPasswordStoreDir() {
- // qDebug() << env;
+ // dbg()<< env;
QStringList store = env.filter("PASSWORD_STORE_DIR");
// put PASSWORD_STORE_DIR in env
if (store.isEmpty()) {
- // qDebug() << "Added PASSWORD_STORE_DIR";
+ // dbg()<< "Added
+ // PASSWORD_STORE_DIR";
env.append("PASSWORD_STORE_DIR=" + QtPassSettings::getPassStore());
} else {
- // qDebug() << "Update PASSWORD_STORE_DIR";
+ // dbg()<< "Update
+ // PASSWORD_STORE_DIR";
env.replaceInStrings(store.first(), "PASSWORD_STORE_DIR=" +
QtPassSettings::getPassStore());
}
diff --git a/passworddialog.cpp b/passworddialog.cpp
index fa00fdb7..ed79f900 100644
--- a/passworddialog.cpp
+++ b/passworddialog.cpp
@@ -1,6 +1,6 @@
#include "passworddialog.h"
+#include "debughelper.h"
#include "ui_passworddialog.h"
-#include <QDebug>
#include <QLabel>
#include <QLineEdit>
diff --git a/qtpass.pro b/qtpass.pro
index 2e0812f1..fdae1205 100644
--- a/qtpass.pro
+++ b/qtpass.pro
@@ -56,7 +56,8 @@ HEADERS += mainwindow.h \
pass.h \
realpass.h \
imitatepass.h \
- datahelpers.h
+ datahelpers.h \
+ debughelper.h
FORMS += mainwindow.ui \
configdialog.ui \
diff --git a/singleapplication.cpp b/singleapplication.cpp
index 58d82176..a156ca50 100644
--- a/singleapplication.cpp
+++ b/singleapplication.cpp
@@ -1,4 +1,5 @@
#include "singleapplication.h"
+#include "debughelper.h"
#include <QLocalSocket>
/**
@@ -18,7 +19,7 @@ SingleApplication::SingleApplication(int &argc, char *argv[],
_isRunning = false;
// create shared memory.
if (!sharedMemory.create(1)) {
- qDebug("Unable to create single instance.");
+ dbg() << "Unable to create single instance.";
return;
}
// create local server and listen to incomming messages from other
@@ -39,7 +40,7 @@ SingleApplication::SingleApplication(int &argc, char *argv[],
void SingleApplication::receiveMessage() {
QLocalSocket *localSocket = localServer->nextPendingConnection();
if (!localSocket->waitForReadyRead(timeout)) {
- qDebug() << localSocket->errorString().toLatin1();
+ dbg() << localSocket->errorString().toLatin1();
return;
}
QByteArray byteArray = localSocket->readAll();
@@ -68,12 +69,12 @@ bool SingleApplication::sendMessage(const QString &message) {
QLocalSocket localSocket(this);
localSocket.connectToServer(_uniqueKey, QIODevice::WriteOnly);
if (!localSocket.waitForConnected(timeout)) {
- qDebug() << localSocket.errorString().toLatin1();
+ dbg() << localSocket.errorString().toLatin1();
return false;
}
localSocket.write(message.toUtf8());
if (!localSocket.waitForBytesWritten(timeout)) {
- qDebug() << localSocket.errorString().toLatin1();
+ dbg() << localSocket.errorString().toLatin1();
return false;
}
localSocket.disconnectFromServer();
diff --git a/usersdialog.cpp b/usersdialog.cpp
index 1259a435..97090713 100644
--- a/usersdialog.cpp
+++ b/usersdialog.cpp
@@ -1,6 +1,6 @@
#include "usersdialog.h"
#include "ui_usersdialog.h"
-#include <QDebug>
+#include "debughelper.h"
#include <QRegExp>
/**
diff --git a/util.cpp b/util.cpp
index 04be5303..4bf8c846 100644
--- a/util.cpp
+++ b/util.cpp
@@ -1,5 +1,5 @@
#include "util.h"
-#include <QDebug>
+#include "debughelper.h"
#include <QDir>
#include <QFileInfo>
#include <QProcessEnvironment>
@@ -101,7 +101,7 @@ QString Util::findBinaryInPath(QString binary) {
qfi.reset(new QFileInfo(entry.append(".exe")));
#endif
- qDebug() << entry;
+ dbg()<< entry;
if (!qfi->isExecutable())
continue;