diff --git a/README.md b/README.md
index d1f8fb1..f2ae92a 100644
--- a/README.md
+++ b/README.md
@@ -46,6 +46,20 @@ Moreover, you need to have a compiled version of [TDLib 1.7](https://github.com/
In case you encounter strange performance issues on startup (several seconds delay, app seems to do nothing), please be sure to [follow the instructions from the respective GitHub issue](https://github.com/tdlib/td/issues/1322), i.e. let TDLib build SQLite with `-DOMIT_MEMLOCK` and be sure to comment the two lines 22558 (`#ifndef OMIT_MEMLOCK`) and 22567 (`#endif`) in the file `sqlite/sqlite/sqlite3.c`.
+Moreover, TDLib 1.7 has issues loading some pinned messages in case the message database is used (which is the case in Fernschreiber). [A small patch](https://github.com/tdlib/td/commit/30d912bd4b145afb8d494b307d37645ffa21ec29) is required to make TDLib work properly in all cases. See [the respective TDLib issue](https://github.com/tdlib/td/issues/1343) for more details.
+
+In case you want to use the same codebase which was used to compile the library that is shipped with Fernschreiber, please [check out the fork](https://github.com/Wunderfitz/td), be sure to use the branch `fernschreiber` and compile these sources using the following commands (be sure to have the Sailfish OS build engine running):
+
+- `alias sfdk=~/SailfishOS/bin/sfdk`
+- `sfdk config target=SailfishOS-3.3.0.16-armv7hl` (this compiles the sources on SFOS 3.3 and ARM - the target needs to be adjusted according to the running SDK engine and the platform)
+- `mkdir build`
+- `cd build`
+- `sfdk build-shell cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../tdlib -DTD_ENABLE_LTO=ON ..` (in case of compilation issues, try removing the flag `-DTD_ENABLE_LTO=ON`)
+- `sfdk build-shell cmake --build . --target install`
+
+You'll find the compiled library in the directory `td/tdlib`.
+
+
## Debug
Fernschreiber does only output a few TDLib messages by default. To get its own debug log messages, you can either run a debug build to see all of them or use the environment variable `QT_LOGGING_RULES` to specify/filter which messages you'd like to see.
diff --git a/qml/components/ChatListViewItem.qml b/qml/components/ChatListViewItem.qml
index 4644efc..9ed98f4 100644
--- a/qml/components/ChatListViewItem.qml
+++ b/qml/components/ChatListViewItem.qml
@@ -24,39 +24,57 @@ PhotoTextsListItem {
isSecret: ( chat_type === TelegramAPI.ChatTypeSecret )
openMenuOnPressAndHold: true//chat_id != overviewPage.ownUserId
- 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 {
- visible: chat_id != listItem.ownUserId
- onClicked: {
- var newNotificationSettings = display.notification_settings;
- if (newNotificationSettings.mute_for > 0) {
- newNotificationSettings.mute_for = 0;
- } else {
- newNotificationSettings.mute_for = 6666666;
- }
- newNotificationSettings.use_default_mute_for = false;
- tdLibWrapper.setChatNotificationSettings(chat_id, newNotificationSettings);
- }
- text: display.notification_settings.mute_for > 0 ? qsTr("Unmute Chat") : qsTr("Mute Chat")
- }
+ onPressAndHold: {
+ contextMenuLoader.active = true;
+ }
- MenuItem {
- onClicked: {
- if(pageStack.depth > 2) {
- pageStack.pop(pageStack.find( function(page){ return(page._depth === 0)} ), PageStackAction.Immediate);
+ Loader {
+ id: contextMenuLoader
+ active: false
+ asynchronous: true
+ onStatusChanged: {
+ if(status === Loader.Ready) {
+ listItem.menu = item;
+ listItem.openMenu();
+ }
+ }
+ sourceComponent: Component {
+ ContextMenu {
+ MenuItem {
+ visible: unread_count > 0
+ onClicked: {
+ tdLibWrapper.viewMessage(chat_id, display.last_message.id, true);
+ }
+ text: qsTr("Mark all messages as read")
}
- pageStack.push(Qt.resolvedUrl("../pages/ChatInformationPage.qml"), { "chatInformation" : display});
+ MenuItem {
+ visible: chat_id != listItem.ownUserId
+ onClicked: {
+ var newNotificationSettings = display.notification_settings;
+ if (newNotificationSettings.mute_for > 0) {
+ newNotificationSettings.mute_for = 0;
+ } else {
+ newNotificationSettings.mute_for = 6666666;
+ }
+ newNotificationSettings.use_default_mute_for = false;
+ tdLibWrapper.setChatNotificationSettings(chat_id, newNotificationSettings);
+ }
+ text: display.notification_settings.mute_for > 0 ? qsTr("Unmute Chat") : qsTr("Mute Chat")
+ }
+
+ MenuItem {
+ onClicked: {
+ if(pageStack.depth > 2) {
+ pageStack.pop(pageStack.find( function(page){ return(page._depth === 0)} ), PageStackAction.Immediate);
+ }
+
+ pageStack.push(Qt.resolvedUrl("../pages/ChatInformationPage.qml"), { "chatInformation" : display});
+ }
+ text: model.display.type['@type'] === "chatTypePrivate" ? qsTr("User Info") : qsTr("Group Info")
+ }
}
- text: model.display.type['@type'] === "chatTypePrivate" ? qsTr("User Info") : qsTr("Group Info")
}
}
diff --git a/qml/components/chatInformationPage/ChatInformationTabItemMembersGroups.qml b/qml/components/chatInformationPage/ChatInformationTabItemMembersGroups.qml
index 9c898bb..79a72db 100644
--- a/qml/components/chatInformationPage/ChatInformationTabItemMembersGroups.qml
+++ b/qml/components/chatInformationPage/ChatInformationTabItemMembersGroups.qml
@@ -154,15 +154,6 @@ ChatInformationTabItemBase {
pageStack.pop(pageStack.find( function(page){ return(page._depth === 0)} ), PageStackAction.Immediate);
pageStack.push(Qt.resolvedUrl("../../pages/ChatPage.qml"), { "chatInformation" : display });
}
- Connections {
- target: chatListModel
- onChatChanged: {
- if (changedChatId === chat_id) {
- // Force update of some list item elements (currently only last message text seems to create problems). dataChanged() doesn't seem to trigger them all :(
- secondaryText.text = last_message_text ? Emoji.emojify(Functions.enhanceHtmlEntities(last_message_text), Theme.fontSizeExtraSmall) : qsTr("Unknown")
- }
- }
- }
}
}
diff --git a/qml/pages/OverviewPage.qml b/qml/pages/OverviewPage.qml
index ffe780f..62e9342 100644
--- a/qml/pages/OverviewPage.qml
+++ b/qml/pages/OverviewPage.qml
@@ -59,13 +59,13 @@ Page {
Timer {
id: chatListCreatedTimer
- interval: 300
+ interval: 100
running: false
repeat: false
onTriggered: {
overviewPage.chatListCreated = true;
- chatListModel.redrawModel();
chatListView.scrollToTop();
+ updateSecondaryContentTimer.start();
}
}
@@ -76,6 +76,15 @@ Page {
pageStack.push(Qt.resolvedUrl("../pages/InitializationPage.qml"));
}
}
+ Timer {
+ id: updateSecondaryContentTimer
+ interval: 600
+ onTriggered: {
+ tdLibWrapper.getRecentStickers();
+ tdLibWrapper.getInstalledStickerSets();
+ tdLibWrapper.getContacts();
+ }
+ }
Timer {
id: searchChatTimer
@@ -114,9 +123,6 @@ Page {
function updateContent() {
tdLibWrapper.getChats();
- tdLibWrapper.getRecentStickers();
- tdLibWrapper.getInstalledStickerSets();
- tdLibWrapper.getContacts();
}
function initializePage() {
@@ -228,144 +234,120 @@ Page {
}
}
- Column {
- id: column
- width: parent.width
- height: parent.height
- spacing: Theme.paddingMedium
-
- Row {
- id: headerRow
- width: parent.width - Theme.horizontalPageMargin
-
- GlassItem {
- id: pageStatus
- width: Theme.itemSizeMedium
- height: Theme.itemSizeMedium
- color: "red"
- falloffRadius: 0.1
- radius: 0.2
- cache: false
- }
-
- PageHeader {
- id: pageHeader
- title: qsTr("Fernschreiber")
- width: visible ? ( parent.width - pageStatus.width - searchChatButton.width ) : 0
- opacity: visible ? 1 : 0
- Behavior on opacity { NumberAnimation {} }
- }
-
- IconButton {
- id: searchChatButton
- width: visible ? height : 0
- opacity: visible ? 1 : 0
- Behavior on opacity { NumberAnimation {} }
- anchors.verticalCenter: parent.verticalCenter
- icon {
- source: "image://theme/icon-m-search?" + Theme.highlightColor
- asynchronous: true
- }
- visible: overviewPage.connectionState === TelegramAPI.ConnectionReady
- onClicked: {
- chatSearchField.focus = true;
- chatSearchField.visible = true;
- pageHeader.visible = false;
- searchChatButton.visible = false;
- }
- }
-
- SearchField {
- id: chatSearchField
- visible: false
- opacity: visible ? 1 : 0
- Behavior on opacity { NumberAnimation {} }
- width: visible ? ( parent.width - pageStatus.width ) : 0
- height: pageHeader.height
- placeholderText: qsTr("Search a chat...")
- active: searchHeaderItem.visible
-
- onTextChanged: {
- searchChatTimer.restart();
- }
-
- EnterKey.iconSource: "image://theme/icon-m-enter-close"
- EnterKey.onClicked: {
- resetFocus();
- }
- }
+ Row {
+ id: headerRow
+ width: parent.width - Theme.horizontalPageMargin
+ GlassItem {
+ id: pageStatus
+ width: Theme.itemSizeMedium
+ height: Theme.itemSizeMedium
+ color: "red"
+ falloffRadius: 0.1
+ radius: 0.2
+ cache: false
}
- Item {
- id: chatListItem
- width: parent.width
- height: parent.height - Theme.paddingMedium - headerRow.height
+ PageHeader {
+ id: pageHeader
+ title: qsTr("Fernschreiber")
+ width: visible ? ( parent.width - pageStatus.width - searchChatButton.width ) : 0
+ opacity: visible ? 1 : 0
+ Behavior on opacity { FadeAnimation {} }
+ }
- SilicaListView {
+ IconButton {
+ id: searchChatButton
+ width: visible ? height : 0
+ opacity: visible ? 1 : 0
+ Behavior on opacity { NumberAnimation {} }
+ anchors.verticalCenter: parent.verticalCenter
+ icon {
+ source: "image://theme/icon-m-search?" + Theme.highlightColor
+ asynchronous: true
+ }
+ visible: overviewPage.connectionState === TelegramAPI.ConnectionReady
+ onClicked: {
+ chatSearchField.focus = true;
+ chatSearchField.visible = true;
+ pageHeader.visible = false;
+ searchChatButton.visible = false;
+ }
+ }
- id: chatListView
+ SearchField {
+ id: chatSearchField
+ visible: false
+ opacity: visible ? 1 : 0
+ Behavior on opacity { FadeAnimation {} }
+ width: visible ? ( parent.width - pageStatus.width ) : 0
+ height: pageHeader.height
+ placeholderText: qsTr("Search a chat...")
+ active: searchHeaderItem.visible
- anchors.fill: parent
-
- clip: true
- opacity: overviewPage.chatListCreated ? 1 : 0
- Behavior on opacity { NumberAnimation {} }
-
- model: chatSearchField.text !== "" ? chatListProxyModel : chatListModel
- delegate: ChatListViewItem {
- ownUserId: overviewPage.ownUserId
- isVerified: is_verified
-
- onClicked: {
- pageStack.push(Qt.resolvedUrl("../pages/ChatPage.qml"), {
- chatInformation : display,
- chatPicture: photo_small
- })
- }
-
- Connections {
- target: chatListModel
- onChatChanged: {
- if (overviewPage.chatListCreated && changedChatId === chat_id) {
- // Force update of some list item elements (currently only last message text seems to create problems). dataChanged() doesn't seem to trigger them all :(
- secondaryText.text = last_message_text ? Emoji.emojify(Functions.enhanceHtmlEntities(last_message_text), Theme.fontSizeExtraSmall) : qsTr("Unknown")
- }
- }
- }
- }
-
- ViewPlaceholder {
- enabled: chatListView.count === 0
- text: qsTr("You don't have any chats yet.")
- }
-
- VerticalScrollDecorator {}
+ onTextChanged: {
+ searchChatTimer.restart();
}
- Column {
- width: parent.width
- height: loadingLabel.height + loadingBusyIndicator.height + Theme.paddingMedium
- spacing: Theme.paddingMedium
- anchors.verticalCenter: parent.verticalCenter
-
- opacity: overviewPage.chatListCreated ? 0 : 1
- Behavior on opacity { NumberAnimation {} }
- visible: !overviewPage.chatListCreated
-
- InfoLabel {
- id: loadingLabel
- text: qsTr("Loading chat list...")
- }
-
- BusyIndicator {
- id: loadingBusyIndicator
- anchors.horizontalCenter: parent.horizontalCenter
- running: !overviewPage.chatListCreated
- size: BusyIndicatorSize.Large
- }
+ EnterKey.iconSource: "image://theme/icon-m-enter-close"
+ EnterKey.onClicked: {
+ resetFocus();
}
}
+
+ }
+
+ SilicaListView {
+ id: chatListView
+ anchors {
+ top: headerRow.bottom
+ bottom: parent.bottom
+ left: parent.left
+ right: parent.right
+ }
+ clip: true
+ opacity: overviewPage.chatListCreated ? 1 : 0
+ Behavior on opacity { FadeAnimation {} }
+ model: chatSearchField.text !== "" ? chatListProxyModel : chatListModel
+ delegate: ChatListViewItem {
+ ownUserId: overviewPage.ownUserId
+ isVerified: is_verified
+ onClicked: {
+ pageStack.push(Qt.resolvedUrl("../pages/ChatPage.qml"), {
+ chatInformation : display,
+ chatPicture: photo_small
+ })
+ }
+ }
+
+ ViewPlaceholder {
+ enabled: chatListView.count === 0
+ text: qsTr("You don't have any chats yet.")
+ }
+
+ VerticalScrollDecorator {}
+ }
+
+ Column {
+ width: parent.width
+ spacing: Theme.paddingMedium
+ anchors.verticalCenter: chatListView.verticalCenter
+
+ opacity: overviewPage.chatListCreated ? 0 : 1
+ Behavior on opacity { FadeAnimation {} }
+ visible: !overviewPage.chatListCreated
+
+ InfoLabel {
+ id: loadingLabel
+ text: qsTr("Loading chat list...")
+ }
+
+ BusyIndicator {
+ id: loadingBusyIndicator
+ anchors.horizontalCenter: parent.horizontalCenter
+ running: !overviewPage.chatListCreated
+ size: BusyIndicatorSize.Large
+ }
}
}
}
diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp
index 5e3ed51..42223a1 100644
--- a/src/tdlibwrapper.cpp
+++ b/src/tdlibwrapper.cpp
@@ -1300,15 +1300,8 @@ void TDLibWrapper::handleMessageInformation(const QString &messageId, const QVar
QString extraInformation = receivedInformation.value(_EXTRA).toString();
if (extraInformation.startsWith("getChatPinnedMessage")) {
emit chatPinnedMessageUpdated(receivedInformation.value(CHAT_ID).toLongLong(), messageId.toLongLong());
- // Sometimes it seems that pinned messages aren't returned as pinned ones, weird!
- // This is a workaround for now, let's see what comes out of https://github.com/tdlib/td/issues/1343
- QVariantMap updatedInformation(receivedInformation);
- updatedInformation.insert("is_pinned", true);
- emit receivedMessage(messageId, updatedInformation);
- } else {
- emit receivedMessage(messageId, receivedInformation);
}
-
+ emit receivedMessage(messageId, receivedInformation);
}
void TDLibWrapper::handleMessageIsPinnedUpdated(qlonglong chatId, qlonglong messageId, bool isPinned)
diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts
index f212b53..5e97037 100644
--- a/translations/harbour-fernschreiber-de.ts
+++ b/translations/harbour-fernschreiber-de.ts
@@ -195,10 +195,6 @@
chats you have in common with a user
Lade gemeinsame Chats…
-
-
- Unbekannt
-
Lade Gruppenmitglieder…
@@ -1014,10 +1010,6 @@
Aktualisiere Inhalte...
-
-
- Unbekannt
-
Lade Chatliste...
diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts
index e449318..3ec3f7f 100644
--- a/translations/harbour-fernschreiber-en.ts
+++ b/translations/harbour-fernschreiber-en.ts
@@ -191,10 +191,6 @@
chats you have in common with a user
Loading common chats…
-
-
- Unknown
-
Loading group members…
@@ -1014,10 +1010,6 @@
Updating content...
-
-
- Unknown
-
Loading chat list...
diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts
index 6217def..0e89436 100644
--- a/translations/harbour-fernschreiber-es.ts
+++ b/translations/harbour-fernschreiber-es.ts
@@ -188,10 +188,6 @@
chats you have in common with a user
Cargando las charlas comunes…
-
-
- Desconocido
-
Cargando miembros del grupo…
@@ -1003,10 +999,6 @@
Actualizando contenido...
-
-
- desconocido
-
cargando lista de charla...
diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts
index 3130d42..871dce3 100644
--- a/translations/harbour-fernschreiber-fi.ts
+++ b/translations/harbour-fernschreiber-fi.ts
@@ -191,10 +191,6 @@
chats you have in common with a user
Ladataan yhteisiä keskusteluja...
-
-
- Tuntematon
-
Ladataan ryhmän jäseniä...
@@ -1015,10 +1011,6 @@
Päivitetään sisältöä...
-
-
- Tuntematon
-
Ladataan keskustelulistaa...
diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts
index 7308f5f..b44ac76 100644
--- a/translations/harbour-fernschreiber-hu.ts
+++ b/translations/harbour-fernschreiber-hu.ts
@@ -188,10 +188,6 @@
chats you have in common with a user
-
-
- Ismeretlen
-
@@ -1003,10 +999,6 @@
Tartalom frissítése...
-
-
- Ismeretlen
-
Csevegés lista betöltése...
diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts
index 5880996..c19d412 100644
--- a/translations/harbour-fernschreiber-it.ts
+++ b/translations/harbour-fernschreiber-it.ts
@@ -190,10 +190,6 @@
Tu
-
-
- Sconosciuto
-
Non hai nessun gruppo in comune con questo utente.
@@ -998,10 +994,6 @@
Fernschreiber
-
-
- Sconosciuto
-
Impostazioni
diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts
index e933f03..68d58b3 100644
--- a/translations/harbour-fernschreiber-pl.ts
+++ b/translations/harbour-fernschreiber-pl.ts
@@ -194,10 +194,6 @@
chats you have in common with a user
Ładowanie wspólnych czatów...
-
-
- Nieznany
-
Ładowanie członków grupy
@@ -1025,10 +1021,6 @@
Aktualizacja treści...
-
-
- Nieznany
-
Ładowanie listy czatu...
diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts
index b53cb0a..8e1ee21 100644
--- a/translations/harbour-fernschreiber-ru.ts
+++ b/translations/harbour-fernschreiber-ru.ts
@@ -194,10 +194,6 @@
chats you have in common with a user
Загрузка общих чатов…
-
-
- нет информации
-
Загрузка списка участников…
@@ -1025,10 +1021,6 @@
Обновление контента...
-
-
- Неизвестный
-
Загрузка чатов...
diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts
index fcbfa98..174b53b 100644
--- a/translations/harbour-fernschreiber-sv.ts
+++ b/translations/harbour-fernschreiber-sv.ts
@@ -191,10 +191,6 @@
chats you have in common with a user
Läser in gemensamma chattar...
-
-
- Okänd
-
Läser in gruppmedlemmar...
@@ -1014,10 +1010,6 @@
Uppdaterar innehåll...
-
-
- Okänd
-
Läser in chattlistan...
diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts
index 403e409..f3c7d1d 100644
--- a/translations/harbour-fernschreiber-zh_CN.ts
+++ b/translations/harbour-fernschreiber-zh_CN.ts
@@ -188,10 +188,6 @@
chats you have in common with a user
正在加载共有对话…
-
-
- 未知
-
正在加载群组成员…
@@ -1003,10 +999,6 @@
正在更新内容…
-
-
- 未知
-
正在加载对话列表…
diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts
index fd91a8d..cf0789a 100644
--- a/translations/harbour-fernschreiber.ts
+++ b/translations/harbour-fernschreiber.ts
@@ -191,10 +191,6 @@
chats you have in common with a user
Loading common chats…
-
-
- Unknown
-
Loading group members…
@@ -1014,10 +1010,6 @@
Updating content...
-
-
- Unknown
-
Loading chat list...