1 | /* |
2 | SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org> |
3 | SPDX-License-Identifier: LGPL-2.0-or-later |
4 | */ |
5 | |
6 | #ifndef KCONTACTS_NAMESPACE_H |
7 | #define KCONTACTS_NAMESPACE_H |
8 | |
9 | #include "kcontacts_export.h" |
10 | |
11 | #include <QMetaType> |
12 | |
13 | /** @file namespace.h |
14 | * Everything that needs to go in to the KContacts Q_NAMESPACE meta object. |
15 | */ |
16 | |
17 | namespace KContacts |
18 | { |
19 | KCONTACTS_EXPORT Q_NAMESPACE |
20 | |
21 | /** Address formatting styles. |
22 | * @see KContacts::Address::formatted |
23 | * @since 5.92 |
24 | */ |
25 | enum class AddressFormatStyle { |
26 | Postal, ///< Format used for addressing postal mail |
27 | MultiLineDomestic, ///< Multi-line format without country, for displaying |
28 | MultiLineInternational, ///< Multi-line format including the country, for displaying |
29 | SingleLineDomestic, ///< Single-line format without country, for displaying |
30 | SingleLineInternational, ///< Single-line format including the country, for displaying |
31 | GeoUriQuery, ///< Format used in geo: URI query expressions |
32 | }; |
33 | |
34 | Q_ENUM_NS(AddressFormatStyle) |
35 | |
36 | /** Address field types. |
37 | * These are the field types that can be referenced in address format rules. |
38 | * @note Not all of those are represented by vCard and thus KContacts, but exist |
39 | * only for compatibility with libaddressinput, so format rules from that can be |
40 | * consumed directly. |
41 | * @see KContacts::AddressFormat |
42 | * @since 5.92 |
43 | */ |
44 | enum class AddressFormatField { |
45 | NoField = 0, |
46 | // from libaddressinput |
47 | Country = 1, |
48 | Region = 2, |
49 | Locality = 4, |
50 | DependentLocality = 8, // not used by us |
51 | SortingCode = 16, // not used by us |
52 | PostalCode = 32, |
53 | StreetAddress = 64, |
54 | Organization = 128, |
55 | Name = 256, |
56 | // added by us for vCard compat |
57 | PostOfficeBox = 512, |
58 | }; |
59 | Q_ENUM_NS(AddressFormatField) |
60 | |
61 | /** A set of address fields. |
62 | * @see KContacts::AddressFormat |
63 | * @since 5.92 |
64 | */ |
65 | Q_DECLARE_FLAGS(AddressFormatFields, AddressFormatField) |
66 | Q_FLAG_NS(AddressFormatFields) |
67 | |
68 | /** Indicate whether to use a address format in the local script or a Latin transliteration. |
69 | * @see KContacts::AddressFormatRepository |
70 | * @since 5.92 |
71 | */ |
72 | enum class AddressFormatScriptPreference { |
73 | Local, |
74 | Latin, |
75 | }; |
76 | Q_ENUM_NS(AddressFormatScriptPreference) |
77 | |
78 | /** Indicate whether to prefer an address format for (postal) business address or a generic one. |
79 | * @see KContacts::AddressFormatRepository |
80 | * @since 5.92 |
81 | */ |
82 | enum class AddressFormatPreference { Generic, Business }; |
83 | Q_ENUM_NS(AddressFormatPreference) |
84 | } |
85 | |
86 | Q_DECLARE_OPERATORS_FOR_FLAGS(KContacts::AddressFormatFields) |
87 | |
88 | #endif // KCONTACTS_NAMESPACE_H |
89 | |