mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-02-04 11:17:31 +01:00
fix missing icon, more efficient adblock usage
This commit is contained in:
parent
c2bc532c93
commit
d1800a9cf9
@ -26,7 +26,7 @@
|
||||
<url type="donation">https://github.com/sponsors/martinrotter</url>
|
||||
<content_rating type="oars-1.1" />
|
||||
<releases>
|
||||
<release version="4.2.1" date="2022-03-25"/>
|
||||
<release version="4.2.1" date="2022-03-28"/>
|
||||
</releases>
|
||||
<content_rating type="oars-1.0">
|
||||
<content_attribute id="violence-cartoon">none</content_attribute>
|
||||
|
@ -29,6 +29,7 @@
|
||||
<file>./graphics/Breeze/actions/32/edit-reset.svg</file>
|
||||
<file>./graphics/Breeze/actions/22/edit-select-all.svg</file>
|
||||
<file>./graphics/Breeze/actions/22/edit-select-none.svg</file>
|
||||
<file>./graphics/Breeze/emblems/22/emblem-favorite.svg</file>
|
||||
<file>./graphics/Breeze/emblems/22/emblem-shared.svg</file>
|
||||
<file>./graphics/Breeze/places/96/folder.svg</file>
|
||||
<file>./graphics/Breeze/actions/22/format-indent-more.svg</file>
|
||||
@ -103,6 +104,7 @@
|
||||
<file>./graphics/Breeze Dark/actions/32/edit-reset.svg</file>
|
||||
<file>./graphics/Breeze Dark/actions/22/edit-select-all.svg</file>
|
||||
<file>./graphics/Breeze Dark/actions/22/edit-select-none.svg</file>
|
||||
<file>./graphics/Breeze Dark/emblems/22/emblem-favorite.svg</file>
|
||||
<file>./graphics/Breeze Dark/emblems/22/emblem-shared.svg</file>
|
||||
<file>./graphics/Breeze Dark/places/96/folder.svg</file>
|
||||
<file>./graphics/Breeze Dark/actions/22/format-indent-more.svg</file>
|
||||
@ -174,6 +176,7 @@
|
||||
<file>./graphics/Faenza/actions/64/edit-copy.png</file>
|
||||
<file>./graphics/Faenza/actions/64/edit-select-all.png</file>
|
||||
<file>./graphics/Faenza/emblems/64/emblem-downloads.png</file>
|
||||
<file>./graphics/Faenza/emblems/64/emblem-favorite.png</file>
|
||||
<file>./graphics/Faenza/emblems/64/emblem-shared.png</file>
|
||||
<file>./graphics/Faenza/emblems/64/emblem-system.png</file>
|
||||
<file>./graphics/Faenza/places/64/folder.png</file>
|
||||
@ -252,6 +255,7 @@
|
||||
<file>./graphics/Numix/22/actions/edit-copy.svg</file>
|
||||
<file>./graphics/Numix/22/actions/edit-select-all.svg</file>
|
||||
<file>./graphics/Numix/22/emblems/emblem-downloads.svg</file>
|
||||
<file>./graphics/Numix/22/emblems/emblem-favorite.svg</file>
|
||||
<file>./graphics/Numix/22/emblems/emblem-shared.svg</file>
|
||||
<file>./graphics/Numix/22/emblems/emblem-system.svg</file>
|
||||
<file>./graphics/Numix/22/places/folder.svg</file>
|
||||
|
@ -60,22 +60,14 @@ void LiteHtmlViewer::findText(const QString& text, bool backwards) {
|
||||
|
||||
void LiteHtmlViewer::setUrl(const QUrl& url) {
|
||||
emit loadStarted();
|
||||
AdblockRequestInfo block_request(url);
|
||||
QString html_str;
|
||||
bool is_error = false;
|
||||
|
||||
if (url.path().endsWith(QSL("css"))) {
|
||||
block_request.setResourceType(QSL("stylesheet"));
|
||||
if (blockedWithAdblock(url)) {
|
||||
is_error = true;
|
||||
html_str = tr("Site \"%1\" was blocked with AdBlock.").arg(url.toString());
|
||||
}
|
||||
else {
|
||||
block_request.setResourceType(QSL("image"));
|
||||
}
|
||||
|
||||
if (qApp->web()->adBlock()->block(block_request).m_blocked) {
|
||||
qWarningNN << LOGSEC_ADBLOCK << "Blocked request:" << QUOTE_W_SPACE_DOT(block_request.requestUrl().toString());
|
||||
|
||||
// TODO: Display "site blocked" error.
|
||||
return;
|
||||
}
|
||||
|
||||
QEventLoop loop;
|
||||
|
||||
connect(m_downloader.data(), &Downloader::completed, &loop, &QEventLoop::quit);
|
||||
@ -87,18 +79,19 @@ void LiteHtmlViewer::setUrl(const QUrl& url) {
|
||||
loop.exec();
|
||||
|
||||
auto net_error = m_downloader->lastOutputError();
|
||||
QString html_str;
|
||||
|
||||
if (net_error != QNetworkReply::NetworkError::NoError) {
|
||||
is_error = true;
|
||||
html_str = "Error!";
|
||||
}
|
||||
else {
|
||||
html_str = QString::fromUtf8(m_downloader->lastOutputData());
|
||||
}
|
||||
}
|
||||
|
||||
setHtml(html_str, url);
|
||||
|
||||
emit loadFinished(net_error == QNetworkReply::NetworkError::NoError);
|
||||
emit loadFinished(is_error);
|
||||
}
|
||||
|
||||
void LiteHtmlViewer::setHtml(const QString& html, const QUrl& base_url) {
|
||||
@ -264,7 +257,7 @@ void LiteHtmlViewer::wheelEvent(QWheelEvent* event) {
|
||||
QLiteHtmlWidget::wheelEvent(event);
|
||||
}
|
||||
|
||||
QByteArray LiteHtmlViewer::handleResource(const QUrl& url) {
|
||||
bool LiteHtmlViewer::blockedWithAdblock(const QUrl& url) {
|
||||
AdblockRequestInfo block_request(url);
|
||||
|
||||
if (url.path().endsWith(QSL("css"))) {
|
||||
@ -276,6 +269,15 @@ QByteArray LiteHtmlViewer::handleResource(const QUrl& url) {
|
||||
|
||||
if (qApp->web()->adBlock()->block(block_request).m_blocked) {
|
||||
qWarningNN << LOGSEC_ADBLOCK << "Blocked request:" << QUOTE_W_SPACE_DOT(block_request.requestUrl().toString());
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
QByteArray LiteHtmlViewer::handleResource(const QUrl& url) {
|
||||
if (blockedWithAdblock(url)) {
|
||||
return {};
|
||||
}
|
||||
else {
|
||||
|
@ -50,6 +50,7 @@ class LiteHtmlViewer : public QLiteHtmlWidget, public WebViewer {
|
||||
virtual void wheelEvent(QWheelEvent* event);
|
||||
|
||||
private:
|
||||
bool blockedWithAdblock(const QUrl& url);
|
||||
QByteArray handleResource(const QUrl& url);
|
||||
|
||||
private:
|
||||
|
@ -15,7 +15,7 @@
|
||||
LabelsNode::LabelsNode(RootItem* parent_item) : RootItem(parent_item), m_actLabelNew(nullptr) {
|
||||
setKind(RootItem::Kind::Labels);
|
||||
setId(ID_LABELS);
|
||||
setIcon(qApp->icons()->fromTheme(QSL("tag-folder")));
|
||||
setIcon(qApp->icons()->fromTheme(QSL("tag-folder"), QSL("emblem-favorite")));
|
||||
setTitle(tr("Labels"));
|
||||
setDescription(tr("You can see all your labels (tags) here."));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user