From 92936e7b4412b0a6a9b15fa95debb18eda00e716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Fri, 17 Jul 2020 04:06:02 +0200 Subject: [PATCH] SendLinkpage: Use plattform-style gestures instad of button Use a Dialog and DialogHeader instead of a button to make the creation of posts easier and more native. Fixes a common pitfall as described in the sailfishos documentation: https://sailfishos.org/develop/docs/silica/sailfish-application-pitfalls.html/#Using%20buttons%20instead%20of%20platform-style%20gestures --- sailfish/qml/SendLinkPage.qml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sailfish/qml/SendLinkPage.qml b/sailfish/qml/SendLinkPage.qml index df7769b6..1bef4e3e 100644 --- a/sailfish/qml/SendLinkPage.qml +++ b/sailfish/qml/SendLinkPage.qml @@ -20,9 +20,8 @@ import QtQuick 2.0 import Sailfish.Silica 1.0 import harbour.quickddit.Core 1.0 -AbstractPage { +Dialog { id: newLinkPage - title: editPost === "" ? qsTr("New Post") : qsTr("Edit Post") property string subreddit property string editPost: "" @@ -54,6 +53,11 @@ AbstractPage { } } + DialogHeader { + title: editPost === "" ? qsTr("New Post") : qsTr("Edit Post") + acceptText: editPost === "" ? qsTr("Submit") : qsTr("Save") + } + Flickable { id: flickable anchors.fill: parent @@ -124,17 +128,13 @@ AbstractPage { } } } - - Button { - text: editPost === "" ? qsTr("Submit") : qsTr("Save") - anchors.horizontalCenter: parent.horizontalCenter - enabled: (editPost != "" || linkTitle.text.length > 0) /* official limits? */ - && ((selfLinkSwitch.checked && linkDescription.text.length > 0) || (!selfLinkSwitch.checked && linkUrl.acceptableInput)) - onClicked: submit() - } } } + canAccept: (editPost != "" || linkTitle.text.length > 0) /* official limits? */ + && ((selfLinkSwitch.checked && linkDescription.text.length > 0) || (!selfLinkSwitch.checked && linkUrl.acceptableInput)) + onAccepted: submit() + AboutSubredditManager { id: aboutSubredditManager manager: quickdditManager