parent
fe0b390a87
commit
653a35500c
3 changed files with 113 additions and 127 deletions
|
@ -24,39 +24,57 @@ 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 {
|
|
||||||
MenuItem {
|
|
||||||
visible: unread_count > 0
|
|
||||||
onClicked: {
|
|
||||||
tdLibWrapper.viewMessage(chat_id, display.last_message.id, true);
|
|
||||||
}
|
|
||||||
text: qsTr("Mark all messages as read")
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuItem {
|
onPressAndHold: {
|
||||||
visible: chat_id != listItem.ownUserId
|
contextMenuLoader.active = true;
|
||||||
onClicked: {
|
}
|
||||||
var newNotificationSettings = display.notification_settings;
|
|
||||||
if (newNotificationSettings.mute_for > 0) {
|
|
||||||
newNotificationSettings.mute_for = 0;
|
|
||||||
} else {
|
|
||||||
newNotificationSettings.mute_for = 6666666;
|
|
||||||
}
|
|
||||||
newNotificationSettings.use_default_mute_for = false;
|
|
||||||
tdLibWrapper.setChatNotificationSettings(chat_id, newNotificationSettings);
|
|
||||||
}
|
|
||||||
text: display.notification_settings.mute_for > 0 ? qsTr("Unmute Chat") : qsTr("Mute Chat")
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuItem {
|
Loader {
|
||||||
onClicked: {
|
id: contextMenuLoader
|
||||||
if(pageStack.depth > 2) {
|
active: false
|
||||||
pageStack.pop(pageStack.find( function(page){ return(page._depth === 0)} ), PageStackAction.Immediate);
|
asynchronous: true
|
||||||
|
onStatusChanged: {
|
||||||
|
if(status === Loader.Ready) {
|
||||||
|
listItem.menu = item;
|
||||||
|
listItem.openMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sourceComponent: Component {
|
||||||
|
ContextMenu {
|
||||||
|
MenuItem {
|
||||||
|
visible: unread_count > 0
|
||||||
|
onClicked: {
|
||||||
|
tdLibWrapper.viewMessage(chat_id, display.last_message.id, true);
|
||||||
|
}
|
||||||
|
text: qsTr("Mark all messages as read")
|
||||||
}
|
}
|
||||||
|
|
||||||
pageStack.push(Qt.resolvedUrl("../pages/ChatInformationPage.qml"), { "chatInformation" : display});
|
MenuItem {
|
||||||
|
visible: chat_id != listItem.ownUserId
|
||||||
|
onClicked: {
|
||||||
|
var newNotificationSettings = display.notification_settings;
|
||||||
|
if (newNotificationSettings.mute_for > 0) {
|
||||||
|
newNotificationSettings.mute_for = 0;
|
||||||
|
} else {
|
||||||
|
newNotificationSettings.mute_for = 6666666;
|
||||||
|
}
|
||||||
|
newNotificationSettings.use_default_mute_for = false;
|
||||||
|
tdLibWrapper.setChatNotificationSettings(chat_id, newNotificationSettings);
|
||||||
|
}
|
||||||
|
text: display.notification_settings.mute_for > 0 ? qsTr("Unmute Chat") : qsTr("Mute Chat")
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItem {
|
||||||
|
onClicked: {
|
||||||
|
if(pageStack.depth > 2) {
|
||||||
|
pageStack.pop(pageStack.find( function(page){ return(page._depth === 0)} ), PageStackAction.Immediate);
|
||||||
|
}
|
||||||
|
|
||||||
|
pageStack.push(Qt.resolvedUrl("../pages/ChatInformationPage.qml"), { "chatInformation" : display});
|
||||||
|
}
|
||||||
|
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,101 +216,72 @@ Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
PageHeader {
|
||||||
id: column
|
id: pageHeader
|
||||||
width: parent.width
|
title: qsTr("Fernschreiber")
|
||||||
height: parent.height
|
leftMargin: Theme.itemSizeMedium
|
||||||
spacing: Theme.paddingMedium
|
|
||||||
|
|
||||||
Row {
|
GlassItem {
|
||||||
id: headerRow
|
id: pageStatus
|
||||||
width: parent.width
|
width: Theme.itemSizeMedium
|
||||||
|
height: Theme.itemSizeMedium
|
||||||
|
color: "red"
|
||||||
|
falloffRadius: 0.1
|
||||||
|
radius: 0.2
|
||||||
|
cache: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GlassItem {
|
SilicaListView {
|
||||||
id: pageStatus
|
id: chatListView
|
||||||
width: Theme.itemSizeMedium
|
anchors {
|
||||||
height: Theme.itemSizeMedium
|
top: pageHeader.bottom
|
||||||
color: "red"
|
bottom: parent.bottom
|
||||||
falloffRadius: 0.1
|
left: parent.left
|
||||||
radius: 0.2
|
right: parent.right
|
||||||
cache: false
|
}
|
||||||
}
|
clip: true
|
||||||
|
opacity: overviewPage.chatListCreated ? 1 : 0
|
||||||
PageHeader {
|
Behavior on opacity { FadeAnimation {} }
|
||||||
id: pageHeader
|
model: chatListModel
|
||||||
title: qsTr("Fernschreiber")
|
delegate: ChatListViewItem {
|
||||||
width: parent.width - pageStatus.width
|
ownUserId: overviewPage.ownUserId
|
||||||
|
isVerified: is_verified
|
||||||
|
onClicked: {
|
||||||
|
pageStack.push(Qt.resolvedUrl("../pages/ChatPage.qml"), {
|
||||||
|
chatInformation : display,
|
||||||
|
chatPicture: photo_small
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
ViewPlaceholder {
|
||||||
id: chatListItem
|
enabled: chatListView.count === 0
|
||||||
width: parent.width
|
text: qsTr("You don't have any chats yet.")
|
||||||
height: parent.height - Theme.paddingMedium - headerRow.height
|
}
|
||||||
|
|
||||||
SilicaListView {
|
VerticalScrollDecorator {}
|
||||||
|
}
|
||||||
|
|
||||||
id: chatListView
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.paddingMedium
|
||||||
|
anchors.verticalCenter: chatListView.verticalCenter
|
||||||
|
|
||||||
anchors.fill: parent
|
opacity: overviewPage.chatListCreated ? 0 : 1
|
||||||
|
Behavior on opacity { FadeAnimation {} }
|
||||||
|
visible: !overviewPage.chatListCreated
|
||||||
|
|
||||||
clip: true
|
InfoLabel {
|
||||||
opacity: overviewPage.chatListCreated ? 1 : 0
|
id: loadingLabel
|
||||||
Behavior on opacity { NumberAnimation {} }
|
text: qsTr("Loading chat list...")
|
||||||
|
}
|
||||||
|
|
||||||
model: chatListModel
|
BusyIndicator {
|
||||||
delegate: ChatListViewItem {
|
id: loadingBusyIndicator
|
||||||
ownUserId: overviewPage.ownUserId
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
isVerified: is_verified
|
running: !overviewPage.chatListCreated
|
||||||
|
size: BusyIndicatorSize.Large
|
||||||
onClicked: {
|
|
||||||
pageStack.push(Qt.resolvedUrl("../pages/ChatPage.qml"), {
|
|
||||||
chatInformation : display,
|
|
||||||
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 {
|
|
||||||
enabled: chatListView.count === 0
|
|
||||||
text: qsTr("You don't have any chats yet.")
|
|
||||||
}
|
|
||||||
|
|
||||||
VerticalScrollDecorator {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
|
||||||
width: parent.width
|
|
||||||
height: loadingLabel.height + loadingBusyIndicator.height + Theme.paddingMedium
|
|
||||||
spacing: Theme.paddingMedium
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
opacity: overviewPage.chatListCreated ? 0 : 1
|
|
||||||
Behavior on opacity { NumberAnimation {} }
|
|
||||||
visible: !overviewPage.chatListCreated
|
|
||||||
|
|
||||||
InfoLabel {
|
|
||||||
id: loadingLabel
|
|
||||||
text: qsTr("Loading chat list...")
|
|
||||||
}
|
|
||||||
|
|
||||||
BusyIndicator {
|
|
||||||
id: loadingBusyIndicator
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
running: !overviewPage.chatListCreated
|
|
||||||
size: BusyIndicatorSize.Large
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue