32 #ifndef __TDEPIM_KMAIL_KLEO_UTIL_H__
33 #define __TDEPIM_KMAIL_KLEO_UTIL_H__
35 #include <kleo/enum.h>
37 static const Kleo::CryptoMessageFormat cryptoMessageFormats[] = {
39 Kleo::InlineOpenPGPFormat,
40 Kleo::OpenPGPMIMEFormat,
42 Kleo::SMIMEOpaqueFormat
44 static const int numCryptoMessageFormats = sizeof cryptoMessageFormats / sizeof *cryptoMessageFormats ;
46 static const Kleo::CryptoMessageFormat concreteCryptoMessageFormats[] = {
47 Kleo::OpenPGPMIMEFormat,
49 Kleo::SMIMEOpaqueFormat,
50 Kleo::InlineOpenPGPFormat
52 static const unsigned int numConcreteCryptoMessageFormats
53 = sizeof concreteCryptoMessageFormats / sizeof *concreteCryptoMessageFormats ;
55 static inline Kleo::CryptoMessageFormat cb2format( int idx ) {
56 return cryptoMessageFormats[ idx >= 0 && idx < numCryptoMessageFormats ? idx : 0 ];
59 static inline int format2cb( Kleo::CryptoMessageFormat f ) {
60 for ( int i = 0 ; i < numCryptoMessageFormats ; ++i )
61 if ( f == cryptoMessageFormats[i] )
72 static inline bool isSMIME( Kleo::CryptoMessageFormat f ) {
73 return f == Kleo::SMIMEFormat || f == Kleo::SMIMEOpaqueFormat ;
76 static inline bool isOpenPGP( Kleo::CryptoMessageFormat f ) {
77 return f == Kleo::InlineOpenPGPFormat || f == Kleo::OpenPGPMIMEFormat ;
80 static inline bool containsSMIME( unsigned int f ) {
81 return f & (Kleo::SMIMEFormat|Kleo::SMIMEOpaqueFormat) ;
84 static inline bool containsOpenPGP( unsigned int f ) {
85 return f & (Kleo::OpenPGPMIMEFormat|Kleo::InlineOpenPGPFormat) ;
|