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