diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index e41a321..227fa89 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -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" diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index 02d8c56..e54d8e5 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -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); diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index 7ad16df..eadfd0c 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -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); diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 83c6ec1..43df792 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -522,6 +522,14 @@ Sponsored Message Gesponsorte Nachricht + + Deleting chat + Lösche Chat + + + Delete Chat + Chat löschen + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index a59539a..9446265 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -522,6 +522,14 @@ Sponsored Message Sponsored Message + + Deleting chat + Deleting chat + + + Delete Chat + Delete Chat + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 397f60e..04977ce 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -522,6 +522,14 @@ Sponsored Message + + Deleting chat + + + + Delete Chat + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 88d303e..d8e5fea 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -522,6 +522,14 @@ Sponsored Message + + Deleting chat + + + + Delete Chat + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-fr.ts b/translations/harbour-fernschreiber-fr.ts index 93e6422..46733a8 100644 --- a/translations/harbour-fernschreiber-fr.ts +++ b/translations/harbour-fernschreiber-fr.ts @@ -522,6 +522,14 @@ Sponsored Message + + Deleting chat + + + + Delete Chat + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index 0e245f1..02b2e10 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -512,6 +512,14 @@ Sponsored Message + + Deleting chat + + + + Delete Chat + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 1a936fe..d0760dd 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -522,6 +522,14 @@ Sponsored Message + + Deleting chat + + + + Delete Chat + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index 5df100e..8e93eab 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -532,6 +532,14 @@ Sponsored Message Wiadomość sponsorowana + + Deleting chat + + + + Delete Chat + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index dc560ae..5db2811 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -532,6 +532,14 @@ Sponsored Message + + Deleting chat + + + + Delete Chat + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-sk.ts b/translations/harbour-fernschreiber-sk.ts index db41dc3..f655cdd 100644 --- a/translations/harbour-fernschreiber-sk.ts +++ b/translations/harbour-fernschreiber-sk.ts @@ -532,6 +532,14 @@ Sponsored Message + + Deleting chat + + + + Delete Chat + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 2442809..79c16fb 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -522,6 +522,14 @@ Sponsored Message Reklammeddelande + + Deleting chat + + + + Delete Chat + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index f9e2c78..5d8c04b 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -512,6 +512,14 @@ Sponsored Message + + Deleting chat + + + + Delete Chat + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index 77fb04c..ef3bbc1 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -522,6 +522,14 @@ Sponsored Message + + Deleting chat + + + + Delete Chat + + ChatSelectionPage