Commit b989b376 authored by Aaron J. Seigo's avatar Aaron J. Seigo

links from plasma.kde.org

parent fd37bc9a
......@@ -14,11 +14,10 @@ function setActive(data)
plasmoid.update()
}
fetcher.fetch("http://127.0.0.1/activeprogress", setActive)
plasmoid.paintInterface = function(painter, options, rect)
{
rect = plasmoid.rect
rect.y = rect.y + newsLabel.geometry.bottom
painter.translate(rect.x, rect.y)
svg.resize(rect.width, rect.height)
for (i in lines) {
......@@ -32,4 +31,48 @@ plasmoid.paintInterface = function(painter, options, rect)
}
}
var layout = new LinearLayout
layout.orientation = QtVertical
var newsLabel = new Label
newsLabel.text = i18n("Loading news..")
newsLabel.linkActivated.connect(plasmoid.openUrl)
newsLabel.alignment = QtAlignHCenter | QtAlignBottom
layout.addItem(newsLabel)
layout.addStretch(10)
var currentNewsItem = 0
var news = Array()
var newsSwitchTimer = new QTimer
newsSwitchTimer.singleShot = true
newsSwitchTimer.interval = 30 * 1000
newsSwitchTimer.timeout.connect(showNextNews)
function showNextNews()
{
if (!news) {
return;
}
++currentNewsItem;
if (!news[currentNewsItem]) {
currentNewsItem = 0;
}
newsLabel.text = '<a href="' + news[currentNewsItem]['link'] + '">' + news[currentNewsItem]['title'] + '</a>';
}
fetcher.fetch("http://plasma.kde.org/active/progress.txt", setActive)
dataEngine("rss").connectSource("http://plasma.kde.org/active/news.xml",
function(source, data)
{
news = data['items'];
newsSwitchTimer.stop()
if (news) {
showNextNews()
if (news[1]) {
newsSwitchTimer.start()
}
}
}, 30 * 60 * 1000)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment