diff --git a/kcms/notifications/package/contents/ui/SourcesPage.qml b/kcms/notifications/package/contents/ui/SourcesPage.qml --- a/kcms/notifications/package/contents/ui/SourcesPage.qml +++ b/kcms/notifications/package/contents/ui/SourcesPage.qml @@ -59,17 +59,6 @@ value: searchField.text } - // We need to manually keep track of the index as we store the sourceModel index - // and then use a proxy model to filter it. We don't get any QML change signals anywhere - // and ListView needs a currentIndex number - Connections { - target: kcm.filteredModel - onRowsRemoved: sourcesList.updateCurrentIndex() - onRowsInserted: sourcesList.updateCurrentIndex() - // TODO re-create model index if possible - onModelReset: appConfiguration.rootIndex = undefined - } - RowLayout { id: rootRow anchors.fill: parent @@ -120,26 +109,9 @@ } } - // We need to manually keep track of the index when we filter - function updateCurrentIndex() { - if (!appConfiguration.rootIndex || !appConfiguration.rootIndex.valid) { - currentIndex = -1; - return; - } - - var filteredIdx = kcm.filteredModel.mapFromSource(appConfiguration.rootIndex); - if (!filteredIdx.valid) { - currentIndex = -1; - return; - } - - currentIndex = filteredIdx.row; - } - - onCurrentIndexChanged: { + onCurrentItemChanged: { var sourceIdx = kcm.filteredModel.mapToSource(kcm.filteredModel.index(sourcesList.currentIndex, 0)); appConfiguration.rootIndex = kcm.sourcesModel.makePersistentModelIndex(sourceIdx); - sourcesList.updateCurrentIndex(); } delegate: QtControls.ItemDelegate { @@ -150,7 +122,6 @@ onClicked: { sourcesList.forceActiveFocus(); sourcesList.currentIndex = index; - sourcesList.updateCurrentIndex(); } contentItem: RowLayout { @@ -196,7 +167,6 @@ ApplicationConfiguration { id: appConfiguration anchors.fill: parent - onRootIndexChanged: sourcesList.updateCurrentIndex() visible: typeof appConfiguration.rootIndex !== "undefined" && appConfiguration.rootIndex.valid }