Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webview landscape display fixing #177

Merged
merged 3 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions examples/custompopups/CustomAlertPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import Sailfish.WebView.Popups 1.0

AlertPopupInterface {
id: popup
width: (parent.width/5)*4
height: (parent.height/5)*4

width: (parent.width / 5) * 4
height: (parent.height / 5) * 4
anchors.centerIn: parent

acceptText: "Dismiss"
Expand All @@ -24,11 +25,13 @@ AlertPopupInterface {

SilicaFlickable {
id: flickable

anchors.fill: parent
contentHeight: content.height + Theme.paddingLarge

Column {
id: content

width: parent.width - 2 * Theme.horizontalPageMargin
anchors.centerIn: parent
spacing: Theme.paddingLarge
Expand All @@ -48,6 +51,7 @@ AlertPopupInterface {
}
TextSwitch {
id: toggle

anchors.horizontalCenter: parent.horizontalCenter
height: visible ? implicitHeight : 0
visible: popup.preventDialogsVisible
Expand Down
14 changes: 9 additions & 5 deletions examples/custompopups/CustomAuthPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import Sailfish.WebView.Popups 1.0

AuthPopupInterface {
id: popup
width: (parent.width/5)*4
height: (parent.height/5)*4

width: (parent.width / 5) * 4
height: (parent.height / 5) * 4
anchors.centerIn: parent

usernameValue: username.text
Expand All @@ -28,11 +29,13 @@ AuthPopupInterface {

SilicaFlickable {
id: flickable

anchors.fill: parent
contentHeight: content.height + Theme.paddingLarge

Column {
id: content

width: parent.width - 2 * Theme.horizontalPageMargin
anchors.centerIn: parent
spacing: Theme.paddingLarge
Expand Down Expand Up @@ -87,17 +90,18 @@ AuthPopupInterface {
}

Button {
id: acceptBtn
anchors.horizontalCenter: parent.horizontalCenter
text: popup.acceptText
onClicked: { popup.accepted(); popup.visible = false }
}

Button {
id: rejectBtn
anchors.horizontalCenter: parent.horizontalCenter
text: popup.cancelText
onClicked: { popup.rejected(); popup.visible = false }
onClicked: {
popup.rejected()
popup.visible = false
}
}
}
}
Expand Down
12 changes: 9 additions & 3 deletions examples/custompopups/CustomBlockedTabPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import Sailfish.WebView.Popups 1.0

BlockedTabPopupInterface {
id: popup
width: (parent.width/5)*4
height: (parent.height/5)*4

width: (parent.width / 5) * 4
height: (parent.height / 5) * 4
anchors.centerIn: parent

rememberValue: toggle.checked
Expand All @@ -26,11 +27,13 @@ BlockedTabPopupInterface {

SilicaFlickable {
id: flickable

anchors.fill: parent
contentHeight: content.height + Theme.paddingLarge

Column {
id: content

width: parent.width - 2 * Theme.horizontalPageMargin
anchors.centerIn: parent
spacing: Theme.paddingLarge
Expand All @@ -54,7 +57,10 @@ BlockedTabPopupInterface {
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: popup.cancelText
onClicked: { popup.rejected(); popup.visible = false }
onClicked: {
popup.rejected()
popup.visible = false
}
}
}
}
Expand Down
19 changes: 14 additions & 5 deletions examples/custompopups/CustomConfirmPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import Sailfish.WebView.Popups 1.0

ConfirmPopupInterface {
id: popup
width: (parent.width/5)*4
height: (parent.height/5)*4

width: (parent.width / 5) * 4
height: (parent.height / 5) * 4
anchors.centerIn: parent

acceptText: "Confirm"
Expand All @@ -25,11 +26,13 @@ ConfirmPopupInterface {

SilicaFlickable {
id: flickable

anchors.fill: parent
contentHeight: content.height + Theme.paddingLarge

Column {
id: content

width: parent.width - 2 * Theme.horizontalPageMargin
anchors.centerIn: parent
spacing: Theme.paddingLarge
Expand All @@ -49,6 +52,7 @@ ConfirmPopupInterface {
}
TextSwitch {
id: toggle

anchors.horizontalCenter: parent.horizontalCenter
height: visible ? implicitHeight : 0
visible: popup.preventDialogsVisible
Expand All @@ -58,13 +62,18 @@ ConfirmPopupInterface {
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: popup.acceptText
onClicked: { popup.accepted(); popup.visible = false }
onClicked: {
popup.accepted()
popup.visible = false
}
}
Button {
id: rejectBtn
anchors.horizontalCenter: parent.horizontalCenter
text: popup.cancelText
onClicked: { popup.rejected(); popup.visible = false }
onClicked: {
popup.rejected()
popup.visible = false
}
}
}
}
Expand Down
19 changes: 15 additions & 4 deletions examples/custompopups/CustomLocationPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import Sailfish.WebView.Popups 1.0

LocationPopupInterface {
id: popup
width: (parent.width/5)*4
height: (parent.height/5)*4

width: (parent.width / 5) * 4
height: (parent.height / 5) * 4
anchors.centerIn: parent

acceptText: "Allow"
Expand All @@ -26,11 +27,13 @@ LocationPopupInterface {

SilicaFlickable {
id: flickable

anchors.fill: parent
contentHeight: content.height + Theme.paddingLarge

Column {
id: content

width: parent.width - 2 * Theme.horizontalPageMargin
anchors.centerIn: parent
spacing: Theme.paddingLarge
Expand All @@ -51,11 +54,13 @@ LocationPopupInterface {
}
TextSwitch {
id: remember

anchors.horizontalCenter: parent.horizontalCenter
text: "Remember for this site"
}
TextSwitch {
id: toggle

anchors.horizontalCenter: parent.horizontalCenter
height: visible ? implicitHeight : 0
visible: popup.preventDialogsVisible
Expand All @@ -65,12 +70,18 @@ LocationPopupInterface {
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: popup.acceptText
onClicked: { popup.accepted(); popup.visible = false }
onClicked: {
popup.accepted()
popup.visible = false
}
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: popup.cancelText
onClicked: { popup.rejected(); popup.visible = false }
onClicked: {
popup.rejected()
popup.visible = false
}
}
}
}
Expand Down
23 changes: 16 additions & 7 deletions examples/custompopups/CustomPasswordManagerPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import Sailfish.WebView.Popups 1.0

PasswordManagerPopupInterface {
id: popup
width: (parent.width/5)*4
height: (parent.height/5)*4

width: (parent.width / 5) * 4
height: (parent.height / 5) * 4
anchors.centerIn: parent

property string displayUser: popup.formData["displayUser"]
Expand All @@ -20,9 +21,9 @@ PasswordManagerPopupInterface {
? (displayUser.length ? ("Save password for user " + displayUser + " on " + displayHost + "?")
: ("Save password on " + displayHost + "?"))
: popup.notificationType == "password-change"
? (displayUser.length ? ("Update password for user " + displayUser + "?")
: ("Update password?"))
: "Unknown password manager request!"
? (displayUser.length ? ("Update password for user " + displayUser + "?")
: ("Update password?"))
: "Unknown password manager request!"

Rectangle {
anchors.fill: parent
Expand All @@ -31,11 +32,13 @@ PasswordManagerPopupInterface {

SilicaFlickable {
id: flickable

anchors.fill: parent
contentHeight: content.height + Theme.paddingLarge

Column {
id: content

width: parent.width - 2 * Theme.horizontalPageMargin
anchors.centerIn: parent
spacing: Theme.paddingLarge
Expand All @@ -49,12 +52,18 @@ PasswordManagerPopupInterface {
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: "Save password"
onClicked: { popup.accepted(); popup.visible = false }
onClicked: {
popup.accepted()
popup.visible = false
}
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: "Cancel"
onClicked: { popup.rejected(); popup.visible = false }
onClicked: {
popup.rejected()
popup.visible = false
}
}
}
}
Expand Down
26 changes: 20 additions & 6 deletions examples/custompopups/CustomPromptPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ PromptPopupInterface {

property bool canAccept: input.text.length > 0

width: (parent.width/5)*4
height: (parent.height/5)*4
width: (parent.width / 5) * 4
height: (parent.height / 5) * 4
anchors.centerIn: parent

acceptText: "Ok"
Expand All @@ -30,11 +30,13 @@ PromptPopupInterface {

SilicaFlickable {
id: flickable

anchors.fill: parent
contentHeight: content.height + Theme.paddingLarge

Column {
id: content

width: parent.width - 2 * Theme.horizontalPageMargin
anchors.centerIn: parent
spacing: Theme.paddingLarge
Expand All @@ -48,6 +50,7 @@ PromptPopupInterface {
}
TextField {
id: input

width: parent.width
focus: true
label: text.length > 0 ? popup.text : ""
Expand All @@ -56,27 +59,38 @@ PromptPopupInterface {
inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
EnterKey.enabled: text.length > 0
EnterKey.iconSource: "image://theme/icon-m-enter-accept"
EnterKey.onClicked: { if (popup.canAccept) { popup.accepted(); popup.visible = false } }
EnterKey.onClicked: {
if (popup.canAccept) {
popup.accepted()
popup.visible = false
}
}
}
TextSwitch {
id: toggle

anchors.horizontalCenter: parent.horizontalCenter
height: visible ? implicitHeight : 0
visible: popup.preventDialogsVisible
checked: popup.preventDialogsVisible && popup.preventDialogsPrefillValue
text: "Don't show this again"
}
Button {
id: acceptBtn
anchors.horizontalCenter: parent.horizontalCenter
enabled: popup.canAccept
text: popup.acceptText
onClicked: { popup.accepted(); popup.visible = false }
onClicked: {
popup.accepted()
popup.visible = false
}
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: popup.cancelText
onClicked: { popup.rejected(); popup.visible = false }
onClicked: {
popup.rejected()
popup.visible = false
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/custompopups/custompopups.pro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TEMPLATE=app
TARGET=custompopups
TEMPLATE = app
TARGET = custompopups
TARGETPATH = /usr/bin/
target.path = $$TARGETPATH
QT += gui qml quick
Expand Down
Loading