KTnef

mapi.cpp
Go to the documentation of this file.
1/*
2 mapi.cpp
3
4 SPDX-FileCopyrightText: 2002 Michael Goffioul <kdeprint@swing.be>
5
6 This file is part of KTNEF, the KDE TNEF support library/program.
7
8 SPDX-License-Identifier: LGPL-2.0-or-later
9 */
10/**
11 * @file
12 * This file is part of the API for handling TNEF data and
13 * provides functions that convert MAPI keycodes to/from tag strings.
14 *
15 * @author Michael Goffioul
16 */
17
18#include "mapi.h"
19#include <KLocalizedString>
20#include <QMap>
21//@cond IGNORE
22#include <KLazyLocalizedString>
23static const struct {
24 int tag;
25 const KLazyLocalizedString str;
26} MAPI_TagStrings[] = {{0x0002, kli18n("Alternate Recipient Allowed")},
27 {0x001A, kli18n("Message Class")},
28 {0x0023, kli18n("Originator Delivery Report Requested")},
29 {0x0024, kli18n("Originator Return Address")},
30 {0x0026, kli18n("Priority")},
31 {0x0029, kli18n("Read Receipt Requested")},
32 {0x002B, kli18n("Recipient Reassignment Prohibited")},
33 {0x002E, kli18n("Original Sensitivity")},
34 {0x0031, kli18n("Report Tag")},
35 {0x0036, kli18n("Sensitivity")},
36 {0x0037, kli18n("Subject")},
37 {0x0039, kli18n("Client Submit Time")},
38 {0x003B, kli18n("Sent Representing Search Key")},
39 {0x003D, kli18n("Subject Prefix")},
40 {0x0041, kli18n("Sent Representing Entry ID")},
41 {0x0042, kli18n("Sent Representing Name")},
42 {0x0047, kli18n("Message Submission ID")},
43 {0x004D, kli18n("Original Author Name")},
44 {0x0062, kli18n("Owner Appointment ID")},
45 {0x0063, kli18n("Response Requested")},
46 {0x0064, kli18n("Sent Representing Address Type")},
47 {0x0065, kli18n("Sent Representing E-mail Address")},
48 {0x0070, kli18n("Conversation Topic")},
49 {0x0071, kli18n("Conversation Index")},
50 {0x007F, kli18n("TNEF Correlation Key")},
51 {0x0C17, kli18n("Reply Requested")},
52 {0x0C1A, kli18n("Sender Name")},
53 {0x0C1D, kli18n("Sender Search Key")},
54 {0x0C1E, kli18n("Sender Address Type")},
55 {0x0C1F, kli18n("Sender E-mail Address")},
56 {0x0E01, kli18n("Delete After Submit")},
57 {0x0E02, kli18n("Display Bcc")},
58 {0x0E03, kli18n("Display Cc")},
59 {0x0E04, kli18n("Display To")},
60 {0x0E06, kli18n("Message Delivery Time")},
61 {0x0E07, kli18n("Message Flags")},
62 {0x0E08, kli18n("Message Size")},
63 {0x0E09, kli18n("Parent Entry ID")},
64 {0x0E0A, kli18n("Sent-Mail Entry ID")},
65 {0x0E12, kli18n("Message Recipients")},
66 {0x0E14, kli18n("Submit Flags")},
67 {0x0E1B, kli18n("Has Attachment")},
68 {0x0E1D, kli18n("Normalized Subject")},
69 {0x0E1F, kli18n("RTF In Sync")},
70 {0x0E20, kli18n("Attachment Size")},
71 {0x0E21, kli18n("Attachment Number")},
72 {0x0FF4, kli18n("Access")},
73 {0x0FF7, kli18n("Access Level")},
74 {0x0FF8, kli18n("Mapping Signature")},
75 {0x0FF9, kli18n("Record Key")},
76 {0x0FFA, kli18n("Store Record Key")},
77 {0x0FFB, kli18n("Store Entry ID")},
78 {0x0FFE, kli18n("Object Type")},
79 {0x0FFF, kli18n("Entry ID")},
80 {0x1000, kli18n("Message Body")},
81 {0x1006, kli18n("RTF Sync Body CRC")},
82 {0x1007, kli18n("RTF Sync Body Count")},
83 {0x1008, kli18n("RTF Sync Body Tag")},
84 {0x1009, kli18n("RTF Compressed")},
85 {0x1010, kli18n("RTF Sync Prefix Count")},
86 {0x1011, kli18n("RTF Sync Trailing Count")},
87 {0x1013, kli18n("HTML Message Body")},
88 {0x1035, kli18n("Message ID")},
89 {0x1042, kli18n("Parent's Message ID")},
90 {0x1080, kli18n("Action")},
91 {0x1081, kli18n("Action Flag")},
92 {0x1082, kli18n("Action Date")},
93 {0x3001, kli18n("Display Name")},
94 {0x3007, kli18n("Creation Time")},
95 {0x3008, kli18n("Last Modification Time")},
96 {0x300B, kli18n("Search Key")},
97 {0x340D, kli18n("Store Support Mask")},
98 {0x3414, kli18n("MDB Provider")},
99 {0x3701, kli18n("Attachment Data")},
100 {0x3702, kli18n("Attachment Encoding")},
101 {0x3703, kli18n("Attachment Extension")},
102 {0x3705, kli18n("Attachment Method")},
103 {0x3707, kli18n("Attachment Long File Name")},
104 {0x370B, kli18n("Attachment Rendering Position")},
105 {0x370E, kli18n("Attachment Mime Tag")},
106 {0x3714, kli18n("Attachment Flags")},
107 {0x3A00, kli18n("Account")},
108 {0x3A05, kli18n("Generation")},
109 {0x3A06, kli18n("Given Name")},
110 {0x3A0A, kli18n("Initials")},
111 {0x3A0B, kli18n("Keyword")},
112 {0x3A0C, kli18n("Language")},
113 {0x3A0D, kli18n("Location")},
114 {0x3A11, kli18n("Surname")},
115 {0x3A16, kli18n("Company Name")},
116 {0x3A17, kli18n("Title")},
117 {0x3A18, kli18n("Department Name")},
118 {0x3A26, kli18n("Country")},
119 {0x3A27, kli18n("Locality")},
120 {0x3A28, kli18n("State/Province")},
121 {0x3A44, kli18n("Middle Name")},
122 {0x3A45, kli18n("Display Name Prefix")},
123
124 /* Some TNEF attributes */
125 {0x0008, kli18n("Owner Appointment ID")},
126 {0x0009, kli18n("Response Requested")},
127 {0x8000, kli18n("From")},
128 {0x8004, kli18n("Subject")},
129 {0x8005, kli18n("Date Sent")},
130 {0x8006, kli18n("Date Received")},
131 {0x8007, kli18n("Message Status")},
132 {0x8008, kli18n("Message Class")},
133 {0x8009, kli18n("Message ID")},
134 {0x800A, kli18n("Parent ID")},
135 {0x800B, kli18n("Conversation ID")},
136 {0x800C, kli18n("Body")},
137 {0x800D, kli18n("Priority")},
138 {0x800F, kli18n("Attachment Data")},
139 {0x8010, kli18n("Attachment Title")},
140 {0x8011, kli18n("Attachment Meta File")},
141 {0x8012, kli18n("Attachment Create Date")},
142 {0x8013, kli18n("Attachment Modify Date")},
143 {0x8020, kli18n("Date Modified")},
144 {0x9001, kli18n("Attachment Transport File Name")},
145 {0x9002, kli18n("Attachment Rendering Data")},
146 {0x9003, kli18n("MAPI Properties")},
147 {0x9004, kli18n("Recipients Table")},
148 {0x9005, kli18n("Attachment MAPI Properties")},
149 {0x9006, kli18n("TNEF Version")},
150 {0x9007, kli18n("OEM Code Page")},
151 {0, KLazyLocalizedString()}},
152 MAPI_NamedTagStrings[] = {{0x8005, kli18n("Contact File Under")},
153 {0x8017, kli18n("Contact Last Name And First Name")},
154 {0x8018, kli18n("Contact Company And Full Name")},
155
156 {0x8080, kli18n("Contact EMail-1 Full")},
157 {0x8082, kli18n("Contact EMail-1 Address Type")},
158 {0x8083, kli18n("Contact EMail-1 Address")},
159 {0x8084, kli18n("Contact EMail-1 Display Name")},
160 {0x8085, kli18n("Contact EMail-1 Entry ID")},
161
162 {0x8090, kli18n("Contact EMail-2 Full")},
163 {0x8092, kli18n("Contact EMail-2 Address Type")},
164 {0x8093, kli18n("Contact EMail-2 Address")},
165 {0x8094, kli18n("Contact EMail-2 Display Name")},
166 {0x8095, kli18n("Contact EMail-2 Entry ID")},
167
168 {0x8208, kli18n("Appointment Location")},
169 {0x8208, kli18n("Appointment Location")},
170 {0x820D, kli18n("Appointment Start Date")},
171 {0x820E, kli18n("Appointment End Date")},
172 {0x8213, kli18n("Appointment Duration")},
173 {0x8218, kli18n("Appointment Response Status")},
174 {0x8223, kli18n("Appointment Is Recurring")},
175 {0x8231, kli18n("Appointment Recurrence Type")},
176 {0x8232, kli18n("Appointment Recurrence Pattern")},
177 {0x8502, kli18n("Reminder Time")},
178 {0x8503, kli18n("Reminder Set")},
179 {0x8516, kli18n("Start Date")},
180 {0x8517, kli18n("End Date")},
181 {0x8560, kli18n("Reminder Next Time")},
182 {0, KLazyLocalizedString()}};
183
184using TagMap = QMap<int, QString>;
185Q_GLOBAL_STATIC(TagMap, MAPI_TagMap)
186Q_GLOBAL_STATIC(TagMap, MAPI_NamedTagMap)
187
188//@endcond
189
190QString KTnef::mapiTagString(int key)
191{
192 if (MAPI_TagMap()->isEmpty()) {
193 for (int i = 0; !KLocalizedString(MAPI_TagStrings[i].str).isEmpty(); i++) {
194 (*MAPI_TagMap())[MAPI_TagStrings[i].tag] = KLocalizedString(MAPI_TagStrings[i].str).toString();
195 }
196 }
197 auto it = MAPI_TagMap()->constFind(key);
198 if (it == MAPI_TagMap()->constEnd()) {
199 return QString::asprintf("0x%04X", key);
200 } else {
201 return QString::asprintf("0x%04X ________: ", key) + *it;
202 }
203}
204
206{
207 if (MAPI_NamedTagMap()->isEmpty()) {
208 for (int i = 0; !KLocalizedString(MAPI_NamedTagStrings[i].str).isEmpty(); i++) {
209 (*MAPI_TagMap())[MAPI_TagStrings[i].tag] = KLocalizedString(MAPI_NamedTagStrings[i].str).toString();
210 }
211 }
212 auto it = MAPI_NamedTagMap()->constFind(key);
213 if (it != MAPI_NamedTagMap()->constEnd()) {
214 if (tag >= 0) {
215 return QString::asprintf("0x%04X [0x%04X]: ", tag, key) + *it;
216 } else {
217 return QString::asprintf("0x%04X ________:", key) + *it;
218 }
219 } else {
220 return QString::asprintf("0x%04X ________:", key);
221 }
222}
QString toString() const
bool isEmpty() const
This file is part of the API for handling TNEF data and provides functions that convert MAPI keycodes...
QString mapiNamedTagString(int key, int tag=-1)
Convert a keycode to a MAPI named tag string.
Definition mapi.cpp:205
QString asprintf(const char *cformat,...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:16:42 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.