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 | /*! |
14 | * \namespace KContacts |
15 | * \inheaderfile KContacts/Namespace |
16 | * \inmodule KContacts |
17 | * \brief Everything that needs to go in to the KContacts Q_NAMESPACE meta object. |
18 | */ |
19 | namespace KContacts |
20 | { |
21 | KCONTACTS_EXPORT Q_NAMESPACE |
22 | |
23 | /*! |
24 | * Address formatting styles. |
25 | * \sa KContacts::Address::formatted |
26 | * \since 5.92 |
27 | * |
28 | * \value Postal Format used for addressing postal mail |
29 | * \value MultiLineDomestic Multi-line format without country, for displaying |
30 | * \value MultiLineInternational Multi-line format including the country, for displaying |
31 | * \value SingleLineDomestic Single-line format without country, for displaying |
32 | * \value SingleLineInternational Single-line format including the country, for displaying |
33 | * \value GeoUriQuery Format used in geo: URI query expressions |
34 | */ |
35 | enum class AddressFormatStyle { |
36 | Postal, |
37 | MultiLineDomestic, |
38 | MultiLineInternational, |
39 | SingleLineDomestic, |
40 | SingleLineInternational, |
41 | GeoUriQuery, |
42 | }; |
43 | |
44 | Q_ENUM_NS(AddressFormatStyle) |
45 | |
46 | /*! |
47 | * Address field types. |
48 | * |
49 | * These are the field types that can be referenced in address format rules. |
50 | * |
51 | * \note Not all of those are represented by vCard and thus KContacts, but exist |
52 | * only for compatibility with libaddressinput, so format rules from that can be |
53 | * consumed directly. |
54 | * |
55 | * \value NoField |
56 | * \value Country |
57 | * \value Region |
58 | * \value Locality |
59 | * \value DependentLocality |
60 | * \value SortingCode |
61 | * \value PostalCode |
62 | * \value StreetAddress |
63 | * \value Organization |
64 | * \value Name |
65 | * \value PostOfficeBox |
66 | * |
67 | * \sa KContacts::AddressFormat |
68 | * \since 5.92 |
69 | */ |
70 | enum class AddressFormatField { |
71 | NoField = 0, |
72 | // from libaddressinput |
73 | Country = 1, |
74 | Region = 2, |
75 | Locality = 4, |
76 | DependentLocality = 8, // not used by us |
77 | SortingCode = 16, // not used by us |
78 | PostalCode = 32, |
79 | StreetAddress = 64, |
80 | Organization = 128, |
81 | Name = 256, |
82 | // added by us for vCard compat |
83 | PostOfficeBox = 512, |
84 | }; |
85 | Q_ENUM_NS(AddressFormatField) |
86 | |
87 | Q_DECLARE_FLAGS(AddressFormatFields, AddressFormatField) |
88 | Q_FLAG_NS(AddressFormatFields) |
89 | |
90 | /*! |
91 | * Indicate whether to use a address format in the local script or a Latin transliteration. |
92 | * \sa KContacts::AddressFormatRepository |
93 | * \since 5.92 |
94 | * |
95 | * \value Local |
96 | * \value Latin |
97 | */ |
98 | enum class AddressFormatScriptPreference { |
99 | Local, |
100 | Latin, |
101 | }; |
102 | Q_ENUM_NS(AddressFormatScriptPreference) |
103 | |
104 | /*! |
105 | * Indicate whether to prefer an address format for (postal) business address or a generic one. |
106 | * \sa KContacts::AddressFormatRepository |
107 | * \since 5.92 |
108 | * |
109 | * \value Generic |
110 | * \value Business |
111 | */ |
112 | enum class AddressFormatPreference { Generic, Business }; |
113 | Q_ENUM_NS(AddressFormatPreference) |
114 | } |
115 | |
116 | Q_DECLARE_OPERATORS_FOR_FLAGS(KContacts::AddressFormatFields) |
117 | |
118 | #endif // KCONTACTS_NAMESPACE_H |
119 | |