parent
fe0b390a87
commit
653a35500c
3 changed files with 113 additions and 127 deletions
|
@ -24,7 +24,23 @@ PhotoTextsListItem {
|
||||||
isSecret: ( chat_type === TelegramAPI.ChatTypeSecret )
|
isSecret: ( chat_type === TelegramAPI.ChatTypeSecret )
|
||||||
|
|
||||||
openMenuOnPressAndHold: true//chat_id != overviewPage.ownUserId
|
openMenuOnPressAndHold: true//chat_id != overviewPage.ownUserId
|
||||||
menu: ContextMenu {
|
|
||||||
|
onPressAndHold: {
|
||||||
|
contextMenuLoader.active = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: contextMenuLoader
|
||||||
|
active: false
|
||||||
|
asynchronous: true
|
||||||
|
onStatusChanged: {
|
||||||
|
if(status === Loader.Ready) {
|
||||||
|
listItem.menu = item;
|
||||||
|
listItem.openMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sourceComponent: Component {
|
||||||
|
ContextMenu {
|
||||||
MenuItem {
|
MenuItem {
|
||||||
visible: unread_count > 0
|
visible: unread_count > 0
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
@ -59,5 +75,7 @@ PhotoTextsListItem {
|
||||||
text: model.display.type['@type'] === "chatTypePrivate" ? qsTr("User Info") : qsTr("Group Info")
|
text: model.display.type['@type'] === "chatTypePrivate" ? qsTr("User Info") : qsTr("Group Info")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,15 +154,6 @@ ChatInformationTabItemBase {
|
||||||
pageStack.pop(pageStack.find( function(page){ return(page._depth === 0)} ), PageStackAction.Immediate);
|
pageStack.pop(pageStack.find( function(page){ return(page._depth === 0)} ), PageStackAction.Immediate);
|
||||||
pageStack.push(Qt.resolvedUrl("../../pages/ChatPage.qml"), { "chatInformation" : display });
|
pageStack.push(Qt.resolvedUrl("../../pages/ChatPage.qml"), { "chatInformation" : display });
|
||||||
}
|
}
|
||||||
Connections {
|
|
||||||
target: chatListModel
|
|
||||||
onChatChanged: {
|
|
||||||
if (changedChatId === chat_id) {
|
|
||||||
// Force update of some list item elements (currently only last message text seems to create problems). dataChanged() doesn't seem to trigger them all :(
|
|
||||||
secondaryText.text = last_message_text ? Emoji.emojify(Functions.enhanceHtmlEntities(last_message_text), Theme.fontSizeExtraSmall) : qsTr("Unknown")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,13 +59,13 @@ Page {
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: chatListCreatedTimer
|
id: chatListCreatedTimer
|
||||||
interval: 300
|
interval: 20
|
||||||
running: false
|
running: false
|
||||||
repeat: false
|
repeat: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
overviewPage.chatListCreated = true;
|
overviewPage.chatListCreated = true;
|
||||||
chatListModel.redrawModel();
|
|
||||||
chatListView.scrollToTop();
|
chatListView.scrollToTop();
|
||||||
|
updateSecondaryContentTimer.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,6 +76,15 @@ Page {
|
||||||
pageStack.push(Qt.resolvedUrl("../pages/InitializationPage.qml"));
|
pageStack.push(Qt.resolvedUrl("../pages/InitializationPage.qml"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Timer {
|
||||||
|
id: updateSecondaryContentTimer
|
||||||
|
interval: 600
|
||||||
|
onTriggered: {
|
||||||
|
tdLibWrapper.getRecentStickers();
|
||||||
|
tdLibWrapper.getInstalledStickerSets();
|
||||||
|
tdLibWrapper.getContacts();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setPageStatus() {
|
function setPageStatus() {
|
||||||
switch (overviewPage.connectionState) {
|
switch (overviewPage.connectionState) {
|
||||||
|
@ -104,9 +113,6 @@ Page {
|
||||||
|
|
||||||
function updateContent() {
|
function updateContent() {
|
||||||
tdLibWrapper.getChats();
|
tdLibWrapper.getChats();
|
||||||
tdLibWrapper.getRecentStickers();
|
|
||||||
tdLibWrapper.getInstalledStickerSets();
|
|
||||||
tdLibWrapper.getContacts();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function initializePage() {
|
function initializePage() {
|
||||||
|
@ -210,15 +216,10 @@ Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
PageHeader {
|
||||||
id: column
|
id: pageHeader
|
||||||
width: parent.width
|
title: qsTr("Fernschreiber")
|
||||||
height: parent.height
|
leftMargin: Theme.itemSizeMedium
|
||||||
spacing: Theme.paddingMedium
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: headerRow
|
|
||||||
width: parent.width
|
|
||||||
|
|
||||||
GlassItem {
|
GlassItem {
|
||||||
id: pageStatus
|
id: pageStatus
|
||||||
|
@ -229,50 +230,29 @@ Page {
|
||||||
radius: 0.2
|
radius: 0.2
|
||||||
cache: false
|
cache: false
|
||||||
}
|
}
|
||||||
|
|
||||||
PageHeader {
|
|
||||||
id: pageHeader
|
|
||||||
title: qsTr("Fernschreiber")
|
|
||||||
width: parent.width - pageStatus.width
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: chatListItem
|
|
||||||
width: parent.width
|
|
||||||
height: parent.height - Theme.paddingMedium - headerRow.height
|
|
||||||
|
|
||||||
SilicaListView {
|
SilicaListView {
|
||||||
|
|
||||||
id: chatListView
|
id: chatListView
|
||||||
|
anchors {
|
||||||
anchors.fill: parent
|
top: pageHeader.bottom
|
||||||
|
bottom: parent.bottom
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
clip: true
|
clip: true
|
||||||
opacity: overviewPage.chatListCreated ? 1 : 0
|
opacity: overviewPage.chatListCreated ? 1 : 0
|
||||||
Behavior on opacity { NumberAnimation {} }
|
Behavior on opacity { FadeAnimation {} }
|
||||||
|
|
||||||
model: chatListModel
|
model: chatListModel
|
||||||
delegate: ChatListViewItem {
|
delegate: ChatListViewItem {
|
||||||
ownUserId: overviewPage.ownUserId
|
ownUserId: overviewPage.ownUserId
|
||||||
isVerified: is_verified
|
isVerified: is_verified
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
pageStack.push(Qt.resolvedUrl("../pages/ChatPage.qml"), {
|
pageStack.push(Qt.resolvedUrl("../pages/ChatPage.qml"), {
|
||||||
chatInformation : display,
|
chatInformation : display,
|
||||||
chatPicture: photo_small
|
chatPicture: photo_small
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: chatListModel
|
|
||||||
onChatChanged: {
|
|
||||||
if (overviewPage.chatListCreated && changedChatId === chat_id) {
|
|
||||||
// Force update of some list item elements (currently only last message text seems to create problems). dataChanged() doesn't seem to trigger them all :(
|
|
||||||
secondaryText.text = last_message_text ? Emoji.emojify(Functions.enhanceHtmlEntities(last_message_text), Theme.fontSizeExtraSmall) : qsTr("Unknown")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewPlaceholder {
|
ViewPlaceholder {
|
||||||
|
@ -285,12 +265,11 @@ Page {
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: loadingLabel.height + loadingBusyIndicator.height + Theme.paddingMedium
|
|
||||||
spacing: Theme.paddingMedium
|
spacing: Theme.paddingMedium
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: chatListView.verticalCenter
|
||||||
|
|
||||||
opacity: overviewPage.chatListCreated ? 0 : 1
|
opacity: overviewPage.chatListCreated ? 0 : 1
|
||||||
Behavior on opacity { NumberAnimation {} }
|
Behavior on opacity { FadeAnimation {} }
|
||||||
visible: !overviewPage.chatListCreated
|
visible: !overviewPage.chatListCreated
|
||||||
|
|
||||||
InfoLabel {
|
InfoLabel {
|
||||||
|
@ -306,6 +285,4 @@ Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue