Warning, /network/neochat/src/qml/GlobalMenu.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2021 Carson Black <uhhadd@gmail.com> 0002 // SPDX-License-Identifier: GPL-3.0-or-later 0003 0004 import Qt.labs.platform as Labs 0005 0006 import QtQuick 0007 import QtQuick.Window 0008 import QtQuick.Layouts 0009 0010 import org.kde.neochat 0011 import org.kde.neochat.config 0012 import org.kde.neochat.accounts 0013 0014 Labs.MenuBar { 0015 id: root 0016 0017 required property NeoChatConnection connection 0018 0019 Labs.Menu { 0020 title: i18nc("menu", "NeoChat") 0021 0022 // TODO: make about page its own thing so we can go to it instead of settings where it's currently at 0023 // Labs.MenuItem { 0024 // text: i18nc("menu", "About NeoChat") 0025 // } 0026 Labs.MenuItem { 0027 enabled: pageStack.layers.currentItem.title !== i18n("Configure NeoChat...") 0028 text: i18nc("menu", "Configure NeoChat...") 0029 0030 shortcut: StandardKey.Preferences 0031 onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", { 0032 connection: root.connection 0033 }, { 0034 title: i18n("Configure") 0035 }) 0036 } 0037 Labs.MenuItem { 0038 text: i18nc("menu", "Quit NeoChat") 0039 0040 shortcut: StandardKey.Quit 0041 onTriggered: Qt.quit() 0042 } 0043 } 0044 Labs.Menu { 0045 title: i18nc("menu", "File") 0046 0047 Labs.MenuItem { 0048 text: i18nc("menu", "Find your friends") 0049 enabled: pageStack.layers.currentItem.title !== i18n("Find your friends") && AccountRegistry.accountCount > 0 0050 onTriggered: pushReplaceLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", { 0051 connection: root.connection 0052 }, { 0053 title: i18nc("@title", "Find your friends") 0054 }) 0055 } 0056 Labs.MenuItem { 0057 text: i18nc("menu", "New Group…") 0058 enabled: pageStack.layers.currentItem.title !== i18n("Find your friends") && AccountRegistry.accountCount > 0 0059 shortcut: StandardKey.New 0060 onTriggered: { 0061 const dialog = createRoomDialog.createObject(root.overlay); 0062 dialog.open(); 0063 } 0064 } 0065 Labs.MenuItem { 0066 text: i18nc("menu", "Browse Chats…") 0067 onTriggered: { 0068 let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", { 0069 connection: root.connection 0070 }, { 0071 title: i18nc("@title", "Explore Rooms") 0072 }); 0073 dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { 0074 RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join"); 0075 }); 0076 } 0077 } 0078 } 0079 EditMenu { 0080 title: i18nc("menu", "Edit") 0081 field: (root.activeFocusItem instanceof TextEdit || root.activeFocusItem instanceof TextInput) ? root.activeFocusItem : null 0082 } 0083 Labs.Menu { 0084 title: i18nc("menu", "View") 0085 0086 Labs.MenuItem { 0087 text: i18nc("menu item that opens a UI element called the 'Quick Switcher', which offers a fast keyboard-based interface for switching in between chats.", "Open Quick Switcher") 0088 shortcut: "Ctrl+K" 0089 onTriggered: quickView.item.open() 0090 } 0091 } 0092 Labs.Menu { 0093 title: i18nc("menu", "Window") 0094 0095 // Labs.MenuItem { 0096 // text: settings.userWantsSidebars ? i18nc("menu", "Hide Sidebar") : i18nc("menu", "Show Sidebar") 0097 // onTriggered: settings.userWantsSidebars = !settings.userWantsSidebars 0098 // } 0099 Labs.MenuItem { 0100 text: root.visibility === Window.FullScreen ? i18nc("menu", "Exit Full Screen") : i18nc("menu", "Enter Full Screen") 0101 onTriggered: root.visibility === Window.FullScreen ? root.showNormal() : root.showFullScreen() 0102 } 0103 } 0104 // TODO: offline help system (https://invent.kde.org/network/neochat/-/issues/411) 0105 Labs.Menu { 0106 title: i18nc("menu", "Help") 0107 0108 Labs.MenuItem { 0109 text: i18nc("menu", "Matrix FAQ") 0110 onTriggered: UrlHelper.openUrl("https://matrix.org/faq/") 0111 } 0112 } 0113 }