Merge pull request #94 from jgibbon/feature/mark-as-read
implement "mark all messages as read" MenuItem
This commit is contained in:
commit
020b076584
13 changed files with 49 additions and 5 deletions
|
@ -25,6 +25,14 @@ PhotoTextsListItem {
|
|||
|
||||
openMenuOnPressAndHold: true//chat_id != overviewPage.ownUserId
|
||||
menu: ContextMenu {
|
||||
MenuItem {
|
||||
visible: unread_count > 0
|
||||
onClicked: {
|
||||
tdLibWrapper.viewMessage(chat_id, display.last_message.id, true);
|
||||
}
|
||||
text: qsTr("Mark all messages as read")
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
visible: chat_id != listItem.ownUserId
|
||||
onClicked: {
|
||||
|
|
|
@ -290,7 +290,7 @@ Page {
|
|||
chatPage.loading = false;
|
||||
if (chatView.height > chatView.contentHeight) {
|
||||
console.log("[ChatPage] Chat content quite small...");
|
||||
tdLibWrapper.viewMessage(chatInformation.id, chatModel.getMessage(chatView.count - 1).id);
|
||||
tdLibWrapper.viewMessage(chatInformation.id, chatModel.getMessage(chatView.count - 1).id, false);
|
||||
}
|
||||
}
|
||||
onNewMessageReceived: {
|
||||
|
@ -498,7 +498,7 @@ Page {
|
|||
|
||||
function handleScrollPositionChanged() {
|
||||
console.log("Current position: " + chatView.contentY);
|
||||
tdLibWrapper.viewMessage(chatInformation.id, chatView.itemAt(chatView.contentX, ( chatView.contentY + chatView.height - Theme.horizontalPageMargin )).myMessage.id);
|
||||
tdLibWrapper.viewMessage(chatInformation.id, chatView.itemAt(chatView.contentX, ( chatView.contentY + chatView.height - Theme.horizontalPageMargin )).myMessage.id, false);
|
||||
}
|
||||
|
||||
onContentYChanged: {
|
||||
|
|
|
@ -258,13 +258,13 @@ void TDLibWrapper::getChatHistory(const QString &chatId, const qlonglong &fromMe
|
|||
this->sendRequest(requestObject);
|
||||
}
|
||||
|
||||
void TDLibWrapper::viewMessage(const QString &chatId, const QString &messageId)
|
||||
void TDLibWrapper::viewMessage(const QString &chatId, const QString &messageId, const bool &force = false)
|
||||
{
|
||||
LOG("Mark message as viewed" << chatId << messageId);
|
||||
QVariantMap requestObject;
|
||||
requestObject.insert(_TYPE, "viewMessages");
|
||||
requestObject.insert("chat_id", chatId);
|
||||
requestObject.insert("force_read", false);
|
||||
requestObject.insert("force_read", force);
|
||||
QVariantList messageIds;
|
||||
messageIds.append(messageId);
|
||||
requestObject.insert("message_ids", messageIds);
|
||||
|
|
|
@ -115,7 +115,7 @@ public:
|
|||
Q_INVOKABLE void closeChat(const QString &chatId);
|
||||
Q_INVOKABLE void leaveChat(const QString &chatId);
|
||||
Q_INVOKABLE void getChatHistory(const QString &chatId, const qlonglong &fromMessageId = 0, const int &offset = 0, const int &limit = 50, const bool &onlyLocal = false);
|
||||
Q_INVOKABLE void viewMessage(const QString &chatId, const QString &messageId);
|
||||
Q_INVOKABLE void viewMessage(const QString &chatId, const QString &messageId, const bool &force);
|
||||
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");
|
||||
|
|
|
@ -226,6 +226,10 @@
|
|||
<source>Group Info</source>
|
||||
<translation>Gruppeninfos</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Mark all messages as read</source>
|
||||
<translation>Nachrichten als gelesen markieren</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ChatPage</name>
|
||||
|
|
|
@ -226,6 +226,10 @@
|
|||
<source>Group Info</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Mark all messages as read</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ChatPage</name>
|
||||
|
|
|
@ -226,6 +226,10 @@
|
|||
<source>Group Info</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Mark all messages as read</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ChatPage</name>
|
||||
|
|
|
@ -226,6 +226,10 @@
|
|||
<source>Group Info</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Mark all messages as read</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ChatPage</name>
|
||||
|
|
|
@ -226,6 +226,10 @@
|
|||
<source>Group Info</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Mark all messages as read</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ChatPage</name>
|
||||
|
|
|
@ -226,6 +226,10 @@
|
|||
<source>Group Info</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Mark all messages as read</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ChatPage</name>
|
||||
|
|
|
@ -226,6 +226,10 @@
|
|||
<source>Group Info</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Mark all messages as read</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ChatPage</name>
|
||||
|
|
|
@ -226,6 +226,10 @@
|
|||
<source>Group Info</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Mark all messages as read</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ChatPage</name>
|
||||
|
|
|
@ -226,6 +226,10 @@
|
|||
<source>Group Info</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Mark all messages as read</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ChatPage</name>
|
||||
|
|
Loading…
Reference in a new issue