summaryrefslogtreecommitdiffstats
path: root/demos/declarative/twitter/TwitterCore/UserModel.qml
blob: 8a8eb7bb550aa75586d5eae33ed3cb49a3b1da3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import Qt 4.7

//This "model" gets the user information about the searched user. Mainly for the icon.
//Copied from RssModel

Item { id: wrapper
    property variant model: xmlModel
    property string user : ""
    property int status: xmlModel.status
    function reload() { xmlModel.reload(); }
XmlListModel {
    id: xmlModel

    source: {if(user!="") {"http://twitter.com/users/show.xml?screen_name="+user;}else{"";}}
    query: "/user"

    XmlRole { name: "name"; query: "name/string()" }
    XmlRole { name: "screenName"; query: "screen_name/string()" }
    XmlRole { name: "image"; query: "profile_image_url/string()" }
    XmlRole { name: "location"; query: "location/string()" }
    XmlRole { name: "description"; query: "description/string()" }
    XmlRole { name: "followers"; query: "followers_count/string()" }
    //XmlRole { name: "protected"; query: "protected/bool()" }
    //TODO: Could also get the user's color scheme, timezone and a few other things
}
}