Auto-detect homeserver scheme://

This commit is contained in:
miruka
2020-08-19 02:14:46 -04:00
parent 2fa8b2c5f9
commit 16970d5e56
3 changed files with 43 additions and 13 deletions

View File

@@ -64,6 +64,8 @@ HBox {
accepted()
}, (type, args, error, traceback, uuid) => {
console.error(traceback)
connectTimeout.stop()
connectFuture = null
@@ -73,7 +75,7 @@ HBox {
text = qsTr("Invalid homeserver address") :
type.startsWith("Matrix") ?
text = qsTr("Error contacting server: %1").arg(type) :
text = qsTr("Connection failed: %1(%2)").arg(type).arg(args) :
py.showError(type, traceback, uuid)
@@ -130,11 +132,11 @@ HBox {
readonly property string cleanText:
text.toLowerCase().trim().replace(/\/+$/, "")
error: text && ! /https?:\/\/.+/.test(cleanText)
inputMethodHints: Qt.ImhUrlCharactersOnly
defaultText: window.getState(
box, "acceptedUserUrl", "",
)
placeholderText: "https://example.org"
placeholderText: "example.org"
Layout.fillWidth: true
Layout.fillHeight: true
@@ -202,7 +204,9 @@ HBox {
width: serverList.width
loadingIconStep: box.loadingIconStep
onClicked: {
serverField.item.field.text = model.id
serverField.item.field.text =
model.id.replace(/^https:\/\//, "")
serverField.item.apply.clicked()
}
}