Now able to pin messages and show in-reply-to messages in overlay
This commit is contained in:
parent
541036d796
commit
b35d268b12
15 changed files with 138 additions and 43 deletions
|
@ -101,6 +101,36 @@ ListItem {
|
|||
}
|
||||
text: qsTr("Select Message")
|
||||
}
|
||||
MenuItem {
|
||||
|
||||
function amIVisible() {
|
||||
console.log("Is pin message menu visible?");
|
||||
if (page.isPrivateChat) {
|
||||
console.log("Private Chat: No!");
|
||||
return false;
|
||||
}
|
||||
if (page.chatGroupInformation.status["@type"] === "chatMemberStatusCreator") {
|
||||
console.log("Creator of this chat: Yes!");
|
||||
return true;
|
||||
}
|
||||
if (page.chatInformation.permissions.can_pin_messages) {
|
||||
console.log("All people can pin: Yes!");
|
||||
return true;
|
||||
}
|
||||
if (page.chatGroupInformation.status["@type"] === "chatMemberStatusAdministrator") {
|
||||
console.log("Admin with privileges? " + page.chatGroupInformation.status.can_pin_messages);
|
||||
return page.chatGroupInformation.status.can_pin_messages;
|
||||
}
|
||||
console.log("Something else: No!");
|
||||
return false;
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
tdLibWrapper.pinMessage(page.chatInformation.id, myMessage.id);
|
||||
}
|
||||
text: qsTr("Pin Message")
|
||||
visible: amIVisible()
|
||||
}
|
||||
MenuItem {
|
||||
onClicked: {
|
||||
var chatId = page.chatInformation.id;
|
||||
|
@ -277,11 +307,22 @@ ListItem {
|
|||
height: active ? precalculatedValues.messageInReplyToHeight : 0
|
||||
property var inReplyToMessage;
|
||||
sourceComponent: Component {
|
||||
InReplyToRow {
|
||||
id: messageInReplyToRow
|
||||
myUserId: page.myUserId
|
||||
visible: true
|
||||
inReplyToMessage: messageInReplyToLoader.inReplyToMessage
|
||||
Item {
|
||||
width: messageInReplyToRow.width
|
||||
height: messageInReplyToRow.height
|
||||
InReplyToRow {
|
||||
id: messageInReplyToRow
|
||||
myUserId: page.myUserId
|
||||
visible: true
|
||||
inReplyToMessage: messageInReplyToLoader.inReplyToMessage
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
messageOverlayLoader.overlayMessage = messageInReplyToRow.inReplyToMessage;
|
||||
messageOverlayLoader.active = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,45 +67,43 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: pinnedMessageColumn
|
||||
spacing: Theme.paddingSmall
|
||||
Item {
|
||||
width: parent.width - pinnedMessageButton.width - removePinnedMessageIconButton.width
|
||||
height: pinnedMessageColumn.height
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
Text {
|
||||
id: pinnedMessageUserText
|
||||
|
||||
Column {
|
||||
id: pinnedMessageColumn
|
||||
spacing: Theme.paddingSmall
|
||||
width: parent.width
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
font.weight: Font.ExtraBold
|
||||
color: Theme.primaryColor
|
||||
maximumLineCount: 1
|
||||
elide: Text.ElideRight
|
||||
textFormat: Text.StyledText
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
pinnedMessageItem.requestShowMessage();
|
||||
}
|
||||
|
||||
Text {
|
||||
id: pinnedMessageUserText
|
||||
|
||||
width: parent.width
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
font.weight: Font.ExtraBold
|
||||
color: Theme.primaryColor
|
||||
maximumLineCount: 1
|
||||
elide: Text.ElideRight
|
||||
textFormat: Text.StyledText
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
}
|
||||
|
||||
Text {
|
||||
id: pinnedMessageText
|
||||
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
color: Theme.primaryColor
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
textFormat: Text.StyledText
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: pinnedMessageText
|
||||
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
color: Theme.primaryColor
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
textFormat: Text.StyledText
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
pinnedMessageItem.requestShowMessage();
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
pinnedMessageItem.requestShowMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -292,6 +292,17 @@ void TDLibWrapper::viewMessage(const QString &chatId, const QString &messageId,
|
|||
this->sendRequest(requestObject);
|
||||
}
|
||||
|
||||
void TDLibWrapper::pinMessage(const QString &chatId, const QString &messageId, bool disableNotification)
|
||||
{
|
||||
LOG("Pin message to chat" << chatId << messageId << disableNotification);
|
||||
QVariantMap requestObject;
|
||||
requestObject.insert(_TYPE, "pinChatMessage");
|
||||
requestObject.insert("chat_id", chatId);
|
||||
requestObject.insert("message_id", messageId);
|
||||
requestObject.insert("disable_notification", disableNotification);
|
||||
this->sendRequest(requestObject);
|
||||
}
|
||||
|
||||
void TDLibWrapper::sendTextMessage(const QString &chatId, const QString &message, const QString &replyToMessageId)
|
||||
{
|
||||
LOG("Sending text message" << chatId << message << replyToMessageId);
|
||||
|
|
|
@ -122,6 +122,7 @@ public:
|
|||
Q_INVOKABLE void leaveChat(const QString &chatId);
|
||||
Q_INVOKABLE void getChatHistory(qlonglong chatId, const qlonglong &fromMessageId = 0, int offset = 0, int limit = 50, bool onlyLocal = false);
|
||||
Q_INVOKABLE void viewMessage(const QString &chatId, const QString &messageId, bool force);
|
||||
Q_INVOKABLE void pinMessage(const QString &chatId, const QString &messageId, bool disableNotification = false);
|
||||
Q_INVOKABLE void sendTextMessage(const QString &chatId, const QString &message, const QString &replyToMessageId = "0");
|
||||
Q_INVOKABLE void sendPhotoMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0");
|
||||
Q_INVOKABLE void sendVideoMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0");
|
||||
|
|
|
@ -839,6 +839,10 @@
|
|||
<source>Select Message</source>
|
||||
<translation>Nachricht auswählen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Pin Message</source>
|
||||
<translation>Nachricht anheften</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MessageListViewItemSimple</name>
|
||||
|
@ -851,11 +855,11 @@
|
|||
<name>MessageOverlayFlickable</name>
|
||||
<message>
|
||||
<source>You</source>
|
||||
<translation type="unfinished">Sie</translation>
|
||||
<translation>Sie</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This message was forwarded. Original author: %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Diese Nachricht wurde weitergeleitet. Ursprünglicher Autor: %1</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -912,11 +916,11 @@
|
|||
<name>PinnedMessageItem</name>
|
||||
<message>
|
||||
<source>You</source>
|
||||
<translation type="unfinished">Sie</translation>
|
||||
<translation>Sie</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Pinned Message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Angeheftete Nachricht</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
|
|
@ -839,6 +839,10 @@
|
|||
<source>Select Message</source>
|
||||
<translation>Select Message</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Pin Message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MessageListViewItemSimple</name>
|
||||
|
|
|
@ -835,6 +835,10 @@
|
|||
<source>Select Message</source>
|
||||
<translation>Seleccionar mensaje</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Pin Message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MessageListViewItemSimple</name>
|
||||
|
|
|
@ -840,6 +840,10 @@
|
|||
<source>Select Message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Pin Message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MessageListViewItemSimple</name>
|
||||
|
|
|
@ -835,6 +835,10 @@
|
|||
<source>Select Message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Pin Message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MessageListViewItemSimple</name>
|
||||
|
|
|
@ -839,6 +839,10 @@
|
|||
<source>Select Message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Pin Message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MessageListViewItemSimple</name>
|
||||
|
|
|
@ -843,6 +843,10 @@
|
|||
<source>Select Message</source>
|
||||
<translation>Wybierz wiadomość</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Pin Message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MessageListViewItemSimple</name>
|
||||
|
|
|
@ -843,6 +843,10 @@
|
|||
<source>Select Message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Pin Message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MessageListViewItemSimple</name>
|
||||
|
|
|
@ -839,6 +839,10 @@
|
|||
<source>Select Message</source>
|
||||
<translation>Välj meddelande</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Pin Message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MessageListViewItemSimple</name>
|
||||
|
|
|
@ -835,6 +835,10 @@
|
|||
<source>Select Message</source>
|
||||
<translation>选择消息</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Pin Message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MessageListViewItemSimple</name>
|
||||
|
|
|
@ -835,6 +835,10 @@
|
|||
<source>Select Message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Pin Message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MessageListViewItemSimple</name>
|
||||
|
|
Loading…
Reference in a new issue