diff --git a/src/qml/ExploreComponent.qml b/src/qml/ExploreComponent.qml index 7acce17f1..84d47be5b 100644 --- a/src/qml/ExploreComponent.qml +++ b/src/qml/ExploreComponent.qml @@ -19,65 +19,6 @@ RowLayout { signal search - property Kirigami.Action exploreAction: Kirigami.Action { - text: i18n("Explore rooms") - icon.name: "compass" - onTriggered: { - let dialog = pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ExploreRoomsPage'), { - connection: root.connection - }, { - title: i18nc("@title", "Explore Rooms") - }); - dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { - RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join"); - }); - } - } - property Kirigami.Action chatAction: Kirigami.Action { - text: i18n("Find your friends") - icon.name: "list-add-user" - onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'UserSearchPage'), { - connection: root.connection - }, { - title: i18nc("@title", "Find your friends") - }) - } - property Kirigami.Action roomAction: Kirigami.Action { - text: i18n("Create a Room") - icon.name: "system-users-symbolic" - onTriggered: { - pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'CreateRoomDialog'), { - connection: root.connection - }, { - title: i18nc("@title", "Create a Room") - }); - } - shortcut: StandardKey.New - } - property Kirigami.Action spaceAction: Kirigami.Action { - text: i18n("Create a Space") - icon.name: "list-add" - onTriggered: { - pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'CreateRoomDialog'), { - connection: root.connection, - isSpace: true, - title: i18nc("@title", "Create a Space") - }, { - title: i18nc("@title", "Create a Space") - }); - } - } - - property Kirigami.Action scanAction: Kirigami.Action { - text: i18n("Scan a QR Code") - icon.name: "view-barcode-qr" - onTriggered: pageStack.pushDialogLayer(Qt.createComponent("org.kde.neochat", "QrScannerPage"), { - connection: root.connection - }, { - title: i18nc("@title", "Scan a QR Code") - }) - } - /** * @brief Emitted when the text is changed in the search field. */ @@ -119,18 +60,13 @@ RowLayout { Accessible.onPressAction: menuButton.action.trigger() display: QQC2.AbstractButton.IconOnly checkable: true - action: Kirigami.Action { + action: QQC2.Action { text: i18nc("@action:button", "Show Menu") icon.name: "application-menu-symbolic" onTriggered: { - if (Kirigami.isMobile) { - const menu = mobileMenu.createObject(); - menu.open(); - } else { - const menu = desktopMenu.createObject(menuButton); - menu.closed.connect(menuButton.toggle); - menu.open(); - } + const item = menu.createObject(menuButton); + item.closed.connect(menuButton.toggle); + item.open(); } } @@ -140,86 +76,70 @@ RowLayout { } Component { - id: desktopMenu + id: menu QQC2.Menu { - x: mirrored ? parent.width - width : 0 - y: parent ? parent.height : 0 - - modal: true - dim: false + QQC2.MenuItem { + text: i18n("Explore rooms") + icon.name: "compass" + onTriggered: { + let dialog = pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ExploreRoomsPage'), { + connection: root.connection + }, { + title: i18nc("@title", "Explore Rooms") + }); + dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { + RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join"); + }); + } + } QQC2.MenuItem { - Accessible.onPressAction: action.triggered() - action: exploreAction + text: i18n("Find your friends") + icon.name: "list-add-user" + onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'UserSearchPage'), { + connection: root.connection + }, { + title: i18nc("@title", "Find your friends") + }) } + QQC2.MenuItem { - Accessible.onPressAction: action.triggered() - action: chatAction + text: i18n("Create a Room") + icon.name: "system-users-symbolic" + action: QQC2.Action { + shortcut: StandardKey.New + onTriggered: { + pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'CreateRoomDialog'), { + connection: root.connection + }, { + title: i18nc("@title", "Create a Room") + }); + } + } } + QQC2.MenuItem { - Accessible.onPressAction: action.triggered() - action: roomAction + text: i18n("Create a Space") + icon.name: "list-add" + onTriggered: { + pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'CreateRoomDialog'), { + connection: root.connection, + isSpace: true, + title: i18nc("@title", "Create a Space") + }, { + title: i18nc("@title", "Create a Space") + }); + } } + QQC2.MenuItem { - Accessible.onPressAction: action.triggered() - action: spaceAction - } - QQC2.MenuItem { - Accessible.onPressAction: action.triggered() - action: scanAction - } - } - } - Component { - id: mobileMenu - - Kirigami.OverlayDrawer { - id: menuRoot - - edge: Qt.BottomEdge - parent: applicationWindow().overlay - - leftPadding: 0 - rightPadding: 0 - bottomPadding: 0 - topPadding: 0 - - ColumnLayout { - width: parent.width - spacing: 0 - - Kirigami.ListSectionHeader { - label: i18n("Create rooms and chats") - } - - Delegates.RoundedItemDelegate { - action: exploreAction - onClicked: menuRoot.close() - Layout.fillWidth: true - } - - Delegates.RoundedItemDelegate { - action: chatAction - onClicked: menuRoot.close() - Layout.fillWidth: true - } - - Delegates.RoundedItemDelegate { - action: roomAction - onClicked: menuRoot.close() - Layout.fillWidth: true - } - - Delegates.RoundedItemDelegate { - action: roomAction - onClicked: menuRoot.close() - Layout.fillWidth: true - } - Delegates.RoundedItemDelegate { - action: scanAction - onClicked: menuRoot.close() - Layout.fillWidth: true - } + text: i18n("Scan a QR Code") + icon.name: "view-barcode-qr" + onTriggered: pageStack.pushDialogLayer(Qt.createComponent("org.kde.neochat", "QrScannerPage"), { + connection: root.connection + }, { + title: i18nc("@title", "Scan a QR Code") + }) } } }