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

List:       kde-commits
Subject:    KDE/kdepim/kleopatra/utils
From:       Marc Mutz <mutz () kde ! org>
Date:       2008-04-22 10:11:20
Message-ID: 1208859080.299850.3369.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 799777 by mutz:

Formatting code for Imports

 M  +36 -0     formatting.cpp  
 M  +6 -0      formatting.h  


--- trunk/KDE/kdepim/kleopatra/utils/formatting.cpp #799776:799777
@@ -39,6 +39,7 @@
 #include <kleo/dn.h>
 
 #include <gpgme++/key.h>
+#include <gpgme++/importresult.h>
 
 #include <KLocale>
 #include <KGlobal>
@@ -442,3 +443,38 @@
         else
             return i18n("Invalid signature by %1: %2", keyToString( key ), \
QString::fromLocal8Bit( sig.status().asString() ) );  }
+
+//
+// ImportResult
+//
+
+QString Formatting::importMetaData( const Import & import ) {
+
+    if ( import.isNull() )
+        return QString();
+
+    if ( import.error().isCanceled() )
+        return i18n( "The import of this certificate was canceled." );
+    if ( import.error() )
+        return i18n( "An error occurred importing this certificate: %1",
+                     QString::fromLocal8Bit( import.error().asString() ) );
+
+    const unsigned int status = import.status();
+    if ( status & Import::NewKey )
+        return ( status & Import::ContainedSecretKey )
+            ? i18n( "This certificate was new to your keystore. The secret key is \
available." ) +            : i18n( "This certificate is new to your keystore." ) ;
+
+    QStringList results;
+    if ( status & Import::NewUserIDs )
+        results.push_back( i18n( "New user-ids were added to this certificate by the \
import." ) ); +    if ( status & Import::NewSignatures )
+        results.push_back( i18n( "New signatures were added to this certificate by \
the import." ) ); +    if ( status & Import::NewSubkeys )
+        results.push_back( i18n( "New subkeys were added to this certificate by the \
import." ) ); +
+    return results.empty()
+        ? i18n( "The import contained no new data for this certifcate. It is \
unchanged.") +        : results.join( "\n" );
+}
+
--- trunk/KDE/kdepim/kleopatra/utils/formatting.h #799776:799777
@@ -38,6 +38,10 @@
 class QString;
 class QDate;
 
+namespace GpgME {
+    class Import;
+}
+
 namespace Kleo {
 namespace Formatting {
 
@@ -96,6 +100,8 @@
 
     const char * summaryToString( const GpgME::Signature::Summary summary );
 
+    QString importMetaData( const GpgME::Import & import );
+
 }
 }
 


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

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