Add EnterKey action when adding an article
parent
1854aeae1b
commit
c5c6630b8a
|
@ -64,6 +64,23 @@ Page {
|
||||||
hideErrorWidgetTimer.start()
|
hideErrorWidgetTimer.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function doAddArticle( url ) {
|
||||||
|
articlesModel.loaded = false
|
||||||
|
serverPage.server.uploadArticle(
|
||||||
|
addArticleUrl.text,
|
||||||
|
function( success ) {
|
||||||
|
if ( success ) {
|
||||||
|
addArticleUrl.text = ""
|
||||||
|
hideAddArticleContainer.start()
|
||||||
|
serverPage.updateArticlesList()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
articlesModel.loaded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
updateArticlesList()
|
updateArticlesList()
|
||||||
}
|
}
|
||||||
|
@ -134,7 +151,7 @@ Page {
|
||||||
id: busyContainer
|
id: busyContainer
|
||||||
visible: !articlesModel.loaded
|
visible: !articlesModel.loaded
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
z: 5
|
z: 10
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -204,6 +221,7 @@ Page {
|
||||||
anchors.topMargin: Theme.horizontalPageMargin
|
anchors.topMargin: Theme.horizontalPageMargin
|
||||||
placeholderText: qsTr( "Article URL" )
|
placeholderText: qsTr( "Article URL" )
|
||||||
inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhUrlCharactersOnly
|
inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhUrlCharactersOnly
|
||||||
|
EnterKey.onClicked: doAddArticle( addArticleUrl.text )
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
|
@ -226,18 +244,7 @@ Page {
|
||||||
IconButton {
|
IconButton {
|
||||||
id: addArticleConfirm
|
id: addArticleConfirm
|
||||||
icon.source: "image://theme/icon-m-acknowledge"
|
icon.source: "image://theme/icon-m-acknowledge"
|
||||||
|
onClicked: doAddArticle( addArticleUrl.text )
|
||||||
onClicked: {
|
|
||||||
serverPage.server.uploadArticle(
|
|
||||||
addArticleUrl.text,
|
|
||||||
function( success ) {
|
|
||||||
if ( success ) {
|
|
||||||
addArticleUrl.text = ""
|
|
||||||
hideAddArticleContainer.start()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue