2012-02-11 00:58:30 +01:00
|
|
|
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
|
|
|
|
import QtQuick 1.1
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: container
|
|
|
|
width: 100
|
|
|
|
height: 62
|
|
|
|
|
|
|
|
signal clicked(string url)
|
|
|
|
|
|
|
|
Text {
|
|
|
|
id: header
|
2013-01-03 13:59:06 +01:00
|
|
|
text: qsTr("Project News")
|
2012-02-11 00:58:30 +01:00
|
|
|
width: parent.width
|
2012-02-25 08:22:08 +01:00
|
|
|
color: "#44515c"
|
2012-02-11 00:58:30 +01:00
|
|
|
font {
|
|
|
|
pointSize: 14
|
|
|
|
weight: Font.Bold
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: view
|
|
|
|
width: parent.width
|
|
|
|
anchors { top: header.bottom; topMargin: 14; bottom: parent.bottom }
|
|
|
|
model: xmlModel
|
|
|
|
delegate: listDelegate
|
|
|
|
clip: true
|
|
|
|
}
|
|
|
|
|
2012-08-14 15:06:31 +02:00
|
|
|
ScrollDecorator {
|
|
|
|
flickableItem: view
|
|
|
|
}
|
|
|
|
|
2012-02-11 00:58:30 +01:00
|
|
|
XmlListModel {
|
|
|
|
id: xmlModel
|
|
|
|
source: "http://www.openpilot.org/feed/"
|
|
|
|
query: "/rss/channel/item"
|
|
|
|
|
|
|
|
XmlRole { name: "title"; query: "title/string()" }
|
|
|
|
XmlRole { name: "description"; query: "description/string()" }
|
|
|
|
XmlRole { name: "link"; query: "link/string()" }
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: listDelegate
|
|
|
|
Item {
|
|
|
|
width: view.width
|
|
|
|
height: column.height + 16
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: column
|
|
|
|
spacing: 4
|
|
|
|
Text {
|
|
|
|
text: title
|
|
|
|
width: view.width
|
2012-02-25 08:22:08 +01:00
|
|
|
textFormat: text.indexOf("&") > 0 ? Text.StyledText : Text.PlainText
|
2012-02-11 00:58:30 +01:00
|
|
|
elide: Text.ElideRight
|
|
|
|
font.bold: true
|
2012-02-25 08:22:08 +01:00
|
|
|
color: mouseArea.containsMouse ? "#224d81" : "black"
|
2012-02-11 00:58:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
text: description
|
|
|
|
width: view.width
|
2012-02-25 08:22:08 +01:00
|
|
|
textFormat: text.indexOf("&") > 0 ? Text.StyledText : Text.PlainText
|
2012-02-11 00:58:30 +01:00
|
|
|
elide: Text.ElideRight
|
2012-02-25 08:22:08 +01:00
|
|
|
color: mouseArea.containsMouse ? "#224d81" : "black"
|
2012-02-11 00:58:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
id: mouseArea
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
|
|
|
onClicked: {
|
|
|
|
console.log(link)
|
|
|
|
container.clicked(link)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|