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 @@
Verlasse Chat
-
-
- Stummschaltung des Chats aufheben
-
-
-
- Chat stummschalten
-
Unbekannt
@@ -183,6 +175,14 @@
Neuer geheimer Chat
+
+
+ Stummschaltung des Chats aufheben
+
+
+
+ Chat stummschalten
+
ChatInformationTabItemMembersGroups
@@ -240,14 +240,6 @@
Sie
-
-
- Stummschaltung des Chats aufheben
-
-
-
- Chat stummschalten
-
Benutzerinfos
@@ -276,6 +268,22 @@
Entwurf
+
+
+ Chat losheften
+
+
+
+ Chat anheften
+
+
+
+ Stummschaltung des Chats aufheben
+
+
+
+ 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
-
-
- Unmute Chat
-
-
-
- Mute Chat
-
Unknown
@@ -183,6 +175,14 @@
New Secret Chat
+
+
+ Unmute Chat
+
+
+
+ Mute Chat
+
ChatInformationTabItemMembersGroups
@@ -240,14 +240,6 @@
You
-
-
- Unmute Chat
-
-
-
- Mute Chat
-
User Info
@@ -276,6 +268,22 @@
Draft
+
+
+ Unpin chat
+
+
+
+ Pin chat
+
+
+
+ Unmute 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 @@
Saliendo de la charla
-
-
- Notificar
-
-
-
- No notificar
-
Desconocido
@@ -180,6 +172,14 @@
Charla secreta
+
+
+ Notificar
+
+
+
+ No notificar
+
ChatInformationTabItemMembersGroups
@@ -237,14 +237,6 @@
Usted
-
-
- Notificar
-
-
-
- No notificar
-
Usuario
@@ -273,6 +265,22 @@
Marcar como leído
+
+
+
+
+
+
+
+
+
+
+ Notificar
+
+
+
+ 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 @@
Poistutaan keskustelusta
-
-
- Poista keskustelun vaimennus
-
-
-
- Vaimenna keskustelu
-
Tuntematon
@@ -183,6 +175,14 @@
Uusi salattu keskustelu
+
+
+ Poista keskustelun vaimennus
+
+
+
+ Vaimenna keskustelu
+
ChatInformationTabItemMembersGroups
@@ -240,14 +240,6 @@
Sinä
-
-
- Poista keskustelun vaimennus
-
-
-
- Vaimenna keskustelu
-
Käyttäjän tiedot
@@ -276,6 +268,22 @@
Merkitse keskustelu luetuksi
+
+
+
+
+
+
+
+
+
+
+ Poista keskustelun vaimennus
+
+
+
+ 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 @@
-
-
- Csevegés némítás feloldása
-
-
-
- Csevegés némítása
-
Ismeretlen
@@ -180,6 +172,14 @@
+
+
+ Csevegés némítás feloldása
+
+
+
+ Csevegés némítása
+
ChatInformationTabItemMembersGroups
@@ -237,14 +237,6 @@
Te
-
-
- Csevegés némítás feloldása
-
-
-
- Csevegés némítása
-
@@ -273,6 +265,22 @@
+
+
+
+
+
+
+
+
+
+
+ Csevegés némítás feloldása
+
+
+
+ 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 @@
Lascia chat
-
-
- Riattiva suoni chat
-
-
-
- Silenzia chat
-
Sconosciuto
@@ -183,6 +175,14 @@
Nuova chat segreta
+
+
+ Riattiva suoni chat
+
+
+
+ Silenzia chat
+
ChatInformationTabItemMembersGroups
@@ -240,14 +240,6 @@
Tu
-
-
- Riattiva suoni chat
-
-
-
- Silenzia chat
-
Info utente
@@ -276,6 +268,22 @@
+
+
+
+
+
+
+
+
+
+
+ Riattiva suoni 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
-
-
- Wyłącz wyciszenie czatu
-
-
-
- Wycisz czat
-
Nieznany
@@ -186,6 +178,14 @@
Nowy tajny czat
+
+
+ Wyłącz wyciszenie czatu
+
+
+
+ Wycisz czat
+
ChatInformationTabItemMembersGroups
@@ -243,14 +243,6 @@
Ty
-
-
- Wyłącz wyciszenie czatu
-
-
-
- Wycisz czat
-
Informacje o użytkowniku
@@ -279,6 +271,22 @@
Oznacz czat jako przeczytany
+
+
+
+
+
+
+
+
+
+
+ Wyłącz wyciszenie czatu
+
+
+
+ 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 @@
Выход из чата
-
-
- Включить уведомления
-
-
-
- Выключить уведомления
-
Неизвестный
@@ -186,6 +178,14 @@
Новый секретный чат
+
+
+ Включить уведомления
+
+
+
+ Выключить уведомления
+
ChatInformationTabItemMembersGroups
@@ -243,14 +243,6 @@
Вы
-
-
- Включить уведомления
-
-
-
- Выключить уведомления
-
Информация о пользователе
@@ -279,6 +271,22 @@
Отметить чат как прочитанный
+
+
+
+
+
+
+
+
+
+
+ Включить уведомления
+
+
+
+ Выключить уведомления
+
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 @@
Lämnar chatten
-
-
- Slå på chatten
-
-
-
- Stäng av chatten
-
Okänd
@@ -183,6 +175,14 @@
Ny hemlig chatt
+
+
+ Slå på chatten
+
+
+
+ Stäng av chatten
+
ChatInformationTabItemMembersGroups
@@ -240,14 +240,6 @@
Du
-
-
- Slå på chatten
-
-
-
- Stäng av chatten
-
Användarinfo
@@ -276,6 +268,22 @@
Markera chatten som läst
+
+
+
+
+
+
+
+
+
+
+ Slå på chatten
+
+
+
+ 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 @@
正在离开对话
-
-
- 取消对话静音
-
-
-
- 静音对话
-
未知
@@ -180,6 +172,14 @@
新加密对话
+
+
+ 取消对话静音
+
+
+
+ 静音对话
+
ChatInformationTabItemMembersGroups
@@ -237,14 +237,6 @@
你
-
-
- 取消对话静音
-
-
-
- 静音对话
-
用户信息
@@ -273,6 +265,22 @@
标记为已读
+
+
+
+
+
+
+
+
+
+
+ 取消对话静音
+
+
+
+ 静音对话
+
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
-
-
- Unmute Chat
-
-
-
- Mute Chat
-
Unknown
@@ -183,6 +175,14 @@
+
+
+ Unmute Chat
+
+
+
+ Mute Chat
+
ChatInformationTabItemMembersGroups
@@ -240,14 +240,6 @@
You
-
-
- Unmute Chat
-
-
-
- Mute Chat
-
User Info
@@ -276,6 +268,22 @@
+
+
+
+
+
+
+
+
+
+
+ Unmute chat
+
+
+
+ Mute chat
+
ChatPage