ContactDetails.qml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * MIT License
  3. *
  4. * Copyright (c) 2019 Alexey Edelev <semlanik@gmail.com>
  5. *
  6. * This file is part of qtprotobuf project https://git.semlanik.org/semlanik/qtprotobuf
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a copy of this
  9. * software and associated documentation files (the "Software"), to deal in the Software
  10. * without restriction, including without limitation the rights to use, copy, modify,
  11. * merge, publish, distribute, sublicense, and/or sell copies of the Software, and
  12. * to permit persons to whom the Software is furnished to do so, subject to the following
  13. * conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be included in all copies
  16. * or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  19. * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  20. * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
  21. * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  22. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  23. * DEALINGS IN THE SOFTWARE.
  24. */
  25. import QtQuick 2.9
  26. import QtQuick.Controls 2.4
  27. import qtprotobuf.examples 1.0
  28. StackItem {
  29. id: root
  30. property Contact contact: null
  31. Flickable {
  32. anchors.fill: parent
  33. contentHeight: innerColumn.height + 70 + 10
  34. contentWidth: parent.width
  35. Column {
  36. id: innerColumn
  37. anchors.right: parent.right
  38. anchors.left: parent.left
  39. TextRow {
  40. id: firstNameField
  41. label: qsTr("First name")
  42. text: contact.firstName
  43. }
  44. TextRow {
  45. id: middleNameField
  46. label: qsTr("Middle name")
  47. text: contact.middleName
  48. }
  49. TextRow {
  50. id: lastNameField
  51. label: qsTr("Last name")
  52. text: contact.lastName
  53. }
  54. TextRow {
  55. id: _homePhoneField
  56. label: qsTr("Home phone")
  57. text: _homePhone ? "+" + _homePhone.countryCode + " " + _homePhone.number : ""
  58. property PhoneNumber _homePhone: contact.phonesData[0]
  59. }
  60. DropDownColumn {
  61. anchors.right: parent.right
  62. anchors.left: parent.left
  63. width: root.width
  64. header: qsTr("Job")
  65. value: _jobTitle.text
  66. TextRow {
  67. id: _jobTitle
  68. label: qsTr("Title")
  69. text: contact.job.title
  70. }
  71. Item {
  72. height: 70
  73. anchors.right: parent.right
  74. anchors.left: parent.left
  75. PrimaryText {
  76. anchors.bottom: parent.bottom
  77. text: qsTr("Address")
  78. }
  79. }
  80. TextRow {
  81. id: _jstreetAddress1
  82. label: qsTr("Street address 1")
  83. text: contact.job.officeAddress.streetAddress1
  84. }
  85. TextRow {
  86. id: _jstreetAddress2
  87. label: qsTr("Street address 2")
  88. text: contact.job.officeAddress.streetAddress2
  89. }
  90. TextRow {
  91. id: _jzipCode
  92. label: qsTr("Zip code")
  93. text: contact.job.officeAddress.zipCode
  94. }
  95. TextRow {
  96. id: _jstate
  97. label: qsTr("State")
  98. text: contact.job.officeAddress.state
  99. }
  100. TextRow {
  101. id: _jCountry
  102. label: qsTr("Country")
  103. text: contact.job.officeAddress.country
  104. }
  105. }
  106. DropDownColumn {
  107. anchors.right: parent.right
  108. anchors.left: parent.left
  109. width: root.width
  110. header: qsTr("Home address")
  111. TextRow {
  112. id: _streetAddress1
  113. label: qsTr("Street address 1")
  114. text: contact.address.streetAddress1
  115. }
  116. TextRow {
  117. id: _streetAddress2
  118. label: qsTr("Street address 2")
  119. text: contact.address.streetAddress2
  120. }
  121. TextRow {
  122. id: _zipCode
  123. label: qsTr("Zip code")
  124. text: contact.address.zipCode
  125. }
  126. TextRow {
  127. id: _state
  128. label: qsTr("State")
  129. text: contact.address.state
  130. }
  131. TextRow {
  132. id: _country
  133. label: qsTr("Country")
  134. text: contact.address.country
  135. }
  136. }
  137. }
  138. }
  139. FloatingRoundButton {
  140. id: call
  141. enabled: _homePhoneField.text.length > 0
  142. && abEngine.callStatus.status !== CallStatus.Active && abEngine.callStatus.status !== CallStatus.Ended
  143. anchors.right: parent.right
  144. anchors.bottom: parent.bottom
  145. anchors.margins: 10
  146. icon: "qrc:/images/call.png"
  147. primaryColor: "#4CAF50"
  148. secondaryColor: "#58cb5c"
  149. onClicked: {
  150. abEngine.makeCall(contact.phonesData[0])
  151. stack.pop();
  152. }
  153. }
  154. }