Get rid of platform dialogs/menus now that Qt6.8 supports native menus without them

This will look bad on some platforms and older versions for now, but
should fix a lot of crashes and we can report the rest as bugs.
This commit is contained in:
Nicolas Werner 2024-10-08 23:04:41 +02:00
parent 3a3c3def7c
commit 65c6e96e24
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
9 changed files with 94 additions and 99 deletions

View file

@ -151,7 +151,7 @@ build-clazy:
- apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake ccache liblmdb-dev - apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake ccache liblmdb-dev
libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev
qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev
qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qt-labs-platform qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts
qt5keychain-dev ccache libcurl4-openssl-dev libevent-dev libspdlog-dev git nlohmann-json3-dev libcmark-dev asciidoc time # libolm-dev qt5keychain-dev ccache libcurl4-openssl-dev libevent-dev libspdlog-dev git nlohmann-json3-dev libcmark-dev asciidoc time # libolm-dev
# need recommended deps for wget # need recommended deps for wget
- apt-get -y install wget - apt-get -y install wget
@ -394,7 +394,7 @@ build-flatpak:
- apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake ccache liblmdb-dev - apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake ccache liblmdb-dev
libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev
qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev
qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qt-labs-platform qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts
qt5keychain-dev ccache libcurl4-openssl-dev libevent-dev libspdlog-dev nlohmann-json3-dev libcmark-dev asciidoc libre2-dev libgtest-dev libgl1-mesa-dev qml-module-qtquick-particles2 qt5keychain-dev ccache libcurl4-openssl-dev libevent-dev libspdlog-dev nlohmann-json3-dev libcmark-dev asciidoc libre2-dev libgtest-dev libgl1-mesa-dev qml-module-qtquick-particles2
# Installing the packages needed to build AppImage # Installing the packages needed to build AppImage

View file

@ -365,7 +365,7 @@ cmake --build build
*Build requirements + qml modules needed at runtime (you may not need all of them, but the following seem to work according to reports):* *Build requirements + qml modules needed at runtime (you may not need all of them, but the following seem to work according to reports):*
```bash ```bash
sudo apt install --no-install-recommends g++ cmake make zlib1g-dev libssl-dev libolm-dev liblmdb-dev libcmark-dev nlohmann-json3-dev libspdlog-dev libevent-dev libcurl4-openssl-dev libre2-dev libxcb-ewmh-dev asciidoc-base \ sudo apt install --no-install-recommends g++ cmake make zlib1g-dev libssl-dev libolm-dev liblmdb-dev libcmark-dev nlohmann-json3-dev libspdlog-dev libevent-dev libcurl4-openssl-dev libre2-dev libxcb-ewmh-dev asciidoc-base \
qt{base,declarative,tools,multimedia,quickcontrols2-}5-dev libqt6svg5-dev qt6keychain-dev qml-module-qt{gstreamer,multimedia,quick-extras,-labs-settings,-labs-platform,graphicaleffects,quick-controls2,quick-particles2} \ qt{base,declarative,tools,multimedia,quickcontrols2-}5-dev libqt6svg5-dev qt6keychain-dev qml-module-qt{gstreamer,multimedia,quick-extras,-labs-settings,graphicaleffects,quick-controls2,quick-particles2} \
libgstreamer1.0-dev libgstreamer-plugins-{base,bad}1.0-dev qtgstreamer-plugins-qt6 libnice-dev ninja-build libgstreamer1.0-dev libgstreamer-plugins-{base,bad}1.0-dev qtgstreamer-plugins-qt6 libnice-dev ninja-build
``` ```
lmdb++-dev is too old so bundled lmdbxx must be used. lmdb++-dev is too old so bundled lmdbxx must be used.

View file

@ -3,7 +3,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import "./components" import "./components"
import Qt.labs.platform 1.1 as Platform
import QtQml import QtQml
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
@ -195,7 +194,7 @@ Page {
} }
} }
Platform.Menu { Menu {
id: communityContextMenu id: communityContextMenu
property bool hidden property bool hidden
@ -209,14 +208,14 @@ Page {
open(); open();
} }
Platform.MenuItem { MenuItem {
checkable: true checkable: true
checked: communityContextMenu.muted checked: communityContextMenu.muted
text: qsTr("Do not show notification counts for this community or tag.") text: qsTr("Do not show notification counts for this community or tag.")
onTriggered: Communities.toggleTagMute(communityContextMenu.tagId) onTriggered: Communities.toggleTagMute(communityContextMenu.tagId)
} }
Platform.MenuItem { MenuItem {
checkable: true checkable: true
checked: communityContextMenu.hidden checked: communityContextMenu.hidden
text: qsTr("Hide rooms with this tag or from this community by default.") text: qsTr("Hide rooms with this tag or from this community by default.")

View file

@ -4,7 +4,6 @@
import "./ui" import "./ui"
import "./dialogs" import "./dialogs"
import Qt.labs.platform 1.1 as Platform
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Layouts 1.2 import QtQuick.Layouts 1.2
@ -393,7 +392,7 @@ Item {
} }
} }
} }
Platform.Menu { Menu {
id: messageContextMenuC id: messageContextMenuC
property string eventId property string eventId
@ -448,7 +447,7 @@ Item {
ReportMessage {} ReportMessage {}
} }
Platform.MenuItem { MenuItem {
enabled: visible enabled: visible
text: qsTr("Go to &message") text: qsTr("Go to &message")
visible: filteredTimeline.filterByContent visible: filteredTimeline.filterByContent
@ -458,21 +457,21 @@ Item {
room.showEvent(messageContextMenuC.eventId); room.showEvent(messageContextMenuC.eventId);
} }
} }
Platform.MenuItem { MenuItem {
enabled: visible enabled: visible
text: qsTr("&Copy") text: qsTr("&Copy")
visible: messageContextMenuC.text visible: messageContextMenuC.text
onTriggered: Clipboard.text = messageContextMenuC.text onTriggered: Clipboard.text = messageContextMenuC.text
} }
Platform.MenuItem { MenuItem {
enabled: visible enabled: visible
text: qsTr("Copy &link location") text: qsTr("Copy &link location")
visible: messageContextMenuC.link visible: messageContextMenuC.link
onTriggered: Clipboard.text = messageContextMenuC.link onTriggered: Clipboard.text = messageContextMenuC.link
} }
Platform.MenuItem { MenuItem {
id: reactionOption id: reactionOption
text: qsTr("Re&act") text: qsTr("Re&act")
@ -483,39 +482,39 @@ Item {
TimelineManager.focusMessageInput(); TimelineManager.focusMessageInput();
}) })
} }
Platform.MenuItem { MenuItem {
text: qsTr("Repl&y") text: qsTr("Repl&y")
visible: room ? room.permissions.canSend(MtxEvent.TextMessage) : false visible: room ? room.permissions.canSend(MtxEvent.TextMessage) : false
onTriggered: room.reply = (messageContextMenuC.eventId) onTriggered: room.reply = (messageContextMenuC.eventId)
} }
Platform.MenuItem { MenuItem {
enabled: visible enabled: visible
text: qsTr("&Edit") text: qsTr("&Edit")
visible: messageContextMenuC.isEditable && (room ? room.permissions.canSend(MtxEvent.TextMessage) : false) visible: messageContextMenuC.isEditable && (room ? room.permissions.canSend(MtxEvent.TextMessage) : false)
onTriggered: room.edit = (messageContextMenuC.eventId) onTriggered: room.edit = (messageContextMenuC.eventId)
} }
Platform.MenuItem { MenuItem {
enabled: visible enabled: visible
text: qsTr("&Thread") text: qsTr("&Thread")
visible: (room ? room.permissions.canSend(MtxEvent.TextMessage) : false) visible: (room ? room.permissions.canSend(MtxEvent.TextMessage) : false)
onTriggered: room.thread = (messageContextMenuC.threadId || messageContextMenuC.eventId) onTriggered: room.thread = (messageContextMenuC.threadId || messageContextMenuC.eventId)
} }
Platform.MenuItem { MenuItem {
enabled: visible enabled: visible
text: visible && room.pinnedMessages.includes(messageContextMenuC.eventId) ? qsTr("Un&pin") : qsTr("&Pin") text: visible && room.pinnedMessages.includes(messageContextMenuC.eventId) ? qsTr("Un&pin") : qsTr("&Pin")
visible: (room ? room.permissions.canChange(MtxEvent.PinnedEvents) : false) visible: (room ? room.permissions.canChange(MtxEvent.PinnedEvents) : false)
onTriggered: visible && room.pinnedMessages.includes(messageContextMenuC.eventId) ? room.unpin(messageContextMenuC.eventId) : room.pin(messageContextMenuC.eventId) onTriggered: visible && room.pinnedMessages.includes(messageContextMenuC.eventId) ? room.unpin(messageContextMenuC.eventId) : room.pin(messageContextMenuC.eventId)
} }
Platform.MenuItem { MenuItem {
text: qsTr("&Read receipts") text: qsTr("&Read receipts")
onTriggered: room.showReadReceipts(messageContextMenuC.eventId) onTriggered: room.showReadReceipts(messageContextMenuC.eventId)
} }
Platform.MenuItem { MenuItem {
text: qsTr("&Forward") text: qsTr("&Forward")
visible: messageContextMenuC.eventType == MtxEvent.ImageMessage || messageContextMenuC.eventType == MtxEvent.VideoMessage || messageContextMenuC.eventType == MtxEvent.AudioMessage || messageContextMenuC.eventType == MtxEvent.FileMessage || messageContextMenuC.eventType == MtxEvent.Sticker || messageContextMenuC.eventType == MtxEvent.TextMessage || messageContextMenuC.eventType == MtxEvent.LocationMessage || messageContextMenuC.eventType == MtxEvent.EmoteMessage || messageContextMenuC.eventType == MtxEvent.NoticeMessage visible: messageContextMenuC.eventType == MtxEvent.ImageMessage || messageContextMenuC.eventType == MtxEvent.VideoMessage || messageContextMenuC.eventType == MtxEvent.AudioMessage || messageContextMenuC.eventType == MtxEvent.FileMessage || messageContextMenuC.eventType == MtxEvent.Sticker || messageContextMenuC.eventType == MtxEvent.TextMessage || messageContextMenuC.eventType == MtxEvent.LocationMessage || messageContextMenuC.eventType == MtxEvent.EmoteMessage || messageContextMenuC.eventType == MtxEvent.NoticeMessage
@ -526,15 +525,15 @@ Item {
timelineRoot.destroyOnClose(forwardMess); timelineRoot.destroyOnClose(forwardMess);
} }
} }
Platform.MenuItem { MenuItem {
text: qsTr("&Mark as read") text: qsTr("&Mark as read")
} }
Platform.MenuItem { MenuItem {
text: qsTr("View raw message") text: qsTr("View raw message")
onTriggered: room.viewRawMessage(messageContextMenuC.eventId) onTriggered: room.viewRawMessage(messageContextMenuC.eventId)
} }
Platform.MenuItem { MenuItem {
enabled: visible enabled: visible
text: qsTr("View decrypted raw message") text: qsTr("View decrypted raw message")
// TODO(Nico): Fix this still being iterated over, when using keyboard to select options // TODO(Nico): Fix this still being iterated over, when using keyboard to select options
@ -542,7 +541,7 @@ Item {
onTriggered: room.viewDecryptedRawMessage(messageContextMenuC.eventId) onTriggered: room.viewDecryptedRawMessage(messageContextMenuC.eventId)
} }
Platform.MenuItem { MenuItem {
text: qsTr("Remo&ve message") text: qsTr("Remo&ve message")
visible: (room ? room.permissions.canRedact() : false) || messageContextMenuC.isSender visible: (room ? room.permissions.canRedact() : false) || messageContextMenuC.isSender
@ -554,7 +553,7 @@ Item {
timelineRoot.destroyOnClose(dialog); timelineRoot.destroyOnClose(dialog);
} }
} }
Platform.MenuItem { MenuItem {
text: qsTr("Report message") text: qsTr("Report message")
enabled: visible enabled: visible
onTriggered: function () { onTriggered: function () {
@ -564,21 +563,21 @@ Item {
timelineRoot.destroyOnClose(dialog); timelineRoot.destroyOnClose(dialog);
} }
} }
Platform.MenuItem { MenuItem {
enabled: visible enabled: visible
text: qsTr("&Save as") text: qsTr("&Save as")
visible: messageContextMenuC.eventType == MtxEvent.ImageMessage || messageContextMenuC.eventType == MtxEvent.VideoMessage || messageContextMenuC.eventType == MtxEvent.AudioMessage || messageContextMenuC.eventType == MtxEvent.FileMessage || messageContextMenuC.eventType == MtxEvent.Sticker visible: messageContextMenuC.eventType == MtxEvent.ImageMessage || messageContextMenuC.eventType == MtxEvent.VideoMessage || messageContextMenuC.eventType == MtxEvent.AudioMessage || messageContextMenuC.eventType == MtxEvent.FileMessage || messageContextMenuC.eventType == MtxEvent.Sticker
onTriggered: room.saveMedia(messageContextMenuC.eventId) onTriggered: room.saveMedia(messageContextMenuC.eventId)
} }
Platform.MenuItem { MenuItem {
enabled: visible enabled: visible
text: qsTr("&Open in external program") text: qsTr("&Open in external program")
visible: messageContextMenuC.eventType == MtxEvent.ImageMessage || messageContextMenuC.eventType == MtxEvent.VideoMessage || messageContextMenuC.eventType == MtxEvent.AudioMessage || messageContextMenuC.eventType == MtxEvent.FileMessage || messageContextMenuC.eventType == MtxEvent.Sticker visible: messageContextMenuC.eventType == MtxEvent.ImageMessage || messageContextMenuC.eventType == MtxEvent.VideoMessage || messageContextMenuC.eventType == MtxEvent.AudioMessage || messageContextMenuC.eventType == MtxEvent.FileMessage || messageContextMenuC.eventType == MtxEvent.Sticker
onTriggered: room.openMedia(messageContextMenuC.eventId) onTriggered: room.openMedia(messageContextMenuC.eventId)
} }
Platform.MenuItem { MenuItem {
enabled: visible enabled: visible
text: qsTr("Copy link to eve&nt") text: qsTr("Copy link to eve&nt")
visible: messageContextMenuC.eventId visible: messageContextMenuC.eventId
@ -592,7 +591,7 @@ Item {
ForwardCompleter { ForwardCompleter {
} }
} }
Platform.Menu { Menu {
id: replyContextMenuC id: replyContextMenuC
property string eventId property string eventId
@ -606,21 +605,21 @@ Item {
open(); open();
} }
Platform.MenuItem { MenuItem {
enabled: visible enabled: visible
text: qsTr("&Copy") text: qsTr("&Copy")
visible: replyContextMenuC.text visible: replyContextMenuC.text
onTriggered: Clipboard.text = replyContextMenuC.text onTriggered: Clipboard.text = replyContextMenuC.text
} }
Platform.MenuItem { MenuItem {
enabled: visible enabled: visible
text: qsTr("Copy &link location") text: qsTr("Copy &link location")
visible: replyContextMenuC.link visible: replyContextMenuC.link
onTriggered: Clipboard.text = replyContextMenuC.link onTriggered: Clipboard.text = replyContextMenuC.link
} }
Platform.MenuItem { MenuItem {
enabled: visible enabled: visible
text: qsTr("&Go to quoted message") text: qsTr("&Go to quoted message")
visible: true visible: true

View file

@ -5,8 +5,6 @@
import "./components" import "./components"
import "./dialogs" import "./dialogs"
import "./ui" import "./ui"
import Qt.labs.platform 1.1 as Platform
import QtQml
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
@ -55,15 +53,15 @@ Page {
onClicked: roomJoinCreateMenu.open(parent) onClicked: roomJoinCreateMenu.open(parent)
Platform.Menu { Menu {
id: roomJoinCreateMenu id: roomJoinCreateMenu
Platform.MenuItem { MenuItem {
text: qsTr("Join a room") text: qsTr("Join a room")
onTriggered: Nheko.openJoinRoomDialog() onTriggered: Nheko.openJoinRoomDialog()
} }
Platform.MenuItem { MenuItem {
text: qsTr("Create a new room") text: qsTr("Create a new room")
onTriggered: { onTriggered: {
@ -72,7 +70,7 @@ Page {
timelineRoot.destroyOnClose(createRoom); timelineRoot.destroyOnClose(createRoom);
} }
} }
Platform.MenuItem { MenuItem {
text: qsTr("Start a direct chat") text: qsTr("Start a direct chat")
onTriggered: { onTriggered: {
@ -81,7 +79,7 @@ Page {
timelineRoot.destroyOnClose(createDirect); timelineRoot.destroyOnClose(createDirect);
} }
} }
Platform.MenuItem { MenuItem {
text: qsTr("Create a new community") text: qsTr("Create a new community")
onTriggered: { onTriggered: {
@ -255,49 +253,49 @@ Page {
Nheko.setStatusMessage(text); Nheko.setStatusMessage(text);
} }
} }
Platform.Menu { Menu {
id: userInfoMenu id: userInfoMenu
Platform.MenuItem { MenuItem {
text: qsTr("Profile settings") text: qsTr("Profile settings")
onTriggered: userInfoPanel.openUserProfile() onTriggered: userInfoPanel.openUserProfile()
} }
Platform.MenuItem { MenuItem {
text: qsTr("Set status message") text: qsTr("Set status message")
onTriggered: statusDialog.show() onTriggered: statusDialog.show()
} }
Platform.MenuSeparator { MenuSeparator {
} }
Platform.MenuItemGroup { ButtonGroup {
id: onlineStateGroup id: onlineStateGroup
} }
Platform.MenuItem { MenuItem {
text: qsTr("Automatic online status") text: qsTr("Automatic online status")
group: onlineStateGroup ButtonGroup.group: onlineStateGroup
checkable: true checkable: true
checked: Settings.presence == Settings.AutomaticPresence checked: Settings.presence == Settings.AutomaticPresence
onTriggered: if (checked) Settings.presence = Settings.AutomaticPresence onTriggered: if (checked) Settings.presence = Settings.AutomaticPresence
} }
Platform.MenuItem { MenuItem {
text: qsTr("Online") text: qsTr("Online")
group: onlineStateGroup ButtonGroup.group: onlineStateGroup
checkable: true checkable: true
checked: Settings.presence == Settings.Online checked: Settings.presence == Settings.Online
onTriggered: if (checked) Settings.presence = Settings.Online onTriggered: if (checked) Settings.presence = Settings.Online
} }
Platform.MenuItem { MenuItem {
text: qsTr("Unavailable") text: qsTr("Unavailable")
group: onlineStateGroup ButtonGroup.group: onlineStateGroup
checkable: true checkable: true
checked: Settings.presence == Settings.Unavailable checked: Settings.presence == Settings.Unavailable
onTriggered: if (checked) Settings.presence = Settings.Unavailable onTriggered: if (checked) Settings.presence = Settings.Unavailable
} }
Platform.MenuItem { MenuItem {
text: qsTr("Offline") text: qsTr("Offline")
group: onlineStateGroup ButtonGroup.group: onlineStateGroup
checkable: true checkable: true
checked: Settings.presence == Settings.Offline checked: Settings.presence == Settings.Offline
onTriggered: if (checked) Settings.presence = Settings.Offline onTriggered: if (checked) Settings.presence = Settings.Offline
@ -734,7 +732,7 @@ Page {
roomid: roomContextMenu.roomid roomid: roomContextMenu.roomid
} }
} }
Platform.Menu { Menu {
id: roomContextMenu id: roomContextMenu
property string roomid property string roomid
@ -756,7 +754,7 @@ Page {
Rooms.toggleTag(roomContextMenu.roomid, "u." + text, true); Rooms.toggleTag(roomContextMenu.roomid, "u." + text, true);
} }
} }
Platform.MenuItem { MenuItem {
text: qsTr("Open separately") text: qsTr("Open separately")
onTriggered: { onTriggered: {
@ -768,27 +766,27 @@ Page {
destroyOnClose(roomWindow); destroyOnClose(roomWindow);
} }
} }
Platform.MenuItem { MenuItem {
text: qsTr("Mark as read") text: qsTr("Mark as read")
onTriggered: Rooms.getRoomById(roomContextMenu.roomid).markRoomAsRead() onTriggered: Rooms.getRoomById(roomContextMenu.roomid).markRoomAsRead()
} }
Platform.MenuItem { MenuItem {
text: qsTr("Room settings") text: qsTr("Room settings")
onTriggered: TimelineManager.openRoomSettings(roomContextMenu.roomid) onTriggered: TimelineManager.openRoomSettings(roomContextMenu.roomid)
} }
Platform.MenuItem { MenuItem {
text: qsTr("Leave room") text: qsTr("Leave room")
onTriggered: TimelineManager.openLeaveRoomDialog(roomContextMenu.roomid) onTriggered: TimelineManager.openLeaveRoomDialog(roomContextMenu.roomid)
} }
Platform.MenuItem { MenuItem {
text: qsTr("Copy room link") text: qsTr("Copy room link")
onTriggered: Rooms.copyLink(roomContextMenu.roomid) onTriggered: Rooms.copyLink(roomContextMenu.roomid)
} }
Platform.Menu { Menu {
id: tagsMenu id: tagsMenu
title: qsTr("Tag room as:") title: qsTr("Tag room as:")
@ -796,7 +794,7 @@ Page {
Instantiator { Instantiator {
model: Communities.tagsWithDefault model: Communities.tagsWithDefault
delegate: Platform.MenuItem { delegate: MenuItem {
property string t: modelData property string t: modelData
checkable: true checkable: true
@ -820,7 +818,7 @@ Page {
onObjectAdded: (index, object) => tagsMenu.insertItem(index, object) onObjectAdded: (index, object) => tagsMenu.insertItem(index, object)
onObjectRemoved: (index, object) => tagsMenu.removeItem(object) onObjectRemoved: (index, object) => tagsMenu.removeItem(object)
} }
Platform.MenuItem { MenuItem {
text: qsTr("Create new tag...") text: qsTr("Create new tag...")
onTriggered: newTag.show() onTriggered: newTag.show()

View file

@ -5,10 +5,10 @@
import "./dialogs" import "./dialogs"
import "./pages" import "./pages"
import "./ui" import "./ui"
import Qt.labs.platform 1.1 as Platform
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Window import QtQuick.Window
import QtQuick.Dialogs
import im.nheko import im.nheko
Pane { Pane {
@ -342,15 +342,13 @@ Pane {
return UIA.submit3pidToken(t); return UIA.submit3pidToken(t);
} }
} }
Platform.MessageDialog { MessageDialog {
id: uiaConfirmationLinkDialog id: uiaConfirmationLinkDialog
buttons: Platform.MessageDialog.Ok buttons: MessageDialog.Ok
text: qsTr("Wait for the confirmation link to arrive, then continue.") text: qsTr("Wait for the confirmation link to arrive, then continue.")
// Broken on macos, see https://bugreports.qt.io/browse/QTBUG-102078 onAccepted: UIA.continue3pidReceived()
//onAccepted: UIA.continue3pidReceived()
onOkClicked: UIA.continue3pidReceived()
} }
Connections { Connections {
function onConfirm3pidToken() { function onConfirm3pidToken() {

View file

@ -2,7 +2,6 @@
// //
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import Qt.labs.platform 1.1 as Platform
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Layouts 1.2 import QtQuick.Layouts 1.2
@ -237,26 +236,26 @@ Pane {
onClicked: roomOptionsMenu.open(roomOptionsButton) onClicked: roomOptionsMenu.open(roomOptionsButton)
Platform.Menu { Menu {
id: roomOptionsMenu id: roomOptionsMenu
Platform.MenuItem { MenuItem {
text: qsTr("Invite users") text: qsTr("Invite users")
visible: room ? room.permissions.canInvite() : false visible: room ? room.permissions.canInvite() : false
onTriggered: TimelineManager.openInviteUsers(roomId) onTriggered: TimelineManager.openInviteUsers(roomId)
} }
Platform.MenuItem { MenuItem {
text: qsTr("Members") text: qsTr("Members")
onTriggered: TimelineManager.openRoomMembers(room) onTriggered: TimelineManager.openRoomMembers(room)
} }
Platform.MenuItem { MenuItem {
text: qsTr("Leave room") text: qsTr("Leave room")
onTriggered: TimelineManager.openLeaveRoomDialog(roomId) onTriggered: TimelineManager.openLeaveRoomDialog(roomId)
} }
Platform.MenuItem { MenuItem {
text: qsTr("Settings") text: qsTr("Settings")
onTriggered: TimelineManager.openRoomSettings(roomId) onTriggered: TimelineManager.openRoomSettings(roomId)

View file

@ -2,11 +2,11 @@
// //
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.15 import QtQuick
import Qt.labs.platform 1.1 as Platform import QtQuick.Controls
import im.nheko 1.0 import im.nheko
Platform.Menu { Menu {
id: spacesMenu id: spacesMenu
property string roomid property string roomid
@ -19,55 +19,60 @@ Platform.Menu {
onAboutToShow: loadChildren = true onAboutToShow: loadChildren = true
//onAboutToHide: loadChildren = false //onAboutToHide: loadChildren = false
Platform.MenuItemGroup { ButtonGroup {
id: modificationGroup id: modificationGroup
visible: position != -1 //visible: position != -1
} }
Platform.MenuItem { MenuItem {
text: qsTr("Official community for this room") text: qsTr("Official community for this room")
group: modificationGroup ButtonGroup.group: modificationGroup
visible: position != -1
checkable: true checkable: true
checked: spacesMenu.position >= 0 && (modelData.childValid && modelData.parentValid && modelData.canonical) checked: spacesMenu.position >= 0 && (modelData.childValid && modelData.parentValid && modelData.canonical)
enabled: spacesMenu.position >= 0 && (modelData.canEditChild && modelData.canEditParent) enabled: spacesMenu.position >= 0 && (modelData.canEditChild && modelData.canEditParent)
onTriggered: if (checked) Communities.updateSpaceStatus(modelData.roomid, spacesMenu.roomid, true, true, true) onTriggered: if (checked) Communities.updateSpaceStatus(modelData.roomid, spacesMenu.roomid, true, true, true)
} }
Platform.MenuItem { MenuItem {
text: qsTr("Affiliated community for this room") text: qsTr("Affiliated community for this room")
group: modificationGroup ButtonGroup.group: modificationGroup
visible: position != -1
checkable: true checkable: true
checked: spacesMenu.position >= 0 && (modelData.childValid && modelData.parentValid && !modelData.canonical) checked: spacesMenu.position >= 0 && (modelData.childValid && modelData.parentValid && !modelData.canonical)
enabled: spacesMenu.position >= 0 && (modelData.canEditChild && modelData.canEditParent) enabled: spacesMenu.position >= 0 && (modelData.canEditChild && modelData.canEditParent)
onTriggered: if (checked) Communities.updateSpaceStatus(modelData.roomid, spacesMenu.roomid, true, true, false) onTriggered: if (checked) Communities.updateSpaceStatus(modelData.roomid, spacesMenu.roomid, true, true, false)
} }
Platform.MenuItem { MenuItem {
text: qsTr("Listed only for community members") text: qsTr("Listed only for community members")
group: modificationGroup ButtonGroup.group: modificationGroup
visible: position != -1
checkable: true checkable: true
checked: spacesMenu.position >= 0 && (modelData.childValid && !modelData.parentValid) checked: spacesMenu.position >= 0 && (modelData.childValid && !modelData.parentValid)
enabled: spacesMenu.position >= 0 && ((modelData.canEditChild || modelData.childValid) && (!modelData.parentValid || modelData.canEditParent)) enabled: spacesMenu.position >= 0 && ((modelData.canEditChild || modelData.childValid) && (!modelData.parentValid || modelData.canEditParent))
onTriggered: if (checked) Communities.updateSpaceStatus(modelData.roomid, spacesMenu.roomid, false, true, false) onTriggered: if (checked) Communities.updateSpaceStatus(modelData.roomid, spacesMenu.roomid, false, true, false)
} }
Platform.MenuItem { MenuItem {
text: qsTr("Listed only for room members") text: qsTr("Listed only for room members")
group: modificationGroup ButtonGroup.group: modificationGroup
visible: position != -1
checkable: true checkable: true
checked: spacesMenu.position >= 0 && (!modelData.childValid && modelData.parentValid) checked: spacesMenu.position >= 0 && (!modelData.childValid && modelData.parentValid)
enabled: spacesMenu.position >= 0 && ((modelData.canEditChild) && (modelData.parentValid || modelData.canEditParent)) enabled: spacesMenu.position >= 0 && ((modelData.canEditChild) && (modelData.parentValid || modelData.canEditParent))
onTriggered: if (checked) Communities.updateSpaceStatus(modelData.roomid, spacesMenu.roomid, true, false, false) onTriggered: if (checked) Communities.updateSpaceStatus(modelData.roomid, spacesMenu.roomid, true, false, false)
} }
Platform.MenuItem { MenuItem {
text: qsTr("Not related") text: qsTr("Not related")
group: modificationGroup ButtonGroup.group: modificationGroup
visible: position != -1
checkable: true checkable: true
checked: spacesMenu.position >= 0 && (!modelData.childValid && !modelData.parentValid) checked: spacesMenu.position >= 0 && (!modelData.childValid && !modelData.parentValid)
enabled: spacesMenu.position >= 0 && ((modelData.canEditChild || !modelData.childValid) && (!modelData.parentValid || modelData.canEditParent)) enabled: spacesMenu.position >= 0 && ((modelData.canEditChild || !modelData.childValid) && (!modelData.parentValid || modelData.canEditParent))
onTriggered: if (checked) Communities.updateSpaceStatus(modelData.roomid, spacesMenu.roomid, false, false, false) onTriggered: if (checked) Communities.updateSpaceStatus(modelData.roomid, spacesMenu.roomid, false, false, false)
} }
Platform.MenuSeparator { MenuSeparator {
text: qsTr("Subcommunities") //text: qsTr("Subcommunities")
group: modificationGroup ButtonGroup.group: modificationGroup
visible: modificationGroup.visible && inst.model != undefined visible: modificationGroup.visible && inst.model != undefined
} }

View file

@ -4,11 +4,11 @@
import ".." import ".."
import "../ui" import "../ui"
import Qt.labs.platform 1.1 as Platform
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2 import QtQuick.Layouts 1.2
import QtQuick.Window 2.13 import QtQuick.Window 2.13
import QtQuick.Dialogs
import im.nheko 1.0 import im.nheko 1.0
ApplicationWindow { ApplicationWindow {
@ -580,26 +580,23 @@ ApplicationWindow {
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
} }
Platform.MessageDialog { MessageDialog {
id: confirmEncryptionDialog id: confirmEncryptionDialog
title: qsTr("End-to-End Encryption") title: qsTr("End-to-End Encryption")
text: qsTr(`Encryption is currently experimental and things might break unexpectedly. <br> text: qsTr(`Encryption is currently experimental and things might break unexpectedly. <br>
Please take note that it can't be disabled afterwards.`) Please take note that it can't be disabled afterwards.`)
modality: Qt.NonModal modality: Qt.NonModal
// Broken on macos, see https://bugreports.qt.io/browse/QTBUG-102078 onAccepted: {
//onAccepted: {
onOkClicked: {
if (roomSettings.isEncryptionEnabled) if (roomSettings.isEncryptionEnabled)
return ; return ;
roomSettings.enableEncryption(); roomSettings.enableEncryption();
} }
//onRejected: { onRejected: {
onCancelClicked: {
encryptionToggle.checked = false; encryptionToggle.checked = false;
} }
buttons: Platform.MessageDialog.Ok | Platform.MessageDialog.Cancel buttons: MessageDialog.Ok | MessageDialog.Cancel
} }
Label { Label {