Skip to content

Commit

Permalink
Cleanup QML
Browse files Browse the repository at this point in the history
  • Loading branch information
neochapay committed Oct 16, 2023
1 parent 56d176b commit 50e6ca0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 40 deletions.
2 changes: 1 addition & 1 deletion src/qml/components/ConversationListDelegate.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2018-2021 Chupligin Serhey <[email protected]>
/* Copyright (C) 2018-2023 Chupligin Serhey <[email protected]>
* Copyright (C) 2012 John Brooks <[email protected]>
* Copyright (C) 2011 Robin Burchell <[email protected]>
*
Expand Down
5 changes: 2 additions & 3 deletions src/qml/components/ConversationListWidget.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2018 Chupligin Serhey <[email protected]>
/* Copyright (C) 2018-2023 Chupligin Serhey <[email protected]>
* Copyright (C) 2012 John Brooks <[email protected]>
* Copyright (C) 2011 Robin Burchell <[email protected]>
*
Expand Down Expand Up @@ -55,8 +55,7 @@ Item {
delegate: ConversationListDelegate {
onClicked: {
var group = model.group
var channel = channelManager.getConversation(group.localUid, group.remoteUids[0])
pageStack.push(Qt.resolvedUrl("../pages/ConversationPage.qml"), { "channel": channel, "group": group })
app.push(Qt.resolvedUrl("../pages/ConversationPage.qml"), { "group": group })
}
}

Expand Down
17 changes: 17 additions & 0 deletions src/qml/glacier-messages.qml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,23 @@ ApplicationWindow {
useBackgroundThread: true
}

OfonoManager {
id: manager
}

OfonoMessageManager{
id: messageManager
modemPath: manager.defaultModem
onMessageAdded: {
console.log("HELLO MESSAGE")
console.log(message)
}

Component.onCompleted: {
messageManager.sendMessage("+79962491221", "Hello nemo")
}
}

PeopleModel {
id: peopleModel
}
Expand Down
41 changes: 5 additions & 36 deletions src/qml/pages/ConversationPage.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2018-2021 Chupligin Sergey <[email protected]>
/* Copyright (C) 2018-2023 Chupligin Sergey <[email protected]>
* Copyright (C) 2012 John Brooks <[email protected]>
* Copyright (C) 2011 Robin Burchell <[email protected]>
*
Expand Down Expand Up @@ -47,7 +47,6 @@ import "../components"
Page {
id: conversationPage

property QtObject channel: null
property QtObject group
property QtObject person: group ? peopleModel.personById(group.contactId) : null
property string remoteUid: ""
Expand Down Expand Up @@ -75,7 +74,6 @@ Page {

TextField {
id: targetEditor
visible: !channel
width: parent.width-Theme.itemSpacingLarge*2
height: Theme.itemHeightExtraLarge-Theme.itemSpacingLarge*2

Expand Down Expand Up @@ -119,50 +117,21 @@ Page {
width: parent.width

onSendMessage: {
if (text.length < 1 && (!channel && targetEditor.length < 1)) {
if (text.length < 1 && (targetEditor.length < 1)) {
return
}

if(!channel) {
channel = channelManager.getConversation(accountsModel.get(0, TelepathyAccountsModel.AccountUidRole),targetEditor.text)
hTools.title = targetEditor.text
}

groupManager.createOutgoingMessageEvent(group.id, channel.localUid, group.remoteUids[0], text, function(eventId) {
groupManager.createOutgoingMessageEvent(group.id, group.localUid, group.remoteUids[0], text, function(eventId) {
console.log("groupId" + group.id)
console.log("channel.localUid" + channel.localUid)
console.log("group.localUid" + group.localUid)
console.log("group.remoteUids[0]" + group.remoteUids[0])
console.log("eventId" + eventId)
channel.sendMessage(text, eventId)
})
clear()
}
}

states: [
State {
name: "new"
when: channel == null

PropertyChanges {
target: targetEditor
visible: true
}

AnchorChanges {
target: messagesView
anchors.top: targetEditor.bottom
}
}
]

onChannelChanged: {
if (channel != null) {
channel.ensureChannel()
_updateGroup()
}
}

Connections {
target: groupManager

Expand All @@ -177,7 +146,7 @@ Page {

function _updateGroup() {
if (group === null)
group = groupManager.findGroup(channel.localUid, channel.remoteUid)
group = groupManager.findGroup(group.localUid, group.remoteUid)
}

function markAsRead() {
Expand Down

0 comments on commit 50e6ca0

Please sign in to comment.