diff --git a/src/librssguard/CMakeLists.txt b/src/librssguard/CMakeLists.txt
index 92299754b..a55c49327 100644
--- a/src/librssguard/CMakeLists.txt
+++ b/src/librssguard/CMakeLists.txt
@@ -250,6 +250,8 @@ set(SOURCES
services/abstract/gui/formcategorydetails.h
services/abstract/gui/formfeeddetails.cpp
services/abstract/gui/formfeeddetails.h
+ services/abstract/gui/custommessagepreviewer.h
+ services/abstract/gui/custommessagepreviewer.cpp
services/abstract/importantnode.cpp
services/abstract/importantnode.h
services/abstract/label.cpp
diff --git a/src/librssguard/gui/dialogs/formabout.ui b/src/librssguard/gui/dialogs/formabout.ui
index 7513934ad..ac1df5291 100644
--- a/src/librssguard/gui/dialogs/formabout.ui
+++ b/src/librssguard/gui/dialogs/formabout.ui
@@ -126,8 +126,8 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'DejaVu Sans Mono'; font-size:10pt; font-weight:400; font-style:normal;">
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"><br /></p></body></html>
+</style></head><body style=" font-family:'Segoe UI'; font-size:9pt; font-weight:400; font-style:normal;">
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif';"><br /></p></body></html>
false
@@ -160,8 +160,8 @@ p, li { white-space: pre-wrap; }
0
0
- 691
- 139
+ 685
+ 141
@@ -216,8 +216,8 @@ p, li { white-space: pre-wrap; }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'DejaVu Sans Mono'; font-size:10pt; font-weight:400; font-style:normal;">
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"><br /></p></body></html>
+</style></head><body style=" font-family:'Segoe UI'; font-size:9pt; font-weight:400; font-style:normal;">
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif';"><br /></p></body></html>
Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse
@@ -234,8 +234,8 @@ p, li { white-space: pre-wrap; }
0
0
- 87
- 64
+ 83
+ 69
@@ -284,8 +284,8 @@ p, li { white-space: pre-wrap; }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'DejaVu Sans Mono'; font-size:10pt; font-weight:400; font-style:normal;">
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"><br /></p></body></html>
+</style></head><body style=" font-family:'Segoe UI'; font-size:9pt; font-weight:400; font-style:normal;">
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif';"><br /></p></body></html>
Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse
@@ -302,8 +302,8 @@ p, li { white-space: pre-wrap; }
0
0
- 87
- 64
+ 83
+ 69
@@ -352,8 +352,8 @@ p, li { white-space: pre-wrap; }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'DejaVu Sans Mono'; font-size:10pt; font-weight:400; font-style:normal;">
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"><br /></p></body></html>
+</style></head><body style=" font-family:'Segoe UI'; font-size:9pt; font-weight:400; font-style:normal;">
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif';"><br /></p></body></html>
Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse
@@ -396,8 +396,8 @@ p, li { white-space: pre-wrap; }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'DejaVu Sans Mono'; font-size:10pt; font-weight:400; font-style:normal;">
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"><br /></p></body></html>
+</style></head><body style=" font-family:'Segoe UI'; font-size:9pt; font-weight:400; font-style:normal;">
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif';"><br /></p></body></html>
false
diff --git a/src/librssguard/gui/messagepreviewer.cpp b/src/librssguard/gui/messagepreviewer.cpp
index ab4b66d08..5e6180f8e 100644
--- a/src/librssguard/gui/messagepreviewer.cpp
+++ b/src/librssguard/gui/messagepreviewer.cpp
@@ -10,6 +10,7 @@
#include "gui/webbrowser.h"
#include "miscellaneous/application.h"
#include "network-web/webfactory.h"
+#include "services/abstract/gui/custommessagepreviewer.h"
#include "services/abstract/label.h"
#include "services/abstract/labelsnode.h"
#include "services/abstract/serviceroot.h"
@@ -108,12 +109,22 @@ void MessagePreviewer::loadMessage(const Message& message, RootItem* root) {
return it->kind() == RootItem::Kind::Feed && it->customId() == msg_feed_id;
})->toFeed();
+ // TODO: tady místo na otevření skrze custom previewer, pokud
+ // ho root má.
+
if (feed != nullptr && feed->openArticlesDirectly() && !m_message.m_url.isEmpty()) {
m_msgBrowser->setVerticalScrollBarPosition(0.0);
m_msgBrowser->loadUrl(m_message.m_url);
}
else {
- m_msgBrowser->loadMessages({ message }, m_root);
+ CustomMessagePreviewer* custom_previewer = root->getParentServiceRoot()->customMessagePreviewer();
+
+ if (custom_previewer != nullptr) {
+ custom_previewer->loadMessage(message, m_root);
+ }
+ else {
+ m_msgBrowser->loadMessages({ message }, m_root);
+ }
}
}
}
diff --git a/src/librssguard/services/abstract/gui/custommessagepreviewer.cpp b/src/librssguard/services/abstract/gui/custommessagepreviewer.cpp
new file mode 100755
index 000000000..7233055db
--- /dev/null
+++ b/src/librssguard/services/abstract/gui/custommessagepreviewer.cpp
@@ -0,0 +1,5 @@
+// For license of this file, see /LICENSE.md.
+
+#include "services/abstract/gui/custommessagepreviewer.h"
+
+CustomMessagePreviewer::CustomMessagePreviewer(QWidget* parent) : QWidget{parent} {}
diff --git a/src/librssguard/services/abstract/gui/custommessagepreviewer.h b/src/librssguard/services/abstract/gui/custommessagepreviewer.h
new file mode 100755
index 000000000..4fa07b148
--- /dev/null
+++ b/src/librssguard/services/abstract/gui/custommessagepreviewer.h
@@ -0,0 +1,27 @@
+// For license of this file, see /LICENSE.md.
+
+#ifndef CUSTOMMESSAGEPREVIEWER_H
+#define CUSTOMMESSAGEPREVIEWER_H
+
+#include
+
+#include "core/message.h"
+
+class RootItem;
+
+class CustomMessagePreviewer : public QWidget {
+ Q_OBJECT
+
+ public:
+ explicit CustomMessagePreviewer(QWidget* parent = nullptr);
+
+ public:
+
+ // Clears displayed message.
+ virtual void clear() = 0;
+
+ // Displays the message.
+ virtual void loadMessage(const Message& msg, RootItem* selected_item) = 0;
+};
+
+#endif // CUSTOMMESSAGEPREVIEWER_H
diff --git a/src/librssguard/services/abstract/serviceroot.cpp b/src/librssguard/services/abstract/serviceroot.cpp
index c10a2e8df..e4b67f508 100644
--- a/src/librssguard/services/abstract/serviceroot.cpp
+++ b/src/librssguard/services/abstract/serviceroot.cpp
@@ -13,6 +13,7 @@
#include "services/abstract/cacheforserviceroot.h"
#include "services/abstract/category.h"
#include "services/abstract/feed.h"
+#include "services/abstract/gui/custommessagepreviewer.h"
#include "services/abstract/importantnode.h"
#include "services/abstract/labelsnode.h"
#include "services/abstract/recyclebin.h"
@@ -131,6 +132,10 @@ void ServiceRoot::start(bool freshly_activated) {
void ServiceRoot::stop() {}
+CustomMessagePreviewer* ServiceRoot::customMessagePreviewer() {
+ return nullptr;
+}
+
void ServiceRoot::updateCounts(bool including_total_count) {
QList feeds;
auto str = getSubTree();
diff --git a/src/librssguard/services/abstract/serviceroot.h b/src/librssguard/services/abstract/serviceroot.h
index 78c4e648f..492c295c7 100644
--- a/src/librssguard/services/abstract/serviceroot.h
+++ b/src/librssguard/services/abstract/serviceroot.h
@@ -13,14 +13,15 @@
#include
#include
+class QAction;
class FeedsModel;
class RecycleBin;
class ImportantNode;
class UnreadNode;
class LabelsNode;
class Label;
-class QAction;
class MessagesModel;
+class CustomMessagePreviewer;
class CacheForServiceRoot;
// THIS IS the root node of the service.
@@ -112,11 +113,13 @@ class ServiceRoot : public RootItem {
const QHash& stated_messages,
const QHash& tagged_messages) = 0;
- // This method should prepare messages for given "item" (download them maybe?)
- // into predefined "Messages" table
- // and then use method QSqlTableModel::setFilter(....).
- // NOTE: It would be more preferable if all messages are downloaded
- // right when feeds are updated.
+ // Returns special widget to display articles of this account type.
+ // Caller does NOT free returned previewer after usage from memory,
+ // it only may hide it.
+ // Thus, account is responsible to free any custom previewers.
+ virtual CustomMessagePreviewer* customMessagePreviewer();
+
+ // This method should load messages for given "item" into model.
virtual bool loadMessagesForItem(RootItem* item, MessagesModel* model);
// Called BEFORE this read status update (triggered by user in message list) is stored in DB,