[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim/kleopatra/commands
From:       Marc Mutz <mutz () kde ! org>
Date:       2008-04-29 9:40:28
Message-ID: 1209462028.418575.3326.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 802413 by mutz:

KUIT; check for presence of --keyserver option in gpg before starting refresh-keys

 M  +37 -10    refreshopenpgpcertscommand.cpp  
 M  +11 -10    refreshx509certscommand.cpp  


--- trunk/KDE/kdepim/kleopatra/commands/refreshopenpgpcertscommand.cpp #802412:802413
@@ -36,12 +36,23 @@
 
 #include <utils/gnupg-helper.h>
 
+#include <kleo/cryptobackendfactory.h>
+#include <kleo/cryptoconfig.h>
+
 #include <KLocale>
 #include <KMessageBox>
 
 using namespace Kleo;
 using namespace Kleo::Commands;
 
+static bool haveKeyserverConfigured() {
+    const Kleo::CryptoConfig * const config = \
Kleo::CryptoBackendFactory::instance()->config(); +    if ( !config )
+        return false;
+    const Kleo::CryptoConfigEntry * const entry = config->entry( "gpg", "Keyserver", \
"keyserver" ); +    return entry && !entry->stringValue().isEmpty();
+}
+
 RefreshOpenPGPCertsCommand::RefreshOpenPGPCertsCommand( KeyListController * c )
     : GnuPGProcessCommand( c )
 {
@@ -57,13 +68,28 @@
 RefreshOpenPGPCertsCommand::~RefreshOpenPGPCertsCommand() {}
 
 bool RefreshOpenPGPCertsCommand::preStartHook( QWidget * parent ) const {
+    if ( !haveKeyserverConfigured() )
+        if ( KMessageBox::warningContinueCancel( parent,
+                                                 i18n( "<para>No OpenPGP directory \
services have been configured. " +                                                    \
"If not all of the certificates carry the name of their preferred " +                 \
"certificate server, a fallback server is needed to fetch from. " +                   \
"Since none is configured, the backend might report an error to that " +              \
"effect.</para>" +                                                       "<para>You \
can configure OpenPGP directory servers in Kleopatra's " +                            \
"configuration dialog.</para>" +                                                      \
"<para>Do you want to continue without a fallback server?</para>" ), +                \
i18n("OpenPGP Certitifcate Refresh"), +                                               \
KStandardGuiItem::cont(), KStandardGuiItem::cancel(), +                               \
QLatin1String( "warn-refresh-openpgp-missing-keyserver" ) ) +             != \
KMessageBox::Continue ) +            return false;
     return KMessageBox::warningContinueCancel( parent,
-                                               i18n("Refreshing OpenPGP certificates \
                implies downloading all certificates anew, "
-                                                    "to check if any of them have \
                been revoked in the meantime. "
-                                                    "This can put a severe strain on \
your own as well as other people's network " +                                        \
i18n("<para>Refreshing OpenPGP certificates implies downloading all certificates \
anew, " +                                                    "to check if any of them \
have been revoked in the meantime.</para>" +                                          \
                "<para>This can put a severe strain on your own as well as other \
                people's network "
                                                     "connection, and can take up to \
                an hour or more to complete, depending on "
-                                                    "your network connection, and \
                the number of certificates to check. "
-                                                    "Are you sure you want to \
continue?"), +                                                    "your network \
connection, and the number of certificates to check.</para> " +                       \
                "<para>Are you sure you want to continue?</para>"),
                                                i18n("OpenPGP Certitifcate Refresh"),
                                                KStandardGuiItem::cont(), \
                KStandardGuiItem::cancel(),
                                                QLatin1String( \
"warn-refresh-openpgp-expensive" ) ) @@ -83,14 +109,15 @@
 }
 
 QString RefreshOpenPGPCertsCommand::crashExitMessage( const QStringList & args ) \
                const {
-    return i18n( "The GPG process that tried to refresh OpenPGP certificates "
-                 "ended prematurely because of an unexpected error. "
-                 "Please check the output of %1 for details.", args.join( " " ) ) ;
+    return i18n( "<para>The GPG process that tried to refresh OpenPGP certificates "
+                 "ended prematurely because of an unexpected error.</para>"
+                 "<para>Please check the output of <icode>%1</icode> for \
details.</para>", args.join( " " ) ) ;  }
 
 QString RefreshOpenPGPCertsCommand::errorExitMessage( const QStringList & args ) \
                const {
-    return i18n( "An error occurred while trying to refresh OpenPGP certificates. "
-                 "The output from %1 was:\n%2", args[0], errorString() );
+    return i18n( "<para>An error occurred while trying to refresh OpenPGP \
certificates.</para> " +                 "<para>The output from <command>%1</command> \
was: <message>%2</message></para>", +                 args[0], errorString() );
 }
 
 QString RefreshOpenPGPCertsCommand::successMessage( const QStringList & ) const {
--- trunk/KDE/kdepim/kleopatra/commands/refreshx509certscommand.cpp #802412:802413
@@ -58,12 +58,12 @@
 
 bool RefreshX509CertsCommand::preStartHook( QWidget * parent ) const {
     return KMessageBox::warningContinueCancel( parent,
-                                               i18n("Refreshing X.509 certificates \
                implies downloading CRLs for all certificates, "
-                                                    "even if they might otherwise \
                still be valid. "
-                                                    "This can put a severe strain on \
your own as well as other people's network " +                                        \
i18n("<para>Refreshing X.509 certificates implies downloading CRLs for all \
certificates, " +                                                    "even if they \
might otherwise still be valid.</para>" +                                             \
                "<para>This can put a severe strain on your own as well as other \
                people's network "
                                                     "connection, and can take up to \
                an hour or more to complete, depending on "
-                                                    "your network connection, and \
                the number of certificates to check. "
-                                                    "Are you sure you want to \
continue?"), +                                                    "your network \
connection, and the number of certificates to check.</para> " +                       \
                "<para>Are you sure you want to continue?</para>"),
                                                i18n("X.509 Certitifcate Refresh"),
                                                KStandardGuiItem::cont(), \
                KStandardGuiItem::cancel(),
                                                QLatin1String( \
"warn-refresh-x509-expensive" ) ) @@ -83,14 +83,15 @@
 }
 
 QString RefreshX509CertsCommand::crashExitMessage( const QStringList & args ) const \
                {
-    return i18n( "The GpgSM process that tried to refresh X.509 certificates "
-                 "ended prematurely because of an unexpected error. "
-                 "Please check the output of %1 for details.", args.join( " " ) ) ;
+    return i18n( "<para>The GpgSM process that tried to refresh X.509 certificates "
+                 "ended prematurely because of an unexpected error.</para>"
+                 "<para>Please check the output of <icode>%1</icode> for \
details.</para>", args.join( " " ) ) ;  }
 
 QString RefreshX509CertsCommand::errorExitMessage( const QStringList & args ) const \
                {
-    return i18n( "An error occurred while trying to refresh X.509 certificates. "
-                 "The output from %1 was:\n%2", args[0], errorString() );
+    return i18n( "<para>An error occurred while trying to refresh X.509 \
certificates.</para>" +                 "<para>The output from <command>%1</command> \
was: <message>%2</message></para>", +                 args[0], errorString() );
 }
 
 QString RefreshX509CertsCommand::successMessage( const QStringList & ) const {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic