Merge pull request #177 from Wunderfitz/feature-pinned-messages-57

Feature: Support pinned messages
This commit is contained in:
Sebastian Wolf 2020-11-19 11:20:08 +01:00 committed by GitHub
commit 437159714f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 915 additions and 37 deletions

View file

@ -46,6 +46,8 @@ DISTFILES += qml/harbour-fernschreiber.qml \
qml/components/LocationPreview.qml \ qml/components/LocationPreview.qml \
qml/components/MessageListViewItem.qml \ qml/components/MessageListViewItem.qml \
qml/components/MessageListViewItemSimple.qml \ qml/components/MessageListViewItemSimple.qml \
qml/components/MessageOverlayFlickable.qml \
qml/components/PinnedMessageItem.qml \
qml/components/PollPreview.qml \ qml/components/PollPreview.qml \
qml/components/StickerPicker.qml \ qml/components/StickerPicker.qml \
qml/components/PhotoTextsListItem.qml \ qml/components/PhotoTextsListItem.qml \

View file

@ -25,13 +25,14 @@ Item {
id: audioMessageComponent id: audioMessageComponent
property ListItem messageListItem property ListItem messageListItem
property var rawMessage: messageListItem.myMessage property MessageOverlayFlickable overlayFlickable
property var rawMessage: messageListItem ? messageListItem.myMessage : overlayFlickable.overlayMessage
property var audioData: ( rawMessage.content['@type'] === "messageVoiceNote" ) ? rawMessage.content.voice_note : ( ( rawMessage.content['@type'] === "messageAudio" ) ? rawMessage.content.audio : ""); property var audioData: ( rawMessage.content['@type'] === "messageVoiceNote" ) ? rawMessage.content.voice_note : ( ( rawMessage.content['@type'] === "messageAudio" ) ? rawMessage.content.audio : "");
property string audioUrl; property string audioUrl;
property int previewFileId; property int previewFileId;
property int audioFileId; property int audioFileId;
property bool onScreen: messageListItem.page.status === PageStatus.Active property bool onScreen: messageListItem ? messageListItem.page.status === PageStatus.Active : true
property string audioType : "voiceNote"; property string audioType : "voiceNote";
width: parent.width width: parent.width

View file

@ -26,7 +26,8 @@ Item {
height: Theme.itemSizeLarge height: Theme.itemSizeLarge
property ListItem messageListItem property ListItem messageListItem
property var rawMessage: messageListItem.myMessage property MessageOverlayFlickable overlayFlickable
property var rawMessage: messageListItem ? messageListItem.myMessage : overlayFlickable.overlayMessage
property var documentData: rawMessage.content.document property var documentData: rawMessage.content.document
property bool openRequested: false; property bool openRequested: false;

View file

@ -24,7 +24,8 @@ Item {
id: imagePreviewItem id: imagePreviewItem
property ListItem messageListItem property ListItem messageListItem
property var rawMessage: messageListItem.myMessage property MessageOverlayFlickable overlayFlickable
property var rawMessage: messageListItem ? messageListItem.myMessage : overlayFlickable.overlayMessage
property var photoData: rawMessage.content.photo; property var photoData: rawMessage.content.photo;
property var pictureFileInformation; property var pictureFileInformation;

View file

@ -25,11 +25,12 @@ Item {
id: imagePreviewItem id: imagePreviewItem
property ListItem messageListItem property ListItem messageListItem
property var rawMessage: messageListItem.myMessage property MessageOverlayFlickable overlayFlickable
property var rawMessage: messageListItem ? messageListItem.myMessage : overlayFlickable.overlayMessage
property var locationData : ( rawMessage.content['@type'] === "messageLocation" ) ? rawMessage.content.location : ( ( rawMessage.content['@type'] === "messageVenue" ) ? rawMessage.content.venue.location : "" ) property var locationData : ( rawMessage.content['@type'] === "messageLocation" ) ? rawMessage.content.location : ( ( rawMessage.content['@type'] === "messageVenue" ) ? rawMessage.content.venue.location : "" )
property string chatId: messageListItem.page.chatInformation.id property string chatId: rawMessage.chat_id
property var pictureFileInformation; property var pictureFileInformation;
width: parent.width width: parent.width
height: width / 2 height: width / 2

View file

@ -101,6 +101,13 @@ ListItem {
} }
text: qsTr("Select Message") text: qsTr("Select Message")
} }
MenuItem {
onClicked: {
tdLibWrapper.pinMessage(page.chatInformation.id, myMessage.id);
}
text: qsTr("Pin Message")
visible: canPinMessages()
}
MenuItem { MenuItem {
onClicked: { onClicked: {
var chatId = page.chatInformation.id; var chatId = page.chatInformation.id;
@ -277,12 +284,23 @@ ListItem {
height: active ? precalculatedValues.messageInReplyToHeight : 0 height: active ? precalculatedValues.messageInReplyToHeight : 0
property var inReplyToMessage; property var inReplyToMessage;
sourceComponent: Component { sourceComponent: Component {
Item {
width: messageInReplyToRow.width
height: messageInReplyToRow.height
InReplyToRow { InReplyToRow {
id: messageInReplyToRow id: messageInReplyToRow
myUserId: page.myUserId myUserId: page.myUserId
visible: true visible: true
inReplyToMessage: messageInReplyToLoader.inReplyToMessage inReplyToMessage: messageInReplyToLoader.inReplyToMessage
} }
MouseArea {
anchors.fill: parent
onClicked: {
messageOverlayLoader.overlayMessage = messageInReplyToRow.inReplyToMessage;
messageOverlayLoader.active = true;
}
}
}
} }
} }
@ -357,8 +375,6 @@ ListItem {
} }
} }
} }
} }
} }
} }

View file

@ -0,0 +1,219 @@
/*
Copyright (C) 2020 Sebastian J. Wolf and other contributors
This file is part of Fernschreiber.
Fernschreiber is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Fernschreiber is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import "../components"
import "../js/functions.js" as Functions
import "../js/twemoji.js" as Emoji
Flickable {
id: messageOverlayFlickable
anchors.fill: parent
boundsBehavior: Flickable.StopAtBounds
contentHeight: messageContentColumn.height
clip: true
property var overlayMessage;
property bool showHeader: true
readonly property var userInformation: tdLibWrapper.getUserInformation(overlayMessage.sender_user_id);
readonly property bool isOwnMessage: tdLibWrapper.getUserInformation().id === overlayMessage.sender_user_id;
readonly property string extraContentComponentName: (typeof overlayMessage.content !== "undefined" && typeof chatView.contentComponentNames[overlayMessage.content['@type']] !== "undefined" )
? chatView.contentComponentNames[overlayMessage.content['@type']] : ""
signal requestClose;
function getOriginalAuthor(forwardInformation, fontSize) {
switch (forwardInformation.origin["@type"]) {
case "messageForwardOriginChannel":
var otherChatInformation = tdLibWrapper.getChat(forwardInformation.origin.chat_id);
return Emoji.emojify(otherChatInformation.title, fontSize);
case "messageForwardOriginUser":
var otherUserInformation = tdLibWrapper.getUserInformation(forwardInformation.origin.sender_user_id);
return Emoji.emojify(Functions.getUserName(otherUserInformation), fontSize);
default:
return Emoji.emojify(forwardInformation.origin.sender_name, fontSize);
}
}
Component.onCompleted: {
delegateComponentLoadingTimer.start();
}
Timer {
id: delegateComponentLoadingTimer
interval: 500
repeat: false
running: false
onTriggered: {
if (typeof overlayMessage.content !== "undefined") {
if (messageOverlayFlickable.extraContentComponentName !== "") {
overlayExtraContentLoader.setSource(
"../components/" + messageOverlayFlickable.extraContentComponentName + ".qml",
{
overlayFlickable: messageOverlayFlickable
})
} else {
if (typeof overlayMessage.content.web_page !== "undefined") {
overlayWebPagePreviewLoader.active = true;
}
}
}
}
}
Rectangle {
id: messageContentBackground
color: Theme.overlayBackgroundColor
opacity: 0.7
width: parent.width
height: messageContentColumn.height >= messageOverlayFlickable.height ? messageContentColumn.height : messageOverlayFlickable.height
MouseArea {
anchors.fill: parent
onClicked: {
messageOverlayFlickable.requestClose();
}
}
}
Column {
id: messageContentColumn
spacing: Theme.paddingMedium
anchors.top: parent.top
anchors.topMargin: Theme.paddingMedium
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - ( 2 * Theme.horizontalPageMargin )
Row {
visible: messageOverlayFlickable.showHeader
width: parent.width
spacing: Theme.paddingMedium
ProfileThumbnail {
id: overlayMessagePictureThumbnail
photoData: (typeof messageOverlayFlickable.userInformation.profile_photo !== "undefined") ? messageOverlayFlickable.userInformation.profile_photo.small : ({})
replacementStringHint: overlayMessageUserText.text
width: Theme.itemSizeLarge
height: Theme.itemSizeLarge
}
Text {
id: overlayMessageUserText
width: parent.width - overlayMessagePictureThumbnail.width
anchors.verticalCenter: parent.verticalCenter
text: messageOverlayFlickable.isOwnMessage ? qsTr("You") : Emoji.emojify(Functions.getUserName(messageOverlayFlickable.userInformation), font.pixelSize)
font.pixelSize: Theme.fontSizeExtraLarge
font.weight: Font.ExtraBold
color: Theme.primaryColor
maximumLineCount: 1
elide: Text.ElideRight
textFormat: Text.StyledText
}
}
Text {
id: overlayForwardedInfoText
width: parent.width
visible: typeof overlayMessage.forward_info !== "undefined"
font.pixelSize: Theme.fontSizeSmall
font.italic: true
textFormat: Text.StyledText
color: Theme.secondaryColor
wrapMode: Text.Wrap
text: visible ? qsTr("This message was forwarded. Original author: %1").arg(getOriginalAuthor(overlayMessage.forward_info, font.pixelSize)) : ""
}
Text {
id: overlayMessageText
width: parent.width
text: Emoji.emojify(Functions.getMessageText(overlayMessage, false, messageOverlayFlickable.isOwnMessage), font.pixelSize)
font.pixelSize: Theme.fontSizeMedium
color: Theme.primaryColor
wrapMode: Text.Wrap
textFormat: Text.StyledText
onLinkActivated: {
Functions.handleLink(link);
}
linkColor: Theme.highlightColor
visible: (text !== "")
}
Loader {
id: overlayWebPagePreviewLoader
active: false
asynchronous: true
width: parent.width
sourceComponent: Component {
id: webPagePreviewComponent
WebPagePreview {
id: webPagePreview
onImplicitHeightChanged: {
webPagePreviewLoader.height = webPagePreview.implicitHeight;
}
webPageData: overlayMessage.content.web_page
largerFontSize: true
width: parent.width
}
}
}
Loader {
id: overlayExtraContentLoader
width: parent.width
asynchronous: true
}
Timer {
id: messageDateUpdater
interval: 60000
running: true
repeat: true
onTriggered: {
overlayMessageDateText.text = ( overlayMessageDateText.useElapsed ? Functions.getDateTimeElapsed(overlayMessage.date) : Functions.getDateTimeTranslated(overlayMessage.date) );
}
}
Text {
width: parent.width
property bool useElapsed: true
id: overlayMessageDateText
font.pixelSize: Theme.fontSizeExtraSmall
color: Theme.secondaryColor
text: ( useElapsed ? Functions.getDateTimeElapsed(overlayMessage.date) : Functions.getDateTimeTranslated(overlayMessage.date) )
MouseArea {
anchors.fill: parent
onClicked: {
overlayMessageDateText.useElapsed = !overlayMessageDateText.useElapsed;
overlayMessageDateText.text = ( useElapsed ? Functions.getDateTimeElapsed(overlayMessage.date) : Functions.getDateTimeTranslated(overlayMessage.date) );
}
}
}
Label {
id: separatorLabel
width: parent.width
font.pixelSize: Theme.fontSizeSmall
}
}
VerticalScrollDecorator {}
}

View file

@ -0,0 +1,143 @@
/*
Copyright (C) 2020 Sebastian J. Wolf and other contributors
This file is part of Fernschreiber.
Fernschreiber is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Fernschreiber is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import "../components"
import "../js/functions.js" as Functions
import "../js/twemoji.js" as Emoji
Item {
id: pinnedMessageItem
property var pinnedMessage;
signal requestShowMessage;
signal requestCloseMessage;
onPinnedMessageChanged: {
if (pinnedMessage) {
console.log("[ChatPage] Activating pinned message");
var messageUserText = (pinnedMessage.sender_user_id !== chatPage.myUserId) ? Emoji.emojify(Functions.getUserName(tdLibWrapper.getUserInformation(pinnedMessage.sender_user_id)), pinnedMessageUserText.font.pixelSize) : qsTr("You");
pinnedMessageUserText.text = (messageUserText === "" ? qsTr("Pinned Message") : messageUserText );
pinnedMessageText.text = Emoji.emojify(Functions.getMessageText(pinnedMessage, true, pinnedMessage.sender_user_id === chatPage.myUserId), pinnedMessageText.font.pixelSize);
pinnedMessageItem.visible = true;
} else {
pinnedMessageItem.visible = false;
}
}
visible: false
anchors.left: parent.left
anchors.right: parent.right
height: visible ? pinnedMessageRow.height : 0
Rectangle {
id: pinnedMessageBackground
anchors.fill: parent
opacity: 0.1
color: Theme.secondaryColor
}
Row {
id: pinnedMessageRow
width: parent.width
IconButton {
id: pinnedMessageButton
width: Theme.itemSizeLarge
height: Theme.itemSizeLarge
icon.source: "image://theme/icon-m-mark-unread"
onClicked: {
pinnedMessageItem.requestShowMessage();
}
}
Item {
width: parent.width - pinnedMessageButton.width - unpinMessageIconLoader.width - removePinnedMessageIconButton.width
height: pinnedMessageColumn.height
anchors.verticalCenter: parent.verticalCenter
Column {
id: pinnedMessageColumn
spacing: Theme.paddingSmall
width: parent.width
Text {
id: pinnedMessageUserText
width: parent.width
font.pixelSize: Theme.fontSizeExtraSmall
font.weight: Font.ExtraBold
color: Theme.primaryColor
maximumLineCount: 1
elide: Text.ElideRight
textFormat: Text.StyledText
horizontalAlignment: Text.AlignLeft
}
Text {
id: pinnedMessageText
font.pixelSize: Theme.fontSizeExtraSmall
color: Theme.primaryColor
width: parent.width
elide: Text.ElideRight
maximumLineCount: 1
textFormat: Text.StyledText
}
}
MouseArea {
anchors.fill: parent
onClicked: {
pinnedMessageItem.requestShowMessage();
}
}
}
Loader {
id: unpinMessageIconLoader
asynchronous: true
active: canPinMessages()
Behavior on opacity { FadeAnimation {} }
width: active ? item.width : 0
height: active ? item.height : 0
anchors.verticalCenter: parent.verticalCenter
sourceComponent: Component {
IconButton {
id: unpinMessageIconButton
icon.source: "image://theme/icon-m-remove"
onClicked: {
Remorse.itemAction(pinnedMessageRow, qsTr("Message unpinned"), function() { tdLibWrapper.unpinMessage(chatPage.chatInformation.id);
pinnedMessageItem.requestCloseMessage(); });
}
}
}
}
IconButton {
id: removePinnedMessageIconButton
icon.source: "image://theme/icon-m-clear"
anchors.verticalCenter: parent.verticalCenter
onClicked: {
pinnedMessageItem.requestCloseMessage();
pinnedMessage = undefined;
}
}
}
}

View file

@ -28,10 +28,11 @@ Item {
property ListItem messageListItem property ListItem messageListItem
property var rawMessage: messageListItem.myMessage property MessageOverlayFlickable overlayFlickable
property string chatId: messageListItem.page.chatInformation.id property var rawMessage: messageListItem ? messageListItem.myMessage : overlayFlickable.overlayMessage
property string chatId: rawMessage.chat_id
property bool isOwnMessage: messageListItem.isOwnMessage property bool isOwnMessage: messageListItem ? messageListItem.isOwnMessage : overlayFlickable.isOwnMessage
property string messageId: rawMessage.id property string messageId: rawMessage.id
property bool canEdit: rawMessage.can_be_edited property bool canEdit: rawMessage.can_be_edited

View file

@ -21,12 +21,15 @@ import Sailfish.Silica 1.0
import WerkWolf.Fernschreiber 1.0 import WerkWolf.Fernschreiber 1.0
Item { Item {
property ListItem messageListItem
readonly property var stickerData: messageListItem.myMessage.content.sticker; property ListItem messageListItem
property MessageOverlayFlickable overlayFlickable
readonly property var stickerData: messageListItem ? messageListItem.myMessage.content.sticker : overlayFlickable.overlayMessage.content.sticker;
readonly property bool animated: stickerData.is_animated && appSettings.animateStickers readonly property bool animated: stickerData.is_animated && appSettings.animateStickers
readonly property bool stickerVisible: staticStickerLoader.item ? staticStickerLoader.item.visible : readonly property bool stickerVisible: staticStickerLoader.item ? staticStickerLoader.item.visible :
animatedStickerLoader.item ? animatedStickerLoader.item.visible : false animatedStickerLoader.item ? animatedStickerLoader.item.visible : false
readonly property bool isOwnSticker : messageListItem ? messageListItem.isOwnMessage : overlayFlickable.isOwnMessage
property real aspectRatio: stickerData.width / stickerData.height property real aspectRatio: stickerData.width / stickerData.height
implicitWidth: stickerData.width implicitWidth: stickerData.width
@ -44,7 +47,7 @@ Item {
height: width * aspectRatio height: width * aspectRatio
// (centered in image mode, text-like in sticker mode) // (centered in image mode, text-like in sticker mode)
x: appSettings.showStickersAsImages ? (parent.width - width) / 2 : x: appSettings.showStickersAsImages ? (parent.width - width) / 2 :
messageListItem.isOwnMessage ? (parent.width - width) : 0 isOwnSticker ? (parent.width - width) : 0
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Loader { Loader {

View file

@ -25,19 +25,21 @@ Item {
id: videoMessageComponent id: videoMessageComponent
property ListItem messageListItem property ListItem messageListItem
property var rawMessage: messageListItem.myMessage property MessageOverlayFlickable overlayFlickable
property var rawMessage: messageListItem ? messageListItem.myMessage : overlayFlickable.overlayMessage
property var videoData: ( rawMessage.content['@type'] === "messageVideo" ) ? rawMessage.content.video : ( ( rawMessage.content['@type'] === "messageAnimation" ) ? rawMessage.content.animation : rawMessage.content.video_note ) property var videoData: ( rawMessage.content['@type'] === "messageVideo" ) ? rawMessage.content.video : ( ( rawMessage.content['@type'] === "messageAnimation" ) ? rawMessage.content.animation : rawMessage.content.video_note )
property string videoUrl; property string videoUrl;
property int previewFileId; property int previewFileId;
property int videoFileId; property int videoFileId;
property bool isVideoNote : false;
property bool fullscreen : false; property bool fullscreen : false;
property bool onScreen: messageListItem.page.status === PageStatus.Active; property bool onScreen: messageListItem ? messageListItem.page.status === PageStatus.Active : true;
property string videoType : "video"; property string videoType : "video";
property bool playRequested: false; property bool playRequested: false;
width: parent.width width: parent.width
height: ( rawMessage.content['@type'] === "messageVideoNote" ) ? width : Functions.getVideoHeight(width, videoData) height: videoMessageComponent.isVideoNote ? width : Functions.getVideoHeight(width, videoData)
Timer { Timer {
id: screensaverTimer id: screensaverTimer
@ -78,11 +80,11 @@ Item {
function updateVideoThumbnail() { function updateVideoThumbnail() {
if (videoData) { if (videoData) {
if (rawMessage.content['@type'] === "messageVideoNote") { if (typeof rawMessage !== "undefined") {
videoType = "video"; videoMessageComponent.isVideoNote = rawMessage.content['@type'] === "messageVideoNote";
} else {
videoType = videoData['@type'];
} }
videoMessageComponent.videoType = videoMessageComponent.isVideoNote ? "video" : videoData['@type'];
videoFileId = videoData[videoType].id; videoFileId = videoData[videoType].id;
if (typeof videoData.thumbnail !== "undefined") { if (typeof videoData.thumbnail !== "undefined") {
previewFileId = videoData.thumbnail.photo.id; previewFileId = videoData.thumbnail.photo.id;
@ -264,7 +266,7 @@ Item {
id: videoComponentLoader id: videoComponentLoader
active: false active: false
width: parent.width width: parent.width
height: ( rawMessage.content['@type'] === "messageVideoNote" ) ? width : Functions.getVideoHeight(parent.width, videoData) height: videoMessageComponent.isVideoNote ? width : Functions.getVideoHeight(parent.width, videoData)
sourceComponent: videoComponent sourceComponent: videoComponent
} }

View file

@ -30,6 +30,7 @@ Column {
property var webPageData; property var webPageData;
property var pictureFileInformation; property var pictureFileInformation;
property bool hasImage: false; property bool hasImage: false;
property bool largerFontSize: false;
spacing: Theme.paddingSmall spacing: Theme.paddingSmall
@ -74,7 +75,7 @@ Column {
width: parent.width width: parent.width
text: webPageData.site_name ? Emoji.emojify(webPageData.site_name, font.pixelSize) : "" text: webPageData.site_name ? Emoji.emojify(webPageData.site_name, font.pixelSize) : ""
font.pixelSize: Theme.fontSizeExtraSmall font.pixelSize: webPagePreviewColumn.largerFontSize ? Theme.fontSizeSmall : Theme.fontSizeExtraSmall
font.bold: true font.bold: true
color: Theme.secondaryHighlightColor color: Theme.secondaryHighlightColor
elide: Text.ElideRight elide: Text.ElideRight
@ -88,7 +89,7 @@ Column {
width: parent.width width: parent.width
text: webPageData.title ? Emoji.emojify(webPageData.title, font.pixelSize) : "" text: webPageData.title ? Emoji.emojify(webPageData.title, font.pixelSize) : ""
font.pixelSize: Theme.fontSizeExtraSmall font.pixelSize: webPagePreviewColumn.largerFontSize ? Theme.fontSizeSmall : Theme.fontSizeExtraSmall
font.bold: true font.bold: true
color: Theme.primaryColor color: Theme.primaryColor
elide: Text.ElideRight elide: Text.ElideRight
@ -103,7 +104,7 @@ Column {
width: parent.width width: parent.width
text: webPageData.description ? Emoji.emojify(webPageData.description, font.pixelSize) : "" text: webPageData.description ? Emoji.emojify(webPageData.description, font.pixelSize) : ""
font.pixelSize: Theme.fontSizeExtraSmall font.pixelSize: webPagePreviewColumn.largerFontSize ? Theme.fontSizeSmall : Theme.fontSizeExtraSmall
color: Theme.primaryColor color: Theme.primaryColor
elide: Text.ElideRight elide: Text.ElideRight
wrapMode: Text.Wrap wrapMode: Text.Wrap
@ -150,7 +151,7 @@ Column {
width: parent.width width: parent.width
text: qsTr("Preview not supported for this link...") text: qsTr("Preview not supported for this link...")
font.pixelSize: Theme.fontSizeTiny font.pixelSize: webPagePreviewColumn.largerFontSize ? Theme.fontSizeExtraSmall : Theme.fontSizeTiny
font.italic: true font.italic: true
color: Theme.secondaryColor color: Theme.secondaryColor
elide: Text.ElideRight elide: Text.ElideRight

View file

@ -17,6 +17,7 @@
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>. along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
*/ */
import QtQuick 2.6 import QtQuick 2.6
import QtGraphicalEffects 1.0
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
import Sailfish.Pickers 1.0 import Sailfish.Pickers 1.0
import Nemo.Thumbnailer 1.0 import Nemo.Thumbnailer 1.0
@ -145,11 +146,15 @@ Page {
updateGroupStatusText(); updateGroupStatusText();
} }
if (stickerManager.needsReload()) { if (stickerManager.needsReload()) {
console.log("Stickers will be reloaded!"); console.log("[ChatPage] Stickers will be reloaded!");
tdLibWrapper.getRecentStickers(); tdLibWrapper.getRecentStickers();
tdLibWrapper.getInstalledStickerSets(); tdLibWrapper.getInstalledStickerSets();
stickerManager.setNeedsReload(false); stickerManager.setNeedsReload(false);
} }
if (chatInformation.pinned_message_id.toString() !== "0") {
console.log("[ChatPage] Loading pinned message " + chatInformation.pinned_message_id);
tdLibWrapper.getMessage(chatInformation.id, chatInformation.pinned_message_id);
}
} }
function getMessageStatusText(message, listItemIndex, lastReadSentIndex, useElapsed) { function getMessageStatusText(message, listItemIndex, lastReadSentIndex, useElapsed) {
@ -278,6 +283,31 @@ Page {
|| groupStatusType === "chatMemberStatusCreator" || groupStatusType === "chatMemberStatusCreator"
|| (groupStatusType === "chatMemberStatusRestricted" && groupStatus.permissions[privilege]) || (groupStatusType === "chatMemberStatusRestricted" && groupStatus.permissions[privilege])
} }
function canPinMessages() {
console.log("Can we pin messages?");
if (chatPage.isPrivateChat) {
console.log("Private Chat: No!");
return false;
}
if (chatPage.chatGroupInformation.status["@type"] === "chatMemberStatusCreator") {
console.log("Creator of this chat: Yes!");
return true;
}
if (chatPage.chatInformation.permissions.can_pin_messages) {
console.log("All people can pin: Yes!");
return true;
}
if (chatPage.chatGroupInformation.status["@type"] === "chatMemberStatusAdministrator") {
console.log("Admin with privileges? " + chatPage.chatGroupInformation.status.can_pin_messages);
return chatPage.chatGroupInformation.status.can_pin_messages;
}
if (chatPage.chatGroupInformation.status["@type"] === "chatMemberStatusRestricted") {
console.log("Restricted, but can pin messages? " + chatPage.chatGroupInformation.status.permissions.can_pin_messages);
return chatPage.chatGroupInformation.status.permissions.can_pin_messages;
}
console.log("Something else: No!");
return false;
}
Timer { Timer {
id: forwardMessagesTimer id: forwardMessagesTimer
@ -359,6 +389,12 @@ Page {
onErrorReceived: { onErrorReceived: {
Functions.handleErrorMessage(code, message); Functions.handleErrorMessage(code, message);
} }
onReceivedMessage: {
if (messageId === chatInformation.pinned_message_id.toString()) {
console.log("[ChatPage] Received pinned message");
pinnedMessageItem.pinnedMessage = message;
}
}
} }
Connections { Connections {
@ -415,6 +451,15 @@ Page {
chatInformation = chatModel.getChatInformation(); chatInformation = chatModel.getChatInformation();
muteChatMenuItem.text = chatInformation.notification_settings.mute_for > 0 ? qsTr("Unmute Chat") : qsTr("Mute Chat"); muteChatMenuItem.text = chatInformation.notification_settings.mute_for > 0 ? qsTr("Unmute Chat") : qsTr("Mute Chat");
} }
onPinnedMessageChanged: {
chatInformation = chatModel.getChatInformation();
if (chatInformation.pinned_message_id.toString() !== "0") {
console.log("[ChatPage] Loading pinned message " + chatInformation.pinned_message_id);
tdLibWrapper.getMessage(chatInformation.id, chatInformation.pinned_message_id);
} else {
pinnedMessageItem.pinnedMessage = undefined;
}
}
} }
Connections { Connections {
@ -482,7 +527,7 @@ Page {
contentWidth: width contentWidth: width
PullDownMenu { PullDownMenu {
visible: chatInformation.id !== chatPage.myUserId && !stickerPickerLoader.active visible: chatInformation.id !== chatPage.myUserId && !stickerPickerLoader.active && !messageOverlayLoader.active
MenuItem { MenuItem {
id: joinLeaveChatMenuItem id: joinLeaveChatMenuItem
visible: (chatPage.isSuperGroup || chatPage.isBasicGroup) && chatGroupInformation && chatGroupInformation.status["@type"] !== "chatMemberStatusBanned" visible: (chatPage.isSuperGroup || chatPage.isBasicGroup) && chatGroupInformation && chatGroupInformation.status["@type"] !== "chatMemberStatusBanned"
@ -535,6 +580,7 @@ Page {
} }
} }
} }
Column { Column {
id: chatColumn id: chatColumn
width: parent.width width: parent.width
@ -589,10 +635,22 @@ Page {
} }
} }
PinnedMessageItem {
id: pinnedMessageItem
onRequestShowMessage: {
messageOverlayLoader.overlayMessage = pinnedMessageItem.pinnedMessage;
messageOverlayLoader.active = true;
}
onRequestCloseMessage: {
messageOverlayLoader.overlayMessage = undefined;
messageOverlayLoader.active = false;
}
}
Item { Item {
id: chatViewItem id: chatViewItem
width: parent.width width: parent.width
height: parent.height - headerRow.height - newMessageColumn.height - selectedMessagesActions.height height: parent.height - headerRow.height - pinnedMessageItem.height - newMessageColumn.height - selectedMessagesActions.height
property int previousHeight; property int previousHeight;
@ -617,10 +675,24 @@ Page {
} }
} }
Loader {
asynchronous: true
active: chatView.blurred
anchors.fill: chatView
sourceComponent: Component {
FastBlur {
source: chatView
radius: Theme.paddingLarge
}
}
}
SilicaListView { SilicaListView {
id: chatView id: chatView
visible: !blurred
property bool blurred: messageOverlayLoader.item
anchors.fill: parent anchors.fill: parent
opacity: chatPage.loading ? 0 : 1 opacity: chatPage.loading ? 0 : 1
Behavior on opacity { FadeAnimation {} } Behavior on opacity { FadeAnimation {} }
@ -829,6 +901,26 @@ Page {
source: "../components/StickerPicker.qml" source: "../components/StickerPicker.qml"
} }
Loader {
id: messageOverlayLoader
property var overlayMessage;
active: false
asynchronous: true
width: parent.width
height: active ? parent.height : 0
sourceComponent: Component {
MessageOverlayFlickable {
overlayMessage: messageOverlayLoader.overlayMessage
showHeader: !chatPage.isChannel
onRequestClose: {
messageOverlayLoader.active = false;
}
}
}
}
} }
Column { Column {
@ -1160,6 +1252,7 @@ Page {
} }
} }
} }
Loader { Loader {
id: selectedMessagesActions id: selectedMessagesActions
asynchronous: true asynchronous: true
@ -1256,7 +1349,6 @@ Page {
} }
} }
} }
} }
} }

View file

@ -44,6 +44,7 @@ namespace {
const QString LAST_READ_OUTBOX_MESSAGE_ID("last_read_outbox_message_id"); const QString LAST_READ_OUTBOX_MESSAGE_ID("last_read_outbox_message_id");
const QString SENDING_STATE("sending_state"); const QString SENDING_STATE("sending_state");
const QString IS_CHANNEL("is_channel"); const QString IS_CHANNEL("is_channel");
const QString PINNED_MESSAGE_ID("pinned_message_id");
const QString _TYPE("@type"); const QString _TYPE("@type");
} }
@ -296,6 +297,7 @@ ChatListModel::ChatListModel(TDLibWrapper *tdLibWrapper) : showHiddenChats(false
connect(tdLibWrapper, SIGNAL(chatReadInboxUpdated(QString, QString, int)), this, SLOT(handleChatReadInboxUpdated(QString, QString, int))); connect(tdLibWrapper, SIGNAL(chatReadInboxUpdated(QString, QString, int)), this, SLOT(handleChatReadInboxUpdated(QString, QString, int)));
connect(tdLibWrapper, SIGNAL(chatReadOutboxUpdated(QString, QString)), this, SLOT(handleChatReadOutboxUpdated(QString, QString))); connect(tdLibWrapper, SIGNAL(chatReadOutboxUpdated(QString, QString)), this, SLOT(handleChatReadOutboxUpdated(QString, QString)));
connect(tdLibWrapper, SIGNAL(chatPhotoUpdated(qlonglong, QVariantMap)), this, SLOT(handleChatPhotoUpdated(qlonglong, QVariantMap))); connect(tdLibWrapper, SIGNAL(chatPhotoUpdated(qlonglong, QVariantMap)), this, SLOT(handleChatPhotoUpdated(qlonglong, QVariantMap)));
connect(tdLibWrapper, SIGNAL(chatPinnedMessageUpdated(qlonglong, qlonglong)), this, SLOT(handleChatPinnedMessageUpdated(qlonglong, qlonglong)));
connect(tdLibWrapper, SIGNAL(messageSendSucceeded(QString, QString, QVariantMap)), this, SLOT(handleMessageSendSucceeded(QString, QString, QVariantMap))); connect(tdLibWrapper, SIGNAL(messageSendSucceeded(QString, QString, QVariantMap)), this, SLOT(handleMessageSendSucceeded(QString, QString, QVariantMap)));
connect(tdLibWrapper, SIGNAL(chatNotificationSettingsUpdated(QString, QVariantMap)), this, SLOT(handleChatNotificationSettingsUpdated(QString, QVariantMap))); connect(tdLibWrapper, SIGNAL(chatNotificationSettingsUpdated(QString, QVariantMap)), this, SLOT(handleChatNotificationSettingsUpdated(QString, QVariantMap)));
connect(tdLibWrapper, SIGNAL(superGroupUpdated(qlonglong)), this, SLOT(handleGroupUpdated(qlonglong))); connect(tdLibWrapper, SIGNAL(superGroupUpdated(qlonglong)), this, SLOT(handleGroupUpdated(qlonglong)));
@ -635,6 +637,22 @@ void ChatListModel::handleChatPhotoUpdated(qlonglong chatId, const QVariantMap &
} }
} }
void ChatListModel::handleChatPinnedMessageUpdated(qlonglong chatId, qlonglong pinnedMessageId)
{
if (chatIndexMap.contains(chatId)) {
LOG("Updating pinned message for" << chatId);
const int chatIndex = chatIndexMap.value(chatId);
ChatData *chat = chatList.at(chatIndex);
chat->chatData.insert(PINNED_MESSAGE_ID, pinnedMessageId);
} else {
ChatData *chat = hiddenChats.value(chatId);
if (chat) {
LOG("Updating pinned message for hidden chat" << chatId);
chat->chatData.insert(PINNED_MESSAGE_ID, pinnedMessageId);
}
}
}
void ChatListModel::handleMessageSendSucceeded(const QString &messageId, const QString &oldMessageId, const QVariantMap &message) void ChatListModel::handleMessageSendSucceeded(const QString &messageId, const QString &oldMessageId, const QVariantMap &message)
{ {
bool ok; bool ok;

View file

@ -49,6 +49,7 @@ private slots:
void handleChatReadInboxUpdated(const QString &chatId, const QString &lastReadInboxMessageId, int unreadCount); void handleChatReadInboxUpdated(const QString &chatId, const QString &lastReadInboxMessageId, int unreadCount);
void handleChatReadOutboxUpdated(const QString &chatId, const QString &lastReadOutboxMessageId); void handleChatReadOutboxUpdated(const QString &chatId, const QString &lastReadOutboxMessageId);
void handleChatPhotoUpdated(qlonglong chatId, const QVariantMap &photo); void handleChatPhotoUpdated(qlonglong chatId, const QVariantMap &photo);
void handleChatPinnedMessageUpdated(qlonglong chatId, qlonglong pinnedMessageId);
void handleMessageSendSucceeded(const QString &messageId, const QString &oldMessageId, const QVariantMap &message); void handleMessageSendSucceeded(const QString &messageId, const QString &oldMessageId, const QVariantMap &message);
void handleChatNotificationSettingsUpdated(const QString &chatId, const QVariantMap &chatNotificationSettings); void handleChatNotificationSettingsUpdated(const QString &chatId, const QVariantMap &chatNotificationSettings);
void handleGroupUpdated(qlonglong groupId); void handleGroupUpdated(qlonglong groupId);

View file

@ -34,6 +34,7 @@ namespace {
const QString UNREAD_COUNT("unread_count"); const QString UNREAD_COUNT("unread_count");
const QString LAST_READ_INBOX_MESSAGE_ID("last_read_inbox_message_id"); const QString LAST_READ_INBOX_MESSAGE_ID("last_read_inbox_message_id");
const QString SENDER_USER_ID("sender_user_id"); const QString SENDER_USER_ID("sender_user_id");
const QString PINNED_MESSAGE_ID("pinned_message_id");
} }
ChatModel::ChatModel(TDLibWrapper *tdLibWrapper) : ChatModel::ChatModel(TDLibWrapper *tdLibWrapper) :
@ -49,6 +50,7 @@ ChatModel::ChatModel(TDLibWrapper *tdLibWrapper) :
connect(this->tdLibWrapper, SIGNAL(messageSendSucceeded(QString, QString, QVariantMap)), this, SLOT(handleMessageSendSucceeded(QString, QString, QVariantMap))); connect(this->tdLibWrapper, SIGNAL(messageSendSucceeded(QString, QString, QVariantMap)), this, SLOT(handleMessageSendSucceeded(QString, QString, QVariantMap)));
connect(this->tdLibWrapper, SIGNAL(chatNotificationSettingsUpdated(QString, QVariantMap)), this, SLOT(handleChatNotificationSettingsUpdated(QString, QVariantMap))); connect(this->tdLibWrapper, SIGNAL(chatNotificationSettingsUpdated(QString, QVariantMap)), this, SLOT(handleChatNotificationSettingsUpdated(QString, QVariantMap)));
connect(this->tdLibWrapper, SIGNAL(chatPhotoUpdated(qlonglong, QVariantMap)), this, SLOT(handleChatPhotoUpdated(qlonglong, QVariantMap))); connect(this->tdLibWrapper, SIGNAL(chatPhotoUpdated(qlonglong, QVariantMap)), this, SLOT(handleChatPhotoUpdated(qlonglong, QVariantMap)));
connect(this->tdLibWrapper, SIGNAL(chatPinnedMessageUpdated(qlonglong, qlonglong)), this, SLOT(handleChatPinnedMessageUpdated(qlonglong, qlonglong)));
connect(this->tdLibWrapper, SIGNAL(messageContentUpdated(QString, QString, QVariantMap)), this, SLOT(handleMessageContentUpdated(QString, QString, QVariantMap))); connect(this->tdLibWrapper, SIGNAL(messageContentUpdated(QString, QString, QVariantMap)), this, SLOT(handleMessageContentUpdated(QString, QString, QVariantMap)));
connect(this->tdLibWrapper, SIGNAL(messagesDeleted(QString, QVariantList)), this, SLOT(handleMessagesDeleted(QString, QVariantList))); connect(this->tdLibWrapper, SIGNAL(messagesDeleted(QString, QVariantList)), this, SLOT(handleMessagesDeleted(QString, QVariantList)));
} }
@ -292,6 +294,15 @@ void ChatModel::handleChatPhotoUpdated(qlonglong id, const QVariantMap &photo)
} }
} }
void ChatModel::handleChatPinnedMessageUpdated(qlonglong id, qlonglong pinnedMessageId)
{
if (id == chatId) {
LOG("Pinned message updated" << chatId);
chatInformation.insert(PINNED_MESSAGE_ID, pinnedMessageId);
emit pinnedMessageChanged();
}
}
void ChatModel::handleMessageContentUpdated(const QString &id, const QString &messageId, const QVariantMap &newContent) void ChatModel::handleMessageContentUpdated(const QString &id, const QString &messageId, const QVariantMap &newContent)
{ {
LOG("Message content updated" << id << messageId); LOG("Message content updated" << id << messageId);

View file

@ -55,6 +55,7 @@ signals:
void messageUpdated(int modelIndex); void messageUpdated(int modelIndex);
void messagesDeleted(); void messagesDeleted();
void smallPhotoChanged(); void smallPhotoChanged();
void pinnedMessageChanged();
public slots: public slots:
void handleMessagesReceived(const QVariantList &messages, int totalCount); void handleMessagesReceived(const QVariantList &messages, int totalCount);
@ -64,6 +65,7 @@ public slots:
void handleMessageSendSucceeded(const QString &messageId, const QString &oldMessageId, const QVariantMap &message); void handleMessageSendSucceeded(const QString &messageId, const QString &oldMessageId, const QVariantMap &message);
void handleChatNotificationSettingsUpdated(const QString &chatId, const QVariantMap &chatNotificationSettings); void handleChatNotificationSettingsUpdated(const QString &chatId, const QVariantMap &chatNotificationSettings);
void handleChatPhotoUpdated(qlonglong chatId, const QVariantMap &photo); void handleChatPhotoUpdated(qlonglong chatId, const QVariantMap &photo);
void handleChatPinnedMessageUpdated(qlonglong chatId, qlonglong pinnedMessageId);
void handleMessageContentUpdated(const QString &chatId, const QString &messageId, const QVariantMap &newContent); void handleMessageContentUpdated(const QString &chatId, const QString &messageId, const QVariantMap &newContent);
void handleMessagesDeleted(const QString &chatId, const QVariantList &messageIds); void handleMessagesDeleted(const QString &chatId, const QVariantList &messageIds);

View file

@ -127,6 +127,7 @@ TDLibReceiver::TDLibReceiver(void *tdLibClient, QObject *parent) : QThread(paren
handlers.insert("updateChatPermissions", &TDLibReceiver::processUpdateChatPermissions); handlers.insert("updateChatPermissions", &TDLibReceiver::processUpdateChatPermissions);
handlers.insert("updateChatPhoto", &TDLibReceiver::processUpdateChatPhoto); handlers.insert("updateChatPhoto", &TDLibReceiver::processUpdateChatPhoto);
handlers.insert("updateChatTitle", &TDLibReceiver::processUpdateChatTitle); handlers.insert("updateChatTitle", &TDLibReceiver::processUpdateChatTitle);
handlers.insert("updateChatPinnedMessage", &TDLibReceiver::processUpdateChatPinnedMessage);
handlers.insert("users", &TDLibReceiver::processUsers); handlers.insert("users", &TDLibReceiver::processUsers);
handlers.insert("error", &TDLibReceiver::processError); handlers.insert("error", &TDLibReceiver::processError);
handlers.insert("ok", &TDLibReceiver::nop); handlers.insert("ok", &TDLibReceiver::nop);
@ -506,6 +507,12 @@ void TDLibReceiver::processUpdateChatTitle(const QVariantMap &receivedInformatio
emit chatTitleUpdated(receivedInformation.value(CHAT_ID).toString(), receivedInformation.value(TITLE).toString()); emit chatTitleUpdated(receivedInformation.value(CHAT_ID).toString(), receivedInformation.value(TITLE).toString());
} }
void TDLibReceiver::processUpdateChatPinnedMessage(const QVariantMap &receivedInformation)
{
LOG("Received UpdateChatPinnedMessage");
emit chatPinnedMessageUpdated(receivedInformation.value(CHAT_ID).toLongLong(), receivedInformation.value("pinned_message_id").toLongLong());
}
void TDLibReceiver::processUsers(const QVariantMap &receivedInformation) void TDLibReceiver::processUsers(const QVariantMap &receivedInformation)
{ {
LOG("Received Users"); LOG("Received Users");

View file

@ -81,6 +81,7 @@ signals:
void chatPermissionsUpdated(const QString &chatId, const QVariantMap &chatPermissions); void chatPermissionsUpdated(const QString &chatId, const QVariantMap &chatPermissions);
void chatPhotoUpdated(qlonglong chatId, const QVariantMap &photo); void chatPhotoUpdated(qlonglong chatId, const QVariantMap &photo);
void chatTitleUpdated(const QString &chatId, const QString &title); void chatTitleUpdated(const QString &chatId, const QString &title);
void chatPinnedMessageUpdated(qlonglong chatId, qlonglong pinnedMessageId);
void usersReceived(const QString &extra, const QVariantList &userIds, int totalUsers); void usersReceived(const QString &extra, const QVariantList &userIds, int totalUsers);
void errorReceived(const int code, const QString &message); void errorReceived(const int code, const QString &message);
@ -139,6 +140,7 @@ private:
void processUpdateChatPermissions(const QVariantMap &receivedInformation); void processUpdateChatPermissions(const QVariantMap &receivedInformation);
void processUpdateChatPhoto(const QVariantMap &receivedInformation); void processUpdateChatPhoto(const QVariantMap &receivedInformation);
void processUpdateChatTitle(const QVariantMap &receivedInformation); void processUpdateChatTitle(const QVariantMap &receivedInformation);
void processUpdateChatPinnedMessage(const QVariantMap &receivedInformation);
void processUsers(const QVariantMap &receivedInformation); void processUsers(const QVariantMap &receivedInformation);
void processError(const QVariantMap &receivedInformation); void processError(const QVariantMap &receivedInformation);
void nop(const QVariantMap &receivedInformation); void nop(const QVariantMap &receivedInformation);

View file

@ -112,6 +112,7 @@ TDLibWrapper::TDLibWrapper(AppSettings *appSettings, QObject *parent) : QObject(
connect(this->tdLibReceiver, SIGNAL(chatPermissionsUpdated(QString, QVariantMap)), this, SIGNAL(chatPermissionsUpdated(QString, QVariantMap))); connect(this->tdLibReceiver, SIGNAL(chatPermissionsUpdated(QString, QVariantMap)), this, SIGNAL(chatPermissionsUpdated(QString, QVariantMap)));
connect(this->tdLibReceiver, SIGNAL(chatPhotoUpdated(qlonglong, QVariantMap)), this, SIGNAL(chatPhotoUpdated(qlonglong, QVariantMap))); connect(this->tdLibReceiver, SIGNAL(chatPhotoUpdated(qlonglong, QVariantMap)), this, SIGNAL(chatPhotoUpdated(qlonglong, QVariantMap)));
connect(this->tdLibReceiver, SIGNAL(chatTitleUpdated(QString, QString)), this, SIGNAL(chatTitleUpdated(QString, QString))); connect(this->tdLibReceiver, SIGNAL(chatTitleUpdated(QString, QString)), this, SIGNAL(chatTitleUpdated(QString, QString)));
connect(this->tdLibReceiver, SIGNAL(chatPinnedMessageUpdated(qlonglong, qlonglong)), this, SIGNAL(chatPinnedMessageUpdated(qlonglong, qlonglong)));
connect(this->tdLibReceiver, SIGNAL(usersReceived(QString, QVariantList, int)), this, SIGNAL(usersReceived(QString, QVariantList, int))); connect(this->tdLibReceiver, SIGNAL(usersReceived(QString, QVariantList, int)), this, SIGNAL(usersReceived(QString, QVariantList, int)));
connect(this->tdLibReceiver, SIGNAL(errorReceived(int, QString)), this, SIGNAL(errorReceived(int, QString))); connect(this->tdLibReceiver, SIGNAL(errorReceived(int, QString)), this, SIGNAL(errorReceived(int, QString)));
@ -291,6 +292,26 @@ void TDLibWrapper::viewMessage(const QString &chatId, const QString &messageId,
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
void TDLibWrapper::pinMessage(const QString &chatId, const QString &messageId, bool disableNotification)
{
LOG("Pin message to chat" << chatId << messageId << disableNotification);
QVariantMap requestObject;
requestObject.insert(_TYPE, "pinChatMessage");
requestObject.insert("chat_id", chatId);
requestObject.insert("message_id", messageId);
requestObject.insert("disable_notification", disableNotification);
this->sendRequest(requestObject);
}
void TDLibWrapper::unpinMessage(const QString &chatId)
{
LOG("Unpin message from chat" << chatId);
QVariantMap requestObject;
requestObject.insert(_TYPE, "unpinChatMessage");
requestObject.insert("chat_id", chatId);
this->sendRequest(requestObject);
}
void TDLibWrapper::sendTextMessage(const QString &chatId, const QString &message, const QString &replyToMessageId) void TDLibWrapper::sendTextMessage(const QString &chatId, const QString &message, const QString &replyToMessageId)
{ {
LOG("Sending text message" << chatId << message << replyToMessageId); LOG("Sending text message" << chatId << message << replyToMessageId);

View file

@ -122,6 +122,8 @@ public:
Q_INVOKABLE void leaveChat(const QString &chatId); Q_INVOKABLE void leaveChat(const QString &chatId);
Q_INVOKABLE void getChatHistory(qlonglong chatId, const qlonglong &fromMessageId = 0, int offset = 0, int limit = 50, bool onlyLocal = false); Q_INVOKABLE void getChatHistory(qlonglong chatId, const qlonglong &fromMessageId = 0, int offset = 0, int limit = 50, bool onlyLocal = false);
Q_INVOKABLE void viewMessage(const QString &chatId, const QString &messageId, bool force); Q_INVOKABLE void viewMessage(const QString &chatId, const QString &messageId, bool force);
Q_INVOKABLE void pinMessage(const QString &chatId, const QString &messageId, bool disableNotification = false);
Q_INVOKABLE void unpinMessage(const QString &chatId);
Q_INVOKABLE void sendTextMessage(const QString &chatId, const QString &message, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendTextMessage(const QString &chatId, const QString &message, const QString &replyToMessageId = "0");
Q_INVOKABLE void sendPhotoMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendPhotoMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0");
Q_INVOKABLE void sendVideoMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendVideoMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0");
@ -218,6 +220,7 @@ signals:
void chatPermissionsUpdated(const QString &chatId, const QVariantMap &permissions); void chatPermissionsUpdated(const QString &chatId, const QVariantMap &permissions);
void chatPhotoUpdated(qlonglong chatId, const QVariantMap &photo); void chatPhotoUpdated(qlonglong chatId, const QVariantMap &photo);
void chatTitleUpdated(const QString &chatId, const QString &title); void chatTitleUpdated(const QString &chatId, const QString &title);
void chatPinnedMessageUpdated(qlonglong chatId, qlonglong pinnedMessageId);
void usersReceived(const QString &extra, const QVariantList &userIds, int totalUsers); void usersReceived(const QString &extra, const QVariantList &userIds, int totalUsers);
void errorReceived(const int code, const QString &message); void errorReceived(const int code, const QString &message);

View file

@ -839,6 +839,10 @@
<source>Select Message</source> <source>Select Message</source>
<translation>Nachricht auswählen</translation> <translation>Nachricht auswählen</translation>
</message> </message>
<message>
<source>Pin Message</source>
<translation>Nachricht anheften</translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>
@ -847,6 +851,17 @@
<translation>Sie</translation> <translation>Sie</translation>
</message> </message>
</context> </context>
<context>
<name>MessageOverlayFlickable</name>
<message>
<source>You</source>
<translation>Sie</translation>
</message>
<message>
<source>This message was forwarded. Original author: %1</source>
<translation>Diese Nachricht wurde weitergeleitet. Ursprünglicher Autor: %1</translation>
</message>
</context>
<context> <context>
<name>NotificationManager</name> <name>NotificationManager</name>
<message> <message>
@ -897,6 +912,21 @@
<translation>Sie haben noch keine Chats.</translation> <translation>Sie haben noch keine Chats.</translation>
</message> </message>
</context> </context>
<context>
<name>PinnedMessageItem</name>
<message>
<source>You</source>
<translation>Sie</translation>
</message>
<message>
<source>Pinned Message</source>
<translation>Angeheftete Nachricht</translation>
</message>
<message>
<source>Message unpinned</source>
<translation>Nachricht losgeheftet</translation>
</message>
</context>
<context> <context>
<name>PollCreationPage</name> <name>PollCreationPage</name>
<message> <message>

View file

@ -839,6 +839,10 @@
<source>Select Message</source> <source>Select Message</source>
<translation>Select Message</translation> <translation>Select Message</translation>
</message> </message>
<message>
<source>Pin Message</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>
@ -847,6 +851,17 @@
<translation>You</translation> <translation>You</translation>
</message> </message>
</context> </context>
<context>
<name>MessageOverlayFlickable</name>
<message>
<source>You</source>
<translation type="unfinished">You</translation>
</message>
<message>
<source>This message was forwarded. Original author: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>NotificationManager</name> <name>NotificationManager</name>
<message> <message>
@ -897,6 +912,21 @@
<translation>You don&apos;t have any chats yet.</translation> <translation>You don&apos;t have any chats yet.</translation>
</message> </message>
</context> </context>
<context>
<name>PinnedMessageItem</name>
<message>
<source>You</source>
<translation type="unfinished">You</translation>
</message>
<message>
<source>Pinned Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Message unpinned</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>PollCreationPage</name> <name>PollCreationPage</name>
<message> <message>

View file

@ -835,6 +835,10 @@
<source>Select Message</source> <source>Select Message</source>
<translation>Seleccionar mensaje</translation> <translation>Seleccionar mensaje</translation>
</message> </message>
<message>
<source>Pin Message</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>
@ -843,6 +847,17 @@
<translation>Usted</translation> <translation>Usted</translation>
</message> </message>
</context> </context>
<context>
<name>MessageOverlayFlickable</name>
<message>
<source>You</source>
<translation type="unfinished">Usted</translation>
</message>
<message>
<source>This message was forwarded. Original author: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>NotificationManager</name> <name>NotificationManager</name>
<message> <message>
@ -893,6 +908,21 @@
<translation>No hay todavía ninguna charla.</translation> <translation>No hay todavía ninguna charla.</translation>
</message> </message>
</context> </context>
<context>
<name>PinnedMessageItem</name>
<message>
<source>You</source>
<translation type="unfinished">Usted</translation>
</message>
<message>
<source>Pinned Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Message unpinned</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>PollCreationPage</name> <name>PollCreationPage</name>
<message> <message>

View file

@ -840,6 +840,10 @@
<source>Select Message</source> <source>Select Message</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Pin Message</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>
@ -848,6 +852,17 @@
<translation>Sinä</translation> <translation>Sinä</translation>
</message> </message>
</context> </context>
<context>
<name>MessageOverlayFlickable</name>
<message>
<source>You</source>
<translation type="unfinished">Sinä</translation>
</message>
<message>
<source>This message was forwarded. Original author: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>NotificationManager</name> <name>NotificationManager</name>
<message> <message>
@ -898,6 +913,21 @@
<translation>Sinulla ei ole vielä keskusteluja.</translation> <translation>Sinulla ei ole vielä keskusteluja.</translation>
</message> </message>
</context> </context>
<context>
<name>PinnedMessageItem</name>
<message>
<source>You</source>
<translation type="unfinished">Sinä</translation>
</message>
<message>
<source>Pinned Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Message unpinned</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>PollCreationPage</name> <name>PollCreationPage</name>
<message> <message>

View file

@ -835,6 +835,10 @@
<source>Select Message</source> <source>Select Message</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Pin Message</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>
@ -843,6 +847,17 @@
<translation type="unfinished">Te</translation> <translation type="unfinished">Te</translation>
</message> </message>
</context> </context>
<context>
<name>MessageOverlayFlickable</name>
<message>
<source>You</source>
<translation type="unfinished">Te</translation>
</message>
<message>
<source>This message was forwarded. Original author: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>NotificationManager</name> <name>NotificationManager</name>
<message> <message>
@ -893,6 +908,21 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>PinnedMessageItem</name>
<message>
<source>You</source>
<translation type="unfinished">Te</translation>
</message>
<message>
<source>Pinned Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Message unpinned</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>PollCreationPage</name> <name>PollCreationPage</name>
<message> <message>

View file

@ -839,6 +839,10 @@
<source>Select Message</source> <source>Select Message</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Pin Message</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>
@ -847,6 +851,17 @@
<translation>Tu</translation> <translation>Tu</translation>
</message> </message>
</context> </context>
<context>
<name>MessageOverlayFlickable</name>
<message>
<source>You</source>
<translation type="unfinished">Tu</translation>
</message>
<message>
<source>This message was forwarded. Original author: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>NotificationManager</name> <name>NotificationManager</name>
<message> <message>
@ -897,6 +912,21 @@
<translation>Carica lista chat...</translation> <translation>Carica lista chat...</translation>
</message> </message>
</context> </context>
<context>
<name>PinnedMessageItem</name>
<message>
<source>You</source>
<translation type="unfinished">Tu</translation>
</message>
<message>
<source>Pinned Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Message unpinned</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>PollCreationPage</name> <name>PollCreationPage</name>
<message> <message>

View file

@ -843,6 +843,10 @@
<source>Select Message</source> <source>Select Message</source>
<translation>Wybierz wiadomość</translation> <translation>Wybierz wiadomość</translation>
</message> </message>
<message>
<source>Pin Message</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>
@ -851,6 +855,17 @@
<translation>Ty</translation> <translation>Ty</translation>
</message> </message>
</context> </context>
<context>
<name>MessageOverlayFlickable</name>
<message>
<source>You</source>
<translation type="unfinished">Ty</translation>
</message>
<message>
<source>This message was forwarded. Original author: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>NotificationManager</name> <name>NotificationManager</name>
<message> <message>
@ -901,6 +916,21 @@
<translation>Nie masz jeszcze żadnych czatów.</translation> <translation>Nie masz jeszcze żadnych czatów.</translation>
</message> </message>
</context> </context>
<context>
<name>PinnedMessageItem</name>
<message>
<source>You</source>
<translation type="unfinished">Ty</translation>
</message>
<message>
<source>Pinned Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Message unpinned</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>PollCreationPage</name> <name>PollCreationPage</name>
<message> <message>

View file

@ -843,6 +843,10 @@
<source>Select Message</source> <source>Select Message</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Pin Message</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>
@ -851,6 +855,17 @@
<translation>Вы</translation> <translation>Вы</translation>
</message> </message>
</context> </context>
<context>
<name>MessageOverlayFlickable</name>
<message>
<source>You</source>
<translation type="unfinished">Вы</translation>
</message>
<message>
<source>This message was forwarded. Original author: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>NotificationManager</name> <name>NotificationManager</name>
<message> <message>
@ -901,6 +916,21 @@
<translation>Тут пока ничего нет</translation> <translation>Тут пока ничего нет</translation>
</message> </message>
</context> </context>
<context>
<name>PinnedMessageItem</name>
<message>
<source>You</source>
<translation type="unfinished">Вы</translation>
</message>
<message>
<source>Pinned Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Message unpinned</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>PollCreationPage</name> <name>PollCreationPage</name>
<message> <message>

View file

@ -839,6 +839,10 @@
<source>Select Message</source> <source>Select Message</source>
<translation>Välj meddelande</translation> <translation>Välj meddelande</translation>
</message> </message>
<message>
<source>Pin Message</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>
@ -847,6 +851,17 @@
<translation>Du</translation> <translation>Du</translation>
</message> </message>
</context> </context>
<context>
<name>MessageOverlayFlickable</name>
<message>
<source>You</source>
<translation type="unfinished">Du</translation>
</message>
<message>
<source>This message was forwarded. Original author: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>NotificationManager</name> <name>NotificationManager</name>
<message> <message>
@ -897,6 +912,21 @@
<translation>Du har inga chattar än.</translation> <translation>Du har inga chattar än.</translation>
</message> </message>
</context> </context>
<context>
<name>PinnedMessageItem</name>
<message>
<source>You</source>
<translation type="unfinished">Du</translation>
</message>
<message>
<source>Pinned Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Message unpinned</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>PollCreationPage</name> <name>PollCreationPage</name>
<message> <message>

View file

@ -835,6 +835,10 @@
<source>Select Message</source> <source>Select Message</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>Pin Message</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>
@ -843,6 +847,17 @@
<translation></translation> <translation></translation>
</message> </message>
</context> </context>
<context>
<name>MessageOverlayFlickable</name>
<message>
<source>You</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This message was forwarded. Original author: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>NotificationManager</name> <name>NotificationManager</name>
<message> <message>
@ -893,6 +908,21 @@
<translation></translation> <translation></translation>
</message> </message>
</context> </context>
<context>
<name>PinnedMessageItem</name>
<message>
<source>You</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Pinned Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Message unpinned</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>PollCreationPage</name> <name>PollCreationPage</name>
<message> <message>

View file

@ -835,6 +835,10 @@
<source>Select Message</source> <source>Select Message</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Pin Message</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>
@ -843,6 +847,17 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>MessageOverlayFlickable</name>
<message>
<source>You</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This message was forwarded. Original author: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>NotificationManager</name> <name>NotificationManager</name>
<message> <message>
@ -893,6 +908,21 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>PinnedMessageItem</name>
<message>
<source>You</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Pinned Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Message unpinned</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>PollCreationPage</name> <name>PollCreationPage</name>
<message> <message>