EditorDrawer.qml 4.75 KB
Newer Older
1 2 3
/*
 *  Copyright 2018  Andreas Cord-Landwehr <cordlandwehr@kde.org>
 *
4
 *  SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
 */

import QtQuick 2.5
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.0 as QQC2
import org.kde.kirigami 2.7 as Kirigami
import artikulate 1.0

Kirigami.GlobalDrawer {
    id: root

    title: "Editor"
    titleIcon: "artikulate"
    resetMenuOnTriggered: false
    bottomPadding: 0
    property QtObject pageStack

    // enforce drawer always to be open
    modal: false
    handleVisible: false

    topContent: [
        ColumnLayout {
            spacing: 0
            Layout.fillWidth: true
            Layout.leftMargin: -root.leftPadding
            Layout.rightMargin: -root.rightPadding
            ActionListItem {
                action: Kirigami.Action {
                    text: i18n("Courses")
                    iconName: "artikulate"
                    onTriggered: {
                        root.pageStack.clear();
38 39
                        root.pageStack.push(editorCourseSelectionPage);
                        root.pageStack.push(editorSkeletonSelectionPage);
40 41 42 43 44 45
                    }
                }
            }
            ActionListItem {
                action: Kirigami.Action {
                    text: i18n("Repository")
46
                    iconName: "folder-sync"
47 48 49 50 51 52 53 54 55
                    onTriggered: {
                        root.pageStack.clear();
                        root.pageStack.push(repositoryPageComponent);
                    }
                }
            }
            Kirigami.Separator {
                Layout.fillWidth: true
            }
56 57 58 59 60 61 62 63 64 65 66
            ActionListItem {
                action: Kirigami.Action {
                    text: i18n("Course Configuration")
                    iconName: "document-properties"
                    enabled: g_editorSession.course !== null
                    onTriggered: {
                        root.pageStack.clear();
                        root.pageStack.push(courseConfigurationPageComponent);
                    }
                }
            }
67 68 69 70 71 72 73 74
        }
    ]

    // ordinary Kirigami actions are filled from training units/phrases
    actions: trainingActions.actions
    DrawerTrainingActions {
        id: trainingActions
        session: g_editorSession
75
        onTriggerPhraseView: {
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
            root.pageStack.clear();
            root.pageStack.push(editCoursePageComponent);
        }
    }

//TODO integrate again
//     [
//         Kirigami.Action {
//             text: i18n("Help")
//             iconName: "help-about"
//             Kirigami.Action {
//                 text: i18n("Artikulate Handbook")
//                 iconName: "help-contents"
//                 onTriggered: {
//                     triggerAction("help_contents");
//                     globalDrawer.resetMenu();
//                 }
//             }
//             Kirigami.Action {
//                 text: i18n("Report Bug")
//                 iconName: "tools-report-bug"
//                 onTriggered: {
//                     triggerAction("help_report_bug");
//                     globalDrawer.resetMenu();
//                 }
//             }
//             Kirigami.Action {
//                 text: i18n("About KDE")
//                 iconName: "help-about"
//                 onTriggered: {
//                     triggerAction("help_about_kde")
//                     globalDrawer.resetMenu();
//                 }
//             }
//         }
//     ]

    ColumnLayout {
        spacing: 0
        Layout.fillWidth: true
        Layout.leftMargin: -root.leftPadding
        Layout.rightMargin: -root.rightPadding

119 120 121 122 123 124 125 126 127 128 129
        ActionListItem {
            action: Kirigami.Action {
                text: i18n("Save")
                iconName: "document-save"
                enabled: g_editorSession.course !== null
                onTriggered: {
                    g_editorSession.course.sync()
                }
            }
        }

130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
        Kirigami.Separator {
            Layout.fillWidth: true
        }

//TODO planned but not implemented
//        ActionListItem {
//            action: Kirigami.Action {
//                text: i18n("Upload Training")
//                iconName: "get-hot-new-stuff"
//                onTriggered: {
//                    root.pageStack.pop();
//                    root.pageStack.push(downloadPageComponent);
//                }
//            }
//        }
        ActionListItem {
            action: Kirigami.Action {
Nicolas Fella's avatar
Nicolas Fella committed
147
                text: i18n("About Artikulate Editor")
148 149
                iconName: "help-about"
                onTriggered: {
Nicolas Fella's avatar
Nicolas Fella committed
150 151 152
                    if (root.pageStack.layers.depth < 2) {
                        root.pageStack.layers.push(aboutPageComponent)
                    }
153 154 155 156 157
                }
            }
        }
    }
}