diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml
index 04eb353..3e2b5fd 100644
--- a/qml/components/MessageListViewItem.qml
+++ b/qml/components/MessageListViewItem.qml
@@ -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;
+ }
+ }
}
}
}
diff --git a/qml/components/PinnedMessageItem.qml b/qml/components/PinnedMessageItem.qml
index 06ccc5e..64f042a 100644
--- a/qml/components/PinnedMessageItem.qml
+++ b/qml/components/PinnedMessageItem.qml
@@ -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();
}
}
}
diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp
index 2b85a41..800bef2 100644
--- a/src/tdlibwrapper.cpp
+++ b/src/tdlibwrapper.cpp
@@ -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);
diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h
index a33eed8..fc6ad80 100644
--- a/src/tdlibwrapper.h
+++ b/src/tdlibwrapper.h
@@ -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");
diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts
index 81d3bce..c5e6cb3 100644
--- a/translations/harbour-fernschreiber-de.ts
+++ b/translations/harbour-fernschreiber-de.ts
@@ -839,6 +839,10 @@
Nachricht auswählen
+
+
+ Nachricht anheften
+
MessageListViewItemSimple
@@ -851,11 +855,11 @@
MessageOverlayFlickable
- Sie
+ Sie
-
+ Diese Nachricht wurde weitergeleitet. Ursprünglicher Autor: %1
@@ -912,11 +916,11 @@
PinnedMessageItem
- Sie
+ Sie
-
+ Angeheftete Nachricht
diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts
index 1a1fe99..3a0487b 100644
--- a/translations/harbour-fernschreiber-en.ts
+++ b/translations/harbour-fernschreiber-en.ts
@@ -839,6 +839,10 @@
Select Message
+
+
+
+
MessageListViewItemSimple
diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts
index 204bdde..7bc6d35 100644
--- a/translations/harbour-fernschreiber-es.ts
+++ b/translations/harbour-fernschreiber-es.ts
@@ -835,6 +835,10 @@
Seleccionar mensaje
+
+
+
+
MessageListViewItemSimple
diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts
index 77c4c98..5ec3674 100644
--- a/translations/harbour-fernschreiber-fi.ts
+++ b/translations/harbour-fernschreiber-fi.ts
@@ -840,6 +840,10 @@
+
+
+
+
MessageListViewItemSimple
diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts
index f34c208..18ca9f1 100644
--- a/translations/harbour-fernschreiber-hu.ts
+++ b/translations/harbour-fernschreiber-hu.ts
@@ -835,6 +835,10 @@
+
+
+
+
MessageListViewItemSimple
diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts
index 71a1e56..393401f 100644
--- a/translations/harbour-fernschreiber-it.ts
+++ b/translations/harbour-fernschreiber-it.ts
@@ -839,6 +839,10 @@
+
+
+
+
MessageListViewItemSimple
diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts
index 5cecd1a..9925848 100644
--- a/translations/harbour-fernschreiber-pl.ts
+++ b/translations/harbour-fernschreiber-pl.ts
@@ -843,6 +843,10 @@
Wybierz wiadomość
+
+
+
+
MessageListViewItemSimple
diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts
index 1688340..719fdb9 100644
--- a/translations/harbour-fernschreiber-ru.ts
+++ b/translations/harbour-fernschreiber-ru.ts
@@ -843,6 +843,10 @@
+
+
+
+
MessageListViewItemSimple
diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts
index 132ba3c..c270c90 100644
--- a/translations/harbour-fernschreiber-sv.ts
+++ b/translations/harbour-fernschreiber-sv.ts
@@ -839,6 +839,10 @@
Välj meddelande
+
+
+
+
MessageListViewItemSimple
diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts
index aabec73..95c6435 100644
--- a/translations/harbour-fernschreiber-zh_CN.ts
+++ b/translations/harbour-fernschreiber-zh_CN.ts
@@ -835,6 +835,10 @@
选择消息
+
+
+
+
MessageListViewItemSimple
diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts
index 7154fb4..9f19869 100644
--- a/translations/harbour-fernschreiber.ts
+++ b/translations/harbour-fernschreiber.ts
@@ -835,6 +835,10 @@
+
+
+
+
MessageListViewItemSimple