implement "mark all messages as read" MenuItem
contributes to #70 (doesn't mark anything as unread, though, and does not use toggleChatIsMarkedAsUnread at all)
This commit is contained in:
parent
214a6c780c
commit
6970dc3625
13 changed files with 49 additions and 5 deletions
|
@ -25,6 +25,14 @@ PhotoTextsListItem {
|
||||||
|
|
||||||
openMenuOnPressAndHold: true//chat_id != overviewPage.ownUserId
|
openMenuOnPressAndHold: true//chat_id != overviewPage.ownUserId
|
||||||
menu: ContextMenu {
|
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 {
|
MenuItem {
|
||||||
visible: chat_id != listItem.ownUserId
|
visible: chat_id != listItem.ownUserId
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
|
|
@ -290,7 +290,7 @@ Page {
|
||||||
chatPage.loading = false;
|
chatPage.loading = false;
|
||||||
if (chatView.height > chatView.contentHeight) {
|
if (chatView.height > chatView.contentHeight) {
|
||||||
console.log("[ChatPage] Chat content quite small...");
|
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: {
|
onNewMessageReceived: {
|
||||||
|
@ -498,7 +498,7 @@ Page {
|
||||||
|
|
||||||
function handleScrollPositionChanged() {
|
function handleScrollPositionChanged() {
|
||||||
console.log("Current position: " + chatView.contentY);
|
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: {
|
onContentYChanged: {
|
||||||
|
|
|
@ -258,13 +258,13 @@ void TDLibWrapper::getChatHistory(const QString &chatId, const qlonglong &fromMe
|
||||||
this->sendRequest(requestObject);
|
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);
|
LOG("Mark message as viewed" << chatId << messageId);
|
||||||
QVariantMap requestObject;
|
QVariantMap requestObject;
|
||||||
requestObject.insert(_TYPE, "viewMessages");
|
requestObject.insert(_TYPE, "viewMessages");
|
||||||
requestObject.insert("chat_id", chatId);
|
requestObject.insert("chat_id", chatId);
|
||||||
requestObject.insert("force_read", false);
|
requestObject.insert("force_read", force);
|
||||||
QVariantList messageIds;
|
QVariantList messageIds;
|
||||||
messageIds.append(messageId);
|
messageIds.append(messageId);
|
||||||
requestObject.insert("message_ids", messageIds);
|
requestObject.insert("message_ids", messageIds);
|
||||||
|
|
|
@ -115,7 +115,7 @@ public:
|
||||||
Q_INVOKABLE void closeChat(const QString &chatId);
|
Q_INVOKABLE void closeChat(const QString &chatId);
|
||||||
Q_INVOKABLE void leaveChat(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 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 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 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");
|
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>
|
<source>Group Info</source>
|
||||||
<translation>Gruppeninfos</translation>
|
<translation>Gruppeninfos</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Mark all messages as read</source>
|
||||||
|
<translation>Nachrichten als gelesen markieren</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ChatPage</name>
|
<name>ChatPage</name>
|
||||||
|
|
|
@ -226,6 +226,10 @@
|
||||||
<source>Group Info</source>
|
<source>Group Info</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Mark all messages as read</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ChatPage</name>
|
<name>ChatPage</name>
|
||||||
|
|
|
@ -226,6 +226,10 @@
|
||||||
<source>Group Info</source>
|
<source>Group Info</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Mark all messages as read</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ChatPage</name>
|
<name>ChatPage</name>
|
||||||
|
|
|
@ -226,6 +226,10 @@
|
||||||
<source>Group Info</source>
|
<source>Group Info</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Mark all messages as read</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ChatPage</name>
|
<name>ChatPage</name>
|
||||||
|
|
|
@ -226,6 +226,10 @@
|
||||||
<source>Group Info</source>
|
<source>Group Info</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Mark all messages as read</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ChatPage</name>
|
<name>ChatPage</name>
|
||||||
|
|
|
@ -226,6 +226,10 @@
|
||||||
<source>Group Info</source>
|
<source>Group Info</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Mark all messages as read</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ChatPage</name>
|
<name>ChatPage</name>
|
||||||
|
|
|
@ -226,6 +226,10 @@
|
||||||
<source>Group Info</source>
|
<source>Group Info</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Mark all messages as read</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ChatPage</name>
|
<name>ChatPage</name>
|
||||||
|
|
|
@ -226,6 +226,10 @@
|
||||||
<source>Group Info</source>
|
<source>Group Info</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Mark all messages as read</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ChatPage</name>
|
<name>ChatPage</name>
|
||||||
|
|
|
@ -226,6 +226,10 @@
|
||||||
<source>Group Info</source>
|
<source>Group Info</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Mark all messages as read</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ChatPage</name>
|
<name>ChatPage</name>
|
||||||
|
|
Loading…
Reference in a new issue