Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma Mobile
Angelfish
Commits
37cd7b69
Verified
Commit
37cd7b69
authored
Oct 19, 2019
by
Jonah Brüchert
Browse files
feature: Add action for showing the desktop site
parent
51407074
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/contents/ui/WebView.qml
View file @
37cd7b69
...
...
@@ -37,25 +37,37 @@ WebEngineView {
/**
* User agent used on mobile devices
*/
property
string
mobileUserAgent
:
"
Mozilla/5.0 (Linux; Plasma Mobile, like Android 9.0 ) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/
69
.0.3
497.128
Mobile Safari/537.36
"
readonly
property
string
mobileUserAgent
:
"
Mozilla/5.0 (Linux; Plasma Mobile, like Android 9.0 ) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/
75
.0.3
770.116
Mobile Safari/537.36
"
/**
* User agent used on desktop devices,
* Defaults to QtWebEngine's default (it is only supported on desktop devices by Qt currently)
*/
property
string
desktopUserAgent
:
profile
.
httpUserAgent
readonly
property
string
desktopUserAgent
:
"
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.14.0 Chrome/75.0.3770.116 Safari/537.36
"
width
:
pageWidth
height
:
pageHeight
profile
{
httpUserAgent
:
{
if
(
Kirigami
.
Settings
.
isMobile
)
return
mobileUserAgent
else
return
desktopUserAgent
state
:
Kirigami
.
Settings
.
isMobile
?
"
mobile
"
:
"
desktop
"
states
:
[
State
{
name
:
"
mobile
"
PropertyChanges
{
target
:
webEngineView
profile.httpUserAgent
:
mobileUserAgent
}
},
State
{
name
:
"
desktop
"
PropertyChanges
{
target
:
webEngineView
profile.httpUserAgent
:
desktopUserAgent
}
}
]
profile
{
offTheRecord
:
rootPage
.
privateMode
onDownloadRequested
:
{
...
...
src/contents/ui/webbrowser.qml
View file @
37cd7b69
...
...
@@ -273,6 +273,27 @@ Kirigami.ApplicationWindow {
request
.
bookmarked
=
true
;
browserManager
.
addBookmark
(
request
);
}
},
Kirigami.Action
{
icon.name
:
"
computer
"
text
:
i18n
(
"
Show desktop site
"
)
checkable
:
true
checked
:
{
if
(
currentWebView
.
state
===
"
mobile
"
)
{
false
}
else
if
(
currentWebView
.
state
===
"
desktop
"
)
{
true
}
}
onTriggered
:
{
if
(
currentWebView
.
state
===
"
desktop
"
)
{
currentWebView
.
state
=
"
mobile
"
}
else
if
(
currentWebView
.
state
===
"
mobile
"
)
{
currentWebView
.
state
=
"
desktop
"
}
currentWebView
.
reload
()
}
}
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment