KContacts::PhoneNumber Class
class KContacts::PhoneNumberPhonenumber information. More...
Header: | #include <KContacts/PhoneNumber> |
CMake: | find_package(KF6 REQUIRED COMPONENTS Contacts) target_link_libraries(mytarget PRIVATE KF6::Contacts) |
In QML: | phoneNumber |
Public Types
Properties
|
|
Public Functions
PhoneNumber() | |
PhoneNumber(const QString &number, KContacts::PhoneNumber::Type type = Home) | |
PhoneNumber(const KContacts::PhoneNumber &other) | |
QString | id() const |
bool | isEmpty() const |
(since 5.12) bool | isPreferred() const |
(since 5.12) QString | normalizedNumber() const |
QString | number() const |
void | setId(const QString &identifier) |
void | setNumber(const QString &number) |
void | setType(KContacts::PhoneNumber::Type type) |
(since 5.12) bool | supportsSms() const |
QString | toString() const |
KContacts::PhoneNumber::Type | type() const |
QString | typeLabel() const |
bool | operator!=(const KContacts::PhoneNumber &other) const |
KContacts::PhoneNumber & | operator=(const KContacts::PhoneNumber &other) |
bool | operator==(const KContacts::PhoneNumber &other) const |
Static Public Members
(since 4.5) QString | typeFlagLabel(KContacts::PhoneNumber::TypeFlag type) |
QString | typeLabel(KContacts::PhoneNumber::Type type) |
KContacts::PhoneNumber::TypeList | typeList() |
Related Non-Members
QDataStream & | operator<<(QDataStream &stream, const KContacts::PhoneNumber &number) |
QDataStream & | operator>>(QDataStream &stream, KContacts::PhoneNumber &number) |
Detailed Description
This class provides phone number information. A phone number is classified by a type. The following types are available, it's possible to use multiple types Types for a number by combining them through a logical or.
Member Type Documentation
PhoneNumber::List
List of phone numbers.
enum PhoneNumber::TypeFlag
flags PhoneNumber::Type
Phone number types.
Constant | Value | Description |
---|---|---|
KContacts::PhoneNumber::Home | 1 | Home number |
KContacts::PhoneNumber::Work | 2 | Office number |
KContacts::PhoneNumber::Msg | 4 | Messaging |
KContacts::PhoneNumber::Pref | 8 | Preferred number |
KContacts::PhoneNumber::Voice | 16 | Voice |
KContacts::PhoneNumber::Fax | 32 | Fax machine |
KContacts::PhoneNumber::Cell | 64 | Cell phone |
KContacts::PhoneNumber::Video | 128 | Video phone |
KContacts::PhoneNumber::Bbs | 256 | Mailbox |
KContacts::PhoneNumber::Modem | 512 | Modem |
KContacts::PhoneNumber::Car | 1024 | Car phone |
KContacts::PhoneNumber::Isdn | 2048 | ISDN connection |
KContacts::PhoneNumber::Pcs | 4096 | Personal Communication Service |
KContacts::PhoneNumber::Pager | 8192 | Pager |
KContacts::PhoneNumber::Undefined | 16384 | Undefined number type |
The Type type is a typedef for QFlags<TypeFlag>. It stores an OR combination of TypeFlag values.
PhoneNumber::TypeList
List of phone number types.
Property Documentation
id : QString
Access functions:
[read-only]
isEmpty : const bool
Access functions:
bool | isEmpty() const |
[read-only]
isPreferred : const bool
Access functions:
bool | isPreferred() const |
[read-only]
normalizedNumber : const QString
Access functions:
QString | normalizedNumber() const |
number : QString
Access functions:
[read-only]
supportsSms : const bool
Access functions:
bool | supportsSms() const |
type : Type
Access functions:
[read-only]
typeLabel : const QString
Access functions:
Member Function Documentation
PhoneNumber::PhoneNumber()
Creates an empty phone number object.
PhoneNumber::PhoneNumber(const QString &number, KContacts::PhoneNumber::Type type = Home)
Creates a phone number object.
number Number
type Type as defined in enum. Multiple types can be specified by combining them by a logical or.
PhoneNumber::PhoneNumber(const KContacts::PhoneNumber &other)
Copy constructor.
Fast operation, PhoneNumber's data is implicitly shared.
other The PhoneNumber object to copy from
QString PhoneNumber::id() const
Returns the unique identifier.
Note: Getter function for property id.
See also setId().
bool PhoneNumber::isEmpty() const
Returns true, if the phone number is empty.
Note: Getter function for property isEmpty.
[since 5.12]
bool PhoneNumber::isPreferred() const
Returns whether this phone number is marked as preferred.
Note: Getter function for property isPreferred.
This function was introduced in 5.12.
[since 5.12]
QString PhoneNumber::normalizedNumber() const
Returns the phone number normalized for dialing. This has all formatting stripped for passing to dialers or tel: URLs.
Note: Getter function for property normalizedNumber.
This function was introduced in 5.12.
See also number().
QString PhoneNumber::number() const
Returns the phone number. This is the number as entered/stored with all formatting preserved. Preferred for display.
Note: Getter function for property number.
See also setNumber() and normalizedNumber().
void PhoneNumber::setId(const QString &identifier)
Sets the unique identifier.
Note: Setter function for property id.
See also id().
void PhoneNumber::setNumber(const QString &number)
Sets the phone number.
Note: Setter function for property number.
See also number().
void PhoneNumber::setType(KContacts::PhoneNumber::Type type)
Sets the type. Multiple types can be specified by combining them by a logical or.
type The #Type of the phone number
Note: Setter function for property type.
See also type().
[since 5.12]
bool PhoneNumber::supportsSms() const
Returns whether this phone number is expected to support receiving SMS messages.
Note: Getter function for property supportsSms.
This function was introduced in 5.12.
QString PhoneNumber::toString() const
Returns a string representation of the phone number.
KContacts::PhoneNumber::Type PhoneNumber::type() const
Returns the type. Can be a multiple types combined by a logical or.
Note: Getter function for property type.
See also setType(), TypeFlag, and typeLabel().
[static, since 4.5]
QString PhoneNumber::typeFlagLabel(KContacts::PhoneNumber::TypeFlag type)
Returns the translated label for phone number type.
type An OR'ed combination of #TypeFlag
This function was introduced in 4.5.
See also typeLabel().
QString PhoneNumber::typeLabel() const
Returns a translated string of the address' type.
Note: Getter function for property typeLabel.
[static]
QString PhoneNumber::typeLabel(KContacts::PhoneNumber::Type type)
Returns the translated label for phone number type.
In opposite to typeFlagLabel( TypeFlag type ), it returns all types of the phone number concatenated by '/'.
type An OR'ed combination of #TypeFlag
Note: Getter function for property typeLabel.
See also type().
[static]
KContacts::PhoneNumber::TypeList PhoneNumber::typeList()
Returns a list of all available types
bool PhoneNumber::operator!=(const KContacts::PhoneNumber &other) const
Not-Equal operator.
KContacts::PhoneNumber &PhoneNumber::operator=(const KContacts::PhoneNumber &other)
Assignment operator.
Fast operation, PhoneNumber's data is implicitly shared.
other The PhoneNumber object to asssign to this
bool PhoneNumber::operator==(const KContacts::PhoneNumber &other) const
Equality operator.
Returns true
if number, type and identifier are equal, otherwise false
Related Non-Members
QDataStream &operator<<(QDataStream &stream, const KContacts::PhoneNumber &number)
Serializes the phone number object into the stream.
stream The stream to write into
number The phone number object to serialize
QDataStream &operator>>(QDataStream &stream, KContacts::PhoneNumber &number)
Initializes the phone number object from the stream.
stream The stream to read from
number The phone number object to deserialize into