Options for creating new chats...
This commit is contained in:
parent
4d1bd029bc
commit
c6fa5cf97f
13 changed files with 360 additions and 37 deletions
|
@ -32,6 +32,7 @@ Page {
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
if (status === PageStatus.Active) {
|
if (status === PageStatus.Active) {
|
||||||
newChatPage.contacts = tdLibWrapper.getContactsFullInfo();
|
newChatPage.contacts = tdLibWrapper.getContactsFullInfo();
|
||||||
|
newChatPage.isLoading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,49 +51,280 @@ Page {
|
||||||
title: qsTr("Your Contacts")
|
title: qsTr("Your Contacts")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: contactsItem
|
||||||
|
|
||||||
|
width: newChatPageColumn.width
|
||||||
|
height: newChatPageColumn.height - newChatPageHeader.height
|
||||||
|
|
||||||
SilicaListView {
|
SilicaListView {
|
||||||
id: contactsListView
|
id: contactsListView
|
||||||
model: newChatPage.contacts
|
model: newChatPage.contacts
|
||||||
clip: true
|
clip: true
|
||||||
height: newChatPageColumn.height - newChatPageHeader.height
|
width: parent.width
|
||||||
width: newChatPageColumn.width
|
height: parent.height
|
||||||
//opacity: newChatPage.isLoading ? 0 : 1
|
visible: !newChatPage.isLoading
|
||||||
|
opacity: visible ? 1 : 0
|
||||||
Behavior on opacity { FadeAnimation {} }
|
Behavior on opacity { FadeAnimation {} }
|
||||||
|
|
||||||
|
signal newChatInitiated ( int currentIndex )
|
||||||
|
|
||||||
ViewPlaceholder {
|
ViewPlaceholder {
|
||||||
y: Theme.paddingLarge
|
y: Theme.paddingLarge
|
||||||
enabled: contactsListView.count === 0
|
enabled: contactsListView.count === 0
|
||||||
text: qsTr("You don't have any contacts.")
|
text: qsTr("You don't have any contacts.")
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: PhotoTextsListItem {
|
delegate: Item {
|
||||||
|
id: newChatListItem
|
||||||
|
width: parent.width
|
||||||
|
height: contactListItem.height
|
||||||
|
|
||||||
|
PhotoTextsListItem {
|
||||||
|
id: contactListItem
|
||||||
|
|
||||||
|
opacity: visible ? 1 : 0
|
||||||
|
Behavior on opacity { FadeAnimation {} }
|
||||||
|
|
||||||
pictureThumbnail {
|
pictureThumbnail {
|
||||||
photoData: (typeof modelData.profile_photo !== "undefined") ? modelData.profile_photo.small : ""
|
photoData: (typeof modelData.profile_photo !== "undefined") ? modelData.profile_photo.small : {}
|
||||||
}
|
}
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
primaryText.text: Emoji.emojify(Functions.getUserName(modelData), primaryText.font.pixelSize, "../js/emoji/")
|
primaryText.text: Emoji.emojify(Functions.getUserName(modelData), primaryText.font.pixelSize, "../js/emoji/")
|
||||||
prologSecondaryText.text: "@" + ( modelData.username !== "" ? modelData.username : modelData.id )
|
prologSecondaryText.text: "@" + ( modelData.username !== "" ? modelData.username : modelData.id )
|
||||||
// secondaryText {
|
|
||||||
// horizontalAlignment: Text.AlignRight
|
|
||||||
// property string statusText: Functions.getChatMemberStatusText(model.status["@type"])
|
|
||||||
// property string customText: model.status.custom_title ? Emoji.emojify(model.status.custom_title, secondaryText.font.pixelSize, "../js/emoji/") : ""
|
|
||||||
// text: (statusText !== "" && customText !== "") ? statusText + ", " + customText : statusText + customText
|
|
||||||
// }
|
|
||||||
tertiaryText {
|
tertiaryText {
|
||||||
maximumLineCount: 1
|
maximumLineCount: 1
|
||||||
text: Functions.getChatPartnerStatusText(modelData.status["@type"], modelData.status.was_online);
|
text: Functions.getChatPartnerStatusText(modelData.status["@type"], modelData.status.was_online);
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
contactsListView.newChatInitiated(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: contactsListView
|
||||||
|
onNewChatInitiated: {
|
||||||
|
if (index === currentIndex) {
|
||||||
|
contactListItem.visible = false;
|
||||||
|
} else {
|
||||||
|
contactListItem.visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: selectChatTypeColumn
|
||||||
|
visible: !contactListItem.visible
|
||||||
|
opacity: visible ? 1 : 0
|
||||||
|
Behavior on opacity { FadeAnimation {} }
|
||||||
|
width: parent.width
|
||||||
|
height: contactListItem.height
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height - chatTypeSeparator.height
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: 0.3
|
||||||
|
color: Theme.overlayBackgroundColor
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: privateChatItem
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width / 2 + ( Theme.horizontalPageMargin / 2 )
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.top: parent.top
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: privateChatHighlightBackground
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Theme.highlightBackgroundColor
|
||||||
|
opacity: 0.5
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height - ( 2 * Theme.paddingSmall )
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
IconButton {
|
||||||
|
id: privateChatButton
|
||||||
|
width: Theme.itemSizeLarge
|
||||||
|
height: Theme.itemSizeLarge
|
||||||
|
icon.source: "image://theme/icon-m-chat"
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
onClicked: {
|
onClicked: {
|
||||||
tdLibWrapper.createPrivateChat(modelData.id);
|
tdLibWrapper.createPrivateChat(modelData.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VerticalScrollDecorator {}
|
Column {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width - privateChatButton.width - Theme.horizontalPageMargin
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: Theme.paddingSmall
|
||||||
|
Text {
|
||||||
|
id: privateChatHeader
|
||||||
|
width: parent.width
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
font.weight: Font.ExtraBold
|
||||||
|
color: Theme.primaryColor
|
||||||
|
maximumLineCount: 1
|
||||||
|
elide: Text.ElideRight
|
||||||
|
textFormat: Text.StyledText
|
||||||
|
text: qsTr("Private Chat")
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height - privateChatHeader.height - Theme.paddingSmall
|
||||||
|
font.pixelSize: Theme.fontSizeTiny
|
||||||
|
color: Theme.secondaryColor
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
elide: Text.ElideRight
|
||||||
|
textFormat: Text.StyledText
|
||||||
|
text: qsTr("Transport-encrypted, stored in Telegram Cloud, sharable across devices")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
tdLibWrapper.createPrivateChat(modelData.id);
|
||||||
|
}
|
||||||
|
onPressed: {
|
||||||
|
privateChatHighlightBackground.visible = true;
|
||||||
|
}
|
||||||
|
onReleased: {
|
||||||
|
privateChatHighlightBackground.visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: secretChatItem
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width / 2 + ( Theme.horizontalPageMargin / 2 )
|
||||||
|
anchors.left: privateChatItem.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: secretChatHighlightBackground
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Theme.highlightBackgroundColor
|
||||||
|
opacity: 0.5
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height - ( 2 * Theme.paddingSmall )
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
IconButton {
|
||||||
|
id: secretChatButton
|
||||||
|
width: Theme.itemSizeLarge
|
||||||
|
height: Theme.itemSizeLarge
|
||||||
|
icon.source: "image://theme/icon-m-device-lock"
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
onClicked: {
|
||||||
|
console.log("SECRET CHAT!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width - secretChatButton.width - Theme.horizontalPageMargin
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: Theme.paddingSmall
|
||||||
|
Text {
|
||||||
|
width: parent.width
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
font.weight: Font.ExtraBold
|
||||||
|
color: Theme.primaryColor
|
||||||
|
maximumLineCount: 1
|
||||||
|
elide: Text.ElideRight
|
||||||
|
textFormat: Text.StyledText
|
||||||
|
text: qsTr("Secret Chat")
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height - privateChatHeader.height - Theme.paddingSmall
|
||||||
|
font.pixelSize: Theme.fontSizeTiny
|
||||||
|
color: Theme.secondaryColor
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
elide: Text.ElideRight
|
||||||
|
textFormat: Text.StyledText
|
||||||
|
text: qsTr("End-to-end-encrypted, accessible on this device only")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
console.log("SECRET CHAT!");
|
||||||
|
}
|
||||||
|
onPressed: {
|
||||||
|
secretChatHighlightBackground.visible = true;
|
||||||
|
}
|
||||||
|
onReleased: {
|
||||||
|
secretChatHighlightBackground.visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Separator {
|
||||||
|
id: chatTypeSeparator
|
||||||
|
width: parent.width
|
||||||
|
color: Theme.primaryColor
|
||||||
|
horizontalAlignment: Qt.AlignHCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
VerticalScrollDecorator {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
|
||||||
|
opacity: visible ? 1 : 0
|
||||||
|
Behavior on opacity { FadeAnimation {} }
|
||||||
|
visible: newChatPage.isLoading
|
||||||
|
width: parent.width
|
||||||
|
height: loadingLabel.height + loadingBusyIndicator.height + Theme.paddingMedium
|
||||||
|
|
||||||
|
spacing: Theme.paddingMedium
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
InfoLabel {
|
||||||
|
id: loadingLabel
|
||||||
|
text: qsTr("Loading contacs...")
|
||||||
|
}
|
||||||
|
|
||||||
|
BusyIndicator {
|
||||||
|
id: loadingBusyIndicator
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
running: newChatPage.isLoading
|
||||||
|
size: BusyIndicatorSize.Large
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -945,11 +945,14 @@ static bool compareUsers(const QVariant &user1, const QVariant &user2)
|
||||||
|
|
||||||
const QString lastName1 = userMap1.value(LAST_NAME).toString();
|
const QString lastName1 = userMap1.value(LAST_NAME).toString();
|
||||||
const QString lastName2 = userMap2.value(LAST_NAME).toString();
|
const QString lastName2 = userMap2.value(LAST_NAME).toString();
|
||||||
|
if (!lastName1.isEmpty()) {
|
||||||
if (lastName1 < lastName2) {
|
if (lastName1 < lastName2) {
|
||||||
return true;
|
return true;
|
||||||
} else if (lastName1 > lastName2) {
|
} else if (lastName1 > lastName2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const QString firstName1 = userMap1.value(FIRST_NAME).toString();
|
const QString firstName1 = userMap1.value(FIRST_NAME).toString();
|
||||||
const QString firstName2 = userMap2.value(FIRST_NAME).toString();
|
const QString firstName2 = userMap2.value(FIRST_NAME).toString();
|
||||||
if (firstName1 < firstName2) {
|
if (firstName1 < firstName2) {
|
||||||
|
|
|
@ -900,6 +900,14 @@
|
||||||
<source>You don't have any contacts.</source>
|
<source>You don't have any contacts.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Loading contacs...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Private Chat</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>NotificationManager</name>
|
<name>NotificationManager</name>
|
||||||
|
|
|
@ -900,6 +900,14 @@
|
||||||
<source>You don't have any contacts.</source>
|
<source>You don't have any contacts.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Loading contacs...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Private Chat</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>NotificationManager</name>
|
<name>NotificationManager</name>
|
||||||
|
|
|
@ -890,6 +890,14 @@
|
||||||
<source>You don't have any contacts.</source>
|
<source>You don't have any contacts.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Loading contacs...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Private Chat</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>NotificationManager</name>
|
<name>NotificationManager</name>
|
||||||
|
|
|
@ -901,6 +901,14 @@
|
||||||
<source>You don't have any contacts.</source>
|
<source>You don't have any contacts.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Loading contacs...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Private Chat</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>NotificationManager</name>
|
<name>NotificationManager</name>
|
||||||
|
|
|
@ -890,6 +890,14 @@
|
||||||
<source>You don't have any contacts.</source>
|
<source>You don't have any contacts.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Loading contacs...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Private Chat</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>NotificationManager</name>
|
<name>NotificationManager</name>
|
||||||
|
|
|
@ -900,6 +900,14 @@
|
||||||
<source>You don't have any contacts.</source>
|
<source>You don't have any contacts.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Loading contacs...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Private Chat</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>NotificationManager</name>
|
<name>NotificationManager</name>
|
||||||
|
|
|
@ -910,6 +910,14 @@
|
||||||
<source>You don't have any contacts.</source>
|
<source>You don't have any contacts.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Loading contacs...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Private Chat</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>NotificationManager</name>
|
<name>NotificationManager</name>
|
||||||
|
|
|
@ -910,6 +910,14 @@
|
||||||
<source>You don't have any contacts.</source>
|
<source>You don't have any contacts.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Loading contacs...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Private Chat</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>NotificationManager</name>
|
<name>NotificationManager</name>
|
||||||
|
|
|
@ -900,6 +900,14 @@
|
||||||
<source>You don't have any contacts.</source>
|
<source>You don't have any contacts.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Loading contacs...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Private Chat</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>NotificationManager</name>
|
<name>NotificationManager</name>
|
||||||
|
|
|
@ -890,6 +890,14 @@
|
||||||
<source>You don't have any contacts.</source>
|
<source>You don't have any contacts.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Loading contacs...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Private Chat</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>NotificationManager</name>
|
<name>NotificationManager</name>
|
||||||
|
|
|
@ -900,6 +900,14 @@
|
||||||
<source>You don't have any contacts.</source>
|
<source>You don't have any contacts.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Loading contacs...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Private Chat</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>NotificationManager</name>
|
<name>NotificationManager</name>
|
||||||
|
|
Loading…
Reference in a new issue