Commit 75cfcfae authored by Thomas BOUTROUE's avatar Thomas BOUTROUE

v21 : fix pinned messages and a few more issues

parent 6fc9d817
......@@ -44,5 +44,6 @@
<file>qml/components/DelegateFormattedText.qml</file>
<file>qml/components/DelegateAbstractMessageContent.qml</file>
<file>qml/components/PanelFixed.qml</file>
<file>qml/components/DelegateMessageSimpleLabelBase.qml</file>
</qresource>
</RCC>
......@@ -3,15 +3,9 @@ import QtQmlTricks 3.0;
import Sailfish.Silica 1.0;
import harbour.Telegrame 1.0;
LabelFixed {
DelegateMessageSimpleLabelBase {
id: self;
text: qsTr ("Group chat '%1' created").arg (messageContentItem.title);
color: Theme.secondaryHighlightColor;
wrapMode: Text.WrapAtWordBoundaryOrAnywhere;
font.italic: true;
font.pixelSize: Theme.fontSizeSmall;
label: qsTr ("Group chat '%1' created").arg (messageContentItem.title);
property TD_Chat chatItem : null;
property TD_Message messageItem : null;
property TD_MessageBasicGroupChatCreate messageContentItem : null;
}
......@@ -3,9 +3,9 @@ import QtQmlTricks 3.0;
import Sailfish.Silica 1.0;
import harbour.Telegrame 1.0;
LabelFixed {
DelegateMessageSimpleLabelBase {
id: self;
text: {
label: {
if (callDiscardReasonItem) {
switch (callDiscardReasonItem.typeOf) {
case TD_ObjectType.CALL_DISCARD_REASON_HUNG_UP: return qsTr ("Call finished (%1)").arg (TD_Global.formatTime (messageContentItem.duration, false));
......@@ -17,13 +17,7 @@ LabelFixed {
}
return qsTr ("Call");
}
color: Theme.secondaryHighlightColor;
wrapMode: Text.WrapAtWordBoundaryOrAnywhere;
font.italic: true;
font.pixelSize: Theme.fontSizeSmall;
property TD_Chat chatItem : null;
property TD_Message messageItem : null;
property TD_MessageCall messageContentItem : null;
readonly property TD_CallDiscardReason callDiscardReasonItem : (messageContentItem ? messageContentItem.discardReason : null);
......
......@@ -3,15 +3,9 @@ import QtQmlTricks 3.0;
import Sailfish.Silica 1.0;
import harbour.Telegrame 1.0;
LabelFixed {
DelegateMessageSimpleLabelBase {
id: self;
text: qsTr ("Changed the group title to '%1'").arg (messageContentItem.title);
color: Theme.secondaryHighlightColor;
wrapMode: Text.WrapAtWordBoundaryOrAnywhere;
font.italic: true;
font.pixelSize: Theme.fontSizeSmall;
label: qsTr ("Changed the group title to '%1'").arg (messageContentItem.title);
property TD_Chat chatItem : null;
property TD_Message messageItem : null;
property TD_MessageChatChangeTitle messageContentItem : null;
}
......@@ -3,15 +3,9 @@ import QtQmlTricks 3.0;
import Sailfish.Silica 1.0;
import harbour.Telegrame 1.0;
LabelFixed {
DelegateMessageSimpleLabelBase {
id: self;
text: qsTr ("Registered in Telegram");
color: Theme.secondaryHighlightColor;
wrapMode: Text.WrapAtWordBoundaryOrAnywhere;
font.italic: true;
font.pixelSize: Theme.fontSizeSmall;
label: qsTr ("Registered in Telegram");
property TD_Chat chatItem : null;
property TD_Message messageItem : null;
property TD_MessagePinMessage messageContentItem : null;
property TD_MessageContactRegistered messageContentItem : null;
}
......@@ -3,15 +3,9 @@ import QtQmlTricks 3.0;
import Sailfish.Silica 1.0;
import harbour.Telegrame 1.0;
LabelFixed {
DelegateMessageSimpleLabelBase {
id: self;
text: qsTr ("Joined the group chat using the invite link");
color: Theme.secondaryHighlightColor;
wrapMode: Text.WrapAtWordBoundaryOrAnywhere;
font.italic: true;
font.pixelSize: Theme.fontSizeSmall;
label: qsTr ("Joined the group chat using the invite link");
property TD_Chat chatItem : null;
property TD_Message messageItem : null;
property TD_MessageChatJoinByLink messageContentItem : null;
}
......@@ -3,15 +3,9 @@ import QtQmlTricks 3.0;
import Sailfish.Silica 1.0;
import harbour.Telegrame 1.0;
LabelFixed {
DelegateMessageSimpleLabelBase {
id: self;
text: qsTr ("Upgraded from basic group");
color: Theme.secondaryHighlightColor;
wrapMode: Text.WrapAtWordBoundaryOrAnywhere;
font.italic: true;
font.pixelSize: Theme.fontSizeSmall;
label: qsTr ("Upgraded from basic group");
property TD_Chat chatItem : null;
property TD_Message messageItem : null;
property TD_MessageChatUpgradeFrom messageContentItem : null;
}
......@@ -3,15 +3,9 @@ import QtQmlTricks 3.0;
import Sailfish.Silica 1.0;
import harbour.Telegrame 1.0;
LabelFixed {
DelegateMessageSimpleLabelBase {
id: self;
text: qsTr ("Upgraded to supergroup");
color: Theme.secondaryHighlightColor;
wrapMode: Text.WrapAtWordBoundaryOrAnywhere;
font.italic: true;
font.pixelSize: Theme.fontSizeSmall;
label: qsTr ("Upgraded to supergroup");
property TD_Chat chatItem : null;
property TD_Message messageItem : null;
property TD_MessageChatUpgradeTo messageContentItem : null;
}
......@@ -3,20 +3,14 @@ import QtQmlTricks 3.0;
import Sailfish.Silica 1.0;
import harbour.Telegrame 1.0;
LabelFixed {
DelegateMessageSimpleLabelBase {
id: self;
text: (messageContentItem
? (messageContentItem.messageId !== "0"
? qsTr ("Pinned message : %1").arg (pinnedMessageItem ? pinnedMessageItem.preview (TD_Message.MINIMAL) : qsTr ("deleted message"))
: qsTr ("Unpinned message"))
: "")
color: Theme.secondaryHighlightColor;
wrapMode: Text.WrapAtWordBoundaryOrAnywhere;
font.italic: true;
font.pixelSize: Theme.fontSizeSmall;
label: (messageContentItem
? (messageContentItem.messageId !== "0"
? qsTr ("Pinned message : %1").arg (pinnedMessageItem ? pinnedMessageItem.preview (TD_Message.MINIMAL) : qsTr ("deleted message"))
: qsTr ("Unpinned message"))
: "");
property TD_Chat chatItem : null;
property TD_Message messageItem : null;
property TD_MessagePinMessage messageContentItem : null;
readonly property TD_MessageRefWatcher pinnedMsgRefWatcher : (chatItem ? chatItem.getMessageRefById (messageContentItem.messageId) : null);
......
import QtQuick 2.6;
import QtQmlTricks 3.0;
import Sailfish.Silica 1.0;
import harbour.Telegrame 1.0;
DelegateAbstractMessageContent {
id: self;
spacing: Theme.paddingSmall;
property alias label : lbl.text;
property alias color : lbl.color;
LabelFixed {
id: lbl;
color: Theme.secondaryHighlightColor;
wrapMode: Text.WrapAtWordBoundaryOrAnywhere;
font.italic: true;
font.pixelSize: Theme.fontSizeSmall;
ExtraAnchors.horizontalFill: parent;
}
}
......@@ -3,15 +3,9 @@ import QtQmlTricks 3.0;
import Sailfish.Silica 1.0;
import harbour.Telegrame 1.0;
LabelFixed {
DelegateMessageSimpleLabelBase {
id: self;
text: qsTr ("Supergroup chat '%1' created").arg (messageContentItem.title);
color: Theme.secondaryHighlightColor;
wrapMode: Text.WrapAtWordBoundaryOrAnywhere;
font.italic: true;
font.pixelSize: Theme.fontSizeSmall;
label: qsTr ("Supergroup chat '%1' created").arg (messageContentItem.title);
property TD_Chat chatItem : null;
property TD_Message messageItem : null;
property TD_MessageSupergroupChatCreate messageContentItem : null;
}
......@@ -3,12 +3,10 @@ import QtQmlTricks 3.0;
import Sailfish.Silica 1.0;
import harbour.Telegrame 1.0;
LabelFixed {
DelegateMessageSimpleLabelBase {
id: self;
text: qsTr ("<Unsupported>");
color: "magenta";
label: qsTr ("<Unsupported>");
property TD_Chat chatItem : null;
property TD_Message messageItem : null;
property TD_MessageContent messageContentItem : null;
}
......@@ -29,7 +29,7 @@ Page {
anchors.horizontalCenter: parent.horizontalCenter;
}
LabelFixed {
text: "Telegra'me v0.10.19";
text: "Telegra'me v21";
wrapMode: Text.WrapAtWordBoundaryOrAnywhere;
font.family: Theme.fontFamilyHeading;
font.pixelSize: Theme.fontSizeExtraLarge;
......
......@@ -63,8 +63,8 @@ Page {
? editingMessageRefWatcher.messageItem
: null);
readonly property TD_MessageRefWatcher pinnedMessageRefWatcher : (currentChatSupergroupItem && currentChatSupergroupItem.pinnedMessageId
? currentChat.getMessageRefById (currentChatSupergroupItem.pinnedMessageId)
readonly property TD_MessageRefWatcher pinnedMessageRefWatcher : (currentChat && currentChat.pinnedMessageId
? currentChat.getMessageRefById (currentChat.pinnedMessageId)
: null);
readonly property TD_Message pinnedMessageItem : (pinnedMessageRefWatcher
......@@ -801,21 +801,20 @@ Page {
}
}
}
MouseArea {
PanelFixed {
id: stripPinned;
visible: (pinnedMessageItem !== null);
implicitHeight: (lblPinned.height + lblPinned.anchors.margins * 2);
ExtraAnchors.horizontalFill: parent;
onClicked: {
longJumpToMsg (pinnedMessageItem.id);
}
PanelFixed {
Rectangle {
color: Theme.rgba (Theme.secondaryHighlightColor, 0.15);
anchors.fill: parent;
Rectangle {
color: Theme.rgba (Theme.secondaryHighlightColor, 0.15);
anchors.fill: parent;
}
MouseArea {
anchors.fill: parent;
onClicked: {
longJumpToMsg (pinnedMessageItem.id);
}
}
LabelFixed {
......
......@@ -13,8 +13,8 @@ Name: harbour-telegrame
%{!?qtc_make:%define qtc_make make}
%{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: A native Telegram client for Sailfish OS
Version: 0.10
Release: 19
Version: 21
Release: 1
Group: Qt/Qt
License: WTFPL
URL: http://gitlab.unique-conception.org/sailfish-app/telegra-me
......@@ -66,7 +66,7 @@ desktop-file-install --delete-original \
%files
%defattr(-,root,root,-)
%{_bindir}
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%{_datadir}/lipstick/notificationcategories/*.conf
......
Name: harbour-telegrame
Summary: A native Telegram client for Sailfish OS
Version: 0.10
Release: 20
Version: 21
Release: 1
Group: Qt/Qt
URL: http://gitlab.unique-conception.org/sailfish-app/telegra-me
......@@ -30,7 +30,7 @@ Requires:
- sailfishsilica-qt5 >= 0.10.9
Files:
- '%{_bindir}'
- '%{_bindir}/%{name}'
- '%{_datadir}/applications/%{name}.desktop'
- '%{_datadir}/icons/hicolor/*/apps/%{name}.png'
- '%{_datadir}/lipstick/notificationcategories/*.conf'
......
......@@ -134,6 +134,7 @@ void QtTdLibChat::updateFromJson (const QJsonObject & json) {
set_title_withJSON (json ["title"]);
set_clientData_withJSON (json ["client_data"]);
set_order_withJSON (json ["order"]);
set_pinnedMessageId_withJSON (json ["pinned_message_id"]);
set_type_withJSON (json ["type"].toObject (), &QtTdLibChatType::createAbstract);
set_photo_withJSON (json ["photo"].toObject (), &QtTdLibChatPhoto::create);
set_notificationSettings_withJSON (json ["notification_settings"].toObject (), &QtTdLibChatNotificationSettings::create);
......@@ -236,7 +237,6 @@ void QtTdLibSupergroup::updateFromJson (const QJsonObject & json) {
set_isAllHistoryAvailable_withJSON (json ["is_all_history_available"]);
set_stickerSetId_withJSON (json ["sticker_set_id"]);
set_inviteLink_withJSON (json ["invite_link"]);
set_pinnedMessageId_withJSON (json ["pinned_message_id"]);
set_upgradedFromBasicGroupId_withJSON (json ["upgraded_from_basic_group_id"]);
set_upgradedFromMaxMessageId_withJSON (json ["upgraded_from_max_message_id"]);
set_status_withJSON (json ["status"], &QtTdLibChatMemberStatus::createAbstract);
......
......@@ -122,7 +122,6 @@ class QtTdLibSupergroup : public QtTdLibAbstractInt32IdObject, public FactoryInt
Q_TDLIB_PROPERTY_BOOL (isAllHistoryAvailable)
Q_TDLIB_PROPERTY_ID64 (stickerSetId)
Q_TDLIB_PROPERTY_STRING (inviteLink)
Q_TDLIB_PROPERTY_ID53 (pinnedMessageId)
Q_TDLIB_PROPERTY_ID32 (upgradedFromBasicGroupId)
Q_TDLIB_PROPERTY_ID53 (upgradedFromMaxMessageId)
Q_TDLIB_PROPERTY_SUBOBJECT (status, QtTdLibChatMemberStatus)
......@@ -245,6 +244,7 @@ class QtTdLibChat : public QtTdLibAbstractInt53IdObject, public FactoryInt53Id<Q
Q_TDLIB_PROPERTY_SUBOBJECT (type, QtTdLibChatType)
Q_TDLIB_PROPERTY_SUBOBJECT (photo, QtTdLibChatPhoto)
Q_TDLIB_PROPERTY_SUBOBJECT (notificationSettings, QtTdLibChatNotificationSettings)
Q_TDLIB_PROPERTY_ID53 (pinnedMessageId)
//last_message:message
//draft_message:draftMessage
......
......@@ -139,6 +139,7 @@ QtTdLibObjectType::Type QtTdLibEnums::objectTypeEnumFromString (const QString &
{ "updateNotificationSettings", QtTdLibObjectType::UPDATE_NOTIFICATION_SETTINGS },
{ "updateSupergroup", QtTdLibObjectType::UPDATE_SUPERGROUP },
{ "updateSupergroupFullInfo", QtTdLibObjectType::UPDATE_SUPERGROUP_FULL_INFO },
{ "updateChatPinnedMessage", QtTdLibObjectType::UPDATE_CHAT_PINNED_MESSAGE },
{ "updateUnreadMessageCount", QtTdLibObjectType::UPDATE_UNREAD_MESSAGE_COUNT },
{ "updateUser", QtTdLibObjectType::UPDATE_USER },
{ "updateUserChatAction", QtTdLibObjectType::UPDATE_USER_CHAT_ACTION },
......
......@@ -129,6 +129,7 @@ QML_ENUM_CLASS (QtTdLibObjectType,
UPDATE_CHAT_READ_OUTBOX,
UPDATE_CHAT_TITLE,
UPDATE_CHAT_UNREAD_MENTION_COUNT,
UPDATE_CHAT_PINNED_MESSAGE,
UPDATE_MESSAGE_MENTION_READ,
UPDATE_CONNECTION_STATE,
UPDATE_DELETE_MESSAGES,
......
......@@ -1346,6 +1346,13 @@ void QtTdLibGlobal::onFrame (const QJsonObject & json) {
}
break;
}
case QtTdLibObjectType::UPDATE_CHAT_PINNED_MESSAGE: {
const qint64 chatId { QtTdLibId53Helper::fromJsonToCpp (json ["chat_id"]) };
if (QtTdLibChat * chatItem = { getChatItemById (chatId) }) {
chatItem->set_pinnedMessageId_withJSON (json ["pinned_message_id"]);
}
break;
}
case QtTdLibObjectType::UPDATE_INSTALLED_STICKER_SETS: {
const QJsonArray stickerSetIds = json ["sticker_set_ids"].toArray ();
for (const QJsonValue & tmp : stickerSetIds) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment