diff --git a/qml/pages/NewChatPage.qml b/qml/pages/NewChatPage.qml
index 0ccb8ca..606710d 100644
--- a/qml/pages/NewChatPage.qml
+++ b/qml/pages/NewChatPage.qml
@@ -32,6 +32,7 @@ Page {
onStatusChanged: {
if (status === PageStatus.Active) {
newChatPage.contacts = tdLibWrapper.getContactsFullInfo();
+ newChatPage.isLoading = false;
}
}
@@ -50,49 +51,280 @@ Page {
title: qsTr("Your Contacts")
}
- SilicaListView {
- id: contactsListView
- model: newChatPage.contacts
- clip: true
- height: newChatPageColumn.height - newChatPageHeader.height
+ Item {
+ id: contactsItem
+
width: newChatPageColumn.width
- //opacity: newChatPage.isLoading ? 0 : 1
- Behavior on opacity { FadeAnimation {} }
+ height: newChatPageColumn.height - newChatPageHeader.height
- ViewPlaceholder {
- y: Theme.paddingLarge
- enabled: contactsListView.count === 0
- text: qsTr("You don't have any contacts.")
- }
-
- delegate: PhotoTextsListItem {
- pictureThumbnail {
- photoData: (typeof modelData.profile_photo !== "undefined") ? modelData.profile_photo.small : ""
- }
+ SilicaListView {
+ id: contactsListView
+ model: newChatPage.contacts
+ clip: true
width: parent.width
+ height: parent.height
+ visible: !newChatPage.isLoading
+ opacity: visible ? 1 : 0
+ Behavior on opacity { FadeAnimation {} }
- primaryText.text: Emoji.emojify(Functions.getUserName(modelData), primaryText.font.pixelSize, "../js/emoji/")
- 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 {
- maximumLineCount: 1
- text: Functions.getChatPartnerStatusText(modelData.status["@type"], modelData.status.was_online);
- elide: Text.ElideRight
+ signal newChatInitiated ( int currentIndex )
+
+ ViewPlaceholder {
+ y: Theme.paddingLarge
+ enabled: contactsListView.count === 0
+ text: qsTr("You don't have any contacts.")
}
- onClicked: {
- tdLibWrapper.createPrivateChat(modelData.id);
+ delegate: Item {
+ id: newChatListItem
+ width: parent.width
+ height: contactListItem.height
+
+ PhotoTextsListItem {
+ id: contactListItem
+
+ opacity: visible ? 1 : 0
+ Behavior on opacity { FadeAnimation {} }
+
+ pictureThumbnail {
+ photoData: (typeof modelData.profile_photo !== "undefined") ? modelData.profile_photo.small : {}
+ }
+ width: parent.width
+
+ primaryText.text: Emoji.emojify(Functions.getUserName(modelData), primaryText.font.pixelSize, "../js/emoji/")
+ prologSecondaryText.text: "@" + ( modelData.username !== "" ? modelData.username : modelData.id )
+ tertiaryText {
+ maximumLineCount: 1
+ text: Functions.getChatPartnerStatusText(modelData.status["@type"], modelData.status.was_online);
+ 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: {
+ tdLibWrapper.createPrivateChat(modelData.id);
+ }
+ }
+
+ 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
}
}
- VerticalScrollDecorator {}
}
- }
+ }
}
}
diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp
index 1ee93e7..35627f6 100644
--- a/src/tdlibwrapper.cpp
+++ b/src/tdlibwrapper.cpp
@@ -945,11 +945,14 @@ static bool compareUsers(const QVariant &user1, const QVariant &user2)
const QString lastName1 = userMap1.value(LAST_NAME).toString();
const QString lastName2 = userMap2.value(LAST_NAME).toString();
- if (lastName1 < lastName2) {
- return true;
- } else if (lastName1 > lastName2) {
- return false;
+ if (!lastName1.isEmpty()) {
+ if (lastName1 < lastName2) {
+ return true;
+ } else if (lastName1 > lastName2) {
+ return false;
+ }
}
+
const QString firstName1 = userMap1.value(FIRST_NAME).toString();
const QString firstName2 = userMap2.value(FIRST_NAME).toString();
if (firstName1 < firstName2) {
diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts
index ba7a6da..7275abf 100644
--- a/translations/harbour-fernschreiber-de.ts
+++ b/translations/harbour-fernschreiber-de.ts
@@ -900,6 +900,14 @@
+
+
+
+
+
+
+
+
NotificationManager
diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts
index 10b812e..cb366d0 100644
--- a/translations/harbour-fernschreiber-en.ts
+++ b/translations/harbour-fernschreiber-en.ts
@@ -900,6 +900,14 @@
+
+
+
+
+
+
+
+
NotificationManager
diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts
index 713df9e..c614667 100644
--- a/translations/harbour-fernschreiber-es.ts
+++ b/translations/harbour-fernschreiber-es.ts
@@ -890,6 +890,14 @@
+
+
+
+
+
+
+
+
NotificationManager
diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts
index 4ac28d9..9fe8954 100644
--- a/translations/harbour-fernschreiber-fi.ts
+++ b/translations/harbour-fernschreiber-fi.ts
@@ -901,6 +901,14 @@
+
+
+
+
+
+
+
+
NotificationManager
diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts
index b4b5943..4285c5b 100644
--- a/translations/harbour-fernschreiber-hu.ts
+++ b/translations/harbour-fernschreiber-hu.ts
@@ -890,6 +890,14 @@
+
+
+
+
+
+
+
+
NotificationManager
diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts
index e447337..891e2dd 100644
--- a/translations/harbour-fernschreiber-it.ts
+++ b/translations/harbour-fernschreiber-it.ts
@@ -900,6 +900,14 @@
+
+
+
+
+
+
+
+
NotificationManager
diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts
index 9c6ca06..5d1a105 100644
--- a/translations/harbour-fernschreiber-pl.ts
+++ b/translations/harbour-fernschreiber-pl.ts
@@ -910,6 +910,14 @@
+
+
+
+
+
+
+
+
NotificationManager
diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts
index c77126f..20f6eef 100644
--- a/translations/harbour-fernschreiber-ru.ts
+++ b/translations/harbour-fernschreiber-ru.ts
@@ -910,6 +910,14 @@
+
+
+
+
+
+
+
+
NotificationManager
diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts
index fb9b0d4..6722cc6 100644
--- a/translations/harbour-fernschreiber-sv.ts
+++ b/translations/harbour-fernschreiber-sv.ts
@@ -900,6 +900,14 @@
+
+
+
+
+
+
+
+
NotificationManager
diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts
index a4c00ab..56403ac 100644
--- a/translations/harbour-fernschreiber-zh_CN.ts
+++ b/translations/harbour-fernschreiber-zh_CN.ts
@@ -890,6 +890,14 @@
+
+
+
+
+
+
+
+
NotificationManager
diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts
index 10b812e..cb366d0 100644
--- a/translations/harbour-fernschreiber.ts
+++ b/translations/harbour-fernschreiber.ts
@@ -900,6 +900,14 @@
+
+
+
+
+
+
+
+
NotificationManager