summaryrefslogtreecommitdiffstats
path: root/src/qtpass.cpp
diff options
context:
space:
mode:
authorClaudio Maradonna <penguyman@stronzi.org>2018-07-24 01:26:22 +0200
committerClaudio Maradonna <penguyman@stronzi.org>2018-07-24 01:26:22 +0200
commit094967fb68c0350d6234cd9374bf24748d7f4133 (patch)
treed6df6569754661cce1882e5aa73873383acadbac /src/qtpass.cpp
parent9ff9147be35f498ec33e42f44a7aa66f9274524e (diff)
Now qDebug enable only if QT_DEBUG is defined. Trying to refactoring MainWindow - QtPass class should handle connecctions and business logic
Diffstat (limited to 'src/qtpass.cpp')
-rw-r--r--src/qtpass.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/qtpass.cpp b/src/qtpass.cpp
index df98de5f..ec93ed7e 100644
--- a/src/qtpass.cpp
+++ b/src/qtpass.cpp
@@ -1,13 +1,12 @@
#include "qtpass.h"
#include "mainwindow.h"
#include "qtpasssettings.h"
+#include <QApplication>
+#include <QClipboard>
#ifdef QT_DEBUG
-#include <QDebug>
+#include "debughelper.h"
#endif
-#include <QApplication>
-#include <QClipboard>
-#include <QProcess>
QtPass::QtPass() : clippedText(QString()) {
// All business logic connected to MainWindow :)
@@ -32,11 +31,25 @@ void QtPass::setMainWindow(MainWindow *mW) {
m_mainWindow, &MainWindow::startReencryptPath);
connect(QtPassSettings::getImitatePass(), &ImitatePass::endReencryptPath,
m_mainWindow, &MainWindow::endReencryptPath);
+
+ connect(m_mainWindow, &MainWindow::passGitInitNeeded, [=]() {
+#ifdef QT_DEBUG
+ dbg() << "Pass git init called";
+#endif
+ QtPassSettings::getPass()->GitInit();
+ });
+
+ connect(
+ m_mainWindow, &MainWindow::generateGPGKeyPair, [=](const QString &batch) {
+ QtPassSettings::getPass()->GenerateGPGKeys(batch);
+ m_mainWindow->showStatusMessage(tr("Generating GPG key pair"), 60000);
+ });
}
void QtPass::connectPassSignalHandlers(Pass *pass) {
connect(pass, &Pass::error, this, &QtPass::processError);
connect(pass, &Pass::processErrorExit, this, &QtPass::processErrorExit);
+
connect(pass, &Pass::critical, m_mainWindow, &MainWindow::critical);
connect(pass, &Pass::startingExecuteWrapper, m_mainWindow,
&MainWindow::executeWrapperStarted);
@@ -47,6 +60,7 @@ void QtPass::connectPassSignalHandlers(Pass *pass) {
&MainWindow::passShowHandler);
connect(pass, &Pass::finishedOtpGenerate, m_mainWindow,
&MainWindow::passOtpHandler);
+
connect(pass, &Pass::finishedGitInit, this, &QtPass::passStoreChanged);
connect(pass, &Pass::finishedGitPull, this, &QtPass::processFinished);
connect(pass, &Pass::finishedGitPush, this, &QtPass::processFinished);