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 class AddresseeHelperPrivate;
17 
18 /**
19  * This singleton class stores static data, which is shared
20  * by all Addressee objects. It maintains three lists of
21  * strings, which can be queried using this class:
22  *
23  * - a list of honoric prefixes, like "Mrs.", "Prof." etc,
24  * see containsTitle()
25  * - a list of inclusions, such as "van" or "de", see
26  * containsPrefix()
27  * - a list of honoric suffixes, such as "I" or "Jr.", see
28  * containsSuffix()
29  *
30  * All of these lists have a hardcoded and a configurable
31  * part. The configurable part is found in @c kabcrc, group
32  * @c General, fields @c Prefixes, @c Inclusions, and
33  * @c Suffixes.
34  *
35  * In addition to the above, this class stores one conveniece
36  * setting: it stores whether or not a single name component
37  * should be interpreted as a family name (see
38  * treatAsFamilyName()). The corresponding configuration
39  * field is @c TreatAsFamilyName.
40  */
41 class KCONTACTS_EXPORT AddresseeHelper : public QObject
42 {
43  Q_OBJECT
44 
45 public:
46  /**
47  * Singleton interface to this class
48  *
49  * @return a pointer to the unique instance of this class.
50  */
51  static AddresseeHelper *self();
52 
53  /**
54  * Queries the list of honoric prefixes.
55  *
56  * @param title the honoric prefix to search for
57  * @return @c true, if @p title was found in the list,
58  * @c false otherwise
59  */
60  Q_REQUIRED_RESULT bool containsTitle(const QString &title) const;
61 
62  /**
63  * Queries the list of inclusions.
64  *
65  * @param prefix the inclusion to search for
66  * @return @c true, if @p prefix was found in the list,
67  * @c false otherwise
68  */
69  Q_REQUIRED_RESULT bool containsPrefix(const QString &prefix) const;
70 
71  /**
72  * Queries the list of honoric suffixes.
73  *
74  * @param suffix the honoric suffix to search for
75  * @return @c true, if @p suffix was found in the list,
76  * @c false otherwise
77  */
78  Q_REQUIRED_RESULT bool containsSuffix(const QString &suffix) const;
79 
80  /**
81  * Returns whether or not a single name component should
82  * be interpreted as a family name.
83  *
84  * @return @c true if single name component is a family name,
85  * @c false otherwise.
86  */
87  Q_REQUIRED_RESULT bool treatAsFamilyName() const;
88 
89  /** @internal */
91 
92  ~AddresseeHelper();
93 
94 public Q_SLOTS:
95  /**
96  * Recreates the static data and reparses the configuration.
97  */
98  void initSettings();
99 
100 private:
102 };
103 }
104 
105 #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 Thu Mar 4 2021 22:56:01 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.