Merge lp:~tiagosh/dialer-app/fix-1496845 into lp:dialer-app

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 472
Merged at revision: 479
Proposed branch: lp:~tiagosh/dialer-app/fix-1496845
Merge into: lp:dialer-app
Diff against target: 58 lines (+15/-7)
2 files modified
src/dialerapplication.cpp (+14/-7)
src/dialerapplication.h (+1/-0)
To merge this branch: bzr merge lp:~tiagosh/dialer-app/fix-1496845
Reviewer Review Type Date Requested Status
Gustavo Pichorim Boiko (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+274925@code.launchpad.net

Commit message

- Avoid removing # and other characters from tel: uri's

Description of the change

- Avoid removing # and other characters from tel: uri's

To post a comment you must log in.
lp:~tiagosh/dialer-app/fix-1496845 updated
472. By Tiago Salem Herrmann

use remove() instead of mid()

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/dialerapplication.cpp'
2--- src/dialerapplication.cpp 2015-07-24 21:58:48 +0000
3+++ src/dialerapplication.cpp 2015-10-19 17:39:28 +0000
4@@ -69,10 +69,9 @@
5 bool DialerApplication::setup()
6 {
7 installIconPath();
8- static QList<QString> validSchemes;
9
10- if (validSchemes.isEmpty()) {
11- validSchemes << "tel" << "dialer";
12+ if (mValidSchemes.isEmpty()) {
13+ mValidSchemes << "tel" << "dialer";
14 }
15
16 QStringList arguments = this->arguments();
17@@ -122,7 +121,7 @@
18
19 if (arguments.size() == 2) {
20 QUrl uri(arguments.at(1));
21- if (validSchemes.contains(uri.scheme())) {
22+ if (mValidSchemes.contains(uri.scheme())) {
23 m_arg = arguments.at(1);
24 }
25 }
26@@ -205,9 +204,17 @@
27
28 QUrl url(arg);
29 QString scheme = url.scheme();
30- QString value = url.path();
31- if (value.startsWith("/")) {
32- value.remove(0, 1);
33+ // we can't fill value with url.path() as it might contain the # character and QUrl will drop it.
34+ QString value;
35+ if (!mValidSchemes.contains(url.scheme())) {
36+ qWarning() << "Url scheme not valid for dialer-app";
37+ return;
38+ } else if (url.scheme() == "tel") {
39+ // remove the initial tel:, it doesn't matter if it contains /// or //, as we
40+ // now use libphonenumber and it will remove these invalid characters when in the beginning
41+ // of the number
42+ value = arg;
43+ value = QUrl::fromPercentEncoding(value.remove("tel:").toLatin1());
44 }
45
46 QQuickItem *mainView = m_view->rootObject();
47
48=== modified file 'src/dialerapplication.h'
49--- src/dialerapplication.h 2014-10-31 20:49:19 +0000
50+++ src/dialerapplication.h 2015-10-19 17:39:28 +0000
51@@ -53,6 +53,7 @@
52 QString m_arg;
53 bool m_applicationIsReady;
54 bool m_fullScreen;
55+ QList<QString> mValidSchemes;
56 };
57
58 #endif // DIALERAPPLICATION_H

Subscribers

People subscribed via source and target branches