diff --git a/autotests/phonenumbertest.cpp b/autotests/phonenumbertest.cpp --- a/autotests/phonenumbertest.cpp +++ b/autotests/phonenumbertest.cpp @@ -201,7 +201,9 @@ KContacts::Addressee addr = lst.at(0); QCOMPARE(addr.phoneNumbers().count(), 1); KContacts::PhoneNumber number1 = addr.phoneNumbers().at(0); - //QCOMPARE(number1.number(), QString()); + QCOMPARE(number1.number(), QLatin1String("+1-919-676-9564")); + QVERIFY(number1.supportsSms()); + QVERIFY(!number1.isPreferred()); } void PhoneNumberTest::shouldExportVCard21() diff --git a/src/phonenumber.h b/src/phonenumber.h --- a/src/phonenumber.h +++ b/src/phonenumber.h @@ -49,6 +49,8 @@ Q_PROPERTY(Type type READ type WRITE setType) Q_PROPERTY(QString typeLabel READ typeLabel) Q_PROPERTY(bool isEmpty READ isEmpty) + Q_PROPERTY(bool isPreferred READ isPreferred) + Q_PROPERTY(bool supportsSms READ supportsSms) public: /** @@ -197,6 +199,17 @@ */ Q_REQUIRED_RESULT static TypeList typeList(); + /** + * Returns whether this phone number is marked as preferred. + * @since 5.12 + */ + Q_REQUIRED_RESULT bool isPreferred() const; + /** + * Returns whether this phone number is expected to support receiving SMS messages. + * @since 5.12 + */ + Q_REQUIRED_RESULT bool supportsSms() const; + /** * Returns the translated label for phone number @p type. * diff --git a/src/phonenumber.cpp b/src/phonenumber.cpp --- a/src/phonenumber.cpp +++ b/src/phonenumber.cpp @@ -263,6 +263,16 @@ return label; } +bool PhoneNumber::isPreferred() const +{ + return type() & Pref; +} + +bool PhoneNumber::supportsSms() const +{ + return type() & Cell; +} + QString PhoneNumber::toString() const { QString str = QLatin1String("PhoneNumber {\n");