File indexing completed on 2024-02-18 03:55:24

0001 /*
0002     SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
0003     SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 
0006 #ifndef KCONTACTS_NAMESPACE_H
0007 #define KCONTACTS_NAMESPACE_H
0008 
0009 #include "kcontacts_export.h"
0010 
0011 #include <QMetaType>
0012 
0013 /** @file namespace.h
0014  *  Everything that needs to go in to the KContacts Q_NAMESPACE meta object.
0015  */
0016 
0017 namespace KContacts
0018 {
0019 KCONTACTS_EXPORT Q_NAMESPACE
0020 
0021     /** Address formatting styles.
0022      *  @see KContacts::Address::formatted
0023      *  @since 5.92
0024      */
0025     enum class AddressFormatStyle {
0026         Postal, ///< Format used for addressing postal mail
0027         MultiLineDomestic, ///< Multi-line format without country, for displaying
0028         MultiLineInternational, ///< Multi-line format including the country, for displaying
0029         SingleLineDomestic, ///< Single-line format without country, for displaying
0030         SingleLineInternational, ///< Single-line format including the country, for displaying
0031         GeoUriQuery, ///< Format used in geo: URI query expressions
0032     };
0033 
0034 Q_ENUM_NS(AddressFormatStyle)
0035 
0036 /** Address field types.
0037  *  These are the field types that can be referenced in address format rules.
0038  *  @note Not all of those are represented by vCard and thus KContacts, but exist
0039  *  only for compatibility with libaddressinput, so format rules from that can be
0040  *  consumed directly.
0041  *  @see KContacts::AddressFormat
0042  *  @since 5.92
0043  */
0044 enum class AddressFormatField {
0045     NoField = 0,
0046     // from libaddressinput
0047     Country = 1,
0048     Region = 2,
0049     Locality = 4,
0050     DependentLocality = 8, // not used by us
0051     SortingCode = 16, // not used by us
0052     PostalCode = 32,
0053     StreetAddress = 64,
0054     Organization = 128,
0055     Name = 256,
0056     // added by us for vCard compat
0057     PostOfficeBox = 512,
0058 };
0059 Q_ENUM_NS(AddressFormatField)
0060 
0061 /** A set of address fields.
0062  *  @see KContacts::AddressFormat
0063  *  @since 5.92
0064  */
0065 Q_DECLARE_FLAGS(AddressFormatFields, AddressFormatField)
0066 Q_FLAG_NS(AddressFormatFields)
0067 
0068 /** Indicate whether to use a address format in the local script or a Latin transliteration.
0069  *  @see KContacts::AddressFormatRepository
0070  *  @since 5.92
0071  */
0072 enum class AddressFormatScriptPreference {
0073     Local,
0074     Latin,
0075 };
0076 Q_ENUM_NS(AddressFormatScriptPreference)
0077 
0078 /** Indicate whether to prefer an address format for (postal) business address or a generic one.
0079  *  @see KContacts::AddressFormatRepository
0080  *  @since 5.92
0081  */
0082 enum class AddressFormatPreference { Generic, Business };
0083 Q_ENUM_NS(AddressFormatPreference)
0084 }
0085 
0086 Q_DECLARE_OPERATORS_FOR_FLAGS(KContacts::AddressFormatFields)
0087 
0088 #endif // KCONTACTS_NAMESPACE_H