Add option to delete private chat, see #439

This commit is contained in:
Sebastian Wolf 2021-12-08 22:35:26 +01:00
parent c509616db9
commit 02573e8d4e
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
16 changed files with 128 additions and 0 deletions

View file

@ -837,6 +837,20 @@ Page {
PullDownMenu {
visible: chatInformation.id !== chatPage.myUserId && !stickerPickerLoader.active && !voiceNoteOverlayLoader.active && !messageOverlayLoader.active && !stickerSetOverlayLoader.active
MenuItem {
id: deleteChatMenuItem
visible: chatPage.isPrivateChat
onClicked: {
var privateChatId = chatInformation.id;
Remorse.popupAction(chatPage, qsTr("Deleting chat"), function() {
tdLibWrapper.deleteChat(privateChatId);
pageStack.pop(pageStack.find( function(page){ return(page._depth === 0)} ));
}, 10000);
}
text: qsTr("Delete Chat")
}
MenuItem {
id: closeSecretChatMenuItem
visible: chatPage.isSecretChat && chatPage.secretChatDetails.state["@type"] !== "secretChatStateClosed"

View file

@ -311,6 +311,15 @@ void TDLibWrapper::leaveChat(const QString &chatId)
this->sendRequest(requestObject);
}
void TDLibWrapper::deleteChat(qlonglong chatId)
{
LOG("Deleting chat " << chatId);
QVariantMap requestObject;
requestObject.insert(_TYPE, "deleteChat");
requestObject.insert(CHAT_ID, chatId);
this->sendRequest(requestObject);
}
void TDLibWrapper::getChatHistory(qlonglong chatId, qlonglong fromMessageId, int offset, int limit, bool onlyLocal)
{
LOG("Retrieving chat history" << chatId << fromMessageId << offset << limit << onlyLocal);

View file

@ -156,6 +156,7 @@ public:
Q_INVOKABLE void closeChat(const QString &chatId);
Q_INVOKABLE void joinChat(const QString &chatId);
Q_INVOKABLE void leaveChat(const QString &chatId);
Q_INVOKABLE void deleteChat(qlonglong chatId);
Q_INVOKABLE void getChatHistory(qlonglong chatId, qlonglong fromMessageId = 0, int offset = -1, int limit = 50, bool onlyLocal = false);
Q_INVOKABLE void viewMessage(const QString &chatId, const QString &messageId, bool force);
Q_INVOKABLE void viewSponsoredMessage(qlonglong chatId, qlonglong messageId);

View file

@ -522,6 +522,14 @@
<source>Sponsored Message</source>
<translation>Gesponsorte Nachricht</translation>
</message>
<message>
<source>Deleting chat</source>
<translation>Lösche Chat</translation>
</message>
<message>
<source>Delete Chat</source>
<translation>Chat löschen</translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -522,6 +522,14 @@
<source>Sponsored Message</source>
<translation>Sponsored Message</translation>
</message>
<message>
<source>Deleting chat</source>
<translation>Deleting chat</translation>
</message>
<message>
<source>Delete Chat</source>
<translation>Delete Chat</translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -522,6 +522,14 @@
<source>Sponsored Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Deleting chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delete Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -522,6 +522,14 @@
<source>Sponsored Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Deleting chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delete Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -522,6 +522,14 @@
<source>Sponsored Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Deleting chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delete Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -512,6 +512,14 @@
<source>Sponsored Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Deleting chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delete Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -522,6 +522,14 @@
<source>Sponsored Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Deleting chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delete Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -532,6 +532,14 @@
<source>Sponsored Message</source>
<translation>Wiadomość sponsorowana</translation>
</message>
<message>
<source>Deleting chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delete Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -532,6 +532,14 @@
<source>Sponsored Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Deleting chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delete Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -532,6 +532,14 @@
<source>Sponsored Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Deleting chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delete Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -522,6 +522,14 @@
<source>Sponsored Message</source>
<translation>Reklammeddelande</translation>
</message>
<message>
<source>Deleting chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delete Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -512,6 +512,14 @@
<source>Sponsored Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Deleting chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delete Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -522,6 +522,14 @@
<source>Sponsored Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Deleting chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delete Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>