QString Formatting::toolTip( const Key & key, int flags ) { if ( flags == 0 || ( key.protocol() != CMS && key.protocol() != OpenPGP ) ) return QString(); const Subkey subkey = key.subkey( 0 ); QString result; if ( flags & Validity ) { if ( key.protocol() == OpenPGP || ( key.keyListMode() & Validate ) ) if ( key.isRevoked() ) result += make_red( i18n( "This certificate has been revoked." ) ); else if ( key.isExpired() ) result += make_red( i18n( "This certificate has expired." ) ); else if ( key.isDisabled() ) result += i18n( "This certificate has been disabled locally." ); else result += i18n( "This certificate is currently valid." ); else result += i18n( "The validity of this certificate cannot be checked at the moment." ); } if ( flags == Validity ) return result; result += QLatin1String( "<table border=\"0\">" ); if ( key.protocol() == CMS ) { if ( flags & SerialNumber ) result += format_row( i18n("Serial number"), key.issuerSerial() ); if ( flags & Issuer ) result += format_row( i18n("Issuer"), key.issuerName() ); } if ( flags & UserIDs ) { const std::vector<UserID> uids = key.userIDs(); if ( !uids.empty() ) result += format_row( key.protocol() == CMS ? i18n("Subject") : i18n("User-ID"), prettyUserID( uids.front() ) ); if ( uids.size() > 1 ) for ( std::vector<UserID>::const_iterator it = uids.begin() + 1, end = uids.end() ; it != end ; ++it ) if ( !it->isRevoked() && !it->isInvalid() ) result += format_row( i18n("a.k.a."), prettyUserID( *it ) ); } if ( flags & ExpiryDates ) result += format_row( i18n("Validity"), subkey.neverExpires() ? i18n( "from %1 until forever", time_t2string( subkey.creationTime() ) ) : i18n( "from %1 through %2", time_t2string( subkey.creationTime() ), time_t2string( subkey.expirationTime() ) ) ); if ( flags & CertificateType ) result += format_row( i18n("Certificate type"), format_keytype( key ) ); if ( flags & CertificateUsage ) result += format_row( i18n("Certificate usage"), format_keyusage( key ) ); if ( flags & Fingerprint ) result += format_row( i18n("Fingerprint"), key.primaryFingerprint() ); result += QLatin1String( "</table><br>" ); return result; }