Guest User

Untitled

a guest
Nov 17th, 2014
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. [nemo@Jolla ~]$ ls -l /opt/sdk/SailChatSailfish
  2. ls: cannot access /opt/sdk/SailChatSailfish: No such file or directory
  3.  
  4. [SailChatSailfish.pro]
  5. TARGET = SailChatSailfish
  6.  
  7. CONFIG += sailfishapp
  8.  
  9. SOURCES += src/SailChatSailfish.cpp
  10.  
  11. OTHER_FILES += qml/SailChatSailfish.qml \
  12. qml/cover/CoverPage.qml \
  13. qml/pages/FirstPage.qml \
  14. qml/pages/SecondPage.qml \
  15. rpm/SailChatSailfish.changes.in \
  16. rpm/SailChatSailfish.spec \
  17. rpm/SailChatSailfish.yaml \
  18. translations/*.ts \
  19. SailChatSailfish.desktop \
  20. qml/logic/client.js \
  21. qml/pages/client.js
  22.  
  23. CONFIG += sailfishapp_i18n
  24. TRANSLATIONS += translations/SailChatSailfish-de.ts
  25.  
  26.  
  27. [pages/Firstpage.qml]
  28. import QtQuick 2.0
  29. import Sailfish.Silica 1.0
  30. import "../logic/client.js" as Client
  31.  
  32. Page {
  33. id: page
  34. property int messageID : -1
  35.  
  36.  
  37. ListView {
  38. id: listview
  39. anchors.top: parent.top
  40. anchors.bottom: bar.top
  41. anchors.left : parent.left
  42. anchors.right: parent.right
  43. anchors.leftMargin: 10
  44. anchors.rightMargin: 10
  45. anchors.topMargin: 10
  46. anchors.bottomMargin: 10
  47.  
  48. model: messages
  49. delegate: Label {
  50. text: from + ": " + message
  51. }
  52. clip: true
  53. }
  54.  
  55. Item {
  56. id: bar
  57. height: textField.height
  58. anchors.left : parent.left
  59. anchors.right: parent.right
  60. anchors.bottom: parent.bottom
  61. TextField {
  62. Keys.onReturnPressed: {
  63. if(text.trim()!=="") {
  64. Client.sendMessage(text ,messageID, messageSend)
  65. text = "";
  66. }
  67. }
  68. id: textField
  69. anchors.fill: parent
  70. }
  71. }
  72.  
  73. ListModel {
  74. id: messages
  75. }
  76.  
  77. function messageSend(data) {
  78. for(var i=0; i<data.messages.length; i++) {
  79. messages.append(data.messages[i]);
  80. }
  81. listview.positionViewAtEnd()
  82. messageID = data.mID
  83. }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment