aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlink2xt <link2xt@testrun.org>2021-08-22 11:54:45 +0000
committerlink2xt <link2xt@testrun.org>2021-08-22 11:54:45 +0000
commit7767e2843c0301bb8ee64eca324707cc93dcad09 (patch)
tree0494937b45352f68da9264aaa90db7d48074635b
parent552fb4e6b280e9b7d0f9688a1734b110ee7460b0 (diff)
downloadkdeltachat-7767e2843c0301bb8ee64eca324707cc93dcad09.tar.gz
kdeltachat-7767e2843c0301bb8ee64eca324707cc93dcad09.zip
AccountsPage: use AbstractListItem for accounts
-rw-r--r--qml/AccountsPage.qml59
1 files changed, 30 insertions, 29 deletions
diff --git a/qml/AccountsPage.qml b/qml/AccountsPage.qml
index bf39d7e..204e4f8 100644
--- a/qml/AccountsPage.qml
+++ b/qml/AccountsPage.qml
@@ -62,41 +62,42 @@ Kirigami.Page {
id: accountsListView
anchors.fill: parent
model: accountsModel
+ currentIndex: -1
- delegate: RowLayout {
+ delegate: Kirigami.AbstractListItem {
width: accountsListView.width
- Label {
- Layout.fillWidth: true
- text: model.title
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
+ onClicked: {
+ while (pageStack.depth > 1) {
+ pageStack.pop()
+ }
+ dcAccounts.selectAccount(model.number)
+ let context = dcAccounts.getSelectedAccount()
+ if (context.isConfigured()) {
+ pageStack.replace("qrc:/qml/ChatlistPage.qml", {context: context, eventEmitter: eventEmitter})
+ } else {
+ pageStack.replace("qrc:/qml/ConfigurePage.qml", {context: context, eventEmitter: eventEmitter})
+ }
+ pageStack.layers.pop()
}
- Button {
- text: "Select"
- onClicked: {
- while (pageStack.depth > 1) {
- pageStack.pop()
- }
- dcAccounts.selectAccount(model.number)
- let context = dcAccounts.getSelectedAccount()
- if (context.isConfigured()) {
- pageStack.replace("qrc:/qml/ChatlistPage.qml", {context: context, eventEmitter: eventEmitter})
- } else {
- pageStack.replace("qrc:/qml/ConfigurePage.qml", {context: context, eventEmitter: eventEmitter})
- }
- pageStack.layers.pop()
+ RowLayout {
+ Label {
+ Layout.fillWidth: true
+ text: model.title
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
}
- }
-
- Button {
- text: "Delete"
- onClicked: {
- dcAccounts.removeAccount(model.number)
- accountsModel.remove(model.index)
- }
- }
+
+ Button {
+ icon.name: "delete"
+ text: "Delete"
+ onClicked: {
+ dcAccounts.removeAccount(model.number)
+ accountsModel.remove(model.index)
+ }
+ }
+ }
}
}