kmail
kleo_util.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef __KDEPIM_KMAIL_KLEO_UTIL_H__
00033 #define __KDEPIM_KMAIL_KLEO_UTIL_H__
00034
00035 #include <kleo/enum.h>
00036
00037 static const Kleo::CryptoMessageFormat cryptoMessageFormats[] = {
00038 Kleo::AutoFormat,
00039 Kleo::InlineOpenPGPFormat,
00040 Kleo::OpenPGPMIMEFormat,
00041 Kleo::SMIMEFormat,
00042 Kleo::SMIMEOpaqueFormat
00043 };
00044 static const int numCryptoMessageFormats = sizeof cryptoMessageFormats / sizeof *cryptoMessageFormats ;
00045
00046 static const Kleo::CryptoMessageFormat concreteCryptoMessageFormats[] = {
00047 Kleo::OpenPGPMIMEFormat,
00048 Kleo::SMIMEFormat,
00049 Kleo::SMIMEOpaqueFormat,
00050 Kleo::InlineOpenPGPFormat
00051 };
00052 static const unsigned int numConcreteCryptoMessageFormats
00053 = sizeof concreteCryptoMessageFormats / sizeof *concreteCryptoMessageFormats ;
00054
00055 static inline Kleo::CryptoMessageFormat cb2format( int idx ) {
00056 return cryptoMessageFormats[ idx >= 0 && idx < numCryptoMessageFormats ? idx : 0 ];
00057 }
00058
00059 static inline int format2cb( Kleo::CryptoMessageFormat f ) {
00060 for ( int i = 0 ; i < numCryptoMessageFormats ; ++i )
00061 if ( f == cryptoMessageFormats[i] )
00062 return i;
00063 return 0;
00064 }
00065
00066
00067
00068
00069
00070
00071
00072 static inline bool isSMIME( Kleo::CryptoMessageFormat f ) {
00073 return f == Kleo::SMIMEFormat || f == Kleo::SMIMEOpaqueFormat ;
00074 }
00075
00076 static inline bool isOpenPGP( Kleo::CryptoMessageFormat f ) {
00077 return f == Kleo::InlineOpenPGPFormat || f == Kleo::OpenPGPMIMEFormat ;
00078 }
00079
00080
00081 #endif // __KDEPIM_KMAIL_KLEO_UTIL_H__
|