33 #include <config-kleopatra.h>
39 #include <kleo/cryptobackendfactory.h>
40 #include <kleo/cryptoconfig.h>
43 #include <KMessageBox>
46 using namespace Kleo::Commands;
49 const Kleo::CryptoConfig *
const config = Kleo::CryptoBackendFactory::instance()->config();
52 const Kleo::CryptoConfigEntry *
const entry = config->entry( QLatin1String(
"gpg"), QLatin1String(
"Keyserver"), QLatin1String(
"keyserver") );
53 return entry && !entry->stringValue().isEmpty();
70 bool RefreshOpenPGPCertsCommand::preStartHook(
QWidget * parent )
const {
72 if ( KMessageBox::warningContinueCancel( parent,
74 "<para>No OpenPGP directory services have been configured.</para>"
75 "<para>If not all of the certificates carry the name of their preferred "
76 "certificate server (few do), a fallback server is needed to fetch from.</para>"
77 "<para>Since none is configured, <application>Kleopatra</application> will use "
78 "<resource>keys.gnupg.net</resource> as the fallback.</para>"
79 "<para>You can configure OpenPGP directory servers in Kleopatra's "
80 "configuration dialog.</para>"
81 "<para>Do you want to continue with <resource>keys.gnupg.net</resource> "
82 "as fallback server?</para>" ),
83 i18nc(
"@title:window",
"OpenPGP Certificate Refresh"),
84 KStandardGuiItem::cont(), KStandardGuiItem::cancel(),
85 QLatin1String(
"warn-refresh-openpgp-missing-keyserver" ) )
86 != KMessageBox::Continue )
88 return KMessageBox::warningContinueCancel( parent,
90 "<para>Refreshing OpenPGP certificates implies downloading all certificates anew, "
91 "to check if any of them have been revoked in the meantime.</para>"
92 "<para>This can put a severe strain on your own as well as other people's network "
93 "connections, and can take up to an hour or more to complete, depending on "
94 "your network connection, and the number of certificates to check.</para> "
95 "<para>Are you sure you want to continue?</para>"),
96 i18nc(
"@title:window",
"OpenPGP Certificate Refresh"),
97 KStandardGuiItem::cont(), KStandardGuiItem::cancel(),
98 QLatin1String(
"warn-refresh-openpgp-expensive" ) )
99 == KMessageBox::Continue;
102 QStringList RefreshOpenPGPCertsCommand::arguments()
const {
106 result << QLatin1String(
"--keyserver") << QLatin1String(
"keys.gnupg.net");
107 result << QLatin1String(
"--refresh-keys");
111 QString RefreshOpenPGPCertsCommand::errorCaption()
const {
112 return i18nc(
"@title:window",
"OpenPGP Certificate Refresh Error" );
115 QString RefreshOpenPGPCertsCommand::successCaption()
const {
116 return i18nc(
"@title:window",
"OpenPGP Certificate Refresh Finished" );
119 QString RefreshOpenPGPCertsCommand::crashExitMessage(
const QStringList & args )
const {
120 return i18nc(
"@info",
121 "<para>The GPG process that tried to refresh OpenPGP certificates "
122 "ended prematurely because of an unexpected error.</para>"
123 "<para>Please check the output of <icode>%1</icode> for details.</para>", args.join( QLatin1String(
" ") ) ) ;
126 QString RefreshOpenPGPCertsCommand::errorExitMessage(
const QStringList & args )
const {
127 return i18nc(
"@info",
128 "<para>An error occurred while trying to refresh OpenPGP certificates.</para> "
129 "<para>The output from <command>%1</command> was: <message>%2</message></para>",
133 QString RefreshOpenPGPCertsCommand::successMessage(
const QStringList & )
const {
134 return i18nc(
"@info",
"OpenPGP certificates refreshed successfully." );
138 #include "moc_refreshopenpgpcertscommand.cpp"
static bool haveKeyserverConfigured()
QString errorString() const
~RefreshOpenPGPCertsCommand()
RefreshOpenPGPCertsCommand(QAbstractItemView *view, KeyListController *parent)
void setShowsOutputWindow(bool show)