diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml
index 81cf572..9baf0c1 100644
--- a/qml/components/MessageListViewItem.qml
+++ b/qml/components/MessageListViewItem.qml
@@ -489,8 +489,12 @@ ListItem {
page.toggleMessageSelection(myMessage)
} else {
messageOptionsDrawer.open = false
- messageOverlayLoader.overlayMessage = messageInReplyToRow.inReplyToMessage
- messageOverlayLoader.active = true
+ if(appSettings.goToQuotedMessage) {
+ chatPage.showMessage(messageInReplyToRow.inReplyToMessage.id, true)
+ } else {
+ messageOverlayLoader.active = true
+ messageOverlayLoader.overlayMessage = messageInReplyToRow.inReplyToMessage
+ }
}
}
onPressAndHold: {
diff --git a/qml/components/settingsPage/SettingsBehavior.qml b/qml/components/settingsPage/SettingsBehavior.qml
index 18b487e..2232791 100644
--- a/qml/components/settingsPage/SettingsBehavior.qml
+++ b/qml/components/settingsPage/SettingsBehavior.qml
@@ -103,6 +103,17 @@ AccordionItem {
}
}
+ TextSwitch {
+ width: parent.columnWidth
+ checked: appSettings.goToQuotedMessage
+ text: qsTr("Go to quoted message")
+ description: qsTr("When tapping a quoted message, open it in chat instead of showing it in an overlay.")
+ automaticCheck: false
+ onClicked: {
+ appSettings.goToQuotedMessage = !checked
+ }
+ }
+
ComboBox {
id: feedbackComboBox
width: parent.columnWidth
diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml
index d6dbe80..4150c50 100644
--- a/qml/pages/ChatPage.qml
+++ b/qml/pages/ChatPage.qml
@@ -54,6 +54,7 @@ Page {
property bool iterativeInitialization: false;
property var messageToShow;
property string messageIdToShow;
+ property string messageIdToScrollTo;
readonly property bool userIsMember: ((isPrivateChat || isSecretChat) && chatInformation["@type"]) || // should be optimized
(isBasicGroup || isSuperGroup) && (
(chatGroupInformation.status["@type"] === "chatMemberStatusMember")
@@ -409,6 +410,23 @@ Page {
chatPage.focus = true;
}
+ function showMessage(messageId, initialRun) {
+ // Means we tapped a quoted message and had to load it.
+ if(initialRun) {
+ chatPage.messageIdToScrollTo = messageId
+ }
+ if (chatPage.messageIdToScrollTo && chatPage.messageIdToScrollTo != "") {
+ var index = chatModel.getMessageIndex(chatPage.messageIdToScrollTo);
+ if(index !== -1) {
+ chatPage.messageIdToScrollTo = "";
+ chatView.scrollToIndex(index);
+ } else if(initialRun) {
+ // we only want to do this once.
+ chatModel.triggerLoadHistoryForMessage(chatPage.messageIdToScrollTo)
+ }
+ }
+ }
+
Timer {
id: forwardMessagesTimer
interval: 200
@@ -657,6 +675,8 @@ Page {
if (chatView.height > chatView.contentHeight) {
Debug.log("[ChatPage] Chat content quite small...");
viewMessageTimer.queueViewMessage(chatView.count - 1);
+ } else if (chatPage.messageIdToScrollTo && chatPage.messageIdToScrollTo != "") {
+ showMessage(chatPage.messageIdToScrollTo, false)
}
chatViewCooldownTimer.restart();
chatViewStartupReadTimer.restart();
diff --git a/src/appsettings.cpp b/src/appsettings.cpp
index d63537a..6df3f38 100644
--- a/src/appsettings.cpp
+++ b/src/appsettings.cpp
@@ -32,6 +32,7 @@ namespace {
const QString KEY_NOTIFICATION_SUPPRESS_ENABLED("notificationSuppressContent");
const QString KEY_NOTIFICATION_FEEDBACK("notificationFeedback");
const QString KEY_NOTIFICATION_ALWAYS_SHOW_PREVIEW("notificationAlwaysShowPreview");
+ const QString KEY_GO_TO_QUOTED_MESSAGE("goToQuotedMessage");
const QString KEY_STORAGE_OPTIMIZER("useStorageOptimizer");
const QString KEY_INLINEBOT_LOCATION_ACCESS("allowInlineBotLocationAccess");
const QString KEY_REMAINING_INTERACTION_HINTS("remainingInteractionHints");
@@ -201,6 +202,20 @@ void AppSettings::setNotificationAlwaysShowPreview(bool enable)
}
}
+bool AppSettings::goToQuotedMessage() const
+{
+ return settings.value(KEY_GO_TO_QUOTED_MESSAGE, false).toBool();
+}
+
+void AppSettings::setGoToQuotedMessage(bool enable)
+{
+ if (goToQuotedMessage() != enable) {
+ LOG(KEY_GO_TO_QUOTED_MESSAGE << enable);
+ settings.setValue(KEY_GO_TO_QUOTED_MESSAGE, enable);
+ emit goToQuotedMessageChanged();
+ }
+}
+
bool AppSettings::storageOptimizer() const
{
return settings.value(KEY_STORAGE_OPTIMIZER, true).toBool();
diff --git a/src/appsettings.h b/src/appsettings.h
index 84e59d9..acc38b2 100644
--- a/src/appsettings.h
+++ b/src/appsettings.h
@@ -35,6 +35,7 @@ class AppSettings : public QObject {
Q_PROPERTY(bool notificationSuppressContent READ notificationSuppressContent WRITE setNotificationSuppressContent NOTIFY notificationSuppressContentChanged)
Q_PROPERTY(NotificationFeedback notificationFeedback READ notificationFeedback WRITE setNotificationFeedback NOTIFY notificationFeedbackChanged)
Q_PROPERTY(bool notificationAlwaysShowPreview READ notificationAlwaysShowPreview WRITE setNotificationAlwaysShowPreview NOTIFY notificationAlwaysShowPreviewChanged)
+ Q_PROPERTY(bool goToQuotedMessage READ goToQuotedMessage WRITE setGoToQuotedMessage NOTIFY goToQuotedMessageChanged)
Q_PROPERTY(bool storageOptimizer READ storageOptimizer WRITE setStorageOptimizer NOTIFY storageOptimizerChanged)
Q_PROPERTY(bool allowInlineBotLocationAccess READ allowInlineBotLocationAccess WRITE setAllowInlineBotLocationAccess NOTIFY allowInlineBotLocationAccessChanged)
Q_PROPERTY(int remainingInteractionHints READ remainingInteractionHints WRITE setRemainingInteractionHints NOTIFY remainingInteractionHintsChanged)
@@ -96,6 +97,9 @@ public:
bool notificationAlwaysShowPreview() const;
void setNotificationAlwaysShowPreview(bool enable);
+ bool goToQuotedMessage() const;
+ void setGoToQuotedMessage(bool enable);
+
bool storageOptimizer() const;
void setStorageOptimizer(bool enable);
@@ -135,6 +139,7 @@ signals:
void notificationSuppressContentChanged();
void notificationFeedbackChanged();
void notificationAlwaysShowPreviewChanged();
+ void goToQuotedMessageChanged();
void storageOptimizerChanged();
void allowInlineBotLocationAccessChanged();
void remainingInteractionHintsChanged();
diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp
index b4bf632..96c40ce 100644
--- a/src/chatmodel.cpp
+++ b/src/chatmodel.cpp
@@ -363,6 +363,15 @@ void ChatModel::initialize(const QVariantMap &chatInformation)
tdLibWrapper->getChatHistory(chatId, this->chatInformation.value(LAST_READ_INBOX_MESSAGE_ID).toLongLong());
}
+void ChatModel::triggerLoadHistoryForMessage(qlonglong messageId)
+{
+ if (!this->inIncrementalUpdate && !messages.isEmpty()) {
+ LOG("Trigger loading message with id..." << messageId);
+ this->inIncrementalUpdate = true;
+ this->tdLibWrapper->getChatHistory(chatId, messageId);
+ }
+}
+
void ChatModel::triggerLoadMoreHistory()
{
if (!this->inIncrementalUpdate && !messages.isEmpty()) {
@@ -400,6 +409,17 @@ QVariantMap ChatModel::getMessage(int index)
return QVariantMap();
}
+int ChatModel::getMessageIndex(qlonglong messageId)
+{
+ if (messages.size() == 0) {
+ return -1;
+ }
+ if (messageIndexMap.contains(messageId)) {
+ return messageIndexMap.value(messageId);
+ }
+ return -1;
+}
+
int ChatModel::getLastReadMessageIndex()
{
LOG("Obtaining last read message index");
diff --git a/src/chatmodel.h b/src/chatmodel.h
index bf4781f..bbf1b4a 100644
--- a/src/chatmodel.h
+++ b/src/chatmodel.h
@@ -40,12 +40,14 @@ public:
Q_INVOKABLE void clear(bool contentOnly = false);
Q_INVOKABLE void initialize(const QVariantMap &chatInformation);
Q_INVOKABLE void triggerLoadMoreHistory();
+ Q_INVOKABLE void triggerLoadHistoryForMessage(qlonglong messageId);
Q_INVOKABLE void triggerLoadMoreFuture();
Q_INVOKABLE QVariantMap getChatInformation();
Q_INVOKABLE QVariantMap getMessage(int index);
Q_INVOKABLE int getLastReadMessageIndex();
Q_INVOKABLE void setSearchQuery(const QString newSearchQuery);
+ Q_INVOKABLE int getMessageIndex(qlonglong messageId);
QVariantMap smallPhoto() const;
qlonglong getChatId() const;
diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts
index c608557..bef6175 100644
--- a/translations/harbour-fernschreiber-de.ts
+++ b/translations/harbour-fernschreiber-de.ts
@@ -1606,6 +1606,14 @@
Inhalte in Hinweisen verbergen
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts
index 3a0b0be..345cc41 100644
--- a/translations/harbour-fernschreiber-en.ts
+++ b/translations/harbour-fernschreiber-en.ts
@@ -1608,6 +1608,14 @@ messages
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts
index 3ea5669..9a3615d 100644
--- a/translations/harbour-fernschreiber-es.ts
+++ b/translations/harbour-fernschreiber-es.ts
@@ -1606,6 +1606,14 @@
Ocultar contenido a notificaciones
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts
index 7d08abb..ca6341c 100644
--- a/translations/harbour-fernschreiber-fi.ts
+++ b/translations/harbour-fernschreiber-fi.ts
@@ -1607,6 +1607,14 @@
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-fr.ts b/translations/harbour-fernschreiber-fr.ts
index 0c5097e..9cbf533 100644
--- a/translations/harbour-fernschreiber-fr.ts
+++ b/translations/harbour-fernschreiber-fr.ts
@@ -1606,6 +1606,14 @@
Masquer le contenu dans les notifications
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts
index adcf023..e07e622 100644
--- a/translations/harbour-fernschreiber-hu.ts
+++ b/translations/harbour-fernschreiber-hu.ts
@@ -1579,6 +1579,14 @@
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts
index 0ff0bfa..8920edd 100644
--- a/translations/harbour-fernschreiber-it.ts
+++ b/translations/harbour-fernschreiber-it.ts
@@ -1606,6 +1606,14 @@
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts
index 436cd14..2cf1221 100644
--- a/translations/harbour-fernschreiber-pl.ts
+++ b/translations/harbour-fernschreiber-pl.ts
@@ -1633,6 +1633,14 @@
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts
index 9006ca3..76461d8 100644
--- a/translations/harbour-fernschreiber-ru.ts
+++ b/translations/harbour-fernschreiber-ru.ts
@@ -1636,6 +1636,14 @@
Не показывать содержимое сообщений в уведомлениях
+
+
+ Переходить к цитируемому сообщению
+
+
+
+ По нажатию на цитируемое сообщение, переходить к нему в чате вместо отображения во всплывающем окне.
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-sk.ts b/translations/harbour-fernschreiber-sk.ts
index df7ec3a..bee3622 100644
--- a/translations/harbour-fernschreiber-sk.ts
+++ b/translations/harbour-fernschreiber-sk.ts
@@ -1633,6 +1633,14 @@
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts
index 92078c6..61b8abe 100644
--- a/translations/harbour-fernschreiber-sv.ts
+++ b/translations/harbour-fernschreiber-sv.ts
@@ -1606,6 +1606,14 @@
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts
index c904169..63b71e5 100644
--- a/translations/harbour-fernschreiber-zh_CN.ts
+++ b/translations/harbour-fernschreiber-zh_CN.ts
@@ -1580,6 +1580,14 @@
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts
index d816a18..d508bc5 100644
--- a/translations/harbour-fernschreiber.ts
+++ b/translations/harbour-fernschreiber.ts
@@ -1606,6 +1606,14 @@
+
+
+
+
+
+
+
+
SettingsPage