Merge branch 'master' of github.com:martinrotter/rssguard
This commit is contained in:
commit
293e285674
@ -343,7 +343,7 @@ However, if you choose `Script` option, then you cannot provide URL of your feed
|
|||||||
|
|
||||||
Any errors in your script must be written to [error output](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)).
|
Any errors in your script must be written to [error output](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)).
|
||||||
|
|
||||||
> **As of RSS Guard 4.2.0, you do not have to separate your arguments with `#`. If your argument contains spaces, then enclose it with DOUBLE quotes, for example `"my argument"`. DO NOT use SINGLE quotes to do that.**
|
> **As of RSS Guard 4.2.0, you cannot separate your arguments with `#`. If your argument contains spaces, then enclose it with DOUBLE quotes, for example `"my argument"`. DO NOT use SINGLE quotes to do that.**
|
||||||
|
|
||||||
If everything goes well, script must return `0` as the process exit code, or a non-zero exit code if some error happened.
|
If everything goes well, script must return `0` as the process exit code, or a non-zero exit code if some error happened.
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 9.8 KiB |
@ -86,8 +86,8 @@ MessagesView* MessagesModel::view() const {
|
|||||||
return m_view;
|
return m_view;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesModel::setView(MessagesView* newView) {
|
void MessagesModel::setView(MessagesView* new_view) {
|
||||||
m_view = newView;
|
m_view = new_view;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessagesModelCache* MessagesModel::cache() const {
|
MessagesModelCache* MessagesModel::cache() const {
|
||||||
@ -773,7 +773,6 @@ QVariant MessagesModel::headerData(int section, Qt::Orientation orientation, int
|
|||||||
|
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
|
|
||||||
// Display textual headers for all columns except "read" and
|
// Display textual headers for all columns except "read" and
|
||||||
// "important" and "has enclosures" columns.
|
// "important" and "has enclosures" columns.
|
||||||
if (section != MSG_DB_READ_INDEX && section != MSG_DB_IMPORTANT_INDEX && section != MSG_DB_SCORE_INDEX &&
|
if (section != MSG_DB_READ_INDEX && section != MSG_DB_IMPORTANT_INDEX && section != MSG_DB_SCORE_INDEX &&
|
||||||
|
@ -17,17 +17,12 @@ class MessagesView;
|
|||||||
class MessagesModelCache;
|
class MessagesModelCache;
|
||||||
|
|
||||||
class MessagesModel : public QSqlQueryModel, public MessagesModelSqlLayer {
|
class MessagesModel : public QSqlQueryModel, public MessagesModelSqlLayer {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Enum which describes basic highlighting schemes
|
// Enum which describes basic highlighting schemes
|
||||||
// for messages.
|
// for messages.
|
||||||
enum class MessageHighlighter {
|
enum class MessageHighlighter { NoHighlighting = 100, HighlightUnread = 101, HighlightImportant = 102 };
|
||||||
NoHighlighting = 100,
|
|
||||||
HighlightUnread = 101,
|
|
||||||
HighlightImportant = 102
|
|
||||||
};
|
|
||||||
|
|
||||||
// Constructors and destructors.
|
// Constructors and destructors.
|
||||||
explicit MessagesModel(QObject* parent = nullptr);
|
explicit MessagesModel(QObject* parent = nullptr);
|
||||||
@ -76,7 +71,9 @@ class MessagesModel : public QSqlQueryModel, public MessagesModelSqlLayer {
|
|||||||
void loadMessages(RootItem* item);
|
void loadMessages(RootItem* item);
|
||||||
|
|
||||||
MessagesView* view() const;
|
MessagesView* view() const;
|
||||||
void setView(MessagesView* newView);
|
void setView(MessagesView* new_view);
|
||||||
|
|
||||||
|
static QIcon generateIconForScore(double score);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
@ -89,8 +86,6 @@ class MessagesModel : public QSqlQueryModel, public MessagesModelSqlLayer {
|
|||||||
void setupHeaderData();
|
void setupHeaderData();
|
||||||
void setupIcons();
|
void setupIcons();
|
||||||
|
|
||||||
static QIcon generateIconForScore(double score);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MessagesView* m_view;
|
MessagesView* m_view;
|
||||||
MessagesModelCache* m_cache;
|
MessagesModelCache* m_cache;
|
||||||
|
@ -155,6 +155,14 @@ bool MessagesProxyModel::filterAcceptsMessage(const Message& current_message) co
|
|||||||
return currentDate.addDays(-7).year() == current_message.m_created.date().year() &&
|
return currentDate.addDays(-7).year() == current_message.m_created.date().year() &&
|
||||||
currentDate.addDays(-7).weekNumber() == current_message.m_created.date().weekNumber();
|
currentDate.addDays(-7).weekNumber() == current_message.m_created.date().weekNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case MessageListFilter::ShowOnlyWithAttachments: {
|
||||||
|
return current_message.m_enclosures.size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
case MessageListFilter::ShowOnlyWithScore: {
|
||||||
|
return current_message.m_score > MSG_SCORE_MIN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -23,7 +23,9 @@ class MessagesProxyModel : public QSortFilterProxyModel {
|
|||||||
ShowLast24Hours = 105,
|
ShowLast24Hours = 105,
|
||||||
ShowLast48Hours = 106,
|
ShowLast48Hours = 106,
|
||||||
ShowThisWeek = 107,
|
ShowThisWeek = 107,
|
||||||
ShowLastWeek = 108
|
ShowLastWeek = 108,
|
||||||
|
ShowOnlyWithAttachments = 109,
|
||||||
|
ShowOnlyWithScore = 110
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit MessagesProxyModel(MessagesModel* source_model, QObject* parent = nullptr);
|
explicit MessagesProxyModel(MessagesModel* source_model, QObject* parent = nullptr);
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
#include "miscellaneous/iconfactory.h"
|
#include "miscellaneous/iconfactory.h"
|
||||||
#include "miscellaneous/settings.h"
|
#include "miscellaneous/settings.h"
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QWidgetAction>
|
#include <QWidgetAction>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
@ -124,7 +124,8 @@ void MessagesToolBar::initializeSearchBox() {
|
|||||||
m_tmrSearchPattern->setSingleShot(true);
|
m_tmrSearchPattern->setSingleShot(true);
|
||||||
|
|
||||||
m_txtSearchMessages = new BaseLineEdit(this);
|
m_txtSearchMessages = new BaseLineEdit(this);
|
||||||
m_txtSearchMessages->setSizePolicy(QSizePolicy::Policy::Expanding, m_txtSearchMessages->sizePolicy().verticalPolicy());
|
m_txtSearchMessages->setSizePolicy(QSizePolicy::Policy::Expanding,
|
||||||
|
m_txtSearchMessages->sizePolicy().verticalPolicy());
|
||||||
m_txtSearchMessages->setPlaceholderText(tr("Search articles (regex only)"));
|
m_txtSearchMessages->setPlaceholderText(tr("Search articles (regex only)"));
|
||||||
|
|
||||||
// Setup wrapping action for search box.
|
// Setup wrapping action for search box.
|
||||||
@ -140,7 +141,11 @@ void MessagesToolBar::initializeSearchBox() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesToolBar::addActionToMenu(QMenu* menu, const QIcon& icon, const QString& title, const QVariant& value, const QString& name) {
|
void MessagesToolBar::addActionToMenu(QMenu* menu,
|
||||||
|
const QIcon& icon,
|
||||||
|
const QString& title,
|
||||||
|
const QVariant& value,
|
||||||
|
const QString& name) {
|
||||||
QAction* action = menu->addAction(icon, title);
|
QAction* action = menu->addAction(icon, title);
|
||||||
|
|
||||||
action->setData(value);
|
action->setData(value);
|
||||||
@ -211,6 +216,16 @@ void MessagesToolBar::initializeHighlighter() {
|
|||||||
tr("Show last week's articles"),
|
tr("Show last week's articles"),
|
||||||
QVariant::fromValue(MessagesProxyModel::MessageListFilter::ShowLastWeek),
|
QVariant::fromValue(MessagesProxyModel::MessageListFilter::ShowLastWeek),
|
||||||
"show_last_week");
|
"show_last_week");
|
||||||
|
addActionToMenu(m_menuMessageFilter,
|
||||||
|
qApp->icons()->fromTheme(QSL("mail-attachment")),
|
||||||
|
tr("Show only articles with attachments"),
|
||||||
|
QVariant::fromValue(MessagesProxyModel::MessageListFilter::ShowOnlyWithAttachments),
|
||||||
|
"show_with_attachments");
|
||||||
|
addActionToMenu(m_menuMessageFilter,
|
||||||
|
MessagesModel::generateIconForScore(MSG_SCORE_MAX / 2.0),
|
||||||
|
tr("Show only articles with some score"),
|
||||||
|
QVariant::fromValue(MessagesProxyModel::MessageListFilter::ShowOnlyWithScore),
|
||||||
|
"show_with_score");
|
||||||
|
|
||||||
m_btnMessageHighlighter = new QToolButton(this);
|
m_btnMessageHighlighter = new QToolButton(this);
|
||||||
m_btnMessageHighlighter->setToolTip(tr("Display all articles"));
|
m_btnMessageHighlighter->setToolTip(tr("Display all articles"));
|
||||||
@ -244,7 +259,8 @@ void MessagesToolBar::saveToolButtonSelection(const QString& button_name, const
|
|||||||
|
|
||||||
for (QString& action_name : action_names) {
|
for (QString& action_name : action_names) {
|
||||||
if (action_name.startsWith(button_name)) {
|
if (action_name.startsWith(button_name)) {
|
||||||
action_name = button_name + (action->objectName().isEmpty() ? "" : "[" + action->objectName().toStdString() + "]").c_str();
|
action_name =
|
||||||
|
button_name + (action->objectName().isEmpty() ? "" : "[" + action->objectName().toStdString() + "]").c_str();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,21 +286,24 @@ void MessagesToolBar::activateAction(const QString& action_name, QWidgetAction*
|
|||||||
}
|
}
|
||||||
|
|
||||||
QStringList MessagesToolBar::defaultActions() const {
|
QStringList MessagesToolBar::defaultActions() const {
|
||||||
return QString(GUI::MessagesToolbarDefaultButtonsDef).split(QL1C(','),
|
return QString(GUI::MessagesToolbarDefaultButtonsDef)
|
||||||
|
.split(QL1C(','),
|
||||||
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||||
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||||
#else
|
#else
|
||||||
QString::SplitBehavior::SkipEmptyParts);
|
QString::SplitBehavior::SkipEmptyParts);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList MessagesToolBar::savedActions() const {
|
QStringList MessagesToolBar::savedActions() const {
|
||||||
return qApp->settings()->value(GROUP(GUI),
|
return qApp->settings()
|
||||||
SETTING(GUI::MessagesToolbarDefaultButtons)).toString().split(QL1C(','),
|
->value(GROUP(GUI), SETTING(GUI::MessagesToolbarDefaultButtons))
|
||||||
|
.toString()
|
||||||
|
.split(QL1C(','),
|
||||||
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||||
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||||
#else
|
#else
|
||||||
QString::SplitBehavior::SkipEmptyParts);
|
QString::SplitBehavior::SkipEmptyParts);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,7 +443,9 @@ void TextBrowserViewer::setHtmlPrivate(const QString& html, const QUrl& base_url
|
|||||||
emit pageUrlChanged(base_url);
|
emit pageUrlChanged(base_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextBrowserDocument::TextBrowserDocument(QObject* parent) : QTextDocument(parent), m_reloadingWithResources(false) {}
|
TextBrowserDocument::TextBrowserDocument(QObject* parent)
|
||||||
|
: QTextDocument(parent), m_reloadingWithResources(false),
|
||||||
|
m_placeholderImage(qApp->icons()->miscPixmap("image-placeholder")) {}
|
||||||
|
|
||||||
QVariant TextBrowserDocument::loadResource(int type, const QUrl& name) {
|
QVariant TextBrowserDocument::loadResource(int type, const QUrl& name) {
|
||||||
if (!m_reloadingWithResources) {
|
if (!m_reloadingWithResources) {
|
||||||
@ -451,12 +453,12 @@ QVariant TextBrowserDocument::loadResource(int type, const QUrl& name) {
|
|||||||
m_neededResourcesForHtml.append(name);
|
m_neededResourcesForHtml.append(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return m_placeholderImage;
|
||||||
}
|
}
|
||||||
else if (m_loadedResources.contains(name)) {
|
else if (m_loadedResources.contains(name)) {
|
||||||
return QImage::fromData(m_loadedResources.value(name));
|
return QImage::fromData(m_loadedResources.value(name));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return {};
|
return m_placeholderImage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "network-web/adblock/adblockmanager.h"
|
#include "network-web/adblock/adblockmanager.h"
|
||||||
|
|
||||||
|
#include <QPixmap>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
class QContextMenuEvent;
|
class QContextMenuEvent;
|
||||||
@ -31,6 +32,7 @@ class TextBrowserDocument : public QTextDocument {
|
|||||||
bool m_reloadingWithResources;
|
bool m_reloadingWithResources;
|
||||||
QList<QUrl> m_neededResourcesForHtml;
|
QList<QUrl> m_neededResourcesForHtml;
|
||||||
QMap<QUrl, QByteArray> m_loadedResources;
|
QMap<QUrl, QByteArray> m_loadedResources;
|
||||||
|
QPixmap m_placeholderImage;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TextBrowserViewer : public QTextBrowser, public WebViewer {
|
class TextBrowserViewer : public QTextBrowser, public WebViewer {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user