Santiago Payà Miralta avatar Santiago Payà Miralta committed a9e8c72

Comments (0)

Files changed (1)

UI/SpeechBubble.qml

-// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 1.1
+// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 
+import QtQuick 1.1 
 import com.nokia.meego 1.0
 
 Rectangle {
         radius: 5
         width:parent.width-150
         height: parent.height
-        color: appWindow.stealth?"transparent":(from_me?"#cfd2d4":"#42b6f2");
-        opacity:theme.inverted?0.5:1
+        color: appWindow.stealth?"transparent":(from_me?(theme.inverted?"#69de4a":"#cfd2d4"):(theme.inverted?"#27a01b":"#42b6f2"));
+        opacity:theme.inverted?0.9:1
 
         anchors.right: from_me?this.right:parent.right
         anchors.left: !from_me?this.left:parent.left
             }
             Label{
                     id:msg_text
-                    text:message;
+                    text:linkify(message);
                     color:appWindow.stealth?colorPicker.color:(from_me?"black":"white")
                     width:parent.width - 5
                     wrapMode: "WrapAtWordBoundaryOrAnywhere"
                     anchors.left: parent.left
                     anchors.leftMargin: 5
+		textFormat: Text.RichText
+
+		function linkify(inputText) {
+    			var replacedText, replacePattern1, replacePattern2, replacePattern3;
+
+    			//URLs starting with http://, https://, or ftp://
+    			replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
+    			replacedText = inputText.replace(replacePattern1, '<a href="$1" target="_blank">$1</a>');
+
+    			//URLs starting with "www." (without // before it, or it'd re-link the ones done above).
+    			replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
+    			replacedText = replacedText.replace(replacePattern2, '$1<a href="http://$2" target="_blank">$2</a>');
+
+    			//Change email addresses to mailto:: links.
+    			replacePattern3 = /(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/gim;
+    			replacedText = replacedText.replace(replacePattern3, '<a href="mailto:$1">$1</a>');
+
+    			return replacedText
+		}
+		
+	
+		onLinkActivated: Qt.openUrlExternally(link);
 
             }
 
 
 
 }
-
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.