Fold extra send icons when thin for mobile
This commit is contained in:
@@ -110,6 +110,7 @@ QQC2.Control {
|
||||
SendBar {
|
||||
room: root.room
|
||||
contentModel: root.model
|
||||
maxAvailableWidth: root.maxAvailableWidth
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,14 +414,4 @@ RowLayout {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: locationChooser
|
||||
LocationChooser {}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: newPollDialog
|
||||
NewPollDialog {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ import org.kde.kirigami as Kirigami
|
||||
import org.kde.neochat.libneochat as LibNeoChat
|
||||
import org.kde.neochat.messagecontent as MessageContent
|
||||
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
RowLayout {
|
||||
id: root
|
||||
|
||||
@@ -23,20 +25,23 @@ RowLayout {
|
||||
|
||||
required property MessageContent.ChatBarMessageContentModel contentModel
|
||||
|
||||
Kirigami.Separator {
|
||||
Layout.fillHeight: true
|
||||
required property real maxAvailableWidth
|
||||
|
||||
readonly property real overflowWidth: Kirigami.Units.gridUnit * 30
|
||||
|
||||
function openLocationChooser(): void {
|
||||
Qt.createComponent('org.kde.neochat.chatbar', 'LocationChooser').createObject(QQC2.ApplicationWindow.overlay, {
|
||||
room: root.room
|
||||
}).open();
|
||||
}
|
||||
QQC2.ToolButton {
|
||||
id: attachmentButton
|
||||
|
||||
property bool isBusy: root.room && root.room.hasFileUploading
|
||||
function openNewPollDialog(): void {
|
||||
Qt.createComponent('org.kde.neochat.chatbar', 'NewPollDialog').createObject(QQC2.Overlay.overlay, {
|
||||
room: root.room
|
||||
}).open();
|
||||
}
|
||||
|
||||
visible: !root.contentModel.hasAttachment && (root.contentModel?.type ?? true) === LibNeoChat.ChatBarType.Room
|
||||
icon.name: "mail-attachment"
|
||||
text: i18nc("@action:button", "Attach an image or file")
|
||||
display: QQC2.AbstractButton.IconOnly
|
||||
|
||||
onClicked: {
|
||||
function addAttachment(): void {
|
||||
if (!root.contentModel.hasRichFormatting) {
|
||||
if (LibNeoChat.Clipboard.hasImage) {
|
||||
attachDialog();
|
||||
@@ -78,49 +83,101 @@ RowLayout {
|
||||
dialog.open();
|
||||
}
|
||||
|
||||
Kirigami.Separator {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
QQC2.ToolButton {
|
||||
id: compressedExtraSendButton
|
||||
property QQC2.Menu overflowMenu
|
||||
|
||||
visible: root.maxAvailableWidth < root.overflowWidth && (root.contentModel?.type ?? true) === LibNeoChat.ChatBarType.Room
|
||||
icon.name: "overflow-menu"
|
||||
enabled: root.chatButtonHelper.richFormatEnabled
|
||||
text: i18nc("@action:button", "Format Text")
|
||||
display: QQC2.AbstractButton.IconOnly
|
||||
checkable: true
|
||||
onClicked: {
|
||||
if (!checked) {
|
||||
if (overflowMenu) {
|
||||
overflowMenu.close();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
overflowMenu = compressedExtraSendMenu.createObject(compressedExtraSendButton)
|
||||
overflowMenu.onClosed.connect(() => {
|
||||
overflowMenu = null;
|
||||
});
|
||||
overflowMenu.open();
|
||||
}
|
||||
|
||||
Component {
|
||||
id: compressedExtraSendMenu
|
||||
QQC2.Menu {
|
||||
y: -implicitHeight
|
||||
|
||||
QQC2.MenuItem {
|
||||
visible: !root.contentModel.hasAttachment
|
||||
icon.name: "mail-attachment"
|
||||
text: i18nc("@action:button", "Attach an image or file")
|
||||
onTriggered: root.addAttachment()
|
||||
}
|
||||
QQC2.MenuItem {
|
||||
icon.name: "globe"
|
||||
text: i18nc("@action:button", "Send a Location")
|
||||
onTriggered: root.openLocationChooser()
|
||||
}
|
||||
QQC2.MenuItem {
|
||||
icon.name: "amarok_playcount"
|
||||
text: i18nc("@action:button", "Create a Poll")
|
||||
onTriggered: root.openNewPollDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QQC2.ToolTip.text: text
|
||||
QQC2.ToolTip.visible: hovered
|
||||
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
}
|
||||
QQC2.ToolButton {
|
||||
id: attachmentButton
|
||||
visible: !root.contentModel.hasAttachment && (root.contentModel?.type ?? true) === LibNeoChat.ChatBarType.Room && root.maxAvailableWidth >= root.overflowWidth
|
||||
icon.name: "mail-attachment"
|
||||
text: i18nc("@action:button", "Attach an image or file")
|
||||
display: QQC2.AbstractButton.IconOnly
|
||||
|
||||
onClicked: root.addAttachment()
|
||||
|
||||
QQC2.ToolTip.visible: hovered
|
||||
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
QQC2.ToolTip.text: text
|
||||
}
|
||||
QQC2.ToolButton {
|
||||
id: mapButton
|
||||
visible: (root.contentModel?.type ?? true) === LibNeoChat.ChatBarType.Room
|
||||
visible: (root.contentModel?.type ?? true) === LibNeoChat.ChatBarType.Room && root.maxAvailableWidth >= root.overflowWidth
|
||||
icon.name: "globe"
|
||||
property bool isBusy: false
|
||||
text: i18nc("@action:button", "Send a Location")
|
||||
display: QQC2.AbstractButton.IconOnly
|
||||
|
||||
onClicked: {
|
||||
locationChooser.createObject(QQC2.ApplicationWindow.overlay, {
|
||||
room: root.room
|
||||
}).open();
|
||||
}
|
||||
onClicked: root.openLocationChooser();
|
||||
QQC2.ToolTip.visible: hovered
|
||||
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
QQC2.ToolTip.text: text
|
||||
}
|
||||
QQC2.ToolButton {
|
||||
id: pollButton
|
||||
visible: (root.contentModel?.type ?? true) === LibNeoChat.ChatBarType.Room
|
||||
visible: (root.contentModel?.type ?? true) === LibNeoChat.ChatBarType.Room && root.maxAvailableWidth >= root.overflowWidth
|
||||
icon.name: "amarok_playcount"
|
||||
property bool isBusy: false
|
||||
text: i18nc("@action:button", "Create a Poll")
|
||||
display: QQC2.AbstractButton.IconOnly
|
||||
|
||||
onClicked: {
|
||||
newPollDialog.createObject(QQC2.Overlay.overlay, {
|
||||
room: root.room
|
||||
}).open();
|
||||
}
|
||||
onClicked: root.openNewPollDialog();
|
||||
QQC2.ToolTip.visible: hovered
|
||||
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
QQC2.ToolTip.text: text
|
||||
}
|
||||
QQC2.ToolButton {
|
||||
id: sendButton
|
||||
|
||||
property bool isBusy: false
|
||||
|
||||
icon.name: "document-send"
|
||||
text: i18nc("@action:button", "Send message")
|
||||
display: QQC2.AbstractButton.IconOnly
|
||||
|
||||
Reference in New Issue
Block a user