KContacts

addresseehelper.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 2003 Carsten Pfeiffer <[email protected]>
4 
5  This SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef KCONTACTS_ADDRESSEEHELPER_H
9 #define KCONTACTS_ADDRESSEEHELPER_H
10 
11 #include "kcontacts_export.h"
12 
13 #include <QObject>
14 
15 namespace KContacts
16 {
17 class AddresseeHelperPrivate;
18 
19 /**
20  * This singleton class stores static data, which is shared
21  * by all Addressee objects. It maintains three lists of
22  * strings, which can be queried using this class:
23  *
24  * - a list of honoric prefixes, like "Mrs.", "Prof." etc,
25  * see containsTitle()
26  * - a list of inclusions, such as "van" or "de", see
27  * containsPrefix()
28  * - a list of honoric suffixes, such as "I" or "Jr.", see
29  * containsSuffix()
30  *
31  * All of these lists have a hardcoded and a configurable
32  * part. The configurable part is found in @c kabcrc, group
33  * @c General, fields @c Prefixes, @c Inclusions, and
34  * @c Suffixes.
35  *
36  * In addition to the above, this class stores one conveniece
37  * setting: it stores whether or not a single name component
38  * should be interpreted as a family name (see
39  * treatAsFamilyName()). The corresponding configuration
40  * field is @c TreatAsFamilyName.
41  */
42 class KCONTACTS_EXPORT AddresseeHelper : public QObject
43 {
44  Q_OBJECT
45 
46 public:
47  /**
48  * Singleton interface to this class
49  *
50  * @return a pointer to the unique instance of this class.
51  */
52  static AddresseeHelper *self();
53 
54  /**
55  * Queries the list of honoric prefixes.
56  *
57  * @param title the honoric prefix to search for
58  * @return @c true, if @p title was found in the list,
59  * @c false otherwise
60  */
61  Q_REQUIRED_RESULT bool containsTitle(const QString &title) const;
62 
63  /**
64  * Queries the list of inclusions.
65  *
66  * @param prefix the inclusion to search for
67  * @return @c true, if @p prefix was found in the list,
68  * @c false otherwise
69  */
70  Q_REQUIRED_RESULT bool containsPrefix(const QString &prefix) const;
71 
72  /**
73  * Queries the list of honoric suffixes.
74  *
75  * @param suffix the honoric suffix to search for
76  * @return @c true, if @p suffix was found in the list,
77  * @c false otherwise
78  */
79  Q_REQUIRED_RESULT bool containsSuffix(const QString &suffix) const;
80 
81  /**
82  * Returns whether or not a single name component should
83  * be interpreted as a family name.
84  *
85  * @return @c true if single name component is a family name,
86  * @c false otherwise.
87  */
88  Q_REQUIRED_RESULT bool treatAsFamilyName() const;
89 
90  /** @internal */
92 
93  ~AddresseeHelper();
94 
95 public Q_SLOTS:
96  /**
97  * Recreates the static data and reparses the configuration.
98  */
99  void initSettings();
100 
101 private:
103 };
104 }
105 
106 #endif
This singleton class stores static data, which is shared by all Addressee objects.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Jun 12 2021 22:55:10 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.