Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [nemo@Jolla ~]$ ls -l /opt/sdk/SailChatSailfish
- ls: cannot access /opt/sdk/SailChatSailfish: No such file or directory
- [SailChatSailfish.pro]
- TARGET = SailChatSailfish
- CONFIG += sailfishapp
- SOURCES += src/SailChatSailfish.cpp
- OTHER_FILES += qml/SailChatSailfish.qml \
- qml/cover/CoverPage.qml \
- qml/pages/FirstPage.qml \
- qml/pages/SecondPage.qml \
- rpm/SailChatSailfish.changes.in \
- rpm/SailChatSailfish.spec \
- rpm/SailChatSailfish.yaml \
- translations/*.ts \
- SailChatSailfish.desktop \
- qml/logic/client.js \
- qml/pages/client.js
- CONFIG += sailfishapp_i18n
- TRANSLATIONS += translations/SailChatSailfish-de.ts
- [pages/Firstpage.qml]
- import QtQuick 2.0
- import Sailfish.Silica 1.0
- import "../logic/client.js" as Client
- Page {
- id: page
- property int messageID : -1
- ListView {
- id: listview
- anchors.top: parent.top
- anchors.bottom: bar.top
- anchors.left : parent.left
- anchors.right: parent.right
- anchors.leftMargin: 10
- anchors.rightMargin: 10
- anchors.topMargin: 10
- anchors.bottomMargin: 10
- model: messages
- delegate: Label {
- text: from + ": " + message
- }
- clip: true
- }
- Item {
- id: bar
- height: textField.height
- anchors.left : parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- TextField {
- Keys.onReturnPressed: {
- if(text.trim()!=="") {
- Client.sendMessage(text ,messageID, messageSend)
- text = "";
- }
- }
- id: textField
- anchors.fill: parent
- }
- }
- ListModel {
- id: messages
- }
- function messageSend(data) {
- for(var i=0; i<data.messages.length; i++) {
- messages.append(data.messages[i]);
- }
- listview.positionViewAtEnd()
- messageID = data.mID
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment