2import Lomiri.Components 1.3
3import QtQuick.Controls.Suru 2.2
5import Lomiri.Components.ListItems 1.0 as CanWeStillUseThis
6import Dekko.Mail.API 1.0
7import Dekko.Mail.Stores.Accounts 1.0
8import Dekko.Mail.Stores.Settings 1.0
10import Dekko.Lomiri.Components 1.0
14 property bool newIdentity: false
18 type: SettingsKeys.saveCurrentGroup
20 if (SettingsStore.saveGroupDisabled) {
23 SettingsStore.tempIsNew = input.newIdentity
24 SettingsStore.tempIdentity = input.toMap()
29 type: SettingsKeys.saveIdentity
32 AccountActions.addIdentity(input.toMap())
34 AccountActions.updateIdentity(input.toMap())
43 map["id"] = SettingsStore.tempIdentity.id
45 map[
"parentId"] = accountSelector.selectedAccount
46 map[
"name"] = name.text
47 map[
"email"] = email.text
48 map[
"replyTo"] = replyTo.text
49 map[
"signature"] = signature.text
54 readonly
property bool isDefault: SettingsStore.tempIdentity.id === AccountStore.identities.defaultIdentity
55 text: qsTr(
"Default identity")
56 visible: !input.newIdentity
60 AccountStore.identities.defaultIdentity = SettingsStore.tempIdentity.id
61 }
else if (isDefault) {
62 AccountStore.identities.defaultIdentity = -1
69 color: Suru.secondaryForegroundColor
72 CanWeStillUseThis.ItemSelector {
74 property int setIdx: 0
75 property int selectedAccount
76 property Timer setIndexTimer: Timer {
79 onTriggered: accountSelector.selectedIndex = accountSelector.setIdx
81 model: AccountStore.enabledAccountsModel
82 delegate: OptionSelectorDelegate {
84 property bool isSelected: accountSelector.selectedIndex === model.index
85 property var account: model.qtObject
88 target: accountSelector
89 property:
"selectedAccount"
90 value: delegate.account.id
91 when: delegate.isSelected
93 Component.onCompleted: {
94 if (!input.newIdentity || SettingsStore.tempIsNew) {
95 if (SettingsStore.tempIdentity.parentId === account.id) {
96 accountSelector.setIdx = model.index
97 accountSelector.setIndexTimer.start()
111 title: qsTr(
"Email Address")
116 title: qsTr(
"Reply-To")
120 text: qsTr(
"Signature")
121 color: Suru.secondaryForegroundColor
135 when: input.newIdentity && !SettingsStore.tempIsNew
138 title: qsTr(
"New identity")
142 name:
"new-continued"
143 when: input.newIdentity && SettingsStore.tempIsNew
146 title: qsTr(
"New identity")
150 text: SettingsStore.tempIdentity.name
154 text: SettingsStore.tempIdentity.email
158 text: SettingsStore.tempIdentity.replyTo
162 text: SettingsStore.tempIdentity.signature
167 when: !input.newIdentity
170 title: qsTr(
"Edit identity")
174 text: SettingsStore.tempIdentity.name
178 text: SettingsStore.tempIdentity.email
182 text: SettingsStore.tempIdentity.replyTo
186 text: SettingsStore.tempIdentity.signature