2020-10-09 17:56:42 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.3
|
|
|
|
import QtWebEngine 1.9
|
2021-09-28 15:04:06 +00:00
|
|
|
import utils 1.0
|
2021-10-01 15:58:36 +00:00
|
|
|
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.status 1.0
|
|
|
|
import shared.popups 1.0
|
2021-10-01 15:58:36 +00:00
|
|
|
|
|
|
|
import "../../Chat/popups"
|
2020-10-09 17:56:42 +00:00
|
|
|
|
2021-10-14 11:48:03 +00:00
|
|
|
// TODO: replace with StatusPopupMenu
|
2020-10-09 17:56:42 +00:00
|
|
|
PopupMenu {
|
|
|
|
property var addNewTab: function () {}
|
|
|
|
|
|
|
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
|
|
|
|
|
|
|
|
Action {
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "New Tab"
|
|
|
|
text: qsTrId("new-tab")
|
2020-10-09 17:56:42 +00:00
|
|
|
shortcut: StandardKey.AddTab
|
|
|
|
onTriggered: {
|
|
|
|
addNewTab()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Action {
|
|
|
|
id: offTheRecordEnabled
|
|
|
|
// TODO show an indicator on the browser or tab?
|
2020-10-29 20:07:52 +00:00
|
|
|
text: checked ?
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Exit Incognito mode"
|
|
|
|
qsTrId("exit-incognito-mode") :
|
|
|
|
//% "Go Incognito"
|
|
|
|
qsTrId("go-incognito")
|
2020-10-09 17:56:42 +00:00
|
|
|
checkable: true
|
|
|
|
checked: currentWebView && currentWebView.profile === otrProfile
|
|
|
|
onToggled: function(checked) {
|
|
|
|
if (currentWebView) {
|
|
|
|
currentWebView.profile = checked ? otrProfile : defaultProfile;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {}
|
|
|
|
|
|
|
|
// TODO find a way to put both in one button
|
|
|
|
Action {
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Zoom In"
|
|
|
|
text: qsTrId("zoom-in")
|
2020-10-09 17:56:42 +00:00
|
|
|
shortcut: StandardKey.ZoomIn
|
|
|
|
onTriggered: {
|
|
|
|
const newZoom = currentWebView.zoomFactor + 0.1
|
|
|
|
currentWebView.changeZoomFactor(newZoom)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Action {
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Zoom Out"
|
|
|
|
text: qsTrId("zoom-out")
|
2020-10-09 17:56:42 +00:00
|
|
|
shortcut: StandardKey.ZoomOut
|
|
|
|
onTriggered: {
|
|
|
|
const newZoom = currentWebView.zoomFactor - 0.1
|
|
|
|
currentWebView.changeZoomFactor(newZoom)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Action {
|
|
|
|
shortcut: "Ctrl+0"
|
|
|
|
onTriggered: currentWebView.changeZoomFactor(1.0)
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {}
|
|
|
|
|
|
|
|
Action {
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Find"
|
|
|
|
text: qsTrId("find")
|
2020-10-09 17:56:42 +00:00
|
|
|
shortcut: StandardKey.Find
|
|
|
|
onTriggered: {
|
|
|
|
if (!findBar.visible) {
|
|
|
|
findBar.visible = true;
|
|
|
|
findBar.forceActiveFocus()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Action {
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Compatibility mode"
|
|
|
|
text: qsTrId("compatibility-mode")
|
2020-10-21 16:50:21 +00:00
|
|
|
checkable: true
|
|
|
|
checked: true
|
|
|
|
onToggled: {
|
|
|
|
for (let i = 0; i < tabs.count; ++i){
|
|
|
|
tabs.getTab(i).item.stop(); // Stop all loading tabs
|
|
|
|
}
|
|
|
|
|
2021-10-20 09:50:50 +00:00
|
|
|
localAccountSensitiveSettings.compatibilityMode = checked;
|
2020-10-21 16:50:21 +00:00
|
|
|
|
|
|
|
for (let i = 0; i < tabs.count; ++i){
|
|
|
|
tabs.getTab(i).item.reload(); // Reload them with new user agent
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Action {
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Developer Tools"
|
|
|
|
text: qsTrId("developer-tools")
|
2020-10-09 17:56:42 +00:00
|
|
|
shortcut: "F12"
|
|
|
|
onTriggered: {
|
2021-10-20 09:50:50 +00:00
|
|
|
localAccountSensitiveSettings.devToolsEnabled = !localAccountSensitiveSettings.devToolsEnabled
|
2020-10-09 17:56:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {}
|
|
|
|
|
|
|
|
Action {
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Settings"
|
|
|
|
text: qsTrId("settings")
|
2020-10-09 17:56:42 +00:00
|
|
|
shortcut: "Ctrl+,"
|
|
|
|
onTriggered: {
|
2020-10-21 14:45:28 +00:00
|
|
|
appMain.changeAppSection(Constants.profile)
|
2021-10-06 09:16:39 +00:00
|
|
|
// TODO: replace with shared store constant
|
|
|
|
// Profile/RootStore.browser_settings_id
|
|
|
|
profileLayoutContainer.changeProfileSection(10)
|
2020-10-09 17:56:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|