From 0ad2650fd4084c7c7518b80d0f2d3f1275d89f28 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 17 Apr 2018 23:13:41 +0200 Subject: Always select the first index (INBOX) in the folderlist initially. --- framework/qml/FolderListView.qml | 6 ------ framework/qml/InlineAccountSwitcher.qml | 12 ++++++++++++ framework/qml/TreeView.qml | 5 +++++ views/conversation/main.qml | 26 ++++++++++++++++++++++---- 4 files changed, 39 insertions(+), 10 deletions(-) diff --git a/framework/qml/FolderListView.qml b/framework/qml/FolderListView.qml index 221ec31c..bf1f52e5 100644 --- a/framework/qml/FolderListView.qml +++ b/framework/qml/FolderListView.qml @@ -74,10 +74,4 @@ Kube.TreeView { accountId: root.accountId } - onActivated: { - //TODO do some event compression in case of double clicks - model.fetchMore(index); - Kube.Fabric.postMessage(Kube.Messages.folderSelection, {"folder": model.data(index, Kube.FolderListModel.DomainObject), - "trash": model.data(index, Kube.FolderListModel.Trash)}); - } } diff --git a/framework/qml/InlineAccountSwitcher.qml b/framework/qml/InlineAccountSwitcher.qml index b7f69588..2af1a455 100644 --- a/framework/qml/InlineAccountSwitcher.qml +++ b/framework/qml/InlineAccountSwitcher.qml @@ -86,6 +86,18 @@ FocusScope { accountId: currentData.accountId visible: isCurrent + onVisibleChanged: { + if (visible) { + selectRootIndex() + } + } + + onActivated: { + if (visible) { + Kube.Fabric.postMessage(Kube.Messages.folderSelection, {"folder": model.data(index, Kube.FolderListModel.DomainObject), + "trash": model.data(index, Kube.FolderListModel.Trash)}); + } + } } } } diff --git a/framework/qml/TreeView.qml b/framework/qml/TreeView.qml index d7fed711..ec249eb9 100644 --- a/framework/qml/TreeView.qml +++ b/framework/qml/TreeView.qml @@ -58,6 +58,11 @@ FocusScope { activated(treeView.selection.currentIndex) } + function selectRootIndex() { + treeView.selection.setCurrentIndex(model.index(0, 0), ItemSelectionModel.ClearAndSelect) + activated(treeView.selection.currentIndex) + } + Flickable { id: flickableItem diff --git a/views/conversation/main.qml b/views/conversation/main.qml index cb42fe5c..f2d28d26 100644 --- a/views/conversation/main.qml +++ b/views/conversation/main.qml @@ -34,12 +34,18 @@ ApplicationWindow { accounts: [{ id: "account1", name: "Test Account" - }], + }, + { + id: "account2", + name: "Test Account2" + } + ], identities: [{ account: "account1", name: "Test Identity", address: "identity@example.org" - }], + } + ], resources: [{ id: "resource1", account: "account1", @@ -49,7 +55,13 @@ ApplicationWindow { id: "resource2", account: "account1", type: "mailtransport" - }], + }, + { + id: "resource3", + account: "account2", + type: "dummy" + } + ], folders: [{ id: "folder1", resource: "resource1", @@ -203,7 +215,13 @@ Bvr+rojxTJ3X+pzb2LJQwJnALL/VdIF3yHtGu2//Yfu4oxGGA0M90KiW ], }, ] - }], + }, + { + id: "folder2", + resource: "resource1", + name: "Folder 2" + } + ], } TestStore.setup(initialState) } -- cgit v1.2.3