Cleanup and fix GlobalMenu
This commit is contained in:
@@ -5,7 +5,6 @@ import Qt.labs.platform as Labs
|
|||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Layouts
|
|
||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
|
|
||||||
@@ -16,6 +15,7 @@ Labs.MenuBar {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property NeoChatConnection connection
|
required property NeoChatConnection connection
|
||||||
|
required property Kirigami.ApplicationWindow appWindow
|
||||||
|
|
||||||
Labs.Menu {
|
Labs.Menu {
|
||||||
title: i18nc("menu", "File")
|
title: i18nc("menu", "File")
|
||||||
@@ -23,8 +23,8 @@ Labs.MenuBar {
|
|||||||
Labs.MenuItem {
|
Labs.MenuItem {
|
||||||
icon.name: "list-add-user"
|
icon.name: "list-add-user"
|
||||||
text: i18nc("@action:inmenu", "Find your Friends")
|
text: i18nc("@action:inmenu", "Find your Friends")
|
||||||
enabled: pageStack.layers.currentItem.title !== i18n("Find your friends") && AccountRegistry.accountCount > 0
|
enabled: root.connection
|
||||||
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'UserSearchPage'), {
|
onTriggered: root.appWindow.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'UserSearchPage'), {
|
||||||
connection: root.connection
|
connection: root.connection
|
||||||
}, {
|
}, {
|
||||||
title: i18nc("@title", "Find your friends")
|
title: i18nc("@title", "Find your friends")
|
||||||
@@ -33,21 +33,22 @@ Labs.MenuBar {
|
|||||||
Labs.MenuItem {
|
Labs.MenuItem {
|
||||||
icon.name: "system-users-symbolic"
|
icon.name: "system-users-symbolic"
|
||||||
text: i18nc("@action:inmenu", "Create a Room…")
|
text: i18nc("@action:inmenu", "Create a Room…")
|
||||||
enabled: pageStack.layers.currentItem.title !== i18n("Find your friends") && AccountRegistry.accountCount > 0
|
enabled: root.connection
|
||||||
shortcut: StandardKey.New
|
shortcut: StandardKey.New
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'CreateRoomDialog'), {
|
Qt.createComponent('org.kde.neochat', 'CreateRoomDialog').createObject(root.appWindow, {
|
||||||
connection: root.connection
|
connection: root.connection
|
||||||
}, {
|
}, {
|
||||||
title: i18nc("@title", "Create a Room")
|
title: i18nc("@title", "Create a Room")
|
||||||
});
|
}).open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Labs.MenuItem {
|
Labs.MenuItem {
|
||||||
icon.name: "compass-symbolic"
|
icon.name: "compass-symbolic"
|
||||||
text: i18nc("@action:inmenu", "Explore Rooms")
|
text: i18nc("@action:inmenu", "Explore Rooms")
|
||||||
|
enabled: root.connection
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
let dialog = pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ExploreRoomsPage'), {
|
let dialog = root.appWindow.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ExploreRoomsPage'), {
|
||||||
connection: root.connection
|
connection: root.connection
|
||||||
}, {
|
}, {
|
||||||
title: i18nc("@title", "Explore Rooms")
|
title: i18nc("@title", "Explore Rooms")
|
||||||
@@ -58,7 +59,6 @@ Labs.MenuBar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Labs.MenuItem {
|
Labs.MenuItem {
|
||||||
enabled: pageStack.layers.currentItem.title !== i18n("Configure NeoChat…")
|
|
||||||
text: i18nc("menu", "Configure NeoChat…")
|
text: i18nc("menu", "Configure NeoChat…")
|
||||||
|
|
||||||
shortcut: StandardKey.Preferences
|
shortcut: StandardKey.Preferences
|
||||||
@@ -77,8 +77,9 @@ Labs.MenuBar {
|
|||||||
|
|
||||||
Labs.MenuItem {
|
Labs.MenuItem {
|
||||||
icon.name: "search-symbolic"
|
icon.name: "search-symbolic"
|
||||||
|
enabled: root.connection
|
||||||
text: i18nc("@action:inmenu opens a UI element called the 'Quick Switcher', which offers a fast keyboard-based interface for switching in between chats.", "Search Rooms")
|
text: i18nc("@action:inmenu opens a UI element called the 'Quick Switcher', which offers a fast keyboard-based interface for switching in between chats.", "Search Rooms")
|
||||||
onTriggered: quickSwitcher.open()
|
onTriggered: (root.appWindow as Main).quickSwitcher.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Labs.Menu {
|
Labs.Menu {
|
||||||
@@ -86,8 +87,8 @@ Labs.MenuBar {
|
|||||||
|
|
||||||
Labs.MenuItem {
|
Labs.MenuItem {
|
||||||
icon.name: "view-fullscreen-symbolic"
|
icon.name: "view-fullscreen-symbolic"
|
||||||
text: root.visibility === Window.FullScreen ? i18nc("menu", "Exit Full Screen") : i18nc("menu", "Enter Full Screen")
|
text: root.appWindow.visibility === Window.FullScreen ? i18nc("menu", "Exit Full Screen") : i18nc("menu", "Enter Full Screen")
|
||||||
onTriggered: root.visibility === Window.FullScreen ? root.showNormal() : root.showFullScreen()
|
onTriggered: root.appWindow.visibility === Window.FullScreen ? root.appWindow.showNormal() : root.appWindow.showFullScreen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Labs.Menu {
|
Labs.Menu {
|
||||||
@@ -96,12 +97,12 @@ Labs.MenuBar {
|
|||||||
Labs.MenuItem {
|
Labs.MenuItem {
|
||||||
icon.name: "help-about-symbolic"
|
icon.name: "help-about-symbolic"
|
||||||
text: i18nc("menu", "About NeoChat")
|
text: i18nc("menu", "About NeoChat")
|
||||||
onTriggered: pageStack.pushDialogLayer(Qt.createComponent("org.kde.kirigamiaddons.formcard", "AboutPage"))
|
onTriggered: root.appWindow.pageStack.pushDialogLayer(Qt.createComponent("org.kde.kirigamiaddons.formcard", "AboutPage"))
|
||||||
}
|
}
|
||||||
Labs.MenuItem {
|
Labs.MenuItem {
|
||||||
icon.name: "kde-symbolic"
|
icon.name: "kde-symbolic"
|
||||||
text: i18nc("menu", "About KDE")
|
text: i18nc("menu", "About KDE")
|
||||||
onTriggered: pageStack.pushDialogLayer(Qt.createComponent("org.kde.kirigamiaddons.formcard", "AboutKDEPage"))
|
onTriggered: root.appWindow.pageStack.pushDialogLayer(Qt.createComponent("org.kde.kirigamiaddons.formcard", "AboutKDEPage"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,11 @@ Kirigami.ApplicationWindow {
|
|||||||
|
|
||||||
property bool initialized: false
|
property bool initialized: false
|
||||||
|
|
||||||
|
readonly property QuickSwitcher quickSwitcher: QuickSwitcher {
|
||||||
|
connection: root.connection
|
||||||
|
window: root
|
||||||
|
}
|
||||||
|
|
||||||
title: {
|
title: {
|
||||||
if (NeoChatConfig.windowTitleFocus) {
|
if (NeoChatConfig.windowTitleFocus) {
|
||||||
return activeFocusItem + " " + (activeFocusItem ? activeFocusItem.Accessible.name : "");
|
return activeFocusItem + " " + (activeFocusItem ? activeFocusItem.Accessible.name : "");
|
||||||
@@ -82,6 +87,7 @@ Kirigami.ApplicationWindow {
|
|||||||
active: Kirigami.Settings.hasPlatformMenuBar && !Kirigami.Settings.isMobile
|
active: Kirigami.Settings.hasPlatformMenuBar && !Kirigami.Settings.isMobile
|
||||||
sourceComponent: GlobalMenu {
|
sourceComponent: GlobalMenu {
|
||||||
connection: root.connection
|
connection: root.connection
|
||||||
|
appWindow: root
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,12 +95,6 @@ Kirigami.ApplicationWindow {
|
|||||||
configGroupName: "MainWindow"
|
configGroupName: "MainWindow"
|
||||||
}
|
}
|
||||||
|
|
||||||
QuickSwitcher {
|
|
||||||
id: quickSwitcher
|
|
||||||
connection: root.connection
|
|
||||||
window: root
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: RoomManager
|
target: RoomManager
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user