Rework context menu RoomList
- Finish port to qt6 and replace icon by icon.name - Use RoundedItemDelegate
This commit is contained in:
committed by
Tobias Fella
parent
f0a7216b4b
commit
442a343097
@@ -2,14 +2,15 @@
|
|||||||
// SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.eu>
|
// SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.eu>
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
import QtQuick 2.15
|
import QtQuick
|
||||||
import QtQuick.Controls 2.15 as QQC2
|
import QtQuick.Controls as QQC2
|
||||||
import QtQuick.Layouts 1.15
|
import QtQuick.Layouts
|
||||||
|
|
||||||
import org.kde.kirigami 2.19 as Kirigami
|
import org.kde.kirigami 2 as Kirigami
|
||||||
import org.kde.kirigamiaddons.labs.components 1.0 as KirigamiComponents
|
import org.kde.kirigamiaddons.components 1 as KirigamiComponents
|
||||||
|
import org.kde.kirigamiaddons.delegates 1 as Delegates
|
||||||
|
|
||||||
import org.kde.neochat 1.0
|
import org.kde.neochat
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Context menu when clicking on a room in the room list
|
* Context menu when clicking on a room in the room list
|
||||||
@@ -142,20 +143,23 @@ Loader {
|
|||||||
|
|
||||||
Kirigami.OverlayDrawer {
|
Kirigami.OverlayDrawer {
|
||||||
id: drawer
|
id: drawer
|
||||||
height: popupContent.implicitHeight
|
|
||||||
|
parent: applicationWindow().overlay
|
||||||
edge: Qt.BottomEdge
|
edge: Qt.BottomEdge
|
||||||
padding: 0
|
|
||||||
|
height: popupContent.implicitHeight
|
||||||
|
|
||||||
leftPadding: 0
|
leftPadding: 0
|
||||||
rightPadding: 0
|
rightPadding: 0
|
||||||
bottomPadding: 0
|
bottomPadding: 0
|
||||||
topPadding: 0
|
topPadding: 0
|
||||||
|
|
||||||
parent: applicationWindow().overlay
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: popupContent
|
id: popupContent
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: headerLayout
|
id: headerLayout
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -192,29 +196,31 @@ Loader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Kirigami.BasicListItem {
|
Delegates.RoundedItemDelegate {
|
||||||
text: room.isLowPriority ? i18n("Reprioritize") : i18n("Deprioritize")
|
text: room.isLowPriority ? i18n("Reprioritize") : i18n("Deprioritize")
|
||||||
icon.name: room.isLowPriority ? "arrow-up" : "arrow-down"
|
icon.name: room.isLowPriority ? "arrow-up" : "arrow-down"
|
||||||
onClicked: room.isLowPriority ? room.removeTag("m.lowpriority") : room.addTag("m.lowpriority", 1.0)
|
onClicked: room.isLowPriority ? room.removeTag("m.lowpriority") : room.addTag("m.lowpriority", 1.0)
|
||||||
implicitHeight: visible ? Kirigami.Units.gridUnit * 3 : 0
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Kirigami.BasicListItem {
|
Delegates.RoundedItemDelegate {
|
||||||
text: i18n("Mark as Read")
|
text: i18n("Mark as Read")
|
||||||
icon.name: "checkmark"
|
icon.name: "checkmark"
|
||||||
onClicked: room.markAllMessagesAsRead()
|
onClicked: room.markAllMessagesAsRead()
|
||||||
implicitHeight: visible ? Kirigami.Units.gridUnit * 3 : 0
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
Kirigami.BasicListItem {
|
|
||||||
|
Delegates.RoundedItemDelegate {
|
||||||
text: i18n("Leave Room")
|
text: i18n("Leave Room")
|
||||||
icon.name: "go-previous"
|
icon.name: "go-previous"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
RoomManager.leaveRoom(room)
|
RoomManager.leaveRoom(room)
|
||||||
drawer.close()
|
drawer.close()
|
||||||
}
|
}
|
||||||
implicitHeight: visible ? Kirigami.Units.gridUnit * 3 : 0
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClosed: root.closed()
|
onClosed: root.closed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
// SPDX-FileCopyrightText: 2023 James Graham <james.h.graham@protonmail.com>
|
// SPDX-FileCopyrightText: 2023 James Graham <james.h.graham@protonmail.com>
|
||||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
|
|
||||||
import QtQuick 2.15
|
import QtQuick
|
||||||
import QtQuick.Controls 2.15 as QQC2
|
import QtQuick.Controls as QQC2
|
||||||
import QtQuick.Layouts 1.15
|
import QtQuick.Layouts
|
||||||
|
|
||||||
import org.kde.kirigami 2.15 as Kirigami
|
import org.kde.kirigami 2 as Kirigami
|
||||||
|
import org.kde.kirigamiaddons.delegates 1 as Delegates
|
||||||
|
|
||||||
import org.kde.neochat 1.0
|
import org.kde.neochat
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: root
|
id: root
|
||||||
@@ -114,14 +115,15 @@ RowLayout {
|
|||||||
|
|
||||||
Kirigami.OverlayDrawer {
|
Kirigami.OverlayDrawer {
|
||||||
id: menuRoot
|
id: menuRoot
|
||||||
|
|
||||||
edge: Qt.BottomEdge
|
edge: Qt.BottomEdge
|
||||||
|
parent: applicationWindow().overlay
|
||||||
|
|
||||||
leftPadding: 0
|
leftPadding: 0
|
||||||
rightPadding: 0
|
rightPadding: 0
|
||||||
bottomPadding: 0
|
bottomPadding: 0
|
||||||
topPadding: 0
|
topPadding: 0
|
||||||
|
|
||||||
parent: applicationWindow().overlay
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: 0
|
spacing: 0
|
||||||
@@ -129,25 +131,29 @@ RowLayout {
|
|||||||
Kirigami.ListSectionHeader {
|
Kirigami.ListSectionHeader {
|
||||||
label: i18n("Create rooms and chats")
|
label: i18n("Create rooms and chats")
|
||||||
}
|
}
|
||||||
Kirigami.BasicListItem {
|
|
||||||
implicitHeight: Kirigami.Units.gridUnit * 3
|
Delegates.RoundedItemDelegate {
|
||||||
action: exploreAction
|
action: exploreAction
|
||||||
onClicked: menuRoot.close()
|
onClicked: menuRoot.close()
|
||||||
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
Kirigami.BasicListItem {
|
|
||||||
implicitHeight: Kirigami.Units.gridUnit * 3
|
Delegates.RoundedItemDelegate {
|
||||||
action: chatAction
|
action: chatAction
|
||||||
onClicked: menuRoot.close()
|
onClicked: menuRoot.close()
|
||||||
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
Kirigami.BasicListItem {
|
|
||||||
implicitHeight: Kirigami.Units.gridUnit * 3
|
Delegates.RoundedItemDelegate {
|
||||||
action: roomAction
|
action: roomAction
|
||||||
onClicked: menuRoot.close()
|
onClicked: menuRoot.close()
|
||||||
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
Kirigami.BasicListItem {
|
|
||||||
implicitHeight: Kirigami.Units.gridUnit * 3
|
Delegates.RoundedItemDelegate {
|
||||||
action: roomAction
|
action: roomAction
|
||||||
onClicked: menuRoot.close()
|
onClicked: menuRoot.close()
|
||||||
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,6 +137,9 @@ Delegates.RoundedItemDelegate {
|
|||||||
|
|
||||||
function createRoomListContextMenu() {
|
function createRoomListContextMenu() {
|
||||||
const component = Qt.createComponent("qrc:/RoomList/ContextMenu.qml")
|
const component = Qt.createComponent("qrc:/RoomList/ContextMenu.qml")
|
||||||
|
if (component.status === Component.Error) {
|
||||||
|
console.error(component.errorString());
|
||||||
|
}
|
||||||
const menu = component.createObject(root, {
|
const menu = component.createObject(root, {
|
||||||
room: root.currentRoom,
|
room: root.currentRoom,
|
||||||
connection: root.connection
|
connection: root.connection
|
||||||
|
|||||||
Reference in New Issue
Block a user