ContactDetails.qml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. import examples.addressbook 1.0
  29. StackItem {
  30. id: root
  31. property Contact contact: null
  32. Flickable {
  33. anchors.fill: parent
  34. contentHeight: innerColumn.height + 70 + 10
  35. contentWidth: parent.width
  36. Column {
  37. id: innerColumn
  38. anchors.right: parent.right
  39. anchors.left: parent.left
  40. TextRow {
  41. id: firstNameField
  42. label: qsTr("First name")
  43. text: contact.firstName
  44. }
  45. TextRow {
  46. id: middleNameField
  47. label: qsTr("Middle name")
  48. text: contact.middleName
  49. }
  50. TextRow {
  51. id: lastNameField
  52. label: qsTr("Last name")
  53. text: contact.lastName
  54. }
  55. TextRow {
  56. id: _homePhoneField
  57. label: qsTr("Home phone")
  58. text: _homePhone ? "+" + _homePhone.countryCode + " " + _homePhone.number : ""
  59. property PhoneNumber _homePhone: contact.phones[0]
  60. }
  61. DropDownColumn {
  62. anchors.right: parent.right
  63. anchors.left: parent.left
  64. width: root.width
  65. header: qsTr("Job")
  66. value: _jobTitle.text
  67. TextRow {
  68. id: _jobTitle
  69. label: qsTr("Title")
  70. text: contact.job.title
  71. }
  72. Item {
  73. height: 70
  74. anchors.right: parent.right
  75. anchors.left: parent.left
  76. PrimaryText {
  77. anchors.bottom: parent.bottom
  78. text: qsTr("Address")
  79. }
  80. }
  81. TextRow {
  82. id: _jstreetAddress1
  83. label: qsTr("Street address 1")
  84. text: contact.job.officeAddress.streetAddress1
  85. }
  86. TextRow {
  87. id: _jstreetAddress2
  88. label: qsTr("Street address 2")
  89. text: contact.job.officeAddress.streetAddress2
  90. }
  91. TextRow {
  92. id: _jzipCode
  93. label: qsTr("Zip code")
  94. text: "" + contact.job.officeAddress.zipCode
  95. }
  96. TextRow {
  97. id: _jstate
  98. label: qsTr("State")
  99. text: contact.job.officeAddress.state
  100. }
  101. TextRow {
  102. id: _jCountry
  103. label: qsTr("Country")
  104. text: contact.job.officeAddress.country
  105. }
  106. }
  107. DropDownColumn {
  108. anchors.right: parent.right
  109. anchors.left: parent.left
  110. width: root.width
  111. header: qsTr("Home address")
  112. TextRow {
  113. id: _streetAddress1
  114. label: qsTr("Street address 1")
  115. text: contact.address.streetAddress1
  116. }
  117. TextRow {
  118. id: _streetAddress2
  119. label: qsTr("Street address 2")
  120. text: contact.address.streetAddress2
  121. }
  122. TextRow {
  123. id: _zipCode
  124. label: qsTr("Zip code")
  125. text: "" + contact.address.zipCode
  126. }
  127. TextRow {
  128. id: _state
  129. label: qsTr("State")
  130. text: contact.address.state
  131. }
  132. TextRow {
  133. id: _country
  134. label: qsTr("Country")
  135. text: contact.address.country
  136. }
  137. }
  138. }
  139. }
  140. FloatingRoundButton {
  141. id: call
  142. enabled: _homePhoneField.text.length > 0
  143. && AddressBookEngine.callStatus.status !== CallStatus.Active && AddressBookEngine.callStatus.status !== CallStatus.Ended
  144. anchors.right: parent.right
  145. anchors.bottom: parent.bottom
  146. anchors.margins: 10
  147. icon: "qrc:/images/call.png"
  148. primaryColor: "#4CAF50"
  149. secondaryColor: "#58cb5c"
  150. onClicked: {
  151. AddressBookEngine.makeCall(contact.phones[0])
  152. stack.pop();
  153. }
  154. }
  155. }