kgpg: apply binary path preferences on first run

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2019-11-19 04:16:43 +00:00
parent 7cd1cf7b19
commit 36f6cf9d23
3 changed files with 19 additions and 4 deletions

View file

@ -463,6 +463,7 @@ void KGpgExternalActions::startAssistant()
void KGpgExternalActions::slotSaveOptionsPath()
{
KGpgSettings::setGpgBinaryPath(m_assistant->getGpgBinaryPath());
KGpgSettings::setAutoStart(m_assistant->getAutoStart());
KGpgSettings::setGpgConfigPath(m_assistant->getConfigPath());
KGpgSettings::setFirstRun(false);

View file

@ -329,6 +329,12 @@ KGpgFirstAssistant::runKeyGenerate() const
return generateCB->isChecked();
}
QString
KGpgFirstAssistant::getGpgBinaryPath() const
{
return m_gpgBinary;
}
QString
KGpgFirstAssistant::getConfigPath() const
{
@ -354,10 +360,11 @@ KGpgFirstAssistant::getAutoStart() const
void
KGpgFirstAssistant::slotBinaryChanged(const QString &binary)
{
if (binary.isEmpty()) {
setValid(page_binary, false);
return;
}
if (binary.isEmpty()) {
setValid(page_binary, false);
m_gpgBinary.clear();
return;
}
m_gpgVersion = GPGProc::gpgVersionString(binary);
setValid(page_binary, !m_gpgVersion.isEmpty());
@ -368,6 +375,7 @@ KGpgFirstAssistant::slotBinaryChanged(const QString &binary)
txtGpgVersion->setText(i18n("Your GnuPG version (%1) seems to be too old.<br />Compatibility with versions before 1.4.0 is no longer guaranteed.", m_gpgVersion));
} else {
txtGpgVersion->setText(i18n("You have GnuPG version: %1", m_gpgVersion));
m_gpgBinary = binary;
}
}
}

View file

@ -53,6 +53,7 @@ private:
KUrlRequester *pathURL;
QString m_gpgVersion;
QString m_gpgBinary;
QString m_confPath;
void findConfigPath();
@ -68,6 +69,11 @@ public:
* @return if user requests dialog to be started
*/
bool runKeyGenerate() const;
/**
* @brief get user selected GnuPG binary path
* @return path to users GnuPG binary
*/
QString getGpgBinaryPath() const;
/**
* @brief get user selected GnuPG home directory
* @return path to users GnuPG directory