[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/plasma/applets/rssnow
From: Sebastian Kügler <sebas () kde ! org>
Date: 2008-07-17 0:41:52
Message-ID: 1216255312.311532.518.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 833544 by sebas:
Put Akregator's feeds into the combobox.
Taken from the news applet.
M +34 -0 news.cpp
M +1 -0 news.h
--- trunk/playground/base/plasma/applets/rssnow/news.cpp #833543:833544
@@ -30,10 +30,14 @@
#include <QPainter>
#include <QDateTime>
#include <QLineEdit>
+#include <QDomDocument>
+#include <QFile>
+
//KDE
#include <kglobal.h>
#include <kicon.h>
#include <kconfigdialog.h>
+#include <KStandardDirs>
//Plasma
#include <plasma/containment.h>
@@ -133,6 +137,10 @@
ui.feedComboBox->addItem(name);
}
+ foreach (const QString& name, akregatorFeeds().values()) {
+ ui.feedComboBox->addItem(name);
+ }
+
ui.intervalSpinBox->setValue(m_interval);
ui.switchInterval->setValue(m_switchInterval);
ui.maxAge->setValue(m_maxAge);
@@ -351,4 +359,30 @@
// updateGeometry();
}
}
+
+QMap<QString, QString> News::akregatorFeeds()
+{
+ QMap<QString, QString> result;
+ QString file = KStandardDirs::locate("data", "akregator/data/feeds.opml");
+ kDebug() << file;
+ if (!file.isEmpty()) {
+ QFile f(file);
+ if (f.open(QIODevice::ReadOnly)) {
+ QDomDocument doc;
+ if (doc.setContent(&f)) {
+ QDomNodeList nodes = doc.elementsByTagName("outline");
+ for (int i = 0; i < nodes.count(); ++i) {
+ QDomElement element = nodes.item(i).toElement();
+ QString title = element.attribute("title");
+ if (!title.isEmpty()) {
+ result[title] = element.attribute("xmlUrl");
+ }
+ }
+ }
+ f.close();
+ }
+ }
+ return result;
+}
+
#include "news.moc"
--- trunk/playground/base/plasma/applets/rssnow/news.h #833543:833544
@@ -83,6 +83,7 @@
Ui::config ui;
QMap<QString, QString> m_defaultFeeds;
+ QMap<QString, QString> akregatorFeeds();
void connectToEngine();
void updateScrollers();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic