NCInputTextField.qml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (C) 2022 by Claudio Cambra <claudio.cambra@nextcloud.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. * for more details.
  13. */
  14. import QtQuick 2.15
  15. import QtQuick.Controls 2.15
  16. import QtQuick.Layouts 1.15
  17. import com.nextcloud.desktopclient 1.0
  18. import Style 1.0
  19. TextField {
  20. id: root
  21. readonly property color accentColor: Style.ncBlue
  22. readonly property color secondaryColor: palette.dark
  23. readonly property alias submitButton: submitButton
  24. implicitHeight: Style.talkReplyTextFieldPreferredHeight
  25. rightPadding: submitButton.width
  26. selectByMouse: true
  27. background: Rectangle {
  28. id: textFieldBorder
  29. radius: Style.slightlyRoundedButtonRadius
  30. border.width: Style.normalBorderWidth
  31. border.color: root.activeFocus ? root.accentColor : root.secondaryColor
  32. color: palette.base
  33. }
  34. Button {
  35. id: submitButton
  36. anchors.top: root.top
  37. anchors.right: root.right
  38. anchors.margins: 1
  39. width: height
  40. height: parent.height
  41. background: null
  42. flat: true
  43. icon.source: "image://svgimage-custom-color/confirm.svg" + "/" + root.secondaryColor
  44. icon.color: hovered && enabled ? UserModel.currentUser.accentColor : root.secondaryColor
  45. enabled: root.text !== ""
  46. onClicked: root.accepted()
  47. }
  48. }