Merge lp:~tiagosh/messaging-app/fix-1192442 into lp:messaging-app

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Francis Ginther
Approved revision: 44
Merged at revision: 41
Proposed branch: lp:~tiagosh/messaging-app/fix-1192442
Merge into: lp:messaging-app
Diff against target: 22 lines (+11/-1)
1 file modified
src/qml/MessageDelegate.qml (+11/-1)
To merge this branch: bzr merge lp:~tiagosh/messaging-app/fix-1192442
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Gustavo Pichorim Boiko (community) Approve
Review via email: mp+188147@code.launchpad.net

Commit message

Parse messages and add links when necessary.

Description of the change

Parse messages and add links when necessary.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Dennis O'Flaherty (doflah) wrote :

Isn't the toString redundant? I think replace should be returning a string already.

Once this gets merged in, I had written some code to convert :), :(, <3 etc to their Unicode equivalents - would that be worth adding to the app inside parseText?

Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

You are right, just removed to redundant toString()'s.

About the symbols, we need to get a feedback from designers first whether we should use unicode equivalents or images from provided by the theme

Thanks.

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

Looks good and works as expected!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Francis Ginther (fginther) wrote :

More severe than normal network issues in the lab today. re-approved.

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/qml/MessageDelegate.qml'
2--- src/qml/MessageDelegate.qml 2013-08-12 17:51:12 +0000
3+++ src/qml/MessageDelegate.qml 2013-09-30 13:23:18 +0000
4@@ -115,7 +115,17 @@
5 fontSize: "medium"
6 color: textColor
7 opacity: incoming ? 1 : 0.9
8- text: textMessage
9+ text: parseText(textMessage)
10+ onLinkActivated: Qt.openUrlExternally(link)
11+ function parseText(text) {
12+ // remove html tags
13+ text = text.replace(/(<([^>]+)>)/ig,"");
14+ // replace line breaks
15+ text = text.replace(/(\n)+/g, '<br />');
16+ // check for links
17+ return text.replace(new RegExp("(\\s?)((http|https|ftp)://[^\\s<]+[^\\s<\.)])", "img"), '$1<a href="$2">$2</a>');
18+ }
19+
20 }
21 }
22 }

Subscribers

People subscribed via source and target branches