Improve the Jitsi meeting button UX
Widgets support is incredibly useful and so is this button, but it has a few problems. The most obvious is that it's still enabled even if you don't actually have the permission to start Jitsi meetings, so I fixed that. I also made sure it's hidden when viewing spaces too. Another problem is that you can't easily tell if a meeting is currently in progress either, nor do we have a good icon for that in Breeze. So I changed the tooltip and colored the icon in this case. The final problem I fixed is something not exclusive to NeoChat, but generally all chat applications with this feature - there's no confirmation! To stop "butt-dialing" random people or rooms, I added a prompt before starting or joining a meeting.
This commit is contained in:
@@ -77,11 +77,33 @@ Kirigami.Page {
|
||||
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
tooltip: i18nc("@action:button", "Open Jitsi Meet in browser")
|
||||
icon.name: "camera-video-symbolic"
|
||||
id: jitsiMeetingAction
|
||||
|
||||
readonly property bool hasExistingMeeting: root.widgetModel.jitsiIndex >= 0
|
||||
readonly property bool canStartNewMeeting: root.currentRoom.canSendState("im.vector.modular.widgets")
|
||||
|
||||
tooltip: {
|
||||
if (hasExistingMeeting) {
|
||||
return i18nc("@action:button", "Join Jitsi meeting…");
|
||||
}
|
||||
|
||||
return canStartNewMeeting ? i18nc("@action:button", "Start Jitsi meeting…") : i18nc("@action:button", "You do not have permissions to start Jitsi meetings")
|
||||
}
|
||||
icon {
|
||||
name: "camera-video-symbolic"
|
||||
color: hasExistingMeeting ? Kirigami.Theme.highlightColor : "transparent"
|
||||
}
|
||||
enabled: hasExistingMeeting || canStartNewMeeting
|
||||
visible: root.currentRoom && !root.currentRoom.isSpace
|
||||
onTriggered: {
|
||||
let url
|
||||
if (root.widgetModel.jitsiIndex < 0) {
|
||||
const dialog = Qt.createComponent("org.kde.neochat", "MeetingDialog").createObject(QQC2.Overlay.overlay, { hasExistingMeeting });
|
||||
dialog.onAccepted.connect(doAction);
|
||||
dialog.open();
|
||||
}
|
||||
|
||||
function doAction(): void {
|
||||
let url;
|
||||
if (!hasExistingMeeting) {
|
||||
url = root.widgetModel.addJitsiConference();
|
||||
} else {
|
||||
let idx = root.widgetModel.index(root.widgetModel.jitsiIndex, 0);
|
||||
|
||||
Reference in New Issue
Block a user