kgpgp: set default mode before processing arguments

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-03-15 03:40:14 +02:00
parent 9ee9de025a
commit 0140cb19a6
2 changed files with 4 additions and 5 deletions

View file

@ -492,7 +492,7 @@ void KGPG::slotQuit()
qApp->quit();
}
void KGPG::updateKeys(const gpgme_keylist_mode_t gpgmode, const bool secret)
void KGPG::updateKeys(const gpgme_keylist_mode_t gpgmode, const bool gpgsecret)
{
disconnect(m_ui.keysbox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotKeysBox(int)));
@ -506,7 +506,7 @@ void KGPG::updateKeys(const gpgme_keylist_mode_t gpgmode, const bool secret)
}
// required by key query
gpgresult = gpgme_op_keylist_start(m_gpgctx, NULL, secret);
gpgresult = gpgme_op_keylist_start(m_gpgctx, NULL, gpgsecret);
if (gpgresult != 0) {
setError(gpgme_strerror(gpgresult));
return;
@ -562,6 +562,7 @@ int main(int argc, char **argv)
KApplication app;
KGPG* kgpg = new KGPG();
kgpg->setMode(KGPG::EncryptMode);
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
for (int pos = 0; pos < args->count(); ++pos) {
@ -583,8 +584,6 @@ int main(int argc, char **argv)
kgpg->setMode(KGPG::SignMode);
} else if (args->isSet("verify")) {
kgpg->setMode(KGPG::VerifyMode);
} else {
kgpg->setMode(KGPG::EncryptMode);
}
kgpg->show();

View file

@ -79,7 +79,7 @@ private Q_SLOTS:
void slotQuit();
private:
void updateKeys(const gpgme_keylist_mode_t gpgmode, const bool secret);
void updateKeys(const gpgme_keylist_mode_t gpgmode, const bool gpgsecret);
Ui_KGPGWindow m_ui;
KGPGMode m_mode;