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)).
|
||||
|
||||
> **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.
|
||||
|
||||
|
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;
|
||||
}
|
||||
|
||||
void MessagesModel::setView(MessagesView* newView) {
|
||||
m_view = newView;
|
||||
void MessagesModel::setView(MessagesView* new_view) {
|
||||
m_view = new_view;
|
||||
}
|
||||
|
||||
MessagesModelCache* MessagesModel::cache() const {
|
||||
@ -773,7 +773,6 @@ QVariant MessagesModel::headerData(int section, Qt::Orientation orientation, int
|
||||
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
|
||||
// Display textual headers for all columns except "read" and
|
||||
// "important" and "has enclosures" columns.
|
||||
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 MessagesModel : public QSqlQueryModel, public MessagesModelSqlLayer {
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
// Enum which describes basic highlighting schemes
|
||||
// for messages.
|
||||
enum class MessageHighlighter {
|
||||
NoHighlighting = 100,
|
||||
HighlightUnread = 101,
|
||||
HighlightImportant = 102
|
||||
};
|
||||
enum class MessageHighlighter { NoHighlighting = 100, HighlightUnread = 101, HighlightImportant = 102 };
|
||||
|
||||
// Constructors and destructors.
|
||||
explicit MessagesModel(QObject* parent = nullptr);
|
||||
@ -76,7 +71,9 @@ class MessagesModel : public QSqlQueryModel, public MessagesModelSqlLayer {
|
||||
void loadMessages(RootItem* item);
|
||||
|
||||
MessagesView* view() const;
|
||||
void setView(MessagesView* newView);
|
||||
void setView(MessagesView* new_view);
|
||||
|
||||
static QIcon generateIconForScore(double score);
|
||||
|
||||
public slots:
|
||||
|
||||
@ -89,8 +86,6 @@ class MessagesModel : public QSqlQueryModel, public MessagesModelSqlLayer {
|
||||
void setupHeaderData();
|
||||
void setupIcons();
|
||||
|
||||
static QIcon generateIconForScore(double score);
|
||||
|
||||
private:
|
||||
MessagesView* m_view;
|
||||
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() &&
|
||||
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;
|
||||
|
@ -23,7 +23,9 @@ class MessagesProxyModel : public QSortFilterProxyModel {
|
||||
ShowLast24Hours = 105,
|
||||
ShowLast48Hours = 106,
|
||||
ShowThisWeek = 107,
|
||||
ShowLastWeek = 108
|
||||
ShowLastWeek = 108,
|
||||
ShowOnlyWithAttachments = 109,
|
||||
ShowOnlyWithScore = 110
|
||||
};
|
||||
|
||||
explicit MessagesProxyModel(MessagesModel* source_model, QObject* parent = nullptr);
|
||||
|
@ -7,11 +7,11 @@
|
||||
#include "miscellaneous/iconfactory.h"
|
||||
#include "miscellaneous/settings.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <QMenu>
|
||||
#include <QTimer>
|
||||
#include <QToolButton>
|
||||
#include <QWidgetAction>
|
||||
#include <chrono>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
@ -124,7 +124,8 @@ void MessagesToolBar::initializeSearchBox() {
|
||||
m_tmrSearchPattern->setSingleShot(true);
|
||||
|
||||
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)"));
|
||||
|
||||
// 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);
|
||||
|
||||
action->setData(value);
|
||||
@ -211,6 +216,16 @@ void MessagesToolBar::initializeHighlighter() {
|
||||
tr("Show last week's articles"),
|
||||
QVariant::fromValue(MessagesProxyModel::MessageListFilter::ShowLastWeek),
|
||||
"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->setToolTip(tr("Display all articles"));
|
||||
@ -244,7 +259,8 @@ void MessagesToolBar::saveToolButtonSelection(const QString& button_name, const
|
||||
|
||||
for (QString& action_name : action_names) {
|
||||
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 {
|
||||
return QString(GUI::MessagesToolbarDefaultButtonsDef).split(QL1C(','),
|
||||
return QString(GUI::MessagesToolbarDefaultButtonsDef)
|
||||
.split(QL1C(','),
|
||||
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||
#else
|
||||
QString::SplitBehavior::SkipEmptyParts);
|
||||
QString::SplitBehavior::SkipEmptyParts);
|
||||
#endif
|
||||
}
|
||||
|
||||
QStringList MessagesToolBar::savedActions() const {
|
||||
return qApp->settings()->value(GROUP(GUI),
|
||||
SETTING(GUI::MessagesToolbarDefaultButtons)).toString().split(QL1C(','),
|
||||
return qApp->settings()
|
||||
->value(GROUP(GUI), SETTING(GUI::MessagesToolbarDefaultButtons))
|
||||
.toString()
|
||||
.split(QL1C(','),
|
||||
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||
#else
|
||||
QString::SplitBehavior::SkipEmptyParts);
|
||||
QString::SplitBehavior::SkipEmptyParts);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -443,7 +443,9 @@ void TextBrowserViewer::setHtmlPrivate(const QString& html, const QUrl& 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) {
|
||||
if (!m_reloadingWithResources) {
|
||||
@ -451,12 +453,12 @@ QVariant TextBrowserDocument::loadResource(int type, const QUrl& name) {
|
||||
m_neededResourcesForHtml.append(name);
|
||||
}
|
||||
|
||||
return {};
|
||||
return m_placeholderImage;
|
||||
}
|
||||
else if (m_loadedResources.contains(name)) {
|
||||
return QImage::fromData(m_loadedResources.value(name));
|
||||
}
|
||||
else {
|
||||
return {};
|
||||
return m_placeholderImage;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "network-web/adblock/adblockmanager.h"
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QPointer>
|
||||
|
||||
class QContextMenuEvent;
|
||||
@ -31,6 +32,7 @@ class TextBrowserDocument : public QTextDocument {
|
||||
bool m_reloadingWithResources;
|
||||
QList<QUrl> m_neededResourcesForHtml;
|
||||
QMap<QUrl, QByteArray> m_loadedResources;
|
||||
QPixmap m_placeholderImage;
|
||||
};
|
||||
|
||||
class TextBrowserViewer : public QTextBrowser, public WebViewer {
|
||||
|
Loading…
x
Reference in New Issue
Block a user