diff --git a/ui/app/AppLayouts/Browser/BrowserLayout.qml b/ui/app/AppLayouts/Browser/BrowserLayout.qml
index 1460e3c059..7b3ebaacc6 100644
--- a/ui/app/AppLayouts/Browser/BrowserLayout.qml
+++ b/ui/app/AppLayouts/Browser/BrowserLayout.qml
@@ -65,6 +65,11 @@ Rectangle {
return url;
}
+ function openUrlInNewTab(url) {
+ browserWindow.addNewTab()
+ currentWebView.url = determineRealURL(url)
+ }
+
property Component accessDialogComponent: BrowserConnectionModal {
currentTab: tabs.getTab(tabs.currentIndex) && tabs.getTab(tabs.currentIndex).item
x: browserWindow.width - width - Style.current.halfPadding
@@ -114,8 +119,7 @@ Rectangle {
FavoriteMenu {
id: favoriteMenu
openInNewTab: function (url) {
- browserWindow.addNewTab()
- currentWebView.url = url
+ browserWindow.openUrlInNewTab(url)
}
}
diff --git a/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/ChatText.qml b/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/ChatText.qml
index e561b77597..7e6fbc42fe 100644
--- a/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/ChatText.qml
+++ b/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/ChatText.qml
@@ -55,7 +55,7 @@ Item {
return;
}
- Qt.openUrlExternally(link)
+ appMain.openLink(link)
}
onLinkHovered: {
diff --git a/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/LinksMessage.qml b/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/LinksMessage.qml
index 69d2d6784a..e87a34b8a6 100644
--- a/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/LinksMessage.qml
+++ b/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/LinksMessage.qml
@@ -170,7 +170,7 @@ Column {
anchors.right: linkImage.right
anchors.bottom: linkSite.bottom
cursorShape: Qt.PointingHandCursor
- onClicked: Qt.openUrlExternally(linkData.address)
+ onClicked: appMain.openLink(linkData.address)
}
}
}
diff --git a/ui/app/AppLayouts/Chat/components/ChooseBrowserPopup.qml b/ui/app/AppLayouts/Chat/components/ChooseBrowserPopup.qml
new file mode 100644
index 0000000000..0ef15bd3fc
--- /dev/null
+++ b/ui/app/AppLayouts/Chat/components/ChooseBrowserPopup.qml
@@ -0,0 +1,56 @@
+import QtQuick 2.12
+import QtQuick.Controls 2.3
+import "../../../../imports"
+import "../../../../shared"
+import "../../../../shared/status"
+
+ModalPopup {
+ property string link
+
+ id: popup
+
+ title: qsTr("Choose browser")
+ width: 440
+ height: 425
+
+ Column {
+ anchors.fill: parent
+ spacing: 20
+
+ Image {
+ source: "../../../img/chooseBrowserImage.png"
+ width: 240
+ height: 148
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ StatusButton {
+ text: qsTr("Open in Status")
+ anchors.horizontalCenter: parent.horizontalCenter
+ onClicked: {
+ appSettings.showBrowserSelector = !rememberChoiceCheckBox.checked
+ changeAppSection(Constants.browser)
+ browserLayoutContainer.item.openUrlInNewTab(popup.link)
+ popup.close()
+ }
+ }
+
+ StatusButton {
+ text: qsTr("Open in my default browser")
+ type: "secondary"
+ anchors.horizontalCenter: parent.horizontalCenter
+ onClicked: {
+ appSettings.showBrowserSelector = !rememberChoiceCheckBox.checked
+ Qt.openUrlExternally(popup.link)
+ }
+ }
+
+
+ StatusCheckBox {
+ id: rememberChoiceCheckBox
+ text: qsTr("Remember my choice. To override it, go to settings.")
+ width: parent.width
+ }
+ }
+}
+
diff --git a/ui/app/AppLayouts/Profile/Sections/AboutContainer.qml b/ui/app/AppLayouts/Profile/Sections/AboutContainer.qml
index 4edee6b944..014ac88d71 100644
--- a/ui/app/AppLayouts/Profile/Sections/AboutContainer.qml
+++ b/ui/app/AppLayouts/Profile/Sections/AboutContainer.qml
@@ -63,7 +63,7 @@ Item {
anchors.top: element12.top
anchors.topMargin: 58
font.pixelSize: 14
- onLinkActivated: Qt.openUrlExternally(link)
+ onLinkActivated: appMain.openLink(link)
MouseArea {
anchors.fill: parent
@@ -80,7 +80,7 @@ Item {
anchors.top: element13.top
anchors.topMargin: 58
font.pixelSize: 14
- onLinkActivated: Qt.openUrlExternally(link)
+ onLinkActivated: appMain.openLink(link)
MouseArea {
anchors.fill: parent
@@ -96,7 +96,7 @@ Item {
anchors.leftMargin: Style.current.bigPadding
anchors.top: element14.top
anchors.topMargin: 58
- onLinkActivated: Qt.openUrlExternally(link)
+ onLinkActivated: appMain.openLink(link)
MouseArea {
anchors.fill: parent
@@ -106,12 +106,12 @@ Item {
}
StyledText {
id: faqLink
- text: "Frequently asked questions"
+ text: `${qsTr("Frequently asked questions")}`
anchors.left: parent.left
anchors.leftMargin: Style.current.bigPadding
anchors.top: privacyPolicyLink.top
anchors.topMargin: 58
- onLinkActivated: Qt.openUrlExternally(link)
+ onLinkActivated: appMain.openLink(link)
MouseArea {
anchors.fill: parent
diff --git a/ui/app/AppLayouts/Profile/Sections/DevicesContainer.qml b/ui/app/AppLayouts/Profile/Sections/DevicesContainer.qml
index 9eb2c64bd4..6000dd4ccd 100644
--- a/ui/app/AppLayouts/Profile/Sections/DevicesContainer.qml
+++ b/ui/app/AppLayouts/Profile/Sections/DevicesContainer.qml
@@ -131,7 +131,7 @@ Item {
MouseArea {
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
- onClicked: Qt.openUrlExternally("https://status.im/user_guides/pairing_devices.html")
+ onClicked: appMain.openLink("https://status.im/user_guides/pairing_devices.html")
}
}
}
diff --git a/ui/app/AppLayouts/Profile/Sections/Ens/TermsAndConditions.qml b/ui/app/AppLayouts/Profile/Sections/Ens/TermsAndConditions.qml
index 568c60e5b2..d9c1bdd641 100644
--- a/ui/app/AppLayouts/Profile/Sections/Ens/TermsAndConditions.qml
+++ b/ui/app/AppLayouts/Profile/Sections/Ens/TermsAndConditions.qml
@@ -138,7 +138,7 @@ Item {
text: qsTr(`Look up on Etherscan`).arg(walletModel.etherscanLink.replace("/tx", "/address")).arg(profileModel.ens.getUsernameRegistrar())
anchors.left: parent.left
anchors.right: parent.right
- onLinkActivated: Qt.openUrlExternally(link)
+ onLinkActivated: appMain.openLink(link)
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton // we don't want to eat clicks on the Text
@@ -159,7 +159,7 @@ Item {
text: qsTr(`Look up on Etherscan`).arg(walletModel.etherscanLink.replace("/tx", "/address")).arg(profileModel.ens.getENSRegistry())
anchors.left: parent.left
anchors.right: parent.right
- onLinkActivated: Qt.openUrlExternally(link)
+ onLinkActivated: appMain.openLink(link)
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton // we don't want to eat clicks on the Text
diff --git a/ui/app/AppLayouts/Profile/Sections/HelpContainer.qml b/ui/app/AppLayouts/Profile/Sections/HelpContainer.qml
index a3dcba9b5f..f6288b3802 100644
--- a/ui/app/AppLayouts/Profile/Sections/HelpContainer.qml
+++ b/ui/app/AppLayouts/Profile/Sections/HelpContainer.qml
@@ -135,49 +135,40 @@ Item {
StyledText {
id: faqLink
- //% "Frequently asked questions"
- text: qsTrId("-a-href--https---status-im-docs-faqs-html--frequently-asked-questions--a-")
+ text: `${qsTr("Frequently asked questions")}`
font.pixelSize: 15
+ onLinkActivated: appMain.openLink(link)
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
- onClicked: {
- mouse.accepted = false
- Qt.openUrlExternally("https://status.im/faq/")
- }
+ acceptedButtons: Qt.NoButton // we don't want to eat clicks on the Text
}
}
StyledText {
id: issueLink
- //% "Submit a bug"
- text: qsTrId("-a-href--https---github-com-status-im-nim-status-client-issues-new--submit-a-bug--a-")
+ text: `${qsTr("Submit a bug")}`
anchors.topMargin: Style.current.bigPadding
anchors.top: faqLink.bottom
font.pixelSize: 15
+ onLinkActivated: appMain.openLink(link)
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
- onClicked: {
- mouse.accepted = false
- Qt.openUrlExternally("https://github.com/status-im/nim-status-client/issues/new")
- }
+ acceptedButtons: Qt.NoButton // we don't want to eat clicks on the Text
}
}
StyledText {
- //% "Request a feature"
- text: qsTrId("-a-href--https---discuss-status-im-c-features-51--request-a-feature--a-")
+ text: `${qsTr("Request a feature")}`
anchors.topMargin: Style.current.bigPadding
anchors.top: issueLink.bottom
font.pixelSize: 15
+ onLinkActivated: appMain.openLink(link)
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
- onClicked: {
- mouse.accepted = false
- Qt.openUrlExternally("https://discuss.status.im/c/features/51")
- }
+ acceptedButtons: Qt.NoButton // we don't want to eat clicks on the Text
}
}
}
diff --git a/ui/app/AppLayouts/Wallet/components/collectiblesComponents/CollectiblesModal.qml b/ui/app/AppLayouts/Wallet/components/collectiblesComponents/CollectiblesModal.qml
index b196ee262f..f221c08c1a 100644
--- a/ui/app/AppLayouts/Wallet/components/collectiblesComponents/CollectiblesModal.qml
+++ b/ui/app/AppLayouts/Wallet/components/collectiblesComponents/CollectiblesModal.qml
@@ -39,7 +39,7 @@ ModalPopup {
label: popup.buttonText
anchors.top: parent.top
onClicked: {
- Qt.openUrlExternally(popup.buttonLink)
+ appMain.openLink(popup.buttonLink)
}
}
}
diff --git a/ui/app/AppMain.qml b/ui/app/AppMain.qml
index e03580ae11..9958aefe09 100644
--- a/ui/app/AppMain.qml
+++ b/ui/app/AppMain.qml
@@ -7,6 +7,7 @@ import "../shared/status"
import "./AppLayouts"
import "./AppLayouts/Timeline"
import "./AppLayouts/Wallet"
+import "./AppLayouts/Chat/components"
RowLayout {
id: appMain
@@ -27,6 +28,33 @@ RowLayout {
return profileModel.contacts.list.rowData(index, useLargeImage ? "largeImage" : "thumbnailImage")
}
+ function openPopup(popupComponent, params = {}) {
+ const popup = popupComponent.createObject(appMain, params);
+ popup.open()
+ return popup
+ }
+
+ function openLink(link) {
+ if (appSettings.showBrowserSelector) {
+ appMain.openPopup(chooseBrowserPopupComponent, {link: link})
+ } else {
+ if (appSettings.openLinksInStatus) {
+ appMain.changeAppSection(Constants.browser)
+ browserLayoutContainer.item.openUrlInNewTab(link)
+ } else {
+ Qt.openUrlExternally(link)
+ }
+ }
+ }
+
+ Component {
+ id: chooseBrowserPopupComponent
+ ChooseBrowserPopup {
+ onClosed: {
+ destroy()
+ }
+ }
+ }
ToastMessage {
id: toastMessage
diff --git a/ui/app/img/chooseBrowserImage.png b/ui/app/img/chooseBrowserImage.png
new file mode 100644
index 0000000000..58476a6ab9
Binary files /dev/null and b/ui/app/img/chooseBrowserImage.png differ
diff --git a/ui/main.qml b/ui/main.qml
index a20e7eb3bb..3fe68c9631 100644
--- a/ui/main.qml
+++ b/ui/main.qml
@@ -114,6 +114,8 @@ ApplicationWindow {
property int fontSize: Constants.fontSizeM
// Browser settings
+ property bool showBrowserSelector: true
+ property bool openLinksInStatus: true
property bool showFavoritesBar: false
property bool autoLoadImages: true
property bool javaScriptEnabled: true
@@ -153,6 +155,8 @@ ApplicationWindow {
property bool hideSignPhraseModal: defaultAppSettings.hideSignPhraseModal
// Browser settings
+ property bool showBrowserSelector: defaultAppSettings.showBrowserSelector
+ property bool openLinksInStatus: defaultAppSettings.openLinksInStatus
property bool showFavoritesBar: defaultAppSettings.showFavoritesBar
property bool autoLoadImages: defaultAppSettings.autoLoadImages
property bool javaScriptEnabled: defaultAppSettings.javaScriptEnabled
diff --git a/ui/nim-status-client.pro b/ui/nim-status-client.pro
index d86f73827b..47e7508256 100644
--- a/ui/nim-status-client.pro
+++ b/ui/nim-status-client.pro
@@ -168,6 +168,7 @@ DISTFILES += \
app/AppLayouts/Chat/ChatColumn/MessageComponents/qmldir \
app/AppLayouts/Chat/ContactsColumn/AddChat.qml \
app/AppLayouts/Chat/ContactsColumn/ClosedEmptyView.qml \
+ app/AppLayouts/Chat/components/ChooseBrowserPopup.qml \
app/AppLayouts/Chat/components/EmojiCategoryButton.qml \
app/AppLayouts/Chat/components/EmojiPopup.qml \
app/AppLayouts/Chat/components/EmojiReaction.qml \
diff --git a/ui/shared/ToastMessage.qml b/ui/shared/ToastMessage.qml
index 549bf29911..c44dcfa419 100644
--- a/ui/shared/ToastMessage.qml
+++ b/ui/shared/ToastMessage.qml
@@ -99,7 +99,7 @@ Popup {
font.weight: Font.Medium
anchors.leftMargin: 12
onLinkActivated: {
- Qt.openUrlExternally(root.link)
+ appMain.openLink(root.link)
root.close()
}
}
diff --git a/ui/shared/status/StatusCheckBox.qml b/ui/shared/status/StatusCheckBox.qml
index 10b21c991a..0a0448c480 100644
--- a/ui/shared/status/StatusCheckBox.qml
+++ b/ui/shared/status/StatusCheckBox.qml
@@ -28,6 +28,8 @@ CheckBox {
text: control.text
opacity: enabled ? 1.0 : 0.3
verticalAlignment: Text.AlignVCenter
+ wrapMode: Text.WordWrap
+ width: parent.width
leftPadding: !!control.text ? control.indicator.width + control.spacing : control.indicator.width
}
}