set valid url for homeserver

fixes https://todo.sr.ht/~thrrgilag/pantalaimon-ut/3
This commit is contained in:
Morgan McMillian 2020-08-09 16:01:00 -07:00
parent 763fbf8e4f
commit b1f5450f58
4 changed files with 15 additions and 8 deletions

View file

@ -48,7 +48,7 @@ install(DIRECTORY src DESTINATION ${DATA_DIR})
install(DIRECTORY qml DESTINATION ${DATA_DIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/AboutPage.qml DESTINATION ${DATA_DIR}qml/)
# example config file for local testing
# TODO: example config file for local testing
# install(FILES example.conf DESTINATION ${CMAKE_INSTALL_PREFIX} RENAME pantalaimon.conf)
# Translations

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: pantalaimon.thrrgilag\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-09 20:24+0000\n"
"POT-Creation-Date: 2020-08-09 22:57+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -25,15 +25,15 @@ msgstr ""
msgid "Save"
msgstr ""
#: ../qml/Components/EditServerPage.qml:83
#: ../qml/Components/EditServerPage.qml:89
msgid "Description:"
msgstr ""
#: ../qml/Components/EditServerPage.qml:103
msgid "Homeserver:"
#: ../qml/Components/EditServerPage.qml:109
msgid "Homeserver URL:"
msgstr ""
#: ../qml/Components/EditServerPage.qml:124
#: ../qml/Components/EditServerPage.qml:131
msgid "Listen on 127.0.0.1:"
msgstr ""

View file

@ -23,6 +23,12 @@ Page {
iconName: 'ok'
text: i18n.tr('Save')
onTriggered: {
if (homeserver.text.length == 0) {
homeserver.text = "https://matrix.org"
}
if (!/^https?:\/\//i.test(homeserver.text)) {
homeserver.text = "https://" + homeserver.text
}
var data = {
name: instance.text,
homeserver: homeserver.text,
@ -85,7 +91,7 @@ Page {
TextField {
id: instance
text: ""
text: "my-homeserver"
anchors.verticalCenter: parent.verticalCenter
Layout.fillWidth: true
}
@ -100,12 +106,13 @@ Page {
Label {
anchors.verticalCenter: parent.verticalCenter
text: i18n.tr('Homeserver:')
text: i18n.tr('Homeserver URL:')
}
TextField {
id: homeserver
text: ""
placeholderText: "https://matrix.org"
anchors.verticalCenter: parent.verticalCenter
Layout.fillWidth: true
inputMethodHints: Qt.ImhUrlCharactersOnly

Binary file not shown.