fix resolving of URLs for external browser and downloading
This commit is contained in:
parent
d9a651490a
commit
4348a51d67
4 changed files with 18 additions and 21 deletions
|
@ -386,10 +386,12 @@ void TextBrowserViewer::enableResources(bool enable) {
|
|||
}
|
||||
|
||||
void TextBrowserViewer::openLinkInExternalBrowser() {
|
||||
auto link = anchorAt(m_lastContextMenuPos);
|
||||
auto url = QUrl(anchorAt(m_lastContextMenuPos));
|
||||
|
||||
if (!link.isEmpty()) {
|
||||
qApp->web()->openUrlInExternalBrowser(link);
|
||||
if (url.isValid()) {
|
||||
const QUrl resolved_url = (m_currentUrl.isValid() && url.isRelative()) ? m_currentUrl.resolved(url) : url;
|
||||
|
||||
qApp->web()->openUrlInExternalBrowser(resolved_url.toString());
|
||||
|
||||
if (qApp->settings()
|
||||
->value(GROUP(Messages), SETTING(Messages::BringAppToFrontAfterMessageOpenedExternally))
|
||||
|
@ -402,10 +404,12 @@ void TextBrowserViewer::openLinkInExternalBrowser() {
|
|||
}
|
||||
|
||||
void TextBrowserViewer::downloadLink() {
|
||||
auto link = anchorAt(m_lastContextMenuPos);
|
||||
auto url = QUrl(anchorAt(m_lastContextMenuPos));
|
||||
|
||||
if (!link.isEmpty()) {
|
||||
qApp->downloadManager()->download(link);
|
||||
if (url.isValid()) {
|
||||
const QUrl resolved_url = (m_currentUrl.isValid() && url.isRelative()) ? m_currentUrl.resolved(url) : url;
|
||||
|
||||
qApp->downloadManager()->download(resolved_url);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,12 @@ DVALUE(QString) Node::PackageFolderDef = QSL(USER_DATA_PLACEHOLDER) + "/node-pac
|
|||
// Cookies.
|
||||
DKEY Cookies::ID = "cookies";
|
||||
|
||||
// Network.
|
||||
DKEY Network::ID = "network";
|
||||
|
||||
DKEY Network::SendDNT = "send_dnt";
|
||||
VALUE(bool) Network::SendDNTDef = false;
|
||||
|
||||
DKEY Network::IgnoreAllCookies = "ignore_all_cookies";
|
||||
DVALUE(bool) Network::IgnoreAllCookiesDef = false;
|
||||
|
||||
|
@ -400,9 +404,6 @@ DKEY Notifications::ID = "notifications";
|
|||
// Web browser.
|
||||
DKEY Browser::ID = "browser";
|
||||
|
||||
DKEY Browser::SendDNT = "send_dnt";
|
||||
VALUE(bool) Browser::SendDNTDef = false;
|
||||
|
||||
DKEY Browser::OpenLinksInExternalBrowserRightAway = "open_link_externally_wo_confirmation";
|
||||
DVALUE(bool) Browser::OpenLinksInExternalBrowserRightAwayDef = false;
|
||||
|
||||
|
|
|
@ -320,6 +320,9 @@ namespace GUI {
|
|||
namespace Network {
|
||||
KEY ID;
|
||||
|
||||
KEY SendDNT;
|
||||
VALUE(bool) SendDNTDef;
|
||||
|
||||
KEY IgnoreAllCookies;
|
||||
VALUE(bool) IgnoreAllCookiesDef;
|
||||
} // namespace Network
|
||||
|
@ -439,40 +442,29 @@ namespace Notifications {
|
|||
// Web browser.
|
||||
namespace Browser {
|
||||
KEY ID;
|
||||
KEY SendDNT;
|
||||
|
||||
VALUE(bool) SendDNTDef;
|
||||
|
||||
KEY OpenLinksInExternalBrowserRightAway;
|
||||
|
||||
VALUE(bool) OpenLinksInExternalBrowserRightAwayDef;
|
||||
|
||||
KEY CustomExternalBrowserEnabled;
|
||||
|
||||
VALUE(bool) CustomExternalBrowserEnabledDef;
|
||||
|
||||
KEY CustomExternalBrowserExecutable;
|
||||
|
||||
VALUE(QString) CustomExternalBrowserExecutableDef;
|
||||
|
||||
KEY CustomExternalBrowserArguments;
|
||||
|
||||
VALUE(char*) CustomExternalBrowserArgumentsDef;
|
||||
|
||||
KEY CustomExternalEmailEnabled;
|
||||
|
||||
VALUE(bool) CustomExternalEmailEnabledDef;
|
||||
|
||||
KEY CustomExternalEmailExecutable;
|
||||
|
||||
VALUE(QString) CustomExternalEmailExecutableDef;
|
||||
|
||||
KEY ExternalTools;
|
||||
|
||||
VALUE(QStringList) ExternalToolsDef;
|
||||
|
||||
KEY CustomExternalEmailArguments;
|
||||
|
||||
VALUE(char*) CustomExternalEmailArgumentsDef;
|
||||
} // namespace Browser
|
||||
|
||||
|
|
|
@ -51,5 +51,5 @@ void NetworkUrlInterceptor::removeUrlInterceptor(UrlInterceptor* interceptor) {
|
|||
}
|
||||
|
||||
void NetworkUrlInterceptor::load() {
|
||||
m_sendDnt = qApp->settings()->value(GROUP(Browser), SETTING(Browser::SendDNT)).toBool();
|
||||
m_sendDnt = qApp->settings()->value(GROUP(Network), SETTING(Network::SendDNT)).toBool();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue