Fix qml warnings in login module
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.kirigamiaddons.formcard as FormCard
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.kirigamiaddons.formcard as FormCard
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.kirigamiaddons.formcard as FormCard
|
||||
|
||||
|
||||
@@ -39,11 +39,11 @@ LoginStep {
|
||||
text: LoginHelper.isLoggedIn ? i18n("Already logged in") : (LoginHelper.testing && matrixIdField.acceptableInput) ? i18n("Loading…") : i18nc("@action:button", "Continue")
|
||||
onTriggered: {
|
||||
if (LoginHelper.supportsSso && LoginHelper.supportsPassword) {
|
||||
processed("LoginMethod");
|
||||
root.processed("LoginMethod");
|
||||
} else if (LoginHelper.supportsSso) {
|
||||
processed("Sso");
|
||||
root.processed("Sso");
|
||||
} else {
|
||||
processed("Password");
|
||||
root.processed("Password");
|
||||
}
|
||||
}
|
||||
enabled: LoginHelper.homeserverReachable
|
||||
|
||||
@@ -18,12 +18,12 @@ LoginStep {
|
||||
FormCard.FormButtonDelegate {
|
||||
id: loginPasswordButton
|
||||
text: i18nc("@action:button", "Login with password")
|
||||
onClicked: processed("Password")
|
||||
onClicked: root.processed("Password")
|
||||
}
|
||||
|
||||
FormCard.FormButtonDelegate {
|
||||
id: loginSsoButton
|
||||
text: i18nc("@action:button", "Login with single sign-on")
|
||||
onClicked: processed("Sso")
|
||||
onClicked: root.processed("Sso")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.kirigamiaddons.formcard as FormCard
|
||||
@@ -15,7 +14,7 @@ LoginStep {
|
||||
Connections {
|
||||
target: LoginHelper
|
||||
function onConnected() {
|
||||
processed("Loading");
|
||||
root.processed("Loading");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +45,6 @@ LoginStep {
|
||||
}
|
||||
}
|
||||
previousAction: Kirigami.Action {
|
||||
onTriggered: processed("Login")
|
||||
onTriggered: root.processed("Login")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.kirigamiaddons.formcard as FormCard
|
||||
@@ -22,7 +21,7 @@ LoginStep {
|
||||
UrlHelper.openUrl(LoginHelper.ssoUrl);
|
||||
}
|
||||
function onConnected() {
|
||||
processed("Loading");
|
||||
root.processed("Loading");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +30,7 @@ LoginStep {
|
||||
}
|
||||
|
||||
previousAction: Kirigami.Action {
|
||||
onTriggered: processed("Login")
|
||||
onTriggered: root.processed("Login")
|
||||
}
|
||||
|
||||
nextAction: Kirigami.Action {
|
||||
|
||||
@@ -22,8 +22,11 @@ LoginStep {
|
||||
Repeater {
|
||||
model: Registration.terms
|
||||
delegate: FormCard.FormTextDelegate {
|
||||
text: "<a href=\"" + modelData.url + "\">" + modelData.title + "</a>"
|
||||
onLinkActivated: Qt.openUrlExternally(modelData.url)
|
||||
required property string url
|
||||
required property string title
|
||||
|
||||
text: "<a href=\"" + url + "\">" + title + "</a>"
|
||||
onLinkActivated: Qt.openUrlExternally(url)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// SPDX-FileCopyrightText: 2020 Tobias Fella <tobias.fella@kde.org>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
@@ -121,6 +123,8 @@ Kirigami.Page {
|
||||
delegate: FormCard.AbstractFormDelegate {
|
||||
id: loadingDelegate
|
||||
|
||||
required property string modelData
|
||||
|
||||
topPadding: Kirigami.Units.smallSpacing
|
||||
bottomPadding: Kirigami.Units.smallSpacing
|
||||
|
||||
@@ -130,7 +134,7 @@ Kirigami.Page {
|
||||
|
||||
QQC2.Label {
|
||||
Layout.fillWidth: true
|
||||
text: i18nc("As in 'this account is still loading'", "%1 (loading)", modelData)
|
||||
text: i18nc("As in 'this account is still loading'", "%1 (loading)", loadingDelegate.modelData)
|
||||
elide: Text.ElideRight
|
||||
wrapMode: Text.Wrap
|
||||
maximumLineCount: 2
|
||||
@@ -141,7 +145,7 @@ Kirigami.Page {
|
||||
QQC2.ToolButton {
|
||||
text: i18nc("@action:button", "Log out of this account")
|
||||
icon.name: "im-kick-user"
|
||||
onClicked: Controller.removeConnection(modelData)
|
||||
onClicked: Controller.removeConnection(loadingDelegate.modelData)
|
||||
display: QQC2.Button.IconOnly
|
||||
QQC2.ToolTip.text: text
|
||||
QQC2.ToolTip.visible: hovered
|
||||
@@ -159,7 +163,7 @@ Kirigami.Page {
|
||||
}
|
||||
}
|
||||
onCountChanged: {
|
||||
if (loadingAccounts.count === 0 && loadedAccounts.count === 1 && showExisting) {
|
||||
if (loadingAccounts.count === 0 && loadedAccounts.count === 1 && root.showExisting) {
|
||||
Controller.activeConnection = AccountRegistry.data(AccountRegistry.index(0, 0), 257);
|
||||
root.connectionChosen();
|
||||
}
|
||||
@@ -181,15 +185,15 @@ Kirigami.Page {
|
||||
|
||||
Connections {
|
||||
id: stepConnections
|
||||
target: currentStep
|
||||
target: root.currentStep
|
||||
|
||||
function onProcessed(nextStep: string): void {
|
||||
module.source = nextStep + ".qml";
|
||||
root.currentStepString = nextStep;
|
||||
headerMessage.text = "";
|
||||
headerMessage.visible = false;
|
||||
if (!module.item.noControls) {
|
||||
module.item.forceActiveFocus();
|
||||
if (!(root.currentStep as LoginStep).noControls) {
|
||||
(root.currentStep as LoginStep).forceActiveFocus();
|
||||
} else {
|
||||
continueButton.forceActiveFocus();
|
||||
}
|
||||
@@ -242,24 +246,24 @@ Kirigami.Page {
|
||||
|
||||
FormCard.FormDelegateSeparator {
|
||||
below: continueButton
|
||||
visible: root.currentStep.nextAction
|
||||
visible: (root.currentStep as LoginStep).nextAction
|
||||
}
|
||||
|
||||
FormCard.FormButtonDelegate {
|
||||
id: continueButton
|
||||
text: root.currentStep.nextAction && root.currentStep.nextAction.text ? root.currentStep.nextAction.text : i18nc("@action:button", "Continue")
|
||||
visible: root.currentStep.nextAction
|
||||
onClicked: root.currentStep.nextAction.trigger()
|
||||
text: (root.currentStep as LoginStep).nextAction && (root.currentStep as LoginStep).nextAction.text ? (root.currentStep as LoginStep).nextAction.text : i18nc("@action:button", "Continue")
|
||||
visible: (root.currentStep as LoginStep).nextAction
|
||||
onClicked: (root.currentStep as LoginStep).nextAction.trigger()
|
||||
icon.name: "arrow-right-symbolic"
|
||||
enabled: root.currentStep.nextAction ? root.currentStep.nextAction.enabled : false
|
||||
enabled: (root.currentStep as LoginStep).nextAction ? (root.currentStep as LoginStep).nextAction.enabled : false
|
||||
}
|
||||
|
||||
FormCard.FormButtonDelegate {
|
||||
text: i18nc("@action:button", "Go back")
|
||||
visible: root.currentStep.previousAction
|
||||
onClicked: root.currentStep.previousAction.trigger()
|
||||
visible: (root.currentStep as LoginStep).previousAction
|
||||
onClicked: (root.currentStep as LoginStep).previousAction.trigger()
|
||||
icon.name: "arrow-left-symbolic"
|
||||
enabled: root.currentStep.previousAction ? root.currentStep.previousAction.enabled : false
|
||||
enabled: (root.currentStep as LoginStep).previousAction ? (root.currentStep as LoginStep).previousAction.enabled : false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,7 +282,7 @@ Kirigami.Page {
|
||||
|
||||
Component.onCompleted: {
|
||||
LoginHelper.init();
|
||||
module.item.forceActiveFocus();
|
||||
(root.currentStep as LoginStep).forceActiveFocus();
|
||||
Registration.username = "";
|
||||
Registration.password = "";
|
||||
Registration.email = "";
|
||||
|
||||
Reference in New Issue
Block a user