API for custom article previwer per account
This commit is contained in:
parent
23b7089e75
commit
ded2ce26eb
@ -250,6 +250,8 @@ set(SOURCES
|
|||||||
services/abstract/gui/formcategorydetails.h
|
services/abstract/gui/formcategorydetails.h
|
||||||
services/abstract/gui/formfeeddetails.cpp
|
services/abstract/gui/formfeeddetails.cpp
|
||||||
services/abstract/gui/formfeeddetails.h
|
services/abstract/gui/formfeeddetails.h
|
||||||
|
services/abstract/gui/custommessagepreviewer.h
|
||||||
|
services/abstract/gui/custommessagepreviewer.cpp
|
||||||
services/abstract/importantnode.cpp
|
services/abstract/importantnode.cpp
|
||||||
services/abstract/importantnode.h
|
services/abstract/importantnode.h
|
||||||
services/abstract/label.cpp
|
services/abstract/label.cpp
|
||||||
|
@ -126,8 +126,8 @@
|
|||||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string notr="true"><!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">
|
<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'DejaVu Sans Mono'; font-size:10pt; font-weight:400; font-style:normal;">
|
</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'; font-size:9pt;"><br /></p></body></html></string>
|
<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></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="acceptRichText">
|
<property name="acceptRichText">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -160,8 +160,8 @@ p, li { white-space: pre-wrap; }
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>691</width>
|
<width>685</width>
|
||||||
<height>139</height>
|
<height>141</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoFillBackground">
|
<property name="autoFillBackground">
|
||||||
@ -216,8 +216,8 @@ p, li { white-space: pre-wrap; }
|
|||||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string notr="true"><!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">
|
<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'DejaVu Sans Mono'; font-size:10pt; font-weight:400; font-style:normal;">
|
</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'; font-size:9pt;"><br /></p></body></html></string>
|
<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></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="textInteractionFlags">
|
<property name="textInteractionFlags">
|
||||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||||
@ -234,8 +234,8 @@ p, li { white-space: pre-wrap; }
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>87</width>
|
<width>83</width>
|
||||||
<height>64</height>
|
<height>69</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="label">
|
<attribute name="label">
|
||||||
@ -284,8 +284,8 @@ p, li { white-space: pre-wrap; }
|
|||||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string notr="true"><!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">
|
<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'DejaVu Sans Mono'; font-size:10pt; font-weight:400; font-style:normal;">
|
</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'; font-size:9pt;"><br /></p></body></html></string>
|
<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></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="textInteractionFlags">
|
<property name="textInteractionFlags">
|
||||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||||
@ -302,8 +302,8 @@ p, li { white-space: pre-wrap; }
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>87</width>
|
<width>83</width>
|
||||||
<height>64</height>
|
<height>69</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="label">
|
<attribute name="label">
|
||||||
@ -352,8 +352,8 @@ p, li { white-space: pre-wrap; }
|
|||||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string notr="true"><!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">
|
<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'DejaVu Sans Mono'; font-size:10pt; font-weight:400; font-style:normal;">
|
</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'; font-size:9pt;"><br /></p></body></html></string>
|
<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></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="textInteractionFlags">
|
<property name="textInteractionFlags">
|
||||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||||
@ -396,8 +396,8 @@ p, li { white-space: pre-wrap; }
|
|||||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string notr="true"><!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">
|
<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'DejaVu Sans Mono'; font-size:10pt; font-weight:400; font-style:normal;">
|
</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'; font-size:9pt;"><br /></p></body></html></string>
|
<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></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="acceptRichText">
|
<property name="acceptRichText">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "gui/webbrowser.h"
|
#include "gui/webbrowser.h"
|
||||||
#include "miscellaneous/application.h"
|
#include "miscellaneous/application.h"
|
||||||
#include "network-web/webfactory.h"
|
#include "network-web/webfactory.h"
|
||||||
|
#include "services/abstract/gui/custommessagepreviewer.h"
|
||||||
#include "services/abstract/label.h"
|
#include "services/abstract/label.h"
|
||||||
#include "services/abstract/labelsnode.h"
|
#include "services/abstract/labelsnode.h"
|
||||||
#include "services/abstract/serviceroot.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;
|
return it->kind() == RootItem::Kind::Feed && it->customId() == msg_feed_id;
|
||||||
})->toFeed();
|
})->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()) {
|
if (feed != nullptr && feed->openArticlesDirectly() && !m_message.m_url.isEmpty()) {
|
||||||
m_msgBrowser->setVerticalScrollBarPosition(0.0);
|
m_msgBrowser->setVerticalScrollBarPosition(0.0);
|
||||||
m_msgBrowser->loadUrl(m_message.m_url);
|
m_msgBrowser->loadUrl(m_message.m_url);
|
||||||
}
|
}
|
||||||
else {
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
src/librssguard/services/abstract/gui/custommessagepreviewer.cpp
Executable file
5
src/librssguard/services/abstract/gui/custommessagepreviewer.cpp
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
// For license of this file, see <project-root-folder>/LICENSE.md.
|
||||||
|
|
||||||
|
#include "services/abstract/gui/custommessagepreviewer.h"
|
||||||
|
|
||||||
|
CustomMessagePreviewer::CustomMessagePreviewer(QWidget* parent) : QWidget{parent} {}
|
27
src/librssguard/services/abstract/gui/custommessagepreviewer.h
Executable file
27
src/librssguard/services/abstract/gui/custommessagepreviewer.h
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
// For license of this file, see <project-root-folder>/LICENSE.md.
|
||||||
|
|
||||||
|
#ifndef CUSTOMMESSAGEPREVIEWER_H
|
||||||
|
#define CUSTOMMESSAGEPREVIEWER_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
#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
|
@ -13,6 +13,7 @@
|
|||||||
#include "services/abstract/cacheforserviceroot.h"
|
#include "services/abstract/cacheforserviceroot.h"
|
||||||
#include "services/abstract/category.h"
|
#include "services/abstract/category.h"
|
||||||
#include "services/abstract/feed.h"
|
#include "services/abstract/feed.h"
|
||||||
|
#include "services/abstract/gui/custommessagepreviewer.h"
|
||||||
#include "services/abstract/importantnode.h"
|
#include "services/abstract/importantnode.h"
|
||||||
#include "services/abstract/labelsnode.h"
|
#include "services/abstract/labelsnode.h"
|
||||||
#include "services/abstract/recyclebin.h"
|
#include "services/abstract/recyclebin.h"
|
||||||
@ -131,6 +132,10 @@ void ServiceRoot::start(bool freshly_activated) {
|
|||||||
|
|
||||||
void ServiceRoot::stop() {}
|
void ServiceRoot::stop() {}
|
||||||
|
|
||||||
|
CustomMessagePreviewer* ServiceRoot::customMessagePreviewer() {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void ServiceRoot::updateCounts(bool including_total_count) {
|
void ServiceRoot::updateCounts(bool including_total_count) {
|
||||||
QList<Feed*> feeds;
|
QList<Feed*> feeds;
|
||||||
auto str = getSubTree();
|
auto str = getSubTree();
|
||||||
|
@ -13,14 +13,15 @@
|
|||||||
#include <QNetworkProxy>
|
#include <QNetworkProxy>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
|
|
||||||
|
class QAction;
|
||||||
class FeedsModel;
|
class FeedsModel;
|
||||||
class RecycleBin;
|
class RecycleBin;
|
||||||
class ImportantNode;
|
class ImportantNode;
|
||||||
class UnreadNode;
|
class UnreadNode;
|
||||||
class LabelsNode;
|
class LabelsNode;
|
||||||
class Label;
|
class Label;
|
||||||
class QAction;
|
|
||||||
class MessagesModel;
|
class MessagesModel;
|
||||||
|
class CustomMessagePreviewer;
|
||||||
class CacheForServiceRoot;
|
class CacheForServiceRoot;
|
||||||
|
|
||||||
// THIS IS the root node of the service.
|
// THIS IS the root node of the service.
|
||||||
@ -112,11 +113,13 @@ class ServiceRoot : public RootItem {
|
|||||||
const QHash<ServiceRoot::BagOfMessages, QStringList>& stated_messages,
|
const QHash<ServiceRoot::BagOfMessages, QStringList>& stated_messages,
|
||||||
const QHash<QString, QStringList>& tagged_messages) = 0;
|
const QHash<QString, QStringList>& tagged_messages) = 0;
|
||||||
|
|
||||||
// This method should prepare messages for given "item" (download them maybe?)
|
// Returns special widget to display articles of this account type.
|
||||||
// into predefined "Messages" table
|
// Caller does NOT free returned previewer after usage from memory,
|
||||||
// and then use method QSqlTableModel::setFilter(....).
|
// it only may hide it.
|
||||||
// NOTE: It would be more preferable if all messages are downloaded
|
// Thus, account is responsible to free any custom previewers.
|
||||||
// right when feeds are updated.
|
virtual CustomMessagePreviewer* customMessagePreviewer();
|
||||||
|
|
||||||
|
// This method should load messages for given "item" into model.
|
||||||
virtual bool loadMessagesForItem(RootItem* item, MessagesModel* model);
|
virtual bool loadMessagesForItem(RootItem* item, MessagesModel* model);
|
||||||
|
|
||||||
// Called BEFORE this read status update (triggered by user in message list) is stored in DB,
|
// Called BEFORE this read status update (triggered by user in message list) is stored in DB,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user