KContacts

phonenumber.h
1 /*
2  This file is part of the KContacts framework.
3  SPDX-FileCopyrightText: 2001 Cornelius Schumacher <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef KCONTACTS_PHONENUMBER_H
9 #define KCONTACTS_PHONENUMBER_H
10 
11 #include "kcontacts_export.h"
12 
13 #include <QMap>
14 #include <QMetaType>
15 #include <QSharedDataPointer>
16 #include <QString>
17 #include <QVector>
18 
19 namespace KContacts {
27 class KCONTACTS_EXPORT PhoneNumber
28 {
29  friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const PhoneNumber &);
30  friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, PhoneNumber &);
31 
32  Q_GADGET
33  Q_PROPERTY(QString id READ id WRITE setId)
34  Q_PROPERTY(QString number READ number WRITE setNumber)
35  Q_PROPERTY(QString normalizedNumber READ normalizedNumber)
36  Q_PROPERTY(Type type READ type WRITE setType)
37  Q_PROPERTY(QString typeLabel READ typeLabel)
38  Q_PROPERTY(bool isEmpty READ isEmpty)
39  Q_PROPERTY(bool isPreferred READ isPreferred)
40  Q_PROPERTY(bool supportsSms READ supportsSms)
41 
42 public:
47  enum TypeFlag {
48  Home = 1,
49  Work = 2,
50  Msg = 4,
51  Pref = 8,
52  Voice = 16,
53  Fax = 32,
54  Cell = 64,
55  Video = 128,
56  Bbs = 256,
57  Modem = 512,
58  Car = 1024,
59  Isdn = 2048,
60  Pcs = 4096,
61  Pager = 8192,
62  //TODO add Text and textphone support vcard4
63  Undefined = 16384
64  };
65 
69  Q_DECLARE_FLAGS(Type, TypeFlag)
70  Q_FLAG(Type)
71 
76 
81 
85  PhoneNumber();
86 
94  PhoneNumber(const QString &number, Type type = Home); //krazy:exclude=explicit
95 
103  PhoneNumber(const PhoneNumber &other);
104 
108  ~PhoneNumber();
109 
116  Q_REQUIRED_RESULT bool operator==(const PhoneNumber &other) const;
117 
121  Q_REQUIRED_RESULT bool operator!=(const PhoneNumber &other) const;
122 
130  PhoneNumber &operator=(const PhoneNumber &other);
131 
135  Q_REQUIRED_RESULT bool isEmpty() const;
136 
140  void setId(const QString &identifier);
141 
145  Q_REQUIRED_RESULT QString id() const;
146 
150  void setNumber(const QString &number);
151 
157  Q_REQUIRED_RESULT QString number() const;
158 
165  Q_REQUIRED_RESULT QString normalizedNumber() const;
166 
173  void setType(Type type);
174 
181  Q_REQUIRED_RESULT Type type() const;
182 
186  Q_REQUIRED_RESULT QString typeLabel() const;
187 
191  Q_REQUIRED_RESULT static TypeList typeList();
192 
197  Q_REQUIRED_RESULT bool isPreferred() const;
202  Q_REQUIRED_RESULT bool supportsSms() const;
203 
214  static QString typeLabel(Type type);
215 
224  Q_REQUIRED_RESULT static QString typeFlagLabel(TypeFlag type);
225 
229  QString toString() const;
230 
231  void setParameters(const QMap<QString, QStringList> &params);
232  Q_REQUIRED_RESULT QMap<QString, QStringList> parameters() const;
233 
234 private:
235  class Private;
236  QSharedDataPointer<Private> d;
237 };
238 
239 Q_DECLARE_OPERATORS_FOR_FLAGS(PhoneNumber::Type)
240 
247 KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const PhoneNumber &number);
248 
255 KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, PhoneNumber &number);
256 }
257 Q_DECLARE_METATYPE(KContacts::PhoneNumber)
258 Q_DECLARE_TYPEINFO(KContacts::PhoneNumber, Q_MOVABLE_TYPE);
259 #endif
QDataStream & operator>>(QDataStream &in, KDateTime::Spec &spec)
TypeFlag
Phone number types.
Definition: phonenumber.h:47
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
Phonenumber information.
Definition: phonenumber.h:27
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Nov 30 2020 22:55:38 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.