KTNEF Library
mapi.cpp
Go to the documentation of this file.
00001 /* 00002 mapi.cpp 00003 00004 Copyright (C) 2002 Michael Goffioul <kdeprint@swing.be> 00005 00006 This file is part of KTNEF, the KDE TNEF support library/program. 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Library General Public 00010 License as published by the Free Software Foundation; either 00011 version 2 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Library General Public License for more details. 00017 00018 You should have received a copy of the GNU Library General Public License 00019 along with this library; see the file COPYING.LIB. If not, write to 00020 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00021 Boston, MA 02110-1301, USA. 00022 */ 00031 #include "mapi.h" 00032 #include <QtCore/QMap> 00033 #include <klocale.h> 00034 00035 //@cond IGNORE 00036 static struct 00037 { 00038 int tag; 00039 const char *str; 00040 } MAPI_TagStrings[] = 00041 { 00042 { 0x0002, I18N_NOOP( "Alternate Recipient Allowed" ) }, 00043 { 0x001A, I18N_NOOP( "Message Class" ) }, 00044 { 0x0023, I18N_NOOP( "Originator Delivery Report Requested" ) }, 00045 { 0x0024, I18N_NOOP( "Originator Return Address" ) }, 00046 { 0x0026, I18N_NOOP( "Priority" ) }, 00047 { 0x0029, I18N_NOOP( "Read Receipt Requested" ) }, 00048 { 0x002B, I18N_NOOP( "Recipient Reassignment Prohibited" ) }, 00049 { 0x002E, I18N_NOOP( "Original Sensitivity" ) }, 00050 { 0x0031, I18N_NOOP( "Report Tag" ) }, 00051 { 0x0036, I18N_NOOP( "Sensitivity" ) }, 00052 { 0x0037, I18N_NOOP2( "@label The subject of an email", "Subject" ) }, 00053 { 0x0039, I18N_NOOP( "Client Submit Time" ) }, 00054 { 0x003B, I18N_NOOP( "Sent Representing Search Key" ) }, 00055 { 0x003D, I18N_NOOP( "Subject Prefix" ) }, 00056 { 0x0041, I18N_NOOP( "Sent Representing Entry ID" ) }, 00057 { 0x0042, I18N_NOOP( "Sent Representing Name" ) }, 00058 { 0x0047, I18N_NOOP( "Message Submission ID" ) }, 00059 { 0x004D, I18N_NOOP( "Original Author Name" ) }, 00060 { 0x0062, I18N_NOOP( "Owner Appointment ID" ) }, 00061 { 0x0063, I18N_NOOP( "Response Requested" ) }, 00062 { 0x0064, I18N_NOOP( "Sent Representing Address Type" ) }, 00063 { 0x0065, I18N_NOOP( "Sent Representing E-mail Address" ) }, 00064 { 0x0070, I18N_NOOP( "Conversation Topic" ) }, 00065 { 0x0071, I18N_NOOP( "Conversation Index" ) }, 00066 { 0x007F, I18N_NOOP( "TNEF Correlation Key" ) }, 00067 { 0x0C17, I18N_NOOP( "Reply Requested" ) }, 00068 { 0x0C1A, I18N_NOOP( "Sender Name" ) }, 00069 { 0x0C1D, I18N_NOOP( "Sender Search Key" ) }, 00070 { 0x0C1E, I18N_NOOP( "Sender Address Type" ) }, 00071 { 0x0C1F, I18N_NOOP( "Sender E-mail Address" ) }, 00072 { 0x0E01, I18N_NOOP( "Delete After Submit" ) }, 00073 { 0x0E02, I18N_NOOP( "Display Bcc" ) }, 00074 { 0x0E03, I18N_NOOP( "Display Cc" ) }, 00075 { 0x0E04, I18N_NOOP( "Display To" ) }, 00076 { 0x0E06, I18N_NOOP( "Message Delivery Time" ) }, 00077 { 0x0E07, I18N_NOOP( "Message Flags" ) }, 00078 { 0x0E08, I18N_NOOP( "Message Size" ) }, 00079 { 0x0E09, I18N_NOOP( "Parent Entry ID" ) }, 00080 { 0x0E0A, I18N_NOOP( "Sent-Mail Entry ID" ) }, 00081 { 0x0E12, I18N_NOOP( "Message Recipients" ) }, 00082 { 0x0E14, I18N_NOOP( "Submit Flags" ) }, 00083 { 0x0E1B, I18N_NOOP( "Has Attachment" ) }, 00084 { 0x0E1D, I18N_NOOP( "Normalized Subject" ) }, 00085 { 0x0E1F, I18N_NOOP( "RTF In Sync" ) }, 00086 { 0x0E20, I18N_NOOP( "Attachment Size" ) }, 00087 { 0x0E21, I18N_NOOP( "Attachment Number" ) }, 00088 { 0x0FF4, I18N_NOOP( "Access" ) }, 00089 { 0x0FF7, I18N_NOOP( "Access Level" ) }, 00090 { 0x0FF8, I18N_NOOP( "Mapping Signature" ) }, 00091 { 0x0FF9, I18N_NOOP( "Record Key" ) }, 00092 { 0x0FFA, I18N_NOOP( "Store Record Key" ) }, 00093 { 0x0FFB, I18N_NOOP( "Store Entry ID" ) }, 00094 { 0x0FFE, I18N_NOOP( "Object Type" ) }, 00095 { 0x0FFF, I18N_NOOP( "Entry ID" ) }, 00096 { 0x1000, I18N_NOOP( "Message Body" ) }, 00097 { 0x1006, I18N_NOOP( "RTF Sync Body CRC" ) }, 00098 { 0x1007, I18N_NOOP( "RTF Sync Body Count" ) }, 00099 { 0x1008, I18N_NOOP( "RTF Sync Body Tag" ) }, 00100 { 0x1009, I18N_NOOP( "RTF Compressed" ) }, 00101 { 0x1010, I18N_NOOP( "RTF Sync Prefix Count" ) }, 00102 { 0x1011, I18N_NOOP( "RTF Sync Trailing Count" ) }, 00103 { 0x1013, I18N_NOOP( "HTML Message Body" ) }, 00104 { 0x1035, I18N_NOOP( "Message ID" ) }, 00105 { 0x1042, I18N_NOOP( "Parent's Message ID" ) }, 00106 { 0x1080, I18N_NOOP( "Action" ) }, 00107 { 0x1081, I18N_NOOP( "Action Flag" ) }, 00108 { 0x1082, I18N_NOOP( "Action Date" ) }, 00109 { 0x3001, I18N_NOOP( "Display Name" ) }, 00110 { 0x3007, I18N_NOOP( "Creation Time" ) }, 00111 { 0x3008, I18N_NOOP( "Last Modification Time" ) }, 00112 { 0x300B, I18N_NOOP( "Search Key" ) }, 00113 { 0x340D, I18N_NOOP( "Store Support Mask" ) }, 00114 { 0x3414, I18N_NOOP( "MDB Provider" ) }, 00115 { 0x3701, I18N_NOOP( "Attachment Data" ) }, 00116 { 0x3702, I18N_NOOP( "Attachment Encoding" ) }, 00117 { 0x3703, I18N_NOOP( "Attachment Extension" ) }, 00118 { 0x3705, I18N_NOOP( "Attachment Method" ) }, 00119 { 0x3707, I18N_NOOP( "Attachment Long File Name" ) }, 00120 { 0x370B, I18N_NOOP( "Attachment Rendering Position" ) }, 00121 { 0x370E, I18N_NOOP( "Attachment Mime Tag" ) }, 00122 { 0x3714, I18N_NOOP( "Attachment Flags" ) }, 00123 { 0x3A00, I18N_NOOP( "Account" ) }, 00124 { 0x3A05, I18N_NOOP( "Generation" ) }, 00125 { 0x3A06, I18N_NOOP( "Given Name" ) }, 00126 { 0x3A0A, I18N_NOOP( "Initials" ) }, 00127 { 0x3A0B, I18N_NOOP( "Keyword" ) }, 00128 { 0x3A0C, I18N_NOOP( "Language" ) }, 00129 { 0x3A0D, I18N_NOOP( "Location" ) }, 00130 { 0x3A11, I18N_NOOP( "Surname" ) }, 00131 { 0x3A16, I18N_NOOP( "Company Name" ) }, 00132 { 0x3A17, I18N_NOOP2( "@label The title of a person", "Title" ) }, 00133 { 0x3A18, I18N_NOOP( "Department Name" ) }, 00134 { 0x3A26, I18N_NOOP( "Country" ) }, 00135 { 0x3A27, I18N_NOOP( "Locality" ) }, 00136 { 0x3A28, I18N_NOOP( "State/Province" ) }, 00137 { 0x3A44, I18N_NOOP( "Middle Name" ) }, 00138 { 0x3A45, I18N_NOOP( "Display Name Prefix" ) }, 00139 00140 /* Some TNEF attributes */ 00141 { 0x0008, I18N_NOOP( "Owner Appointment ID" ) }, 00142 { 0x0009, I18N_NOOP( "Response Requested" ) }, 00143 { 0x8000, I18N_NOOP( "From" ) }, 00144 { 0x8004, I18N_NOOP2( "@label The subject of an email", "Subject" ) }, 00145 { 0x8005, I18N_NOOP( "Date Sent" ) }, 00146 { 0x8006, I18N_NOOP( "Date Received" ) }, 00147 { 0x8007, I18N_NOOP( "Message Status" ) }, 00148 { 0x8008, I18N_NOOP( "Message Class" ) }, 00149 { 0x8009, I18N_NOOP( "Message ID" ) }, 00150 { 0x800A, I18N_NOOP( "Parent ID" ) }, 00151 { 0x800B, I18N_NOOP( "Conversation ID" ) }, 00152 { 0x800C, I18N_NOOP( "Body" ) }, 00153 { 0x800D, I18N_NOOP( "Priority" ) }, 00154 { 0x800F, I18N_NOOP( "Attachment Data" ) }, 00155 { 0x8010, I18N_NOOP( "Attachment Title" ) }, 00156 { 0x8011, I18N_NOOP( "Attachment Meta File" ) }, 00157 { 0x8012, I18N_NOOP( "Attachment Create Date" ) }, 00158 { 0x8013, I18N_NOOP( "Attachment Modify Date" ) }, 00159 { 0x8020, I18N_NOOP( "Date Modified" ) }, 00160 { 0x9001, I18N_NOOP( "Attachment Transport File Name" ) }, 00161 { 0x9002, I18N_NOOP( "Attachment Rendering Data" ) }, 00162 { 0x9003, I18N_NOOP( "MAPI Properties" ) }, 00163 { 0x9004, I18N_NOOP( "Recipients Table" ) }, 00164 { 0x9005, I18N_NOOP( "Attachment MAPI Properties" ) }, 00165 { 0x9006, I18N_NOOP( "TNEF Version" ) }, 00166 { 0x9007, I18N_NOOP( "OEM Code Page" ) }, 00167 00168 { 0, 0 } 00169 }, 00170 MAPI_NamedTagStrings[] = 00171 { 00172 { 0x8005, I18N_NOOP( "Contact File Under" ) }, 00173 { 0x8017, I18N_NOOP( "Contact Last Name And First Name" ) }, 00174 { 0x8018, I18N_NOOP( "Contact Company And Full Name" ) }, 00175 00176 { 0x8080, I18N_NOOP( "Contact EMail-1 Full" ) }, 00177 { 0x8082, I18N_NOOP( "Contact EMail-1 Address Type" ) }, 00178 { 0x8083, I18N_NOOP( "Contact EMail-1 Address" ) }, 00179 { 0x8084, I18N_NOOP( "Contact EMail-1 Display Name" ) }, 00180 { 0x8085, I18N_NOOP( "Contact EMail-1 Entry ID" ) }, 00181 00182 { 0x8090, I18N_NOOP( "Contact EMail-2 Full" ) }, 00183 { 0x8092, I18N_NOOP( "Contact EMail-2 Address Type" ) }, 00184 { 0x8093, I18N_NOOP( "Contact EMail-2 Address" ) }, 00185 { 0x8094, I18N_NOOP( "Contact EMail-2 Display Name" ) }, 00186 { 0x8095, I18N_NOOP( "Contact EMail-2 Entry ID" ) }, 00187 00188 { 0x8208, I18N_NOOP( "Appointment Location" ) }, 00189 { 0x8208, I18N_NOOP( "Appointment Location" ) }, 00190 { 0x820D, I18N_NOOP( "Appointment Start Date" ) }, 00191 { 0x820E, I18N_NOOP( "Appointment End Date" ) }, 00192 { 0x8213, I18N_NOOP( "Appointment Duration" ) }, 00193 { 0x8218, I18N_NOOP( "Appointment Response Status" ) }, 00194 { 0x8223, I18N_NOOP( "Appointment Is Recurring" ) }, 00195 { 0x8231, I18N_NOOP( "Appointment Recurrence Type" ) }, 00196 { 0x8232, I18N_NOOP( "Appointment Recurrence Pattern" ) }, 00197 { 0x8502, I18N_NOOP( "Reminder Time" ) }, 00198 { 0x8503, I18N_NOOP( "Reminder Set" ) }, 00199 { 0x8516, I18N_NOOP( "Start Date" ) }, 00200 { 0x8517, I18N_NOOP( "End Date" ) }, 00201 { 0x8560, I18N_NOOP( "Reminder Next Time" ) }, 00202 { 0, 0 } 00203 }; 00204 static QMap<int,QString> MAPI_TagMap; 00205 static QMap<int,QString> MAPI_NamedTagMap; 00206 //@endcond 00207 00208 QString mapiTagString( int key ) 00209 { 00210 if ( MAPI_TagMap.count() == 0 ) { 00211 for ( int i=0; MAPI_TagStrings[ i ].str; i++ ) { 00212 MAPI_TagMap[ MAPI_TagStrings[ i ].tag ] = 00213 i18n( MAPI_TagStrings[ i ].str ); 00214 } 00215 } 00216 QMap<int,QString>::ConstIterator it = MAPI_TagMap.constFind( key ); 00217 if ( it == MAPI_TagMap.constEnd() ) { 00218 return QString().sprintf( "0x%04X", key ); 00219 } else { 00220 return QString().sprintf( "0x%04X ________: ", key ) + *it; 00221 } 00222 } 00223 00224 QString mapiNamedTagString( int key, int tag ) 00225 { 00226 if ( MAPI_NamedTagMap.count() == 0 ) { 00227 for ( int i=0; MAPI_NamedTagStrings[ i ].str; i++ ) { 00228 MAPI_NamedTagMap[ MAPI_NamedTagStrings[ i ].tag ] = 00229 i18n( MAPI_NamedTagStrings[ i ].str ); 00230 } 00231 } 00232 QMap<int,QString>::ConstIterator it = MAPI_NamedTagMap.constFind( key ); 00233 if ( it == MAPI_NamedTagMap.constEnd() ) { 00234 if ( tag >= 0 ) { 00235 return QString().sprintf( "0x%04X [0x%04X]: ", tag, key ) + *it; 00236 } else { 00237 return QString().sprintf( "0x%04X ________:", key ) + *it; 00238 } 00239 } else { 00240 return *it; 00241 } 00242 }