Remorse.itemAction; content Loader height preset
This commit is contained in:
parent
1fa7192728
commit
fb5cf0d382
12 changed files with 67 additions and 49 deletions
|
@ -28,10 +28,6 @@ ApplicationWindow
|
||||||
cover: Qt.resolvedUrl("pages/CoverPage.qml")
|
cover: Qt.resolvedUrl("pages/CoverPage.qml")
|
||||||
allowedOrientations: defaultAllowedOrientations
|
allowedOrientations: defaultAllowedOrientations
|
||||||
|
|
||||||
RemorseItem {
|
|
||||||
id: deleteMessageRemorseItem
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: dBusAdaptor
|
target: dBusAdaptor
|
||||||
onPleaseOpenMessage: {
|
onPleaseOpenMessage: {
|
||||||
|
|
|
@ -517,6 +517,23 @@ Page {
|
||||||
messageVenue: "LocationPreview",
|
messageVenue: "LocationPreview",
|
||||||
messagePoll: "PollPreview"
|
messagePoll: "PollPreview"
|
||||||
})
|
})
|
||||||
|
function getContentComponentHeight(componentName, content, parentWidth) {
|
||||||
|
switch(componentName) {
|
||||||
|
case "StickerPreview": return content.sticker.height;
|
||||||
|
case "ImagePreview":
|
||||||
|
case "LocationPreview":
|
||||||
|
return parentWidth * 0.66666666; // 2 / 3;
|
||||||
|
case "VideoPreview":
|
||||||
|
return Functions.getVideoHeight(parentWidth, ( content['@type'] === "messageVideo" ) ? content.video : content.animation);
|
||||||
|
case "AudioPreview":
|
||||||
|
return parentWidth / 2;
|
||||||
|
case "DocumentPreview":
|
||||||
|
return Theme.itemSizeSmall;
|
||||||
|
case "PollPreview":
|
||||||
|
return Theme.itemSizeSmall * (4 + content.poll.options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
delegate: ListItem {
|
delegate: ListItem {
|
||||||
id: messageListItem
|
id: messageListItem
|
||||||
contentHeight: messageBackground.height + Theme.paddingMedium
|
contentHeight: messageBackground.height + Theme.paddingMedium
|
||||||
|
@ -527,7 +544,9 @@ Page {
|
||||||
property Page page: chatPage
|
property Page page: chatPage
|
||||||
|
|
||||||
property bool isOwnMessage: chatPage.myUserId === display.sender_user_id
|
property bool isOwnMessage: chatPage.myUserId === display.sender_user_id
|
||||||
|
property string extraContentComponentName: typeof display.content !== "undefined"
|
||||||
|
&& chatView.contentComponentNames.hasOwnProperty(display.content['@type']) ?
|
||||||
|
chatView.contentComponentNames[display.content['@type']] : ""
|
||||||
menu: ContextMenu {
|
menu: ContextMenu {
|
||||||
MenuItem {
|
MenuItem {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
@ -546,9 +565,10 @@ Page {
|
||||||
visible: display.can_be_edited
|
visible: display.can_be_edited
|
||||||
}
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
enabled: !deleteMessageRemorseItem.pending
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
deleteMessageRemorseItem.execute(messageListItem, qsTr("Deleting message"), function() { tdLibWrapper.deleteMessages(chatInformation.id, [ display.id ]); } );
|
var chatId = chatInformation.id;
|
||||||
|
var messageId = display.id;
|
||||||
|
Remorse.itemAction(messageListItem, qsTr("Message deleted"), function() { tdLibWrapper.deleteMessages(chatId, [ messageId]); })
|
||||||
}
|
}
|
||||||
text: qsTr("Delete Message")
|
text: qsTr("Delete Message")
|
||||||
visible: display.can_be_deleted_for_all_users || (display.can_be_deleted_only_for_self && display.chat_id === chatPage.myUserId)
|
visible: display.can_be_deleted_for_all_users || (display.can_be_deleted_only_for_self && display.chat_id === chatPage.myUserId)
|
||||||
|
@ -604,9 +624,9 @@ Page {
|
||||||
running: false
|
running: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (typeof display.content !== "undefined") {
|
if (typeof display.content !== "undefined") {
|
||||||
if(chatView.contentComponentNames.hasOwnProperty(display.content['@type'])) {
|
if(messageListItem.extraContentComponentName !== "") {
|
||||||
extraContentLoader.setSource(
|
extraContentLoader.setSource(
|
||||||
"../components/" +chatView.contentComponentNames[display.content['@type']] +".qml",
|
"../components/" +messageListItem.extraContentComponentName +".qml",
|
||||||
{
|
{
|
||||||
messageListItem: messageListItem
|
messageListItem: messageListItem
|
||||||
})
|
})
|
||||||
|
@ -825,6 +845,8 @@ Page {
|
||||||
id: extraContentLoader
|
id: extraContentLoader
|
||||||
width: parent.width
|
width: parent.width
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
|
property int heightPreset: messageListItem.extraContentComponentName !== "" ? chatView.getContentComponentHeight(messageListItem.extraContentComponentName, display.content, width) : 0
|
||||||
|
height: item ? item.height : heightPreset
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
|
|
|
@ -281,10 +281,6 @@
|
||||||
<source>edited</source>
|
<source>edited</source>
|
||||||
<translation>bearbeitet</translation>
|
<translation>bearbeitet</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Deleting message</source>
|
|
||||||
<translation>Lösche Nachricht</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Delete Message</source>
|
<source>Delete Message</source>
|
||||||
<translation>Nachricht löschen</translation>
|
<translation>Nachricht löschen</translation>
|
||||||
|
@ -301,6 +297,10 @@
|
||||||
<source>This chat is empty.</source>
|
<source>This chat is empty.</source>
|
||||||
<translation>Dieser Chat ist leer.</translation>
|
<translation>Dieser Chat ist leer.</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Message deleted</source>
|
||||||
|
<translation>Nachricht gelöscht</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CoverPage</name>
|
<name>CoverPage</name>
|
||||||
|
|
|
@ -281,10 +281,6 @@
|
||||||
<source>edited</source>
|
<source>edited</source>
|
||||||
<translation>editado</translation>
|
<translation>editado</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Deleting message</source>
|
|
||||||
<translation>Borrando mensaje</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Delete Message</source>
|
<source>Delete Message</source>
|
||||||
<translation>Borrar</translation>
|
<translation>Borrar</translation>
|
||||||
|
@ -301,6 +297,10 @@
|
||||||
<source>This chat is empty.</source>
|
<source>This chat is empty.</source>
|
||||||
<translation>Esta charla está vacía.</translation>
|
<translation>Esta charla está vacía.</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Message deleted</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CoverPage</name>
|
<name>CoverPage</name>
|
||||||
|
|
|
@ -281,10 +281,6 @@
|
||||||
<source>edited</source>
|
<source>edited</source>
|
||||||
<translation>muokattu</translation>
|
<translation>muokattu</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Deleting message</source>
|
|
||||||
<translation>Poistetaan viestiä</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Delete Message</source>
|
<source>Delete Message</source>
|
||||||
<translation>Poista viesti</translation>
|
<translation>Poista viesti</translation>
|
||||||
|
@ -301,6 +297,10 @@
|
||||||
<source>This chat is empty.</source>
|
<source>This chat is empty.</source>
|
||||||
<translation>Tämä keskustelu on tyhjä.</translation>
|
<translation>Tämä keskustelu on tyhjä.</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Message deleted</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CoverPage</name>
|
<name>CoverPage</name>
|
||||||
|
|
|
@ -281,10 +281,6 @@
|
||||||
<source>edited</source>
|
<source>edited</source>
|
||||||
<translation>Szerkesztett</translation>
|
<translation>Szerkesztett</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Deleting message</source>
|
|
||||||
<translation>Üzenet törlése</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Delete Message</source>
|
<source>Delete Message</source>
|
||||||
<translation>Üzenet törlése</translation>
|
<translation>Üzenet törlése</translation>
|
||||||
|
@ -301,6 +297,10 @@
|
||||||
<source>This chat is empty.</source>
|
<source>This chat is empty.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Message deleted</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CoverPage</name>
|
<name>CoverPage</name>
|
||||||
|
|
|
@ -277,10 +277,6 @@
|
||||||
<source>edited</source>
|
<source>edited</source>
|
||||||
<translation>modificato</translation>
|
<translation>modificato</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Deleting message</source>
|
|
||||||
<translation>Cancellazione del messaggio</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Delete Message</source>
|
<source>Delete Message</source>
|
||||||
<translation>Cancella messaggio</translation>
|
<translation>Cancella messaggio</translation>
|
||||||
|
@ -301,6 +297,10 @@
|
||||||
<source>Uploading...</source>
|
<source>Uploading...</source>
|
||||||
<translation>Carica...</translation>
|
<translation>Carica...</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Message deleted</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CoverPage</name>
|
<name>CoverPage</name>
|
||||||
|
|
|
@ -281,10 +281,6 @@
|
||||||
<source>edited</source>
|
<source>edited</source>
|
||||||
<translation>edytowana</translation>
|
<translation>edytowana</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Deleting message</source>
|
|
||||||
<translation>Usuwanie wiadomości</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Delete Message</source>
|
<source>Delete Message</source>
|
||||||
<translation>Usuń wiadomość</translation>
|
<translation>Usuń wiadomość</translation>
|
||||||
|
@ -301,6 +297,10 @@
|
||||||
<source>This chat is empty.</source>
|
<source>This chat is empty.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Message deleted</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CoverPage</name>
|
<name>CoverPage</name>
|
||||||
|
|
|
@ -281,10 +281,6 @@
|
||||||
<source>edited</source>
|
<source>edited</source>
|
||||||
<translation>изменено</translation>
|
<translation>изменено</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Deleting message</source>
|
|
||||||
<translation>Удаление сообщения</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Delete Message</source>
|
<source>Delete Message</source>
|
||||||
<translation>Удалить</translation>
|
<translation>Удалить</translation>
|
||||||
|
@ -301,6 +297,10 @@
|
||||||
<source>This chat is empty.</source>
|
<source>This chat is empty.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Message deleted</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CoverPage</name>
|
<name>CoverPage</name>
|
||||||
|
|
|
@ -281,10 +281,6 @@
|
||||||
<source>edited</source>
|
<source>edited</source>
|
||||||
<translation>redigerade</translation>
|
<translation>redigerade</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Deleting message</source>
|
|
||||||
<translation>Tar bort meddelande</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Delete Message</source>
|
<source>Delete Message</source>
|
||||||
<translation>Ta bort meddelandet</translation>
|
<translation>Ta bort meddelandet</translation>
|
||||||
|
@ -301,6 +297,10 @@
|
||||||
<source>This chat is empty.</source>
|
<source>This chat is empty.</source>
|
||||||
<translation>Denna chatt är tom.</translation>
|
<translation>Denna chatt är tom.</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Message deleted</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CoverPage</name>
|
<name>CoverPage</name>
|
||||||
|
|
|
@ -281,10 +281,6 @@
|
||||||
<source>edited</source>
|
<source>edited</source>
|
||||||
<translation>已编辑</translation>
|
<translation>已编辑</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Deleting message</source>
|
|
||||||
<translation>正在删除消息</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Delete Message</source>
|
<source>Delete Message</source>
|
||||||
<translation>删除消息</translation>
|
<translation>删除消息</translation>
|
||||||
|
@ -301,6 +297,10 @@
|
||||||
<source>This chat is empty.</source>
|
<source>This chat is empty.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Message deleted</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CoverPage</name>
|
<name>CoverPage</name>
|
||||||
|
|
|
@ -281,10 +281,6 @@
|
||||||
<source>edited</source>
|
<source>edited</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Deleting message</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Delete Message</source>
|
<source>Delete Message</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
|
@ -301,6 +297,10 @@
|
||||||
<source>This chat is empty.</source>
|
<source>This chat is empty.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Message deleted</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CoverPage</name>
|
<name>CoverPage</name>
|
||||||
|
|
Loading…
Reference in a new issue