diff --git a/resources/text/CHANGELOG b/resources/text/CHANGELOG
index f0d242b90..ee0ed61f5 100644
--- a/resources/text/CHANGELOG
+++ b/resources/text/CHANGELOG
@@ -8,6 +8,7 @@ Fixed:
Added:
+- Automatic detection of feeds on websites. User loads website and can add feeds via custom web browser toolbar button. (issue #47)
- Better format for logged messages. Logging to file is possible via "rssguard 2> log.txt" command.
- Full support for podcasts (issue #81). Supports RSS 2.0 podcasts and ATOM 1.0 podcasts. In ATOM, RSS Guard is able to fetch multiple podcasts per message. Podcasts are displayed as additional URL addresses in message preview panel.
diff --git a/src/network-web/discoverfeedsbutton.cpp b/src/network-web/discoverfeedsbutton.cpp
index bd42e70e8..e86aa2633 100644
--- a/src/network-web/discoverfeedsbutton.cpp
+++ b/src/network-web/discoverfeedsbutton.cpp
@@ -1,3 +1,20 @@
+// This file is part of RSS Guard.
+//
+// Copyright (C) 2011-2015 by Martin Rotter
+//
+// RSS Guard is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// RSS Guard is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with RSS Guard. If not, see .
+
#include "network-web/discoverfeedsbutton.h"
#include "miscellaneous/application.h"
@@ -7,6 +24,7 @@
DiscoverFeedsButton::DiscoverFeedsButton(QWidget *parent) : QToolButton(parent) {
setEnabled(false);
setIcon(qApp->icons()->fromTheme("folder-feed"));
+ setPopupMode(QToolButton::InstantPopup);
}
DiscoverFeedsButton::~DiscoverFeedsButton() {
@@ -24,8 +42,7 @@ void DiscoverFeedsButton::setFeedAddresses(const QStringList &addresses) {
if (menu() == NULL) {
setMenu(new QMenu(this));
-
- // TODO: pokračovat asi zde, po kliku na menu vyslat signal, ten odchytne webbrowser a provede akce.
+ connect(menu(), SIGNAL(triggered(QAction*)), this, SLOT(linkTriggered(QAction*)));
}
menu()->hide();
@@ -36,7 +53,9 @@ void DiscoverFeedsButton::setFeedAddresses(const QStringList &addresses) {
foreach (const QString &feed, addresses) {
menu()->addAction(feed);
}
-
- connect(this, SIGNAL(clicked(bool)), this, SLOT(showMenu()));
}
}
+
+void DiscoverFeedsButton::linkTriggered(QAction *action) {
+ emit addingOfFeedRequested(action->text());
+}
diff --git a/src/network-web/discoverfeedsbutton.h b/src/network-web/discoverfeedsbutton.h
index c4d79dffb..a1acadf4d 100644
--- a/src/network-web/discoverfeedsbutton.h
+++ b/src/network-web/discoverfeedsbutton.h
@@ -1,3 +1,20 @@
+// This file is part of RSS Guard.
+//
+// Copyright (C) 2011-2015 by Martin Rotter
+//
+// RSS Guard is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// RSS Guard is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with RSS Guard. If not, see .
+
#ifndef DISCOVERFEEDSBUTTON_H
#define DISCOVERFEEDSBUTTON_H
@@ -13,6 +30,12 @@ class DiscoverFeedsButton : public QToolButton {
void clearFeedAddresses();
void setFeedAddresses(const QStringList &addresses);
+
+ private slots:
+ void linkTriggered(QAction *action);
+
+ signals:
+ void addingOfFeedRequested(const QString &feed_link);
};
#endif // DISCOVERFEEDSBUTTON_H
diff --git a/src/network-web/webbrowser.cpp b/src/network-web/webbrowser.cpp
index 0a4d7247e..cd32bcb16 100755
--- a/src/network-web/webbrowser.cpp
+++ b/src/network-web/webbrowser.cpp
@@ -25,6 +25,8 @@
#include "miscellaneous/skinfactory.h"
#include "gui/formmain.h"
#include "gui/tabwidget.h"
+#include "gui/feedmessageviewer.h"
+#include "gui/feedsview.h"
#include
#include
@@ -36,6 +38,7 @@
#include
#include
#include
+#include
QList WebBrowser::m_runningWebBrowsers;
@@ -90,7 +93,7 @@ void WebBrowser::initializeZoomWidget() {
layout->setMargin(3);
m_zoomButtons->setLayout(layout);
- // Make connections..
+ // Make connections.
connect(button_increase, SIGNAL(clicked()), this, SLOT(increaseZoom()));
connect(button_decrease, SIGNAL(clicked()), this, SLOT(decreaseZoom()));
connect(m_btnResetZoom, SIGNAL(clicked()), this, SLOT(resetZoom()));
@@ -198,12 +201,18 @@ void WebBrowser::createConnections() {
// Misc connections.
connect(m_webView, SIGNAL(zoomFactorChanged()), this, SLOT(updateZoomGui()));
+ connect(m_btnDiscoverFeeds, SIGNAL(addingOfFeedRequested(QString)), this, SLOT(addFeedFromWebsite(QString)));
}
void WebBrowser::onIconChanged() {
emit iconChanged(m_index, m_webView->icon());
}
+void WebBrowser::addFeedFromWebsite(const QString &feed_link) {
+ qApp->clipboard()->setText(feed_link);
+ qApp->mainForm()->tabWidget()->feedMessageViewer()->feedsView()->addNewFeed();
+}
+
void WebBrowser::onTitleChanged(const QString &new_title) {
if (new_title.isEmpty()) {
//: Webbrowser tab title when no title is available.
diff --git a/src/network-web/webbrowser.h b/src/network-web/webbrowser.h
index 399496c1c..699c00148 100755
--- a/src/network-web/webbrowser.h
+++ b/src/network-web/webbrowser.h
@@ -132,6 +132,8 @@ class WebBrowser : public TabContent {
void onTitleChanged(const QString &new_title);
void onIconChanged();
+ void addFeedFromWebsite(const QString &feed_link);
+
signals:
// User requests opening of new tab or clicks the link
// with middle mouse button