33 #include <config-kleopatra.h>
41 #include <kleo/cryptobackendfactory.h>
42 #include <kleo/cryptoconfig.h>
44 #include <gpgme++/key.h>
47 #include <KMessageBox>
50 using namespace Kleo::Commands;
51 using namespace GpgME;
54 const Kleo::CryptoConfig *
const config = Kleo::CryptoBackendFactory::instance()->config();
57 const Kleo::CryptoConfigEntry *
const entry = config->entry( QLatin1String(
"gpg"), QLatin1String(
"Keyserver"), QLatin1String(
"keyserver") );
58 return entry && !entry->stringValue().isEmpty();
82 bool ExportOpenPGPCertsToServerCommand::preStartHook(
QWidget * parent )
const {
84 if ( KMessageBox::warningContinueCancel( parent,
86 "<para>No OpenPGP directory services have been configured.</para>"
87 "<para>Since none is configured, <application>Kleopatra</application> will use "
88 "<resource>keys.gnupg.net</resource> as the server to export to.</para>"
89 "<para>You can configure OpenPGP directory servers in <application>Kleopatra</application>'s "
90 "configuration dialog.</para>"
91 "<para>Do you want to continue with <resource>keys.gnupg.net</resource> "
92 "as the server to export to?</para>" ),
93 i18nc(
"@title:window",
"OpenPGP Certificate Export"),
94 KStandardGuiItem::cont(), KStandardGuiItem::cancel(),
95 QLatin1String(
"warn-export-openpgp-missing-keyserver" ) )
96 != KMessageBox::Continue )
98 return KMessageBox::warningContinueCancel( parent,
100 "<para>When OpenPGP certificates have been exported to a public directory server, "
101 "it is nearly impossible to remove them again.</para>"
102 "<para>Before exporting your certificate to a public directory server, make sure that you "
103 "have created a revocation certificate so you can revoke the certificate if needed later.</para>"
104 "<para>Are you sure you want to continue?</para>"),
105 i18nc(
"@title:window",
"OpenPGP Certificate Export"),
106 KStandardGuiItem::cont(), KStandardGuiItem::cancel(),
107 QLatin1String(
"warn-export-openpgp-nonrevocable" ) )
108 == KMessageBox::Continue;
111 QStringList ExportOpenPGPCertsToServerCommand::arguments()
const {
115 result << QLatin1String(
"--keyserver") << QLatin1String(
"keys.gnupg.net");
116 result << QLatin1String(
"--send-keys");
117 Q_FOREACH(
const Key & key,
d->
keys() )
118 result << QLatin1String(key.primaryFingerprint());
122 QString ExportOpenPGPCertsToServerCommand::errorCaption()
const {
123 return i18nc(
"@title:window",
"OpenPGP Certificate Export Error" );
126 QString ExportOpenPGPCertsToServerCommand::successCaption()
const {
127 return i18nc(
"@title:window",
"OpenPGP Certificate Export Finished" );
130 QString ExportOpenPGPCertsToServerCommand::crashExitMessage(
const QStringList & args )
const {
131 return i18nc(
"@info",
132 "<para>The GPG process that tried to export OpenPGP certificates "
133 "ended prematurely because of an unexpected error.</para>"
134 "<para>Please check the output of <icode>%1</icode> for details.</para>", args.join( QLatin1String(
" ") ) ) ;
137 QString ExportOpenPGPCertsToServerCommand::errorExitMessage(
const QStringList & args )
const {
138 return i18nc(
"@info",
139 "<para>An error occurred while trying to export OpenPGP certificates.</para> "
140 "<para>The output from <command>%1</command> was: <message>%2</message></para>",
144 QString ExportOpenPGPCertsToServerCommand::successMessage(
const QStringList & )
const {
145 return i18nc(
"@info",
"OpenPGP certificates exported successfully." );
148 #include "moc_exportopenpgpcertstoservercommand.cpp"
~ExportOpenPGPCertsToServerCommand()
QString errorString() const
static bool haveKeyserverConfigured()
ExportOpenPGPCertsToServerCommand(QAbstractItemView *view, KeyListController *parent)
kdtools::pimpl_ptr< Private > d
std::vector< GpgME::Key > keys() const