diff --git a/src/qml/LoginPage.qml b/src/qml/LoginPage.qml
index 1c7e94e..8340a2f 100644
--- a/src/qml/LoginPage.qml
+++ b/src/qml/LoginPage.qml
@@ -1,178 +1,180 @@
/*
* Kaidan - A user-friendly XMPP client for every device!
*
* Copyright (C) 2016-2020 Kaidan developers and contributors
* (see the LICENSE file for a full list of copyright authors)
*
* Kaidan is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* In addition, as a special exception, the author of Kaidan gives
* permission to link the code of its release with the OpenSSL
* project's "OpenSSL" library (or with modified versions of it that
* use the same license as the "OpenSSL" library), and distribute the
* linked executables. You must obey the GNU General Public License in
* all respects for all of the code used other than "OpenSSL". If you
* modify this file, you may extend this exception to your version of
* the file, but you are not obligated to do so. If you do not wish to
* do so, delete this exception statement from your version.
*
* Kaidan is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Kaidan. If not, see .
*/
import QtQuick 2.7
import QtQuick.Controls 2.3 as Controls
import QtQuick.Controls.Material 2.3
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.8 as Kirigami
import im.kaidan.kaidan 1.0
+import "elements"
+
Kirigami.Page {
title: qsTr("Log in")
contextualActions: [
Kirigami.Action {
text: qsTr("Log in using a QR-Code")
icon.name: "view-barcode"
onTriggered: pageStack.layers.push(qrCodeScannerPage)
}
]
ColumnLayout {
anchors.fill: parent
Kirigami.Heading {
text: qsTr("Log in to your XMPP account")
wrapMode: Text.WordWrap
Layout.fillWidth: true
horizontalAlignment: Qt.AlignHCenter
}
ColumnLayout {
width: parent.width
Layout.fillWidth: true
// For desktop or tablet devices
Layout.alignment: Qt.AlignCenter
Layout.maximumWidth: Kirigami.Units.gridUnit * 25
// JID field
Controls.Label {
id: jidLabel
text: qsTr("Your Jabber-ID:")
}
Controls.TextField {
id: jidField
text: kaidan.jid
placeholderText: qsTr("user@example.org")
Layout.fillWidth: true
selectByMouse: true
inputMethodHints: Qt.ImhEmailCharactersOnly
}
// Password field
Controls.Label {
text: qsTr("Your Password:")
}
Controls.TextField {
id: passField
text: kaidan.password
echoMode: TextInput.Password
selectByMouse: true
Layout.fillWidth: true
}
// Connect button
- Controls.Button {
+ Button {
id: connectButton
Layout.fillWidth: true
highlighted: true
Kirigami.Theme.backgroundColor: Material.accent
state: kaidan.connectionState !== Enums.StateDisconnected ? "connecting" : ""
states: [
State {
name: "connecting"
PropertyChanges {
target: connectButton
enabled: false
}
PropertyChanges {
target: connectLabel
text: "" + qsTr("Connecting…") + ""
color: "black"
}
}
]
onClicked: {
// connect to given account data
kaidan.jid = jidField.text
kaidan.password = passField.text
kaidan.mainConnect()
}
Controls.Label {
id: connectLabel
anchors.centerIn: connectButton
text: qsTr("Connect")
color: Kirigami.Theme.highlightedTextColor
textFormat: Text.StyledText
}
}
// connect when return was pressed
Keys.onPressed: {
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
if (jidField.activeFocus)
passField.forceActiveFocus()
else
connectButton.clicked()
}
}
}
// placeholder
Item {
Layout.preferredHeight: Kirigami.Units.gridUnit * 3
}
}
function handleConnectionError() {
var error = kaidan.disconnReason
if (error === Enums.ConnAuthenticationFailed) {
passiveNotification(qsTr("Invalid username or password."))
} else if (error === Enums.ConnNotConnected) {
passiveNotification(qsTr("Cannot connect to the server. Please check your internet connection."))
} else if (error === Enums.ConnTlsNotAvailable) {
passiveNotification(qsTr("The server doesn't support secure connections."))
} else if (error === Enums.ConnTlsFailed) {
passiveNotification(qsTr("Error while trying to connect securely."))
} else if (error === Enums.ConnDnsError) {
passiveNotification(qsTr("Could not resolve the server's address. Please check your JID again."))
} else if (error === Enums.ConnConnectionRefused) {
passiveNotification(qsTr("Could not connect to the server."))
} else if (error === Enums.ConnNoSupportedAuth) {
passiveNotification(qsTr("Authentification protocol not supported by the server."))
} else {
passiveNotification(qsTr("An unknown error occured; see log for details."))
}
}
Component.onCompleted: {
kaidan.disconnReasonChanged.connect(handleConnectionError)
}
Component.onDestruction: {
kaidan.disconnReasonChanged.disconnect(handleConnectionError)
}
}
diff --git a/src/qml/elements/RosterRenameContactSheet.qml b/src/qml/elements/Button.qml
similarity index 63%
copy from src/qml/elements/RosterRenameContactSheet.qml
copy to src/qml/elements/Button.qml
index 8ce6790..9e70f15 100644
--- a/src/qml/elements/RosterRenameContactSheet.qml
+++ b/src/qml/elements/Button.qml
@@ -1,77 +1,39 @@
/*
* Kaidan - A user-friendly XMPP client for every device!
*
- * Copyright (C) 2016-2020 Kaidan developers and contributors
+ * Copyright (C) 2016-2019 Kaidan developers and contributors
* (see the LICENSE file for a full list of copyright authors)
*
* Kaidan is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* In addition, as a special exception, the author of Kaidan gives
* permission to link the code of its release with the OpenSSL
* project's "OpenSSL" library (or with modified versions of it that
* use the same license as the "OpenSSL" library), and distribute the
* linked executables. You must obey the GNU General Public License in
* all respects for all of the code used other than "OpenSSL". If you
* modify this file, you may extend this exception to your version of
* the file, but you are not obligated to do so. If you do not wish to
* do so, delete this exception statement from your version.
*
* Kaidan is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Kaidan. If not, see .
*/
-import QtQuick 2.7
-import QtQuick.Controls 2.3 as Controls
-import QtQuick.Layouts 1.3
+import QtQuick.Controls 2.4 as Controls
import org.kde.kirigami 2.8 as Kirigami
-Kirigami.OverlaySheet {
- property string jid
- property alias currentName: nickField.text
-
- ColumnLayout {
- width: 300
-
- Kirigami.Heading {
- text: qsTr("Rename contact")
- Layout.fillWidth: true
- }
-
- Controls.Label {
- text: qsTr("Edit name:")
- }
- Controls.TextField {
- id: nickField
- selectByMouse: true
- Layout.fillWidth: true
- }
-
- RowLayout {
- Layout.topMargin: 10
-
- Controls.Button {
- text: qsTr("Cancel")
- onClicked: close()
- Layout.fillWidth: true
- }
-
- Controls.Button {
- id: addButton
- text: qsTr("Rename")
- onClicked: {
- kaidan.renameContact(jid, nickField.text);
- close();
- }
- Layout.fillWidth: true
- }
- }
- }
+/**
+ * This is a button fitting mobile and desktop user interfaces.
+ */
+Controls.Button {
+ flat: Kirigami.Settings.isMobile
}
diff --git a/src/qml/elements/RosterAddContactSheet.qml b/src/qml/elements/RosterAddContactSheet.qml
index fc3c2dd..0c152c5 100644
--- a/src/qml/elements/RosterAddContactSheet.qml
+++ b/src/qml/elements/RosterAddContactSheet.qml
@@ -1,128 +1,128 @@
/*
* Kaidan - A user-friendly XMPP client for every device!
*
* Copyright (C) 2016-2020 Kaidan developers and contributors
* (see the LICENSE file for a full list of copyright authors)
*
* Kaidan is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* In addition, as a special exception, the author of Kaidan gives
* permission to link the code of its release with the OpenSSL
* project's "OpenSSL" library (or with modified versions of it that
* use the same license as the "OpenSSL" library), and distribute the
* linked executables. You must obey the GNU General Public License in
* all respects for all of the code used other than "OpenSSL". If you
* modify this file, you may extend this exception to your version of
* the file, but you are not obligated to do so. If you do not wish to
* do so, delete this exception statement from your version.
*
* Kaidan is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Kaidan. If not, see .
*/
import QtQuick 2.7
import QtQuick.Controls 2.3 as Controls
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.8 as Kirigami
Kirigami.OverlaySheet {
property string jid: ""
ColumnLayout {
Layout.fillWidth: true
Kirigami.Heading {
text: qsTr("Add new contact")
Layout.fillWidth: true
}
Controls.Label {
text: qsTr("This will also send a request to access the " +
"presence of the contact.")
textFormat: Text.PlainText
wrapMode: Text.WordWrap
Layout.fillWidth: true
bottomPadding: 10
}
Controls.Label {
text: qsTr("Jabber-ID:")
}
Controls.TextField {
id: jidField
text: jid
placeholderText: qsTr("user@example.org")
inputMethodHints: Qt.ImhEmailCharactersOnly | Qt.ImhPreferLowercase
selectByMouse: true
Layout.fillWidth: true
}
Controls.Label {
text: qsTr("Nickname:")
}
Controls.TextField {
id: nickField
selectByMouse: true
Layout.fillWidth: true
}
Controls.Label {
text: qsTr("Optional message:")
textFormat: Text.PlainText
Layout.fillWidth: true
}
Controls.TextArea {
id: msgField
Layout.fillWidth: true
Layout.minimumHeight: Kirigami.Units.gridUnit * 4
placeholderText: qsTr("Tell your chat partner who you are.")
wrapMode: Controls.TextArea.Wrap
selectByMouse: true
}
RowLayout {
Layout.topMargin: 10
- Controls.Button {
+ Button {
text: qsTr("Cancel")
onClicked: {
clearInput()
close()
}
Layout.fillWidth: true
}
- Controls.Button {
+ Button {
id: addButton
text: qsTr("Add")
enabled: {
jidField.length >= 3 && // JID needs to be at least 3 chars longs
jidField.text.includes("@") && // JID has to contain '@'
jidField.text.slice(-1) !== "@" // last character is no '@'
}
onClicked: {
kaidan.addContact(jidField.text.toLowerCase(),
nickField.text, msgField.text)
clearInput()
close()
}
Layout.fillWidth: true
}
}
}
function clearInput() {
jid = "";
jidField.text = "";
nickField.text = "";
msgField.text = "";
}
}
diff --git a/src/qml/elements/RosterRemoveContactSheet.qml b/src/qml/elements/RosterRemoveContactSheet.qml
index 10142ed..0337275 100644
--- a/src/qml/elements/RosterRemoveContactSheet.qml
+++ b/src/qml/elements/RosterRemoveContactSheet.qml
@@ -1,80 +1,80 @@
/*
* Kaidan - A user-friendly XMPP client for every device!
*
* Copyright (C) 2016-2020 Kaidan developers and contributors
* (see the LICENSE file for a full list of copyright authors)
*
* Kaidan is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* In addition, as a special exception, the author of Kaidan gives
* permission to link the code of its release with the OpenSSL
* project's "OpenSSL" library (or with modified versions of it that
* use the same license as the "OpenSSL" library), and distribute the
* linked executables. You must obey the GNU General Public License in
* all respects for all of the code used other than "OpenSSL". If you
* modify this file, you may extend this exception to your version of
* the file, but you are not obligated to do so. If you do not wish to
* do so, delete this exception statement from your version.
*
* Kaidan is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Kaidan. If not, see .
*/
import QtQuick 2.7
import QtQuick.Controls 2.3 as Controls
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.8 as Kirigami
Kirigami.OverlaySheet {
property string jid
onSheetOpenChanged: {
infoLabel.text = qsTr("Do you really want to delete the contact "
+ "%1 from your roster?").arg(jid)
}
ColumnLayout {
Kirigami.Heading {
text: qsTr("Delete contact")
Layout.fillWidth: true
}
Controls.Label {
id: infoLabel
text: ""
textFormat: Text.StyledText
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
RowLayout {
Layout.topMargin: 10
Layout.fillWidth: true
- Controls.Button {
+ Button {
text: qsTr("Cancel")
onClicked: close()
Layout.fillWidth: true
}
- Controls.Button {
+ Button {
text: qsTr("Delete")
onClicked: {
kaidan.removeContact(jid)
close()
}
Layout.fillWidth: true
}
}
}
}
diff --git a/src/qml/elements/RosterRenameContactSheet.qml b/src/qml/elements/RosterRenameContactSheet.qml
index 8ce6790..f668702 100644
--- a/src/qml/elements/RosterRenameContactSheet.qml
+++ b/src/qml/elements/RosterRenameContactSheet.qml
@@ -1,77 +1,77 @@
/*
* Kaidan - A user-friendly XMPP client for every device!
*
* Copyright (C) 2016-2020 Kaidan developers and contributors
* (see the LICENSE file for a full list of copyright authors)
*
* Kaidan is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* In addition, as a special exception, the author of Kaidan gives
* permission to link the code of its release with the OpenSSL
* project's "OpenSSL" library (or with modified versions of it that
* use the same license as the "OpenSSL" library), and distribute the
* linked executables. You must obey the GNU General Public License in
* all respects for all of the code used other than "OpenSSL". If you
* modify this file, you may extend this exception to your version of
* the file, but you are not obligated to do so. If you do not wish to
* do so, delete this exception statement from your version.
*
* Kaidan is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Kaidan. If not, see .
*/
import QtQuick 2.7
import QtQuick.Controls 2.3 as Controls
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.8 as Kirigami
Kirigami.OverlaySheet {
property string jid
property alias currentName: nickField.text
ColumnLayout {
width: 300
Kirigami.Heading {
text: qsTr("Rename contact")
Layout.fillWidth: true
}
Controls.Label {
text: qsTr("Edit name:")
}
Controls.TextField {
id: nickField
selectByMouse: true
Layout.fillWidth: true
}
RowLayout {
Layout.topMargin: 10
- Controls.Button {
+ Button {
text: qsTr("Cancel")
onClicked: close()
Layout.fillWidth: true
}
- Controls.Button {
+ Button {
id: addButton
text: qsTr("Rename")
onClicked: {
kaidan.renameContact(jid, nickField.text);
close();
}
Layout.fillWidth: true
}
}
}
}
diff --git a/src/qml/elements/SendMediaSheet.qml b/src/qml/elements/SendMediaSheet.qml
index ed4ab69..7793676 100644
--- a/src/qml/elements/SendMediaSheet.qml
+++ b/src/qml/elements/SendMediaSheet.qml
@@ -1,191 +1,191 @@
/*
* Kaidan - A user-friendly XMPP client for every device!
*
* Copyright (C) 2016-2020 Kaidan developers and contributors
* (see the LICENSE file for a full list of copyright authors)
*
* Kaidan is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* In addition, as a special exception, the author of Kaidan gives
* permission to link the code of its release with the OpenSSL
* project's "OpenSSL" library (or with modified versions of it that
* use the same license as the "OpenSSL" library), and distribute the
* linked executables. You must obey the GNU General Public License in
* all respects for all of the code used other than "OpenSSL". If you
* modify this file, you may extend this exception to your version of
* the file, but you are not obligated to do so. If you do not wish to
* do so, delete this exception statement from your version.
*
* Kaidan is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Kaidan. If not, see .
*/
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.3 as Controls
import org.kde.kirigami 2.8 as Kirigami
import im.kaidan.kaidan 1.0
import MediaUtils 0.1
Kirigami.OverlaySheet {
id: root
property string targetJid
property url source
property int sourceType
property bool newMedia: false
signal rejected()
signal accepted()
showCloseButton: false
contentItem: ColumnLayout {
// message type preview
Loader {
id: loader
enabled: (root.newMedia || root.source != '') && sourceComponent !== null
visible: enabled
sourceComponent: root.newMedia ? newMediaComponent : mediaPreviewComponent
Layout.fillHeight: item ? item.Layout.fillHeight : false
Layout.fillWidth: item ? item.Layout.fillWidth : false
Layout.preferredHeight: item ? item.Layout.preferredHeight : -1
Layout.preferredWidth: item ? item.Layout.preferredWidth : -1
Layout.minimumHeight: item ? item.Layout.minimumHeight : -1
Layout.minimumWidth: item ? item.Layout.minimumWidth : -1
Layout.maximumHeight: item ? item.Layout.maximumHeight : -1
Layout.maximumWidth: item ? item.Layout.maximumWidth : -1
Layout.alignment: item ? item.Layout.alignment : Qt.AlignCenter
Layout.margins: item ? item.Layout.margins : 0
Layout.leftMargin: item ? item.Layout.leftMargin : 0
Layout.topMargin: item ? item.Layout.topMargin : 0
Layout.rightMargin: item ? item.Layout.rightMargin : 0
Layout.bottomMargin: item ? item.Layout.bottomMargin : 0
Component {
id: newMediaComponent
NewMediaLoader {
mediaSourceType: root.sourceType
mediaSheet: root
}
}
Component {
id: mediaPreviewComponent
MediaPreviewLoader {
mediaSource: root.source
mediaSourceType: root.sourceType
mediaSheet: root
}
}
}
// TODO: - Maybe add option to change file name
// - Enabled/Disable image compression
// caption/description text field
// disabled for now; most other clients (currently) don't support this
Controls.TextField {
id: descField
visible: false
placeholderText: qsTr("Caption")
selectByMouse: true
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.largeSpacing
}
// buttons for send/cancel
RowLayout {
Layout.topMargin: Kirigami.Units.largeSpacing
Layout.fillWidth: true
- Controls.Button {
+ Button {
text: qsTr("Cancel")
Layout.fillWidth: true
onClicked: {
close()
root.rejected()
}
}
- Controls.Button {
+ Button {
id: sendButton
enabled: root.source != ''
text: qsTr("Send")
Layout.fillWidth: true
onClicked: {
switch (root.sourceType) {
case Enums.MessageType.MessageUnknown:
case Enums.MessageType.MessageText:
break
case Enums.MessageType.MessageImage:
case Enums.MessageType.MessageAudio:
case Enums.MessageType.MessageVideo:
case Enums.MessageType.MessageFile:
case Enums.MessageType.MessageDocument:
kaidan.sendFile(root.targetJid, root.source, descField.text)
break
case Enums.MessageType.MessageGeoLocation:
kaidan.sendMessage(root.targetJid, root.source, false, '')
break
}
close()
root.accepted()
}
}
}
Keys.onPressed: {
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
sendButton.clicked()
}
}
}
onSheetOpenChanged: {
if (!sheetOpen) {
targetJid = ''
source = ''
sourceType = Enums.MessageType.MessageUnknown
newMedia = false
descField.clear()
}
}
function sendMessageType(jid, type) {
targetJid = jid
sourceType = type
open()
}
function sendNewMessageType(jid, type) {
newMedia = true
sendMessageType(jid, type)
}
function sendFile(jid, url) {
source = url
sendMessageType(jid, MediaUtilsInstance.messageType(url))
}
}
diff --git a/src/qml/elements/SubRequestAcceptSheet.qml b/src/qml/elements/SubRequestAcceptSheet.qml
index d7e2b99..8963048 100644
--- a/src/qml/elements/SubRequestAcceptSheet.qml
+++ b/src/qml/elements/SubRequestAcceptSheet.qml
@@ -1,78 +1,78 @@
/*
* Kaidan - A user-friendly XMPP client for every device!
*
* Copyright (C) 2016-2020 Kaidan developers and contributors
* (see the LICENSE file for a full list of copyright authors)
*
* Kaidan is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* In addition, as a special exception, the author of Kaidan gives
* permission to link the code of its release with the OpenSSL
* project's "OpenSSL" library (or with modified versions of it that
* use the same license as the "OpenSSL" library), and distribute the
* linked executables. You must obey the GNU General Public License in
* all respects for all of the code used other than "OpenSSL". If you
* modify this file, you may extend this exception to your version of
* the file, but you are not obligated to do so. If you do not wish to
* do so, delete this exception statement from your version.
*
* Kaidan is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Kaidan. If not, see .
*/
import QtQuick 2.7
import QtQuick.Controls 2.3 as Controls
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.8 as Kirigami
Kirigami.OverlaySheet {
property string from;
property string message;
ColumnLayout {
spacing: 10
Kirigami.Heading {
text: qsTr("Subscription Request")
Layout.fillWidth: true
}
Controls.Label {
text: qsTr("You received a subscription request by %1. " +
"If you accept it, the account will have access to your " +
"presence status.").arg(from)
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
RowLayout {
Layout.topMargin: 10
- Controls.Button {
+ Button {
Layout.fillWidth: true
text: qsTr("Decline")
onClicked: {
kaidan.subscriptionRequestAnswered(from, false)
close()
}
}
- Controls.Button {
+ Button {
Layout.fillWidth: true
text: qsTr("Accept")
onClicked: {
kaidan.subscriptionRequestAnswered(from, true)
close()
}
}
}
}
}
diff --git a/src/qml/qml.qrc b/src/qml/qml.qrc
index 18b5018..7bb7fd8 100644
--- a/src/qml/qml.qrc
+++ b/src/qml/qml.qrc
@@ -1,51 +1,52 @@
main.qml
RosterPage.qml
LoginPage.qml
ChatPageBase.qml
ChatPage.qml
EmptyChatPage.qml
AboutDialog.qml
GlobalDrawer.qml
QrCodeScannerPage.qml
UserProfilePage.qml
MultimediaSettingsPage.qml
elements/SubRequestAcceptSheet.qml
elements/RosterAddContactSheet.qml
elements/RosterRenameContactSheet.qml
elements/RosterRemoveContactSheet.qml
elements/RosterListItem.qml
elements/MessageCounter.qml
elements/ChatMessage.qml
elements/RoundedImage.qml
elements/RoundImage.qml
+ elements/Button.qml
elements/IconButton.qml
elements/FileChooser.qml
elements/FileChooserDesktop.qml
elements/FileChooserMobile.qml
elements/SendMediaSheet.qml
elements/MediaPreview.qml
elements/MediaPreviewImage.qml
elements/MediaPreviewAudio.qml
elements/MediaPreviewVideo.qml
elements/MediaPreviewOther.qml
elements/MediaPreviewLocation.qml
elements/MediaPreviewLoader.qml
elements/NewMedia.qml
elements/NewMediaLocation.qml
elements/NewMediaLoader.qml
elements/EmojiPicker.qml
elements/TextAvatar.qml
elements/Avatar.qml
settings/SettingsItem.qml
settings/SettingsPage.qml
settings/SettingsSheet.qml
settings/ChangePassword.qml
diff --git a/src/qml/settings/ChangePassword.qml b/src/qml/settings/ChangePassword.qml
index 6df69e4..59d1b19 100644
--- a/src/qml/settings/ChangePassword.qml
+++ b/src/qml/settings/ChangePassword.qml
@@ -1,160 +1,162 @@
/*
* Kaidan - A user-friendly XMPP client for every device!
*
* Copyright (C) 2016-2020 Kaidan developers and contributors
* (see the LICENSE file for a full list of copyright authors)
*
* Kaidan is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* In addition, as a special exception, the author of Kaidan gives
* permission to link the code of its release with the OpenSSL
* project's "OpenSSL" library (or with modified versions of it that
* use the same license as the "OpenSSL" library), and distribute the
* linked executables. You must obey the GNU General Public License in
* all respects for all of the code used other than "OpenSSL". If you
* modify this file, you may extend this exception to your version of
* the file, but you are not obligated to do so. If you do not wish to
* do so, delete this exception statement from your version.
*
* Kaidan is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Kaidan. If not, see .
*/
import QtQuick 2.7
import QtQuick.Controls 2.3 as Controls
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.8 as Kirigami
import im.kaidan.kaidan 1.0
+import "../elements"
+
Kirigami.Page {
topPadding: 0
Controls.BusyIndicator {
id: busyIndicator
visible: false
anchors.centerIn: parent
width: 60
height: 60
}
ColumnLayout {
id: content
anchors.fill: parent
spacing: 0
Kirigami.Heading {
Layout.alignment: Qt.Top
level: 2
text: qsTr("Change password")
}
Kirigami.FormLayout {
Layout.fillWidth: true
Controls.TextField {
id: oldPassword
echoMode: TextInput.Password
selectByMouse: true
Kirigami.FormData.label: qsTr("Current password:")
}
Controls.TextField {
id: password1
echoMode: TextInput.Password
selectByMouse: true
Kirigami.FormData.label: qsTr("New password:")
}
Controls.TextField {
id: password2
echoMode: TextInput.Password
selectByMouse: true
Kirigami.FormData.label: qsTr("New password (repeat):")
}
}
Kirigami.InlineMessage {
type: Kirigami.MessageType.Warning
visible: password1.text !== password2.text
text: qsTr("New passwords do not match.")
anchors.left: parent.left
anchors.right: parent.right
showCloseButton: true
}
Kirigami.InlineMessage {
id: currentPasswordInvalidMessage
visible: false
type: Kirigami.MessageType.Warning
text: qsTr("Current password is invalid.")
anchors.left: parent.left
anchors.right: parent.right
showCloseButton: true
}
Kirigami.InlineMessage {
visible: kaidan.connectionState !== Enums.StateConnected
type: Kirigami.MessageType.Error
text: qsTr("You need to be connected to change your password.")
anchors.left: parent.left
anchors.right: parent.right
}
Controls.Label {
Layout.fillWidth: true
text: qsTr("After changing your password, you will need to reenter "
+ "it on all your other devices.")
textFormat: Text.PlainText
wrapMode: Text.WordWrap
}
RowLayout {
Layout.fillWidth: true
Layout.alignment: Qt.AlignBottom
- Controls.Button {
+ Button {
text: qsTr("Cancel")
onClicked: stack.pop()
Layout.fillWidth: true
}
- Controls.Button {
+ Button {
text: qsTr("Change")
Layout.fillWidth: true
enabled: {
password1.text === password2.text && password1.text !== ""
&& kaidan.connectionState === Enums.StateConnected
}
onClicked: {
if (oldPassword.text !== kaidan.password) {
currentPasswordInvalidMessage.visible = true
return
}
kaidan.changePassword(password1.text)
content.visible = false
busyIndicator.visible = true
}
}
}
}
function handleChangeResult() {
busyIndicator.visible = false
stack.pop()
}
Component.onCompleted: {
kaidan.passwordChangeSucceeded.connect(handleChangeResult)
kaidan.passwordChangeFailed.connect(handleChangeResult)
}
Component.onDestruction: {
kaidan.passwordChangeSucceeded.disconnect(handleChangeResult)
kaidan.passwordChangeFailed.disconnect(handleChangeResult)
}
}