diff --git a/images/icon-verified.svg b/images/icon-verified.svg
new file mode 100644
index 0000000..2f56398
--- /dev/null
+++ b/images/icon-verified.svg
@@ -0,0 +1,26 @@
+
+
diff --git a/qml/components/PhotoTextsListItem.qml b/qml/components/PhotoTextsListItem.qml
index c91fd1e..8ea03af 100644
--- a/qml/components/PhotoTextsListItem.qml
+++ b/qml/components/PhotoTextsListItem.qml
@@ -3,7 +3,6 @@ import Sailfish.Silica 1.0
import WerkWolf.Fernschreiber 1.0
ListItem {
-
id: chatListViewItem
property alias primaryText: primaryText //usually chat name
@@ -13,13 +12,12 @@ ListItem {
property int unreadCount: 0
property bool isSecret: false
+ property bool isVerified: false
property alias pictureThumbnail: pictureThumbnail
contentHeight: mainRow.height + separator.height + 2 * Theme.paddingMedium
contentWidth: parent.width
-
-
Column {
id: mainColumn
width: parent.width - ( 2 * Theme.horizontalPageMargin )
@@ -31,7 +29,6 @@ ListItem {
Row {
id: mainRow
- width: parent.width
height: contentColumn.height
spacing: Theme.paddingMedium
@@ -42,7 +39,6 @@ ListItem {
anchors.verticalCenter: parent.verticalCenter
Item {
- id: chatListPictureItem
width: parent.width
height: parent.width
@@ -96,19 +92,33 @@ ListItem {
Column {
id: contentColumn
- width: parent.width * 5 / 6 - Theme.horizontalPageMargin
+ width: mainColumn.width - pictureColumn.width - mainRow.spacing
spacing: Theme.paddingSmall
- Label {
- id: primaryText
- textFormat: Text.StyledText
- font.pixelSize: Theme.fontSizeMedium
- truncationMode: TruncationMode.Fade
- width: parent.width
+ Row {
+ id: primaryTextRow
+ spacing: Theme.paddingMedium
+
+ Label {
+ id: primaryText
+ textFormat: Text.StyledText
+ font.pixelSize: Theme.fontSizeMedium
+ truncationMode: TruncationMode.Fade
+ anchors.verticalCenter: parent.verticalCenter
+ width: Math.min(contentColumn.width - (verifiedImage.visible ? (verifiedImage.width + primaryTextRow.spacing) : 0), implicitWidth)
+ }
+
+ Image {
+ id: verifiedImage
+ anchors.verticalCenter: parent.verticalCenter
+ source: chatListViewItem.isVerified ? "../../images/icon-verified.svg" : ""
+ sourceSize.width: Theme.iconSizeExtraSmall
+ width: Theme.iconSizeExtraSmall
+ visible: status === Image.Ready
+ }
}
Row {
- id: additionalTextRow
width: parent.width
spacing: Theme.paddingSmall
Label {
diff --git a/qml/pages/OverviewPage.qml b/qml/pages/OverviewPage.qml
index e3f9415..7006fa3 100644
--- a/qml/pages/OverviewPage.qml
+++ b/qml/pages/OverviewPage.qml
@@ -249,6 +249,7 @@ Page {
model: chatListModel
delegate: ChatListViewItem {
ownUserId: overviewPage.ownUserId
+ isVerified: is_verified
onClicked: {
pageStack.push(Qt.resolvedUrl("../pages/ChatPage.qml"), {
diff --git a/src/chatlistmodel.cpp b/src/chatlistmodel.cpp
index 6c2044f..a8f2f96 100644
--- a/src/chatlistmodel.cpp
+++ b/src/chatlistmodel.cpp
@@ -44,6 +44,7 @@ namespace {
const QString LAST_READ_OUTBOX_MESSAGE_ID("last_read_outbox_message_id");
const QString SENDING_STATE("sending_state");
const QString IS_CHANNEL("is_channel");
+ const QString IS_VERIFIED("is_verified");
const QString PINNED_MESSAGE_ID("pinned_message_id");
const QString _TYPE("@type");
const QString SECRET_CHAT_ID("secret_chat_id");
@@ -66,6 +67,7 @@ public:
RoleLastMessageStatus,
RoleChatMemberStatus,
RoleSecretChatState,
+ RoleIsVerified,
RoleIsChannel
};
@@ -95,6 +97,7 @@ public:
qlonglong chatId;
qlonglong order;
qlonglong groupId;
+ bool verified;
TDLibWrapper::ChatType chatType;
TDLibWrapper::ChatMemberStatus memberStatus;
TDLibWrapper::SecretChatState secretChatState;
@@ -106,6 +109,7 @@ ChatListModel::ChatData::ChatData(const QVariantMap &data, const QVariantMap &us
chatId(data.value(ID).toLongLong()),
order(data.value(ORDER).toLongLong()),
groupId(0),
+ verified(false),
memberStatus(TDLibWrapper::ChatMemberStatusUnknown),
secretChatState(TDLibWrapper::SecretChatStateUnknown),
userInformation(userInfo)
@@ -293,6 +297,13 @@ QVector ChatListModel::ChatData::updateGroup(const TDLibWrapper::Group *gro
memberStatus = groupMemberStatus;
changedRoles.append(RoleChatMemberStatus);
}
+ // There's no "is_verified" in "basic_group" but that's ok since
+ // it naturally becomes false
+ const bool groupIsVerified = group->groupInfo.value(IS_VERIFIED).toBool();
+ if (verified != groupIsVerified) {
+ verified = groupIsVerified;
+ changedRoles.append(RoleIsVerified);
+ }
}
return changedRoles;
}
@@ -357,6 +368,7 @@ QHash ChatListModel::roleNames() const
roles.insert(ChatData::RoleLastMessageStatus, "last_message_status");
roles.insert(ChatData::RoleChatMemberStatus, "chat_member_status");
roles.insert(ChatData::RoleSecretChatState, "secret_chat_state");
+ roles.insert(ChatData::RoleIsVerified, "is_verified");
roles.insert(ChatData::RoleIsChannel, "is_channel");
return roles;
}
@@ -385,6 +397,7 @@ QVariant ChatListModel::data(const QModelIndex &index, int role) const
case ChatData::RoleLastMessageStatus: return data->senderMessageStatus();
case ChatData::RoleChatMemberStatus: return data->memberStatus;
case ChatData::RoleSecretChatState: return data->secretChatState;
+ case ChatData::RoleIsVerified: return data->verified;
case ChatData::RoleIsChannel: return data->isChannel();
}
}