mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-02-03 02:37:46 +01:00
resolve relative URLs when navigating in nwe
This commit is contained in:
parent
e0174e9ddc
commit
3ccce27dd5
@ -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-04-20"/>
|
||||
<release version="4.2.1" date="2022-04-21"/>
|
||||
</releases>
|
||||
<content_rating type="oars-1.0">
|
||||
<content_attribute id="violence-cartoon">none</content_attribute>
|
||||
|
@ -364,11 +364,11 @@ void TextBrowserViewer::reloadWithImages() {
|
||||
}
|
||||
}
|
||||
|
||||
auto scrolled = verticalScrollBar()->value();
|
||||
auto scrolled = verticalScrollBarPosition();
|
||||
|
||||
setHtmlPrivate(html(), m_currentUrl);
|
||||
|
||||
verticalScrollBar()->setValue(scrolled);
|
||||
setVerticalScrollBarPosition(scrolled);
|
||||
}
|
||||
|
||||
void TextBrowserViewer::openLinkInExternalBrowser() {
|
||||
@ -397,22 +397,18 @@ void TextBrowserViewer::downloadLink() {
|
||||
|
||||
void TextBrowserViewer::onAnchorClicked(const QUrl& url) {
|
||||
if (!url.isEmpty()) {
|
||||
const QUrl resolved_url = (m_currentUrl.isValid() && url.isRelative()) ? m_currentUrl.resolved(url) : url;
|
||||
|
||||
bool open_externally_now =
|
||||
qApp->settings()->value(GROUP(Browser), SETTING(Browser::OpenLinksInExternalBrowserRightAway)).toBool();
|
||||
|
||||
if (open_externally_now) {
|
||||
qApp->web()->openUrlInExternalBrowser(url.toString());
|
||||
qApp->web()->openUrlInExternalBrowser(resolved_url.toString());
|
||||
}
|
||||
else {
|
||||
setUrl(url);
|
||||
setUrl(resolved_url);
|
||||
}
|
||||
}
|
||||
else {
|
||||
MsgBox::show(qApp->mainFormWidget(),
|
||||
QMessageBox::Warning,
|
||||
tr("Incorrect link"),
|
||||
tr("Selected hyperlink is invalid."));
|
||||
}
|
||||
}
|
||||
|
||||
void TextBrowserViewer::setHtml(const QString& html, const QUrl& base_url) {
|
||||
@ -456,12 +452,12 @@ QVariant TextBrowserDocument::loadResource(int type, const QUrl& name) {
|
||||
m_resourcesForHtml.append(name);
|
||||
}
|
||||
|
||||
return QTextDocument::loadResource(type, name);
|
||||
return {};
|
||||
}
|
||||
else if (m_loadedResources.contains(name)) {
|
||||
return QImage::fromData(m_loadedResources.value(name));
|
||||
}
|
||||
else {
|
||||
return QTextDocument::loadResource(type, name);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user