// SPDX-FileCopyrightText: 2024 Joshua Goins // SPDX-License-Identifier: GPL-3.0-or-later import QtQuick import QtQuick.Layouts import QtQuick.Controls as QQC2 import org.kde.kirigami as Kirigami import com.redstrate.sukai import com.redstrate.sukai.models Kirigami.ApplicationWindow { id: root pageStack.defaultColumnWidth: root.width function startupAccountCheck(): void { if (AccountManager.hasAccounts) { decideDefaultPage(); } else { pageStack.push(Qt.createComponent("qrc:/qt/qml/com/redstrate/sukai/ui/WelcomePage.qml")); } } function decideDefaultPage(): void { pageStack.clear(); pageStack.push(homeTimeline.createObject(root)); } Component.onCompleted: { if (AccountManager.isReady) { startupAccountCheck(); } } Connections { target: AccountManager function onAccountSelected(): void { root.decideDefaultPage(); } function onAccountsReady(): void { root.startupAccountCheck(); } } Connections { target: Navigation function onOpenProfile(did: string, handle: string): void { pageStack.push(Qt.createComponent("qrc:/qt/qml/com/redstrate/sukai/ui/ProfilePage.qml"), { did, handle }); } function onOpenThread(uri: string): void { pageStack.push(Qt.createComponent("qrc:/qt/qml/com/redstrate/sukai/ui/ThreadPage.qml"), { uri }); } } Component { id: homeTimeline TimelinePage { id: timelinePage model: TimelineModel { Component.onCompleted: load(AccountManager.selectedAccount) } } } }