diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index a2c4341..61c7cb4 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -97,16 +97,6 @@ ListItem { } sourceComponent: Component { ContextMenu { - Repeater { - model: (extraContentLoader.item && ("extraContextMenuItems" in extraContentLoader.item)) ? - extraContentLoader.item.extraContextMenuItems : 0 - delegate: MenuItem { - visible: modelData.visible - text: modelData.name - onClicked: modelData.action() - } - } - MenuItem { visible: messageListItem.canReplyToMessage onClicked: messageListItem.replyToMessage() @@ -127,32 +117,13 @@ ListItem { onClicked: { messageOptionsDrawer.myMessage = myMessage; messageOptionsDrawer.userInformation = userInformation; + messageOptionsDrawer.sourceItem = messageListItem + messageOptionsDrawer.additionalItemsModel = (extraContentLoader.item && ("extraContextMenuItems" in extraContentLoader.item)) ? extraContentLoader.item.extraContextMenuItems : 0; messageListItem.highlighted = true; messageOptionsDrawer.open = true; } text: qsTr("More Options...") } - MenuItem { - onClicked: { - if (myMessage.is_pinned) { - Remorse.popupAction(page, qsTr("Message unpinned"), function() { tdLibWrapper.unpinMessage(page.chatInformation.id, messageId); - pinnedMessageItem.requestCloseMessage(); } ); - } else { - tdLibWrapper.pinMessage(page.chatInformation.id, messageId); - } - } - text: myMessage.is_pinned ? qsTr("Unpin Message") : qsTr("Pin Message") - visible: canPinMessages() - } - MenuItem { - onClicked: { - var chatId = page.chatInformation.id; - var messageId = messageListItem.messageId; - Remorse.itemAction(messageListItem, qsTr("Message deleted"), function() { tdLibWrapper.deleteMessages(chatId, [ messageId]); }) - } - text: qsTr("Delete Message") - visible: myMessage.can_be_deleted_for_all_users || (myMessage.can_be_deleted_only_for_self && myMessage.chat_id === page.myUserId) - } } } } diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 477d0e2..a91f5dd 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -686,54 +686,31 @@ Page { property var myMessage: ({}) property var userInformation: ({}) + property var additionalItemsModel: 0 + property var sourceItem signal closeRequested(); + function closeDrawer() { + messageOptionsDrawer.closeRequested(); + messageOptionsDrawer.open = false; + } + anchors.fill: parent - dock: chatPage.isPortrait ? Dock.Top : Dock.Right + dock: chatPage.isPortrait ? Dock.Bottom : Dock.Right + backgroundSize: dock == Dock.Left || dock == Dock.Right ? width / 2 : height / 3 - background: SilicaListView { + background: Column { anchors.fill: parent - model: ListModel { - id: myListModel - property var actions: { - "copyToClipboard": function() { Clipboard.text = Functions.getMessageText(messageOptionsDrawer.myMessage, true, messageOptionsDrawer.userInformation.id, true) }, - "pinMessage": function() { - if (messageOptionsDrawer.myMessage.is_pinned) { - Remorse.popupAction(page, qsTr("Message unpinned"), function() { tdLibWrapper.unpinMessage(chatPage.chatInformation.id, messageOptionsDrawer.myMessage.id); - pinnedMessageItem.requestCloseMessage(); } ); - } else { - tdLibWrapper.pinMessage(chatPage.chatInformation.id, messageOptionsDrawer.myMessage.id); - } - } - } - property var conditions: { - "copyToClipboard": function() { return true; }, - "pinMessage": function() { return canPinMessages(); } - } - - property var texts: { - "copyToClipboard": function() { return qsTr("Copy Message to Clipboard"); }, - "pinMessage": function() { return messageOptionsDrawer.myMessage.is_pinned ? qsTr("Unpin Message") : qsTr("Pin Message"); } - } - - ListElement { - elementActionName: "copyToClipboard" - } - - ListElement { - elementActionName: "pinMessage" - } - } - - header: Row { - width: parent.width - ( 4 * Theme.horizontalPageMargin) + Row { + id: drawerHeaderRow + width: parent.width - ( 2 * Theme.horizontalPageMargin) height: messageOptionsLabel.height + Theme.paddingLarge + ( chatPage.isPortrait ? ( 2 * Theme.paddingSmall ) : 0 ) anchors.horizontalCenter: parent.horizontalCenter spacing: Theme.paddingMedium Label { id: messageOptionsLabel - text: qsTr("Message Options") + text: qsTr("Additional Options") color: Theme.highlightColor font.pixelSize: Theme.fontSizeLarge width: parent.width - closeMessageOptionsButton.width - Theme.paddingMedium @@ -746,28 +723,93 @@ Page { icon.source: "image://theme/icon-m-clear" anchors.verticalCenter: parent.verticalCenter onClicked: { - messageOptionsDrawer.closeRequested(); - messageOptionsDrawer.open = false; + messageOptionsDrawer.closeDrawer(); } } } - delegate: ListItem { + Flickable { + id: drawerFlickable width: parent.width - visible: myListModel.actions[conditions]() - onClicked: { - myListModel.actions[elementActionName](); - } - Label { - width: parent.width - ( 2 * Theme.horizontalPageMargin ) - text: myListModel.texts[elementActionName](); - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - horizontalAlignment: Text.AlignHCenter - } - } + height: parent.height - drawerHeaderRow.height + contentHeight: drawerContentColumn.height + clip: true + Column { + id: drawerContentColumn + width: parent.width + Repeater { + model: messageOptionsDrawer.additionalItemsModel + delegate: BackgroundItem { + width: parent.width + visible: modelData.visible + onClicked: { + modelData.action(); + messageOptionsDrawer.closeDrawer(); + } + Label { + width: parent.width - ( 2 * Theme.horizontalPageMargin ) + text: modelData.name + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + } + } + } + BackgroundItem { + width: parent.width + onClicked: { + Clipboard.text = Functions.getMessageText(messageOptionsDrawer.myMessage, true, messageOptionsDrawer.userInformation.id, true); + messageOptionsDrawer.closeDrawer(); + } + Label { + width: parent.width - ( 2 * Theme.horizontalPageMargin ) + text: qsTr("Copy Message to Clipboard") + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + } + } + BackgroundItem { + width: parent.width + visible: canPinMessages() + onClicked: { + if (messageOptionsDrawer.myMessage.is_pinned) { + Remorse.popupAction(page, qsTr("Message unpinned"), function() { tdLibWrapper.unpinMessage(chatPage.chatInformation.id, messageOptionsDrawer.myMessage.id); + pinnedMessageItem.requestCloseMessage(); } ); + } else { + tdLibWrapper.pinMessage(chatPage.chatInformation.id, messageOptionsDrawer.myMessage.id); + } + messageOptionsDrawer.closeDrawer(); + } + Label { + width: parent.width - ( 2 * Theme.horizontalPageMargin ) + text: messageOptionsDrawer.myMessage.is_pinned ? qsTr("Unpin Message") : qsTr("Pin Message") + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + } + } + BackgroundItem { + width: parent.width + visible: messageOptionsDrawer.myMessage.can_be_deleted_for_all_users || (messageOptionsDrawer.myMessage.can_be_deleted_only_for_self && messageOptionsDrawer.myMessage.chat_id === chatPage.myUserId) + onClicked: { + var chatId = page.chatInformation.id; + var messageId = messageOptionsDrawer.myMessage.id; + Remorse.itemAction(messageOptionsDrawer.sourceItem, qsTr("Message deleted"), function() { tdLibWrapper.deleteMessages(chatId, [ messageId ]); }); + messageOptionsDrawer.closeDrawer(); + } + Label { + width: parent.width - ( 2 * Theme.horizontalPageMargin ) + text: qsTr("Delete Message") + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + } + } - VerticalScrollDecorator {} + } + VerticalScrollDecorator {} + } } SilicaFlickable { diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index f15679a..61604bc 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -437,11 +437,31 @@ Copy Message to Clipboard - Nachricht in die Zwischenablage kopieren + Nachricht in die Zwischenablage kopieren - Message Options - + Message unpinned + Nachricht losgeheftet + + + Unpin Message + Nachricht losheften + + + Pin Message + Nachricht anheften + + + Additional Options + Zusätzliche Optionen + + + Message deleted + Nachricht gelöscht + + + Delete Message + Nachricht löschen @@ -963,18 +983,6 @@ Edit Message Nachricht bearbeiten - - Copy Message to Clipboard - Nachricht in die Zwischenablage kopieren - - - Message deleted - Nachricht gelöscht - - - Delete Message - Nachricht löschen - You Sie @@ -987,21 +995,9 @@ Select Message Nachricht auswählen - - Pin Message - Nachricht anheften - - - Message unpinned - Nachricht losgeheftet - - - Unpin Message - Nachricht losheften - More Options... - + Mehr Optionen... diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index 4785223..5c1938c 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -437,11 +437,31 @@ Copy Message to Clipboard - Copy Message to Clipboard + Copy Message to Clipboard - Message Options - + Message unpinned + Message unpinned + + + Unpin Message + Unpin Message + + + Pin Message + Pin Message + + + Additional Options + Additional Options + + + Message deleted + Message deleted + + + Delete Message + Delete Message @@ -965,18 +985,6 @@ messages Edit Message Edit Message - - Copy Message to Clipboard - Copy Message to Clipboard - - - Message deleted - Message deleted - - - Delete Message - Delete Message - You You @@ -989,21 +997,9 @@ messages Select Message Select Message - - Pin Message - Pin Message - - - Message unpinned - Message unpinned - - - Unpin Message - Unpin Message - More Options... - + More Options... diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index aa9b741..fd979a2 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -440,9 +440,29 @@ Copiar - Message Options + Message unpinned + Mensaje desanclado + + + Unpin Message + Desanclar mensaje + + + Pin Message + Anclar mensaje + + + Additional Options + + Message deleted + Mensaje borrado + + + Delete Message + Borrar + ChatSelectionPage @@ -963,18 +983,6 @@ Edit Message Editar - - Copy Message to Clipboard - Copiar - - - Message deleted - Mensaje borrado - - - Delete Message - Borrar - You Usted @@ -987,18 +995,6 @@ Select Message Seleccionar - - Pin Message - Anclar mensaje - - - Message unpinned - Mensaje desanclado - - - Unpin Message - Desanclar mensaje - More Options... diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 093bc77..a9a4acd 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -440,9 +440,29 @@ Kopioi viesti leikepöydälle - Message Options + Message unpinned + Viestin kiinnitys poistettu + + + Unpin Message + Poista viestin kiinnitys + + + Pin Message + Kiinnitä viesti + + + Additional Options + + Message deleted + Viesti poistettu + + + Delete Message + Poista viesti + ChatSelectionPage @@ -964,18 +984,6 @@ Edit Message Muokkaa viestiä - - Copy Message to Clipboard - Kopioi viesti leikepöydälle - - - Message deleted - Viesti poistettu - - - Delete Message - Poista viesti - You Sinä @@ -988,18 +996,6 @@ Select Message Valitse viesti - - Pin Message - Kiinnitä viesti - - - Message unpinned - Viestin kiinnitys poistettu - - - Unpin Message - Poista viestin kiinnitys - More Options... diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index 31173e4..4617ee6 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -430,9 +430,29 @@ - Message Options + Message unpinned + + Unpin Message + + + + Pin Message + + + + Additional Options + + + + Message deleted + + + + Delete Message + Üzenet törlése + ChatSelectionPage @@ -949,18 +969,6 @@ Edit Message Üzenet szerkesztése - - Copy Message to Clipboard - - - - Message deleted - - - - Delete Message - Üzenet törlése - You Te @@ -973,18 +981,6 @@ Select Message - - Pin Message - - - - Message unpinned - - - - Unpin Message - - More Options... diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 366d1a7..23b9379 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -440,9 +440,29 @@ Copia messaggio nella clipboard - Message Options + Message unpinned + Messaggio non più in evidenza + + + Unpin Message + Togli messaggio in evidenza + + + Pin Message + Metti messaggio in evidenza + + + Additional Options + + Message deleted + Messaggio cancellato + + + Delete Message + Cancella messaggio + ChatSelectionPage @@ -963,18 +983,6 @@ Edit Message Modifica messaggio - - Copy Message to Clipboard - Copia messaggio nella clipboard - - - Message deleted - Messaggio cancellato - - - Delete Message - Cancella messaggio - You Tu @@ -987,18 +995,6 @@ Select Message Seleziona messaggio - - Pin Message - Metti messaggio in evidenza - - - Message unpinned - Messaggio non più in evidenza - - - Unpin Message - Togli messaggio in evidenza - More Options... diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index f0acce1..4869f04 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -450,9 +450,29 @@ Skopiuj wiadomość do schowka - Message Options + Message unpinned + Wiadomość opięta + + + Unpin Message + Odepnij wiadomość + + + Pin Message + Przypnij wiadomość + + + Additional Options + + Message deleted + Wiadomość usunięta + + + Delete Message + Usuń wiadomość + ChatSelectionPage @@ -977,18 +997,6 @@ Edit Message Edytuj widomość - - Copy Message to Clipboard - Skopiuj wiadomość do schowka - - - Message deleted - Wiadomość usunięta - - - Delete Message - Usuń wiadomość - You Ty @@ -1001,18 +1009,6 @@ Select Message Wybierz wiadomość - - Pin Message - Przypnij wiadomość - - - Message unpinned - Wiadomość odpięta - - - Unpin Message - Odepnij wiadomość - More Options... diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 84182ef..0c0b046 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -450,9 +450,29 @@ Скопировать в буфер обмена - Message Options + Message unpinned + Сообщение откреплено + + + Unpin Message + Открепить сообщение + + + Pin Message + Закрепить сообщение + + + Additional Options + + Message deleted + Сообщение удалено + + + Delete Message + Удалить + ChatSelectionPage @@ -980,18 +1000,6 @@ Edit Message Редактировать - - Copy Message to Clipboard - Скопировать в буфер обмена - - - Message deleted - Сообщение удалено - - - Delete Message - Удалить - You Вы @@ -1004,18 +1012,6 @@ Select Message Выбрать сообщение - - Pin Message - Закрепить сообщение - - - Message unpinned - Сообщение откреплено - - - Unpin Message - Открепить сообщение - More Options... diff --git a/translations/harbour-fernschreiber-sk.ts b/translations/harbour-fernschreiber-sk.ts index 56cf8f9..ce27ea6 100644 --- a/translations/harbour-fernschreiber-sk.ts +++ b/translations/harbour-fernschreiber-sk.ts @@ -450,9 +450,29 @@ Kopírovať správu do schránky - Message Options + Message unpinned + Správa bola odopnutá + + + Unpin Message + Odopnúť správu + + + Pin Message + Pripnúť správu + + + Additional Options + + Message deleted + Správa bola odstránená + + + Delete Message + Odstrániť správu + ChatSelectionPage @@ -977,18 +997,6 @@ Edit Message Upraviť správu - - Copy Message to Clipboard - Kopírovať správu do schránky - - - Message deleted - Správa bola odstránená - - - Delete Message - Odstrániť správu - You Ja @@ -1001,18 +1009,6 @@ Select Message Vybrať správu - - Pin Message - Pripnúť správu - - - Message unpinned - Správa bola odopnutá - - - Unpin Message - Odopnúť správu - More Options... diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 910c4b9..16911ce 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -440,9 +440,29 @@ Kopiera meddelandet till urklipp - Message Options + Message unpinned + Meddelandet lösgjort + + + Unpin Message + Lösgör meddelandet + + + Pin Message + Fäst meddelandet + + + Additional Options + + Message deleted + Mededelande borttaget + + + Delete Message + Ta bort meddelandet + ChatSelectionPage @@ -963,18 +983,6 @@ Edit Message Redigera meddelandet - - Copy Message to Clipboard - Kopiera meddelandet till urklipp - - - Message deleted - Mededelande borttaget - - - Delete Message - Ta bort meddelandet - You Du @@ -987,18 +995,6 @@ Select Message Markera meddelanden - - Pin Message - Fäst meddelandet - - - Message unpinned - Meddelandet lösgjort - - - Unpin Message - Lösgör meddelandet - More Options... diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 127afe2..eac8e4e 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -430,9 +430,29 @@ 复制消息到剪切板 - Message Options + Message unpinned + 已取消置顶消息 + + + Unpin Message + 取消置顶 + + + Pin Message + 置顶消息 + + + Additional Options + + Message deleted + 已删除消息 + + + Delete Message + 删除消息 + ChatSelectionPage @@ -950,18 +970,6 @@ Edit Message 编辑消息 - - Copy Message to Clipboard - 复制消息到剪切板 - - - Message deleted - 已删除消息 - - - Delete Message - 删除消息 - You @@ -974,18 +982,6 @@ Select Message 选择消息 - - Pin Message - 置顶消息 - - - Message unpinned - 已取消消息置顶 - - - Unpin Message - 取消置顶 - More Options... diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index 7160831..985cbc1 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -440,9 +440,29 @@ Copy Message to Clipboard - Message Options + Message unpinned + + Unpin Message + + + + Pin Message + + + + Additional Options + + + + Message deleted + Message deleted + + + Delete Message + Delete Message + ChatSelectionPage @@ -963,18 +983,6 @@ Edit Message Edit Message - - Copy Message to Clipboard - Copy Message to Clipboard - - - Message deleted - Message deleted - - - Delete Message - Delete Message - You You @@ -987,18 +995,6 @@ Select Message Select Message - - Pin Message - - - - Message unpinned - - - - Unpin Message - - More Options...