Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.0
- import Ubuntu.Components 0.1
- import Ubuntu.Components.Popups 0.1
- import Communi 3.1
- Page{
- id: page
- property IrcBuffer serverBuffer
- property alias bufferModel: bufferListView.bufferModel
- property alias currentBuffer: bufferListView.currentBuffer
- property IrcChannel currentChannel: currentBuffer ? currentBuffer.toChannel() : null
- title: currentBuffer.name
- tools: chatToolbars
- TopicLabel {
- id: topicLabel
- width: parent.width
- visible: currentChannel
- channel: currentChannel
- anchors.top: parent.top
- }
- //thetext that is recived
- Item{
- width: parent.width
- anchors.top: topicLabel.bottom
- anchors.bottom: textEntry.top
- Repeater {
- anchors.fill: parent
- model: bufferModel
- delegate: TextBrowser {
- anchors.fill: parent
- buffer: model.buffer
- visible: buffer == currentBuffer
- }
- }
- }
- TextEntry {
- id: textEntry
- width: parent.width
- height: parent.height / 12
- buffer: currentBuffer
- enabled: currentBuffer
- anchors.bottom: parent.bottom
- onMessageSent: currentBuffer.receiveMessage(message)
- Connections {
- target: page
- onCurrentBufferChanged: {
- if (page.visible && currentBuffer)
- textEntry.forceActiveFocus()
- }
- }
- }
- Connections {
- target: bufferModel
- onAdded: currentBuffer = buffer
- onAboutToBeRemoved: {
- var idx = bufferModel.indexOf(buffer)
- currentBuffer = bufferModel.get(idx + 1) || bufferModel.get(Math.max(0, idx - 1))
- }
- }
- //Different channels that are open/
- BufferListView {
- id: bufferListView
- width: parent.width
- height: parent.height - window.header.height
- y: Math.round(window.header.hight)
- visible: false
- onClosed: {
- if (buffer === serverBuffer) {
- bufferModel.quit()
- } else {
- if (buffer.channel)
- buffer.part(qsTr("Ubuntu Touch Port of Communi %1 ").arg(irc.version()))
- bufferModel.remove(buffer)
- }
- }
- }
- //Component{
- //Query and look up users to PM
- UserListView {
- id: userPage
- width: page.width
- height: parent.height - window.header.height
- y: units.gu(12)
- visible: false
- channel: currentChannel
- onQueried: currentBuffer = currentBuffer.model.add(user.name)
- }
- ToolbarItems{
- id:chatToolbars
- ToolbarButton{
- text: qsTr("Users")
- iconSource: "/usr/share/icons/ubuntu-mobile/actions/scalable/contact.svg"
- onTriggered: pageStack.push(userPage)
- }
- ToolbarButton{
- text: "Channels"
- iconSource: "/usr/share/icons/ubuntu-mobile/actions/scalable/messages.svg"
- onTriggered: pageStack.push(bufferListView)
- }
- ToolbarButton {
- text: qsTr("Settings")
- iconSource: "/usr/share/icons/ubuntu-mobile/actions/scalable/settings.svg"
- onTriggered: pageStack.push(settingsPage)
- }
- ToolbarButton {
- text: qsTr("Close")
- iconSource: "/usr/share/icons/ubuntu-mobile/actions/scalable/close.svg"
- enabled: !!bufferListView.currentBuffer
- onTriggered: bufferListView.closed(currentBuffer)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement