diff --git a/src/akonadi-contacts/actions/dialphonenumberaction.cpp b/src/akonadi-contacts/actions/dialphonenumberaction.cpp --- a/src/akonadi-contacts/actions/dialphonenumberaction.cpp +++ b/src/akonadi-contacts/actions/dialphonenumberaction.cpp @@ -36,21 +36,6 @@ using namespace Akonadi; -static QString strippedDialNumber(const QString &number) -{ - QString result; - - const int numberLength(number.length()); - for (int i = 0; i < numberLength; ++i) { - const QChar character = number.at(i); - if (character.isDigit() || (character == QLatin1Char('+') && i == 0)) { - result += character; - } - } - - return result; -} - void DialPhoneNumberAction::dialNumber(const KContacts::PhoneNumber &number) { // synchronize @@ -66,7 +51,7 @@ dialer = new QEkigaDialer(QStringLiteral("AkonadiContacts")); } if (dialer) { - if (!dialer->dialNumber(strippedDialNumber(number.number().trimmed()))) { + if (!dialer->dialNumber(number.normalizedNumber())) { KMessageBox::sorry(nullptr, dialer->errorMessage()); } delete dialer; @@ -76,7 +61,7 @@ if (ContactActionsSettings::self()->dialPhoneNumberAction() == ContactActionsSettings::UseSystemDefault) { QUrl url; url.setScheme(QStringLiteral("tel")); - url.setPath(strippedDialNumber(number.number())); + url.setPath(number.normalizedNumber()); QDesktopServices::openUrl(url); return; } @@ -92,7 +77,7 @@ * %n the number with all additional non-number characters removed */ command = command.replace(QLatin1String("%N"), number.number()); - command = command.replace(QLatin1String("%n"), strippedDialNumber(number.number().trimmed())); + command = command.replace(QLatin1String("%n"), number.normalizedNumber()); KRun::runCommand(command, nullptr); } diff --git a/src/akonadi-contacts/actions/sendsmsaction.cpp b/src/akonadi-contacts/actions/sendsmsaction.cpp --- a/src/akonadi-contacts/actions/sendsmsaction.cpp +++ b/src/akonadi-contacts/actions/sendsmsaction.cpp @@ -38,21 +38,6 @@ #include -static QString strippedSmsNumber(const QString &number) -{ - QString result; - - const int numberLenght(number.length()); - for (int i = 0; i < numberLenght; ++i) { - const QChar character = number.at(i); - if (character.isDigit() || (character == QLatin1Char('+') && i == 0)) { - result += character; - } - } - - return result; -} - void SendSmsAction::sendSms(const KContacts::PhoneNumber &phoneNumber) { const QString number = phoneNumber.number().trimmed(); @@ -94,7 +79,7 @@ if (ContactActionsSettings::self()->sendSmsAction() == ContactActionsSettings::UseSystemDefaultSms) { QUrl url; url.setScheme(QStringLiteral("sms")); - url.setPath(strippedSmsNumber(phoneNumber.number())); + url.setPath(phoneNumber.normalizedNumber()); QUrlQuery query; query.addQueryItem(QStringLiteral("body"), message); url.setQuery(query); @@ -107,7 +92,7 @@ * %n the number with all additional non-number characters removed */ command = command.replace(QLatin1String("%N"), QStringLiteral("\"%1\"").arg(phoneNumber.number())); - command = command.replace(QLatin1String("%n"), QStringLiteral("\"%1\"").arg(strippedSmsNumber(number))); + command = command.replace(QLatin1String("%n"), QStringLiteral("\"%1\"").arg(phoneNumber.normalizedNumber())); command = command.replace(QLatin1String("%t"), QStringLiteral("\"%1\"").arg(message)); //Bug: 293232 In KDE3 We used %F to replace text command = command.replace(QLatin1String("%F"), message);