main.qml 3.24 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*
    Copyright (C) 2018 Volker Krause <vkrause@kde.org>

    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU Library General Public License as published by
    the Free Software Foundation; either version 2 of the License, or (at your
    option) any later version.

    This program is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
    License for more details.

    You should have received a copy of the GNU General Public License
15
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
16 17 18 19 20 21 22 23 24
*/

import QtQuick 2.5
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.1 as QQC2
import org.kde.kirigami 2.0 as Kirigami
import "." as App

Kirigami.ApplicationWindow {
Volker Krause's avatar
Volker Krause committed
25
    title: i18n("KDE Itinerary")
Volker Krause's avatar
Volker Krause committed
26
    reachableModeEnabled: false
27 28 29 30

    width: 480
    height: 720

31 32
    App.ImportDialog {
        id: importDialog
33 34 35
    }

    globalDrawer: Kirigami.GlobalDrawer {
Volker Krause's avatar
Volker Krause committed
36
        title: i18n("KDE Itinerary")
37 38
        titleIcon: "map-symbolic"
        actions: [
39
            Kirigami.Action {
Volker Krause's avatar
Volker Krause committed
40
                text: i18n("Import...")
41
                iconName: "document-open"
42
                onTriggered: importDialog.importReservation()
43
            },
44 45 46
            Kirigami.Action {
                text: i18n("Paste")
                iconName: "edit-paste"
47
                onTriggered: _appController.importFromClipboard()
48 49
                enabled: _appController.hasClipboardContent
            },
50 51 52 53 54 55
            Kirigami.Action {
                text: i18n("Check Calendar")
                iconName: "view-calendar-day"
                onTriggered: _appController.checkCalendar()
                visible: Qt.platform.os == "android"
            },
56
            Kirigami.Action {
Volker Krause's avatar
Volker Krause committed
57
                text: i18n("Check for Updates")
58 59
                iconName: "view-refresh"
                onTriggered: {
60
                    _liveDataManager.checkForUpdates();
61
                }
Volker Krause's avatar
Volker Krause committed
62 63
            },
            Kirigami.Action {
64
                id: settingsAction
Volker Krause's avatar
Volker Krause committed
65
                text: i18n("Settings...")
Volker Krause's avatar
Volker Krause committed
66 67
                iconName: "settings-configure"
                onTriggered: pageStack.push(settingsComponent)
Volker Krause's avatar
Volker Krause committed
68 69 70 71 72 73
            },
            Kirigami.Action {
                id: aboutAction
                text: i18n("About")
                iconName: "help-about"
                onTriggered: pageStack.push(aboutComponent)
74 75 76 77 78 79 80
            }
        ]
    }
    contextDrawer: Kirigami.ContextDrawer {
        id: contextDrawer
    }
    pageStack.initialPage: mainPageComponent
81

82 83
    Component {
        id: mainPageComponent
84
        App.TimelinePage {}
85
    }
Volker Krause's avatar
Volker Krause committed
86 87
    Component {
        id: settingsComponent
88 89 90 91 92 93 94 95
        App.SettingsPage {
            id: settingsPage
            Binding {
                target: settingsAction
                property: "enabled"
                value: !settingsPage.isCurrentPage
            }
        }
Volker Krause's avatar
Volker Krause committed
96
    }
Volker Krause's avatar
Volker Krause committed
97 98 99 100 101 102 103 104 105 106 107
    Component {
        id: aboutComponent
        App.AboutPage {
            id: aboutPage
            Binding {
                target: aboutAction
                property: "enabled"
                value: !aboutPage.isCurrentPage
            }
        }
    }
108
}