Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Mike Royal
plasma-angelfish
Commits
ac3facee
Commit
ac3facee
authored
Feb 23, 2019
by
Jonah Brüchert
🌳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement context menu and find in page
parent
382cf2db
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
54 deletions
+84
-54
src/contents/ui/Options.qml
src/contents/ui/Options.qml
+1
-40
src/contents/ui/OptionsOverview.qml
src/contents/ui/OptionsOverview.qml
+16
-1
src/contents/ui/WebView.qml
src/contents/ui/WebView.qml
+67
-10
src/contents/ui/webbrowser.qml
src/contents/ui/webbrowser.qml
+0
-3
No files found.
src/contents/ui/Options.qml
View file @
ac3facee
...
...
@@ -38,20 +38,13 @@ Rectangle {
property
string
title
:
""
property
int
expandedHeight
:
Kirigami
.
Units
.
gridUnit
*
12
property
int
expandedWidth
:
Kirigami
.
Units
.
gridUnit
*
14
Behavior
on
opacity
{
NumberAnimation
{
duration
:
Kirigami
.
Units
.
longDuration
/
2
;
easing.type
:
Easing
.
InOutQuad
}
}
Behavior
on
x
{
NumberAnimation
{
duration
:
Kirigami
.
Units
.
longDuration
/
2
;
easing.type
:
Easing
.
InOutQuad
}
}
height
:
expandedHeight
width
:
expandedWidth
//height: childrenRect.height + Kirigami.Units.gridUnit
//width: childrenRect.width + Kirigami.Units.gridUnit/2
//width: expandedWidth
//anchors.rightMargin: -options.margins.right
//Rectangle { anchors.fill: parent; color: theme.backgroundColor; }
height
:
childrenRect
.
height
Rectangle
{
width
:
webBrowser
.
borderWidth
...
...
@@ -74,13 +67,7 @@ Rectangle {
}
ColumnLayout
{
//visible: parent.height > 0
//spacing: Kirigami.Units.gridUnit
spacing
:
0
//x: Kirigami.Units.gridUnit / 2
//y: - (Kirigami.Units.gridUnit + webBrowser.borderWidth)
//width: Kirigami.Units.gridUnit * 14
anchors
{
//fill: parent
top
:
parent
.
top
...
...
@@ -100,11 +87,6 @@ Rectangle {
//Rectangle { anchors.fill: parent; color: "black"; opacity: 0.1; }
}
}
// NumberAnimation on state {
// //loops: Animation.Infinite
// from: state == "hidden" ? 0 : 1.0
// to: state == "hidden" ? 1.0 : 0.0
// }
states
:
[
State
{
name
:
"
hidden
"
...
...
@@ -118,27 +100,6 @@ Rectangle {
PropertyChanges
{
target
:
options
;
opacity
:
1.0
}
PropertyChanges
{
target
:
options
;
x
:
webBrowser
.
width
-
options
.
width
}
}
/*,
State {
name: "bookmarks"
PropertyChanges { target: loader; source: "Bookmarks.qml"}
PropertyChanges { target: options; title: i18n("Bookmarks")}
PropertyChanges { target: options; height: expandedHeight}
},
State {
name: "tabs"
PropertyChanges { target: options; title: i18n("Tabs")}
PropertyChanges { target: loader; source: "Tabs.qml"}
PropertyChanges { target: options; height: expandedHeight}
},
State {
name: "settings"
PropertyChanges { target: options; title: i18n("Settings")}
PropertyChanges { target: loader; source: "Settings.qml"}
PropertyChanges { target: options; height: expandedHeight}
}
*/
]
}
src/contents/ui/OptionsOverview.qml
View file @
ac3facee
...
...
@@ -138,6 +138,22 @@ ColumnLayout {
text
:
i18n
(
"
History
"
)
}
InputSheet
{
id
:
findSheet
title
:
i18n
(
"
Find in page
"
)
placeholderText
:
i18n
(
"
Find...
"
)
description
:
i18n
(
"
Highlight text on the current website
"
)
onAccepted
:
currentWebView
.
findText
(
findSheet
.
text
)
}
OptionButton
{
iconSource
:
"
edit-find
"
Layout.fillWidth
:
true
Layout.preferredHeight
:
buttonSize
onClicked
:
findSheet
.
open
()
text
:
i18n
(
"
Find in page
"
)
}
OptionButton
{
iconSource
:
"
configure
"
Layout.fillWidth
:
true
...
...
@@ -147,6 +163,5 @@ ColumnLayout {
pageStack
.
layers
.
push
(
"
Settings.qml
"
)
options
.
state
=
"
hidden
"
}
}
}
src/contents/ui/WebView.qml
View file @
ac3facee
...
...
@@ -20,9 +20,9 @@
***************************************************************************/
import
QtQuick
2.3
import
QtQuick
.
Controls
2.
0
import
QtQuick
.
Controls
2.
4
as
Controls
import
QtWebEngine
1.
4
import
QtWebEngine
1.
7
WebEngineView
{
...
...
@@ -30,12 +30,62 @@ WebEngineView {
property
string
errorCode
:
""
property
string
errorString
:
""
property
string
userAgent
:
"
Mozilla/5.0 (Linux; Plasma Mobile, like Android
7
.0 ) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/60.0.3112.107 Mobile Safari/537.36
"
property
string
userAgent
:
"
Mozilla/5.0 (Linux; Plasma Mobile, like Android
9
.0 ) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/60.0.3112.107 Mobile Safari/537.36
"
width
:
pageWidth
height
:
pageHeight
profile.httpUserAgent
:
userAgent
profile
{
httpUserAgent
:
userAgent
onDownloadRequested
:
{
showPassiveNotification
(
i18n
(
"
Do you want to download this file?
"
),
"
long
"
,
"
Download
"
,
function
()
{
download
.
accept
})
}
onDownloadFinished
:
showPassiveNotification
(
i18n
(
"
Download finished
"
))
}
settings
{
errorPageEnabled
:
false
}
Controls.Menu
{
property
var
request
id
:
contextMenu
Controls.MenuItem
{
text
:
i18n
(
"
Copy
"
)
enabled
:
(
contextMenu
.
request
.
editFlags
&
ContextMenuRequest
.
CanCopy
)
!=
0
onTriggered
:
webEngineView
.
triggerWebAction
(
WebEngineView
.
Copy
)
}
Controls.MenuItem
{
text
:
i18n
(
"
Cut
"
)
enabled
:
(
contextMenu
.
request
.
editFlags
&
ContextMenuRequest
.
CanCut
)
!=
0
onTriggered
:
webEngineView
.
triggerWebAction
(
WebEngineView
.
Cut
)
}
Controls.MenuItem
{
text
:
i18n
(
"
Paste
"
)
enabled
:
(
contextMenu
.
request
.
editFlags
&
ContextMenuRequest
.
CanPaste
)
!=
0
onTriggered
:
webEngineView
.
triggerWebAction
(
WebEngineView
.
Paste
)
}
Controls.MenuItem
{
enabled
:
contextMenu
.
request
.
linkUrl
!==
""
text
:
i18n
(
"
Copy Url
"
)
onTriggered
:
webEngineView
.
triggerWebAction
(
WebEngineView
.
CopyLinkToClipboard
)
}
Controls.MenuItem
{
text
:
i18n
(
"
View source
"
)
onTriggered
:
webEngineView
.
triggerWebAction
(
WebEngineView
.
ViewSource
)
}
Controls.MenuItem
{
text
:
i18n
(
"
Download
"
)
onTriggered
:
webEngineView
.
triggerWebAction
(
WebEngineView
.
DownloadLinkToDisk
)
}
Controls.MenuItem
{
enabled
:
contextMenu
.
request
.
linkUrl
!==
""
text
:
i18n
(
"
Open in new Tab
"
)
onTriggered
:
webEngineView
.
triggerWebAction
(
WebEngineView
.
OpenLinkInNewTab
)
}
}
//Rectangle { color: "yellow"; opacity: 0.3; anchors.fill: parent }
focus
:
true
...
...
@@ -74,12 +124,6 @@ WebEngineView {
errorString
=
es
;
}
// onLoadProgressChanged: {
// if (loadProgress > 50) {
// contentView.state = "hidden";
// }
// }
Component.onCompleted
:
{
print
(
"
WebView completed.
"
);
var
settings
=
webEngineView
.
settings
;
...
...
@@ -90,4 +134,17 @@ WebEngineView {
if
(
icon
)
browserManager
.
history
.
updateIcon
(
url
,
icon
)
}
onNewViewRequested
:
{
newTab
(
request
.
requestedUrl
.
toString
())
showPassiveNotification
(
"
Website was opened in a new tab
"
)
}
onContextMenuRequested
:
{
request
.
accepted
=
true
;
contextMenu
.
request
=
request
contextMenu
.
x
=
request
.
x
contextMenu
.
y
=
request
.
y
contextMenu
.
open
()
}
}
src/contents/ui/webbrowser.qml
View file @
ac3facee
...
...
@@ -69,9 +69,7 @@ Kirigami.ApplicationWindow {
pageStack.globalToolBar.style
:
layerShown
?
Kirigami
.
ApplicationHeaderStyle
.
Auto
:
Kirigami
.
ApplicationHeaderStyle
.
None
pageStack.initialPage
:
Kirigami.Page
{
leftPadding
:
0
rightPadding
:
0
topPadding
:
0
...
...
@@ -190,6 +188,5 @@ Kirigami.ApplicationWindow {
right
:
options
.
left
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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