// SPDX-FileCopyrightText: 2020 Jonah BrĂ¼chert // // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL import QtQuick import org.kde.kirigami as Kirigami import QtQuick.Controls as Controls import org.kde.spacebar as Spacebar Kirigami.ApplicationWindow { id: root contextDrawer: Kirigami.ContextDrawer { id: contextDrawer } pageStack { initialPage: "qrc:/ChatsPage.qml" globalToolBar { canContainHandles: true style: Kirigami.ApplicationHeaderStyle.ToolBar showNavigationButtons: Kirigami.ApplicationHeaderStyle.ShowBackButton } } // pop pages when not in use Connections { target: applicationWindow().pageStack function onCurrentIndexChanged() { // wait for animation to finish before popping pages popPageTimer.restart(); } } Timer { id: popPageTimer interval: 300 onTriggered: { let currentIndex = applicationWindow().pageStack.currentIndex; while (applicationWindow().pageStack.depth > (currentIndex + 1) && currentIndex >= 0) { applicationWindow().pageStack.pop(); } } } }