diff options
author | Claudio Maradonna <penguyman@stronzi.org> | 2018-07-24 01:26:22 +0200 |
---|---|---|
committer | Claudio Maradonna <penguyman@stronzi.org> | 2018-07-24 01:26:22 +0200 |
commit | 094967fb68c0350d6234cd9374bf24748d7f4133 (patch) | |
tree | d6df6569754661cce1882e5aa73873383acadbac /src/mainwindow.cpp | |
parent | 9ff9147be35f498ec33e42f44a7aa66f9274524e (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/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 66 |
1 files changed, 22 insertions, 44 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 4dc56c36..5c0c239c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1,8 +1,13 @@ #include "mainwindow.h" + +#ifdef QT_DEBUG #include "debughelper.h" +#endif + #include <QClipboard> #include <QCloseEvent> #include <QDesktopServices> +#include <QDialog> #include <QFileInfo> #include <QInputDialog> #include <QLabel> @@ -172,6 +177,11 @@ const QModelIndex MainWindow::getCurrentTreeViewIndex() { return ui->treeView->currentIndex(); } +void MainWindow::cleanKeygenDialog() { + this->keygen->close(); + this->keygen = 0; +} + void MainWindow::setTextTextBrowser(const QString &text) { ui->textBrowser->setText(text); } @@ -293,7 +303,10 @@ bool MainWindow::checkConfig() { // Config updates if (version.isEmpty()) { - dbg() << "assuming fresh install"; +#ifdef QT_DEBUG + dbg() << "assuming fresh install"; +#endif + if (QtPassSettings::getAutoclearSeconds() < 5) QtPassSettings::setAutoclearSeconds(10); if (QtPassSettings::getAutoclearPanelSeconds() < 5) @@ -508,14 +521,6 @@ void MainWindow::deselect() { clearPanel(false); } -/** - * @brief MainWindow::executePassGitInit git init wrapper - */ -void MainWindow::executePassGitInit() { - dbg() << "Pass git init called"; - QtPassSettings::getPass()->GitInit(); -} - void MainWindow::executeWrapperStarted() { clearTemplateWidgets(); ui->textBrowser->clear(); @@ -523,20 +528,6 @@ void MainWindow::executeWrapperStarted() { clearPanelTimer.stop(); } -// void MainWindow::onKeyGenerationComplete(const QString &p_output, -// const QString &p_errout) { -// // qDebug() << p_output; -// // qDebug() << p_errout; -// if (0 != keygen) { -// qDebug() << "Keygen Done"; -// keygen->close(); -// keygen = 0; -// // TODO(annejan) some sanity checking ? -// } - -// // processFinished(p_output, p_errout); -//} - void MainWindow::passShowHandler(const QString &p_output) { QStringList templ = QtPassSettings::isUseTemplate() ? QtPassSettings::getPassTemplate().split("\n") @@ -672,7 +663,9 @@ void MainWindow::on_lineEdit_textChanged(const QString &arg1) { * Select the first possible file in the tree */ void MainWindow::on_lineEdit_returnPressed() { +#ifdef QT_DEBUG dbg() << "on_lineEdit_returnPressed"; +#endif selectFirstFile(); on_treeView_clicked(ui->treeView->currentIndex()); } @@ -892,31 +885,13 @@ void MainWindow::messageAvailable(QString message) { } /** - * @brief MainWindow::getSecretKeys get list of secret/private keys - * @return QStringList keys - */ -QStringList MainWindow::getSecretKeys() { - QList<UserInfo> keys = QtPassSettings::getPass()->listKeys("", true); - QStringList names; - - if (keys.size() == 0) - return names; - - foreach (const UserInfo &sec, keys) - names << sec.name; - - return names; -} - -/** * @brief MainWindow::generateKeyPair internal gpg keypair generator . . * @param batch * @param keygenWindow */ void MainWindow::generateKeyPair(QString batch, QDialog *keygenWindow) { keygen = keygenWindow; - ui->statusBar->showMessage(tr("Generating GPG key pair"), 60000); - QtPassSettings::getPass()->GenerateGPGKeys(batch); + emit generateGPGKeyPair(batch); } /** @@ -972,8 +947,11 @@ void MainWindow::initTrayIcon() { this->tray = new TrayIcon(this); // Setup tray icon - if (tray == NULL) - dbg() << "Allocating tray icon failed."; + if (tray == NULL) { +#ifdef QT_DEBUG + dbg() << "Allocating tray icon failed."; +#endif + } if (!tray->getIsAllocated()) { destroyTrayIcon(); |