diff --git a/qml/components/ChatListViewItem.qml b/qml/components/ChatListViewItem.qml index 4090989..b05f364 100644 --- a/qml/components/ChatListViewItem.qml +++ b/qml/components/ChatListViewItem.qml @@ -55,19 +55,18 @@ PhotoTextsListItem { } MenuItem { - visible: unread_count === 0 && !is_marked_as_unread + visible: unread_count === 0 onClicked: { - tdLibWrapper.toggleChatIsMarkedAsUnread(chat_id, true); + tdLibWrapper.toggleChatIsMarkedAsUnread(chat_id, !is_marked_as_unread); } - text: qsTr("Mark chat as unread") + text: is_marked_as_unread ? qsTr("Mark chat as read") : qsTr("Mark chat as unread") } MenuItem { - visible: unread_count === 0 && is_marked_as_unread onClicked: { - tdLibWrapper.toggleChatIsMarkedAsUnread(chat_id, false); + tdLibWrapper.toggleChatIsPinned(chat_id, !is_pinned); } - text: qsTr("Mark chat as read") + text: is_pinned ? qsTr("Unpin chat") : qsTr("Pin chat") } MenuItem { @@ -82,7 +81,7 @@ PhotoTextsListItem { newNotificationSettings.use_default_mute_for = false; tdLibWrapper.setChatNotificationSettings(chat_id, newNotificationSettings); } - text: display.notification_settings.mute_for > 0 ? qsTr("Unmute Chat") : qsTr("Mute Chat") + text: display.notification_settings.mute_for > 0 ? qsTr("Unmute chat") : qsTr("Mute chat") } MenuItem { diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index f3e3329..ffa0b5e 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -47,8 +47,10 @@ namespace { const QString USERNAME("username"); const QString THREAD_ID("thread_id"); const QString VALUE("value"); + const QString CHAT_LIST_TYPE("chat_list_type"); const QString _TYPE("@type"); const QString _EXTRA("@extra"); + const QString CHAT_LIST_MAIN("chatListMain"); } TDLibWrapper::TDLibWrapper(AppSettings *appSettings, MceInterface *mceInterface, QObject *parent) : QObject(parent), joinChatRequested(false) @@ -1035,6 +1037,20 @@ void TDLibWrapper::toggleChatIsMarkedAsUnread(qlonglong chatId, bool isMarkedAsU this->sendRequest(requestObject); } +void TDLibWrapper::toggleChatIsPinned(qlonglong chatId, bool isPinned) +{ + LOG("Toggle chat is pinned" << chatId << isPinned); + QVariantMap requestObject; + requestObject.insert(_TYPE, "toggleChatIsPinned"); + QVariantMap chatListMap; + chatListMap.insert(_TYPE, CHAT_LIST_MAIN); + requestObject.insert("chat_list", chatListMap); + requestObject.insert(CHAT_ID, chatId); + requestObject.insert("is_pinned", isPinned); + requestObject.insert("is_marked_as_unread", isPinned); + this->sendRequest(requestObject); +} + void TDLibWrapper::setChatDraftMessage(qlonglong chatId, qlonglong threadId, qlonglong replyToMessageId, const QString &draft) { LOG("Set Draft Message" << chatId); @@ -1345,7 +1361,7 @@ void TDLibWrapper::handleChatReceived(const QVariantMap &chatInformation) void TDLibWrapper::handleUnreadMessageCountUpdated(const QVariantMap &messageCountInformation) { - if (messageCountInformation.value("chat_list_type").toString() == "chatListMain") { + if (messageCountInformation.value(CHAT_LIST_TYPE).toString() == CHAT_LIST_MAIN) { this->unreadMessageInformation = messageCountInformation; emit unreadMessageCountUpdated(messageCountInformation); } @@ -1353,7 +1369,7 @@ void TDLibWrapper::handleUnreadMessageCountUpdated(const QVariantMap &messageCou void TDLibWrapper::handleUnreadChatCountUpdated(const QVariantMap &chatCountInformation) { - if (chatCountInformation.value("chat_list_type").toString() == "chatListMain") { + if (chatCountInformation.value(CHAT_LIST_TYPE).toString() == CHAT_LIST_MAIN) { this->unreadChatInformation = chatCountInformation; emit unreadChatCountUpdated(chatCountInformation); } diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index c777c60..c07c761 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -185,6 +185,7 @@ public: Q_INVOKABLE void searchPublicChats(const QString &query); Q_INVOKABLE void readAllChatMentions(qlonglong chatId); Q_INVOKABLE void toggleChatIsMarkedAsUnread(qlonglong chatId, bool isMarkedAsUnread); + Q_INVOKABLE void toggleChatIsPinned(qlonglong chatId, bool isPinned); Q_INVOKABLE void setChatDraftMessage(qlonglong chatId, qlonglong threadId, qlonglong replyToMessageId, const QString &draft); // Others (candidates for extraction ;)) diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 1408d84..4e85e52 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -123,14 +123,6 @@ Leaving chat Verlasse Chat - - Unmute Chat - Stummschaltung des Chats aufheben - - - Mute Chat - Chat stummschalten - Unknown Unbekannt @@ -183,6 +175,14 @@ New Secret Chat Neuer geheimer Chat + + Unmute Chat + Stummschaltung des Chats aufheben + + + Mute Chat + Chat stummschalten + ChatInformationTabItemMembersGroups @@ -240,14 +240,6 @@ You Sie - - Unmute Chat - Stummschaltung des Chats aufheben - - - Mute Chat - Chat stummschalten - User Info Benutzerinfos @@ -276,6 +268,22 @@ Draft Entwurf + + Unpin chat + Chat losheften + + + Pin chat + Chat anheften + + + Unmute chat + Stummschaltung des Chats aufheben + + + Mute chat + Chat stummschalten + ChatPage diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index 45f24f0..76ae152 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -123,14 +123,6 @@ Leaving chat Leaving chat - - Unmute Chat - Unmute Chat - - - Mute Chat - Mute Chat - Unknown Unknown @@ -183,6 +175,14 @@ New Secret Chat New Secret Chat + + Unmute Chat + Unmute Chat + + + Mute Chat + Mute Chat + ChatInformationTabItemMembersGroups @@ -240,14 +240,6 @@ You You - - Unmute Chat - Unmute Chat - - - Mute Chat - Mute Chat - User Info User Info @@ -276,6 +268,22 @@ Draft Draft + + Unpin chat + Unpin chat + + + Pin chat + Pin chat + + + Unmute chat + Unmute chat + + + Mute chat + Mute chat + ChatPage diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 1983615..4eaa586 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -121,14 +121,6 @@ Leaving chat Saliendo de la charla - - Unmute Chat - Notificar - - - Mute Chat - No notificar - Unknown Desconocido @@ -180,6 +172,14 @@ New Secret Chat Charla secreta + + Unmute Chat + Notificar + + + Mute Chat + No notificar + ChatInformationTabItemMembersGroups @@ -237,14 +237,6 @@ You Usted - - Unmute Chat - Notificar - - - Mute Chat - No notificar - User Info Usuario @@ -273,6 +265,22 @@ Mark chat as read Marcar como leído + + Unpin chat + + + + Pin chat + + + + Unmute chat + Notificar + + + Mute chat + No notificar + ChatPage diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 5004959..478b93f 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -123,14 +123,6 @@ Leaving chat Poistutaan keskustelusta - - Unmute Chat - Poista keskustelun vaimennus - - - Mute Chat - Vaimenna keskustelu - Unknown Tuntematon @@ -183,6 +175,14 @@ New Secret Chat Uusi salattu keskustelu + + Unmute Chat + Poista keskustelun vaimennus + + + Mute Chat + Vaimenna keskustelu + ChatInformationTabItemMembersGroups @@ -240,14 +240,6 @@ You Sinä - - Unmute Chat - Poista keskustelun vaimennus - - - Mute Chat - Vaimenna keskustelu - User Info Käyttäjän tiedot @@ -276,6 +268,22 @@ Mark chat as read Merkitse keskustelu luetuksi + + Unpin chat + + + + Pin chat + + + + Unmute chat + Poista keskustelun vaimennus + + + Mute chat + Vaimenna keskustelu + ChatPage diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index 2abc351..7dcd524 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -121,14 +121,6 @@ Leaving chat - - Unmute Chat - Csevegés némítás feloldása - - - Mute Chat - Csevegés némítása - Unknown Ismeretlen @@ -180,6 +172,14 @@ New Secret Chat + + Unmute Chat + Csevegés némítás feloldása + + + Mute Chat + Csevegés némítása + ChatInformationTabItemMembersGroups @@ -237,14 +237,6 @@ You Te - - Unmute Chat - Csevegés némítás feloldása - - - Mute Chat - Csevegés némítása - User Info @@ -273,6 +265,22 @@ Mark chat as read + + Unpin chat + + + + Pin chat + + + + Unmute chat + Csevegés némítás feloldása + + + Mute chat + Csevegés némítása + ChatPage diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 8c71667..47d99df 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -123,14 +123,6 @@ Leaving chat Lascia chat - - Unmute Chat - Riattiva suoni chat - - - Mute Chat - Silenzia chat - Unknown Sconosciuto @@ -183,6 +175,14 @@ New Secret Chat Nuova chat segreta + + Unmute Chat + Riattiva suoni chat + + + Mute Chat + Silenzia chat + ChatInformationTabItemMembersGroups @@ -240,14 +240,6 @@ You Tu - - Unmute Chat - Riattiva suoni chat - - - Mute Chat - Silenzia chat - User Info Info utente @@ -276,6 +268,22 @@ Mark chat as read + + Unpin chat + + + + Pin chat + + + + Unmute chat + Riattiva suoni chat + + + Mute chat + Silenzia chat + ChatPage diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index 8170d55..e1b9901 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -97,14 +97,6 @@ ChatInformationPageContent - - Unmute Chat - Wyłącz wyciszenie czatu - - - Mute Chat - Wycisz czat - Unknown Nieznany @@ -186,6 +178,14 @@ New Secret Chat Nowy tajny czat + + Unmute Chat + Wyłącz wyciszenie czatu + + + Mute Chat + Wycisz czat + ChatInformationTabItemMembersGroups @@ -243,14 +243,6 @@ You Ty - - Unmute Chat - Wyłącz wyciszenie czatu - - - Mute Chat - Wycisz czat - User Info Informacje o użytkowniku @@ -279,6 +271,22 @@ Mark chat as read Oznacz czat jako przeczytany + + Unpin chat + + + + Pin chat + + + + Unmute chat + Wyłącz wyciszenie czatu + + + Mute chat + Wycisz czat + ChatPage diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index a38f538..cc00fbd 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -125,14 +125,6 @@ Leaving chat Выход из чата - - Unmute Chat - Включить уведомления - - - Mute Chat - Выключить уведомления - Unknown Неизвестный @@ -186,6 +178,14 @@ New Secret Chat Новый секретный чат + + Unmute Chat + Включить уведомления + + + Mute Chat + Выключить уведомления + ChatInformationTabItemMembersGroups @@ -243,14 +243,6 @@ You Вы - - Unmute Chat - Включить уведомления - - - Mute Chat - Выключить уведомления - User Info Информация о пользователе @@ -279,6 +271,22 @@ Mark chat as read Отметить чат как прочитанный + + Unpin chat + + + + Pin chat + + + + Unmute chat + Включить уведомления + + + Mute chat + Выключить уведомления + ChatPage diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 1299738..4c290f1 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -123,14 +123,6 @@ Leaving chat Lämnar chatten - - Unmute Chat - Slå på chatten - - - Mute Chat - Stäng av chatten - Unknown Okänd @@ -183,6 +175,14 @@ New Secret Chat Ny hemlig chatt + + Unmute Chat + Slå på chatten + + + Mute Chat + Stäng av chatten + ChatInformationTabItemMembersGroups @@ -240,14 +240,6 @@ You Du - - Unmute Chat - Slå på chatten - - - Mute Chat - Stäng av chatten - User Info Användarinfo @@ -276,6 +268,22 @@ Mark chat as read Markera chatten som läst + + Unpin chat + + + + Pin chat + + + + Unmute chat + Slå på chatten + + + Mute chat + Stäng av chatten + ChatPage diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index a0c6e8d..c2559d8 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -121,14 +121,6 @@ Leaving chat 正在离开对话 - - Unmute Chat - 取消对话静音 - - - Mute Chat - 静音对话 - Unknown 未知 @@ -180,6 +172,14 @@ New Secret Chat 新加密对话 + + Unmute Chat + 取消对话静音 + + + Mute Chat + 静音对话 + ChatInformationTabItemMembersGroups @@ -237,14 +237,6 @@ You - - Unmute Chat - 取消对话静音 - - - Mute Chat - 静音对话 - User Info 用户信息 @@ -273,6 +265,22 @@ Mark chat as read 标记为已读 + + Unpin chat + + + + Pin chat + + + + Unmute chat + 取消对话静音 + + + Mute chat + 静音对话 + ChatPage diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index da64793..f3bb1d2 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -123,14 +123,6 @@ Leaving chat Leaving chat - - Unmute Chat - Unmute Chat - - - Mute Chat - Mute Chat - Unknown Unknown @@ -183,6 +175,14 @@ New Secret Chat + + Unmute Chat + Unmute Chat + + + Mute Chat + Mute Chat + ChatInformationTabItemMembersGroups @@ -240,14 +240,6 @@ You You - - Unmute Chat - Unmute Chat - - - Mute Chat - Mute Chat - User Info User Info @@ -276,6 +268,22 @@ Draft + + Unpin chat + + + + Pin chat + + + + Unmute chat + Unmute chat + + + Mute chat + Mute chat + ChatPage