summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-04-09 05:17:19 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-04-09 05:17:19 (GMT)
commitce69639de67ae74caedb545c9c94aaae6512243f (patch)
treee2b6c1702045b09311b1eb45f2a741588da8d0ad
parent1f0d3ac7038e9169634d8e923bac6380124faa47 (diff)
downloadQt-ce69639de67ae74caedb545c9c94aaae6512243f.zip
Qt-ce69639de67ae74caedb545c9c94aaae6512243f.tar.gz
Qt-ce69639de67ae74caedb545c9c94aaae6512243f.tar.bz2
Remove use of obsolete "Script" element.
-rw-r--r--demos/declarative/twitter/TwitterCore/FatDelegate.qml28
-rw-r--r--demos/declarative/twitter/TwitterCore/HomeTitleBar.qml34
-rw-r--r--demos/declarative/twitter/TwitterCore/TitleBar.qml14
-rw-r--r--demos/declarative/twitter/twitter.qml9
4 files changed, 39 insertions, 46 deletions
diff --git a/demos/declarative/twitter/TwitterCore/FatDelegate.qml b/demos/declarative/twitter/TwitterCore/FatDelegate.qml
index e999bb4..62ee11a 100644
--- a/demos/declarative/twitter/TwitterCore/FatDelegate.qml
+++ b/demos/declarative/twitter/TwitterCore/FatDelegate.qml
@@ -4,21 +4,19 @@ Component {
id: listDelegate
Item {
id: wrapper; width: wrapper.ListView.view.width; height: if(txt.height > 58){txt.height+8}else{58}//50+4+4
- Script {
- function handleLink(link){
- if(link.slice(0,3) == 'app'){
- setUser(link.slice(7));
- screen.setMode(true);
- }else if(link.slice(0,4) == 'http'){
- Qt.openUrlExternally(link);
- }
- }
- function addTags(str){
- var ret = str.replace(/@[a-zA-Z0-9_]+/g, '<a href="app://$&">$&</a>');//click to jump to user?
- var ret2 = ret.replace(/http:\/\/[^ \n\t]+/g, '<a href="$&">$&</a>');//surrounds http links with html link tags
- return ret2;
+ function handleLink(link){
+ if(link.slice(0,3) == 'app'){
+ screen.setUser(link.slice(7));
+ screen.setMode(true);
+ }else if(link.slice(0,4) == 'http'){
+ Qt.openUrlExternally(link);
}
}
+ function addTags(str){
+ var ret = str.replace(/@[a-zA-Z0-9_]+/g, '<a href="app://$&">$&</a>');//click to jump to user?
+ var ret2 = ret.replace(/http:\/\/[^ \n\t]+/g, '<a href="$&">$&</a>');//surrounds http links with html link tags
+ return ret2;
+ }
Item {
id: moveMe; height: parent.height
Rectangle {
@@ -35,11 +33,11 @@ Component {
Text { id:txt; y:4; x: 56
text: '<html><style type="text/css">a:link {color:"#aaccaa"}; a:visited {color:"#336633"}</style>'
+ '<a href="app://@'+userScreenName+'"><b>'+userScreenName + "</b></a> from " +source
- + "<br /><b>" + addTags(statusText) + "</b></html>";
+ + "<br /><b>" + wrapper.addTags(statusText) + "</b></html>";
textFormat: Qt.RichText
color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrapMode: Text.WordWrap
anchors.left: whiteRect.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6
- onLinkActivated: handleLink(link)
+ onLinkActivated: wrapper.handleLink(link)
}
}
}
diff --git a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml
index 0835315..45f3157 100644
--- a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml
+++ b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml
@@ -11,25 +11,23 @@ Item {
id: container
width: (parent.width * 2) - 55 ; height: parent.height
- Script {
- function accept() {
- if(rssModel.authName == '' || rssModel.authPass == '')
- return false;//Can't login like that
+ function accept() {
+ if(rssModel.authName == '' || rssModel.authPass == '')
+ return false;//Can't login like that
- var postData = "status=" + editor.text;
- var postman = new XMLHttpRequest();
- postman.open("POST", "http://twitter.com/statuses/update.xml", true, rssModel.authName, rssModel.authPass);
- postman.onreadystatechange = function() {
- if (postman.readyState == postman.DONE) {
- titleBar.update();
- }
+ var postData = "status=" + editor.text;
+ var postman = new XMLHttpRequest();
+ postman.open("POST", "http://twitter.com/statuses/update.xml", true, rssModel.authName, rssModel.authPass);
+ postman.onreadystatechange = function() {
+ if (postman.readyState == postman.DONE) {
+ titleBar.update();
}
- postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- postman.send(postData);
-
- editor.text = ""
- titleBar.state = ""
}
+ postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ postman.send(postData);
+
+ editor.text = ""
+ titleBar.state = ""
}
Rectangle {
@@ -59,7 +57,7 @@ Item {
Button {
id: tagButton; x: titleBar.width - 90; width: 85; height: 32; text: "New Post..."
anchors.verticalCenter: parent.verticalCenter;
- onClicked: if (titleBar.state == "Posting") accept(); else titleBar.state = "Posting"
+ onClicked: if (titleBar.state == "Posting") container.accept(); else titleBar.state = "Posting"
}
Text {
@@ -96,7 +94,7 @@ Item {
Keys.forwardTo: [(returnKey), (editor)]
Item {
id: returnKey
- Keys.onReturnPressed: accept()
+ Keys.onReturnPressed: container.accept()
Keys.onEscapePressed: titleBar.state = ""
}
}
diff --git a/demos/declarative/twitter/TwitterCore/TitleBar.qml b/demos/declarative/twitter/TwitterCore/TitleBar.qml
index 1125519..87ceec5 100644
--- a/demos/declarative/twitter/TwitterCore/TitleBar.qml
+++ b/demos/declarative/twitter/TwitterCore/TitleBar.qml
@@ -11,12 +11,10 @@ Item {
id: container
width: (parent.width * 2) - 55 ; height: parent.height
- Script {
- function accept() {
- titleBar.state = ""
- background.state = ""
- rssModel.tags = editor.text
- }
+ function accept() {
+ titleBar.state = ""
+ background.state = ""
+ rssModel.tags = editor.text
}
Text {
@@ -33,7 +31,7 @@ Item {
Button {
id: tagButton; x: titleBar.width - 50; width: 45; height: 32; text: "..."
- onClicked: if (titleBar.state == "Tags") accept(); else titleBar.state = "Tags"
+ onClicked: if (titleBar.state == "Tags") container.accept(); else titleBar.state = "Tags"
anchors.verticalCenter: parent.verticalCenter
}
@@ -58,7 +56,7 @@ Item {
Item {
id: returnKey
- Keys.onReturnPressed: accept()
+ Keys.onReturnPressed: container.accept()
Keys.onEscapePressed: titleBar.state = ""
}
}
diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml
index 84926cd..537c3fb 100644
--- a/demos/declarative/twitter/twitter.qml
+++ b/demos/declarative/twitter/twitter.qml
@@ -15,12 +15,11 @@ Item {
toolBar.button2Label = "Return home";
}
}
+ function setUser(str){hack.running = true; tmpStr = str}
+ function reallySetUser(){rssModel.tags = tmpStr;}
+
//Workaround for bug 260266
- Timer{ interval: 1; running: false; repeat: false; onTriggered: reallySetUser(); id:hack }
- Script {
- function setUser(str){hack.running = true; tmpStr = str}
- function reallySetUser(){rssModel.tags = tmpStr;}
- }
+ Timer{ interval: 1; running: false; repeat: false; onTriggered: screen.reallySetUser(); id:hack }
//TODO: better way to return to the auth screen
Keys.onEscapePressed: rssModel.authName=''