From 1f0d3ac7038e9169634d8e923bac6380124faa47 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 9 Apr 2010 15:17:07 +1000 Subject: unwarn --- src/declarative/qml/qdeclarativescriptparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index 92a10aa..ac49332 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -647,7 +647,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node) property.location = location(node->firstSourceLocation(), node->lastSourceLocation()); - if (memberType == QByteArray("var")) + if (memberType == QLatin1String("var")) qWarning().nospace() << qPrintable(_parser->_scriptFile) << ":" << property.location.start.line << ":" << property.location.start.column << ": var type has been replaced by variant. " << "Support will be removed entirely shortly."; -- cgit v0.12 From ce69639de67ae74caedb545c9c94aaae6512243f Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 9 Apr 2010 15:17:19 +1000 Subject: Remove use of obsolete "Script" element. --- .../twitter/TwitterCore/FatDelegate.qml | 28 +++++++++--------- .../twitter/TwitterCore/HomeTitleBar.qml | 34 ++++++++++------------ demos/declarative/twitter/TwitterCore/TitleBar.qml | 14 ++++----- demos/declarative/twitter/twitter.qml | 9 +++--- 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, '$&');//click to jump to user? - var ret2 = ret.replace(/http:\/\/[^ \n\t]+/g, '$&');//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, '$&');//click to jump to user? + var ret2 = ret.replace(/http:\/\/[^ \n\t]+/g, '$&');//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: '' + ''+userScreenName + " from " +source - + "
" + addTags(statusText) + ""; + + "
" + wrapper.addTags(statusText) + ""; 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='' -- cgit v0.12