Skip to content

Commit

Permalink
[qtcontacts-sqlite] Allow '+' in DTMF section when validating phone n…
Browse files Browse the repository at this point in the history
…umber

Also add unit tests for phone numebr validation.
  • Loading branch information
matthewvogt committed Apr 28, 2014
1 parent 25964b7 commit d8f21d4
Show file tree
Hide file tree
Showing 6 changed files with 464 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/extensions/qtcontacts-extensions_impl.h
Expand Up @@ -81,6 +81,9 @@ QString normalize(const QString &input, int flags, int maxCharacters)
// This is the start of the diallable number
subset.append(*it);
initialChar = *it;
} else if (firstDtmfIndex != -1) {
// Allow inside the DMTF section
subset.append(*it);
} else if (flags & QtContactsSqliteExtensions::ValidatePhoneNumber) {
// Not valid in this location
return QString();
Expand Down Expand Up @@ -110,7 +113,10 @@ QString normalize(const QString &input, int flags, int maxCharacters)
}
}
break;
} else if (firstDtmfIndex == -1) {
}

// Otherwise, continue with processing
if (firstDtmfIndex == -1) {
firstDtmfIndex = subset.length();
}
subset.append(*it);
Expand Down
3 changes: 1 addition & 2 deletions tests/auto/aggregation/aggregation.pro
Expand Up @@ -4,8 +4,7 @@ include(../../common.pri)
QT += contacts-private

INCLUDEPATH += \
../../../src/engine/ \
../../../src/extensions/
../../../src/engine/

HEADERS += \
../../../src/engine/contactid_p.h \
Expand Down
2 changes: 1 addition & 1 deletion tests/auto/auto.pro
@@ -1,3 +1,3 @@
TEMPLATE = subdirs

SUBDIRS = qcontactmanager aggregation qcontactmanagerfiltering
SUBDIRS = qcontactmanager aggregation qcontactmanagerfiltering phonenumber
10 changes: 10 additions & 0 deletions tests/auto/phonenumber/phonenumber.pro
@@ -0,0 +1,10 @@
include(../../common.pri)

TARGET = tst_phonenumber

QT += contacts-private

HEADERS += \
../../util.h
SOURCES += \
tst_phonenumber.cpp

0 comments on commit d8f21d4

Please sign in to comment.