summaryrefslogtreecommitdiff
path: root/src/webtab.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-04-24 16:31:45 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-04-24 16:31:45 +0200
commit78be08b8e18a44f5ab77484f5c28933d91a71aaf (patch)
tree9d1239bf166dd855ebc560945a36b1bb27e6a3e6 /src/webtab.cpp
parentMerge commit 'refs/merge-requests/2250' of git://gitorious.org/rekonq/mainlin... (diff)
parentRe-remove linedit after rebase (diff)
downloadrekonq-78be08b8e18a44f5ab77484f5c28933d91a71aaf.tar.xz
Merge commit 'refs/merge-requests/2251' of git://gitorious.org/rekonq/mainline into m2251
Diffstat (limited to 'src/webtab.cpp')
-rw-r--r--src/webtab.cpp66
1 files changed, 35 insertions, 31 deletions
diff --git a/src/webtab.cpp b/src/webtab.cpp
index bc051e27..7687a957 100644
--- a/src/webtab.cpp
+++ b/src/webtab.cpp
@@ -40,6 +40,7 @@
#include "bookmarksmanager.h"
#include "walletbar.h"
#include "previewselectorbar.h"
+#include "rsswidget.h"
// KDE Includes
#include <KService>
@@ -199,43 +200,46 @@ void WebTab::createPreviewSelectorBar(int index)
bool WebTab::hasRSSInfo()
{
- _rssList.clear();
- QWebElementCollection col = page()->mainFrame()->findAllElements("link");
- foreach(QWebElement el, col)
- {
- if( el.attribute("type") == QL1S("application/rss+xml") || el.attribute("type") == QL1S("application/rss+xml") )
- {
- if( el.attribute("href").startsWith( QL1S("http") ) )
- {
- _rssList << KUrl( el.attribute("href") );
- }
- else
- {
- KUrl u = url();
- // NOTE
- // cd() is probably better than setPath() here,
- // for all those url sites just having a path
- if(u.cd( el.attribute("href") ))
- _rssList << u;
- }
- }
- }
+ QWebElementCollection col = page()->mainFrame()->findAllElements("link[type=\"application/rss+xml\"]");
+ col.append(page()->mainFrame()->findAllElements("link[type=\"application/atom+xml\"]"));
+ if(col.count() != 0)
+ return true;
- return !_rssList.isEmpty();
+ return false;
}
-void WebTab::showRSSInfo()
+void WebTab::showRSSInfo(QPoint pos)
{
- QString urlList = QString(i18n("The following RSS feeds were found:<br /><br />"));
- foreach(const KUrl &url, _rssList)
+ QWebElementCollection col = page()->mainFrame()->findAllElements("link[type=\"application/rss+xml\"]");
+ col.append(page()->mainFrame()->findAllElements("link[type=\"application/atom+xml\"]"));
+
+ QMap<KUrl, QString> map;
+ int i = 0;
+ foreach(QWebElement el, col)
{
- urlList += QString("<a href=\"") + url.url() + QString("\">") + url.url() + QString("</a><br />");
+ QString urlString;
+ if( el.attribute("href").startsWith( QL1S("http") ) )
+ urlString = el.attribute("href");
+ else
+ {
+ KUrl u = url();
+ // NOTE
+ // cd() is probably better than setPath() here,
+ // for all those url sites just having a path
+ if(u.cd( el.attribute("href") ))
+ urlString = u.toMimeDataString();
+ }
+
+ QString title = el.attribute("title");
+ if(title.isEmpty())
+ title= el.attribute("href");
+
+ map.insert(KUrl(urlString), title);
+
+ i++;
}
- urlList += QString(i18n("<br />Enough for now... Waiting for some cool Akonadi based feeds management :)"));
- KMessageBox::information( view(),
- urlList,
- i18n("RSS Management")
- );
+ RSSWidget *widget = new RSSWidget(map, window());
+ widget->showAt(pos);
}