Simplify ExploreComponent
Remove mobile mode support as this is handled by ExploreComponentMobile
This commit is contained in:
@@ -19,65 +19,6 @@ RowLayout {
|
|||||||
|
|
||||||
signal search
|
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.
|
* @brief Emitted when the text is changed in the search field.
|
||||||
*/
|
*/
|
||||||
@@ -119,18 +60,13 @@ RowLayout {
|
|||||||
Accessible.onPressAction: menuButton.action.trigger()
|
Accessible.onPressAction: menuButton.action.trigger()
|
||||||
display: QQC2.AbstractButton.IconOnly
|
display: QQC2.AbstractButton.IconOnly
|
||||||
checkable: true
|
checkable: true
|
||||||
action: Kirigami.Action {
|
action: QQC2.Action {
|
||||||
text: i18nc("@action:button", "Show Menu")
|
text: i18nc("@action:button", "Show Menu")
|
||||||
icon.name: "application-menu-symbolic"
|
icon.name: "application-menu-symbolic"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (Kirigami.isMobile) {
|
const item = menu.createObject(menuButton);
|
||||||
const menu = mobileMenu.createObject();
|
item.closed.connect(menuButton.toggle);
|
||||||
menu.open();
|
item.open();
|
||||||
} else {
|
|
||||||
const menu = desktopMenu.createObject(menuButton);
|
|
||||||
menu.closed.connect(menuButton.toggle);
|
|
||||||
menu.open();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,86 +76,70 @@ RowLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: desktopMenu
|
id: menu
|
||||||
QQC2.Menu {
|
QQC2.Menu {
|
||||||
x: mirrored ? parent.width - width : 0
|
QQC2.MenuItem {
|
||||||
y: parent ? parent.height : 0
|
text: i18n("Explore rooms")
|
||||||
|
icon.name: "compass"
|
||||||
modal: true
|
onTriggered: {
|
||||||
dim: false
|
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 {
|
QQC2.MenuItem {
|
||||||
Accessible.onPressAction: action.triggered()
|
text: i18n("Find your friends")
|
||||||
action: exploreAction
|
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 {
|
QQC2.MenuItem {
|
||||||
Accessible.onPressAction: action.triggered()
|
text: i18n("Create a Room")
|
||||||
action: chatAction
|
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 {
|
QQC2.MenuItem {
|
||||||
Accessible.onPressAction: action.triggered()
|
text: i18n("Create a Space")
|
||||||
action: roomAction
|
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 {
|
QQC2.MenuItem {
|
||||||
Accessible.onPressAction: action.triggered()
|
text: i18n("Scan a QR Code")
|
||||||
action: spaceAction
|
icon.name: "view-barcode-qr"
|
||||||
}
|
onTriggered: pageStack.pushDialogLayer(Qt.createComponent("org.kde.neochat", "QrScannerPage"), {
|
||||||
QQC2.MenuItem {
|
connection: root.connection
|
||||||
Accessible.onPressAction: action.triggered()
|
}, {
|
||||||
action: scanAction
|
title: i18nc("@title", "Scan a QR Code")
|
||||||
}
|
})
|
||||||
}
|
|
||||||
}
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user