kgpg: connect signals before returning from constructor in case GPG initialization fails

otherwise quit action will be noop

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-03-15 22:10:50 +02:00
parent 2ccc712d05
commit e4f880700a
2 changed files with 9 additions and 10 deletions

View file

@ -38,6 +38,15 @@ KGPG::KGPG(QWidget *parent)
m_ui.startbutton->setEnabled(false);
m_ui.progressbar->setVisible(false);
connect(m_ui.keysbox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotKeysBox(int)));
connect(m_ui.startbutton, SIGNAL(clicked()), this, SLOT(slotStart()));
connect(m_ui.actionQuit, SIGNAL(triggered()), this, SLOT(slotQuit()));
connect(m_ui.actionEncrypt, SIGNAL(triggered()), this, SLOT(slotEncryptMode()));
connect(m_ui.actionDecrypt, SIGNAL(triggered()), this, SLOT(slotDecryptMode()));
connect(m_ui.actionSign, SIGNAL(triggered()), this, SLOT(slotSignMode()));
connect(m_ui.actionVerify, SIGNAL(triggered()), this, SLOT(slotVerifyMode()));
// required by context
kDebug() << gpgme_check_version(NULL);
@ -53,15 +62,6 @@ KGPG::KGPG(QWidget *parent)
gpgme_set_pinentry_mode(m_gpgctx, GPGME_PINENTRY_MODE_LOOPBACK); // for password callback
gpgme_set_passphrase_cb(m_gpgctx, KGPG::gpgPasswordCallback, this);
gpgme_set_progress_cb(m_gpgctx, KGPG::gpgProgressCallback, this);
connect(m_ui.keysbox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotKeysBox(int)));
connect(m_ui.startbutton, SIGNAL(clicked()), this, SLOT(slotStart()));
connect(m_ui.actionQuit, SIGNAL(triggered()), this, SLOT(slotQuit()));
connect(m_ui.actionEncrypt, SIGNAL(triggered()), this, SLOT(slotEncryptMode()));
connect(m_ui.actionDecrypt, SIGNAL(triggered()), this, SLOT(slotDecryptMode()));
connect(m_ui.actionSign, SIGNAL(triggered()), this, SLOT(slotSignMode()));
connect(m_ui.actionVerify, SIGNAL(triggered()), this, SLOT(slotVerifyMode()));
}
KGPG::~KGPG()

View file

@ -19,7 +19,6 @@
#ifndef KGPG_H
#define KGPG_H
#include <QResizeEvent>
#include <kmainwindow.h>
#include <gpgme.h>