Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
KGpg
Commits
565b6c31
Unverified
Commit
565b6c31
authored
Oct 25, 2020
by
Rolf Eike Beer
Browse files
use the configured config file and directory when generating keys in expert mode
BUG:428215
parent
7f164118
Changes
3
Hide whitespace changes
Inline
Side-by-side
gpgproc.cpp
View file @
565b6c31
...
...
@@ -131,19 +131,7 @@ void GnupgBinary::setBinary(const QString &executable)
<<
QLatin1String
(
"--no-tty"
)
<<
QLatin1String
(
"--no-greeting"
);
if
(
!
gpgConfigFile
.
isEmpty
())
{
m_standardArguments
<<
QLatin1String
(
"--options"
)
<<
gpgConfigFile
;
// Check if the config file is in the default home directory
// of the binary. If it isn't add --homedir to command line also.
QString
gpgdir
=
GPGProc
::
getGpgHome
(
executable
);
gpgdir
.
chop
(
1
);
// remove trailing '/' as QFileInfo returns string without it
QFileInfo
confFile
(
gpgConfigFile
);
if
(
confFile
.
absolutePath
()
!=
gpgdir
)
m_standardArguments
<<
QLatin1String
(
"--homedir"
)
<<
confFile
.
absolutePath
();
}
m_standardArguments
<<
GPGProc
::
getGpgHomeArguments
(
executable
);
QStringList
debugLevelArguments
(
QLatin1String
(
"--debug-level"
));
debugLevelArguments
<<
QLatin1String
(
"none"
);
...
...
@@ -407,3 +395,24 @@ QString GPGProc::getGpgHome(const QString &binary)
#endif
return
gpgHome
;
}
QStringList
GPGProc
::
getGpgHomeArguments
(
const
QString
&
binary
)
{
const
QString
gpgConfigFile
=
KGpgSettings
::
gpgConfigPath
();
if
(
gpgConfigFile
.
isEmpty
())
return
{};
QStringList
options
{
QLatin1String
(
"--options"
),
gpgConfigFile
};
// Check if the config file is in the default home directory
// of the binary. If it isn't add --homedir to command line also.
QString
gpgdir
=
GPGProc
::
getGpgHome
(
binary
);
gpgdir
.
chop
(
1
);
// remove trailing '/' as QFileInfo returns string without it
QFileInfo
confFile
(
gpgConfigFile
);
if
(
confFile
.
absolutePath
()
!=
gpgdir
)
options
<<
QLatin1String
(
"--homedir"
)
<<
confFile
.
absolutePath
();
return
options
;
}
gpgproc.h
View file @
565b6c31
...
...
@@ -141,6 +141,13 @@ public:
*/
static
QString
getGpgHome
(
const
QString
&
binary
);
/**
* @brief get arguments to set the configuration file and home directory
* @param binary name or path to GnuPG binary
* @return GnuPG argument list
*/
static
QStringList
getGpgHomeArguments
(
const
QString
&
binary
);
/**
* @brief return a list of the public key algorithms GnuPG announces support for
* @param binary name or path to GnuPG binary
...
...
keysmanager.cpp
View file @
565b6c31
...
...
@@ -518,6 +518,8 @@ void KeysManager::slotGenerateKey()
else
gpg_args
+=
QLatin1String
(
" --gen-key"
);
gpg_args
+=
GPGProc
::
getGpgHomeArguments
(
gpgbin
).
join
(
QLatin1Char
(
' '
));
QStringList
args
;
args
<<
QLatin1String
(
"-e"
)
<<
gpg_args
;
...
...
Rolf Eike Beer
@dakon
mentioned in commit
09b95f4d
·
Jan 11, 2022
mentioned in commit
09b95f4d
mentioned in commit 09b95f4d27b0475a0c8b937969125d31533317c2
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment