[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: aegypten_branch: kdepim/certmanager/lib/backends/qgpgme
From: David Faure <faure () kde ! org>
Date: 2004-03-31 23:14:30
Message-ID: 20040331231430.5A08F90CD () office ! kde ! org
[Download RAW message or body]
CVS commit by faure:
backport error handling fix
M +10 -5 qgpgmecryptoconfig.cpp 1.16.2.8
M +2 -2 qgpgmecryptoconfig.h 1.9.2.2
--- kdepim/certmanager/lib/backends/qgpgme/qgpgmecryptoconfig.cpp #1.16.2.7:1.16.2.8
@@ -57,9 +57,8 @@ static bool s_duringClear = false;
// Change size of mFlags bitfield if adding new values here
-QGpgMECryptoConfig::QGpgMECryptoConfig( bool showErrors )
+QGpgMECryptoConfig::QGpgMECryptoConfig()
: mComponents( 7 ), mParsed( false )
{
mComponents.setAutoDelete( true );
- runGpgConf( showErrors );
}
@@ -84,9 +83,15 @@ void QGpgMECryptoConfig::runGpgConf( boo
rc = -1;
else
- rc = ( proc.normalExit() ) ? proc.exitStatus() : -1 ;
+ rc = ( proc.normalExit() ) ? proc.exitStatus() : -2 ;
// handle errors, if any (and if requested)
if ( showErrors && rc != 0 ) {
- QString wmsg = i18n("<qt>Failed to execute gpgconf:<br>%1</qt>").arg( strerror(rc) );
+ QString wmsg = i18n("<qt>Failed to execute gpgconf:<br>%1</qt>");
+ if ( rc == -1 )
+ wmsg = wmsg.arg( i18n( "program not found" ) );
+ else if ( rc == -2 )
+ wmsg = wmsg.arg( i18n( "program cannot be executed" ) );
+ else
+ wmsg = wmsg.arg( strerror(rc) );
kdWarning(5150) << wmsg << endl; // to see it from test_cryptoconfig.cpp
KMessageBox::error(0, wmsg);
@@ -114,5 +119,5 @@ QStringList QGpgMECryptoConfig::componen
{
if ( !mParsed )
- const_cast<QGpgMECryptoConfig*>( this )->runGpgConf( false );
+ const_cast<QGpgMECryptoConfig*>( this )->runGpgConf( true );
QDictIterator<QGpgMECryptoConfigComponent> it( mComponents );
QStringList names;
--- kdepim/certmanager/lib/backends/qgpgme/qgpgmecryptoconfig.h #1.9.2.1:1.9.2.2
@@ -53,7 +53,6 @@ public:
/**
* Constructor
- * @param showErrors if true, a messagebox will be shown if e.g. gpgconf wasn't found
*/
- QGpgMECryptoConfig( bool showErrors = true );
+ QGpgMECryptoConfig();
virtual ~QGpgMECryptoConfig();
@@ -68,4 +67,5 @@ private slots:
void slotCollectStdOut( KProcIO* proc );
private:
+ /// @param showErrors if true, a messagebox will be shown if e.g. gpgconf wasn't found
void runGpgConf( bool showErrors );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic