CVS commit by faure: Fixed error box when using KMail's configure dialog and gpgconf can't be found (no more error box until actually clicking the "configure" button in the Security module's last tab) M +10 -5 qgpgmecryptoconfig.cpp 1.22 M +2 -2 qgpgmecryptoconfig.h 1.10 --- kdepim/certmanager/lib/backends/qgpgme/qgpgmecryptoconfig.cpp #1.21:1.22 @@ -56,9 +56,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 ); } @@ -83,9 +82,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("Failed to execute gpgconf:
%1
").arg( strerror(rc) ); + QString wmsg = i18n("Failed to execute gpgconf:
%1
"); + 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); @@ -113,5 +118,5 @@ QStringList QGpgMECryptoConfig::componen { if ( !mParsed ) - const_cast( this )->runGpgConf( false ); + const_cast( this )->runGpgConf( true ); QDictIterator it( mComponents ); QStringList names; --- kdepim/certmanager/lib/backends/qgpgme/qgpgmecryptoconfig.h #1.9:1.10 @@ -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 );