Fixed an issue where accounts get deleted when the dialog is aborted
This commit is contained in:
parent
f9ee0021ef
commit
23cc868e93
6 changed files with 14 additions and 8 deletions
|
@ -6,6 +6,7 @@ Dialog {
|
|||
id: loginDialog
|
||||
|
||||
property string accountId
|
||||
property bool addingNew: false
|
||||
|
||||
ConfigurationGroup {
|
||||
id: account
|
||||
|
@ -19,7 +20,7 @@ Dialog {
|
|||
}
|
||||
|
||||
canAccept: (nameField.text.length > 0 && serverField.acceptableInput && usernameField.text.length > 0 && passwordField.text.length > 0)
|
||||
onDone: {
|
||||
onAccepted: {
|
||||
account.setValue("name", nameField.text)
|
||||
account.setValue("server", serverField.text)
|
||||
account.setValue("username", usernameField.text)
|
||||
|
@ -27,12 +28,10 @@ Dialog {
|
|||
//account.setValue("unsecureConnection", unsecureConnectionTextSwitch.checked)
|
||||
//account.setValue("unencryptedConnection", unencryptedConnectionTextSwitch.checked)
|
||||
account.sync()
|
||||
}
|
||||
onAccepted: {
|
||||
api.uuid = accountId
|
||||
}
|
||||
onRejected: {
|
||||
appSettings.removeAccount(accountId)
|
||||
if (addingNew) appSettings.removeAccount(accountId)
|
||||
}
|
||||
|
||||
SilicaFlickable {
|
||||
|
@ -45,7 +44,7 @@ Dialog {
|
|||
|
||||
DialogHeader {
|
||||
//title: qsTr("Nextcloud Login")
|
||||
acceptText: qsTr("Login")
|
||||
acceptText: addingNew ? qsTr("Login") : qsTr("Save")
|
||||
}
|
||||
|
||||
Image {
|
||||
|
|
|
@ -89,7 +89,7 @@ Page {
|
|||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
onClicked: {
|
||||
var newAccountID = appSettings.addAccount()
|
||||
var login = pageStack.replace(Qt.resolvedUrl("LoginDialog.qml"), { accountId: newAccountID })
|
||||
var login = pageStack.replace(Qt.resolvedUrl("LoginDialog.qml"), { accountId: newAccountID, addingNew: true })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
# * date Author's Name <author's email> version-release
|
||||
# - Summary of changes
|
||||
|
||||
* Thu Dec 06 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.2-2
|
||||
- Fixed an issue where accounts get deleted when the dialog is aborted
|
||||
|
||||
* Thu Dec 06 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.2-1
|
||||
- Improved account handling
|
||||
- Directly go to edit page when creating a new note
|
||||
|
|
|
@ -14,7 +14,7 @@ Name: harbour-nextcloudnotes
|
|||
%{?qtc_builddir:%define _builddir %qtc_builddir}
|
||||
Summary: Nextcloud Notes
|
||||
Version: 0.2
|
||||
Release: 1
|
||||
Release: 2
|
||||
Group: Qt/Qt
|
||||
License: LICENSE
|
||||
URL: http://example.org/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Name: harbour-nextcloudnotes
|
||||
Summary: Nextcloud Notes
|
||||
Version: 0.2
|
||||
Release: 1
|
||||
Release: 2
|
||||
# The contents of the Group field should be one of the groups listed here:
|
||||
# https://github.com/mer-tools/spectacle/blob/master/data/GROUPS
|
||||
Group: Qt/Qt
|
||||
|
|
|
@ -111,6 +111,10 @@
|
|||
<source>Password</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MITLicense</name>
|
||||
|
|
Loading…
Reference in a new issue