static QString findGpgExe( GpgME::Engine engine, const char * exe ) {
    const GpgME::EngineInfo info = GpgME::engineInfo( engine );
    return info.fileName() ? QFile::decodeName( info.fileName() ) : KStandardDirs::findExe( exe ) ;
}
Ejemplo n.º 2
0
static bool check(GpgME::Context::Protocol proto, QString *reason)
{
    if(!GpgME::checkEngine(proto))
        return true;
    if(!reason)
        return false;
    // error, check why:
    const GpgME::EngineInfo ei = GpgME::engineInfo(proto);
    if(ei.isNull())
        *reason = i18n("GPGME was compiled without support for %1.").arg(proto == GpgME::Context::CMS ? "S/MIME" : "OpenPGP");
    else if(ei.fileName() && !ei.version())
        *reason = i18n("Engine %1 is not installed properly.").arg(QFile::decodeName(ei.fileName()));
    else if(ei.fileName() && ei.version() && ei.requiredVersion())
        *reason = i18n("Engine %1 version %2 installed, "
                       "but at least version %3 is required.")
                  .arg(QFile::decodeName(ei.fileName()), ei.version(), ei.requiredVersion());
    else
        *reason = i18n("Unknown problem with engine for protocol %1.").arg(proto == GpgME::Context::CMS ? "S/MIME" : "OpenPGP");
    return false;
}
Ejemplo n.º 3
0
static QString gpgConfPath() {
    const GpgME::EngineInfo ei = GpgME::engineInfo( GpgME::GpgConfEngine );
    return ei.fileName() ? QFile::decodeName( ei.fileName() ) : KStandardDirs::findExe( "gpgconf" ) ;
}
QString QGpgMECryptoConfig::gpgConfPath()
{
    const GpgME::EngineInfo info = GpgME::engineInfo( GpgME::GpgConfEngine );
    return info.fileName() ? QFile::decodeName( info.fileName() ) : KStandardDirs::findExe( "gpgconf" );
}