2024-05-06 17:55:11 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
2024-06-19 13:13:32 +00:00
|
|
|
import QtQml.Models 2.15
|
2024-05-06 17:55:11 +00:00
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
|
2024-05-21 10:42:50 +00:00
|
|
|
import StatusQ.Core 0.1
|
2024-05-06 17:55:11 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
2024-05-21 10:42:50 +00:00
|
|
|
import StatusQ.Components 0.1
|
2024-05-06 17:55:11 +00:00
|
|
|
|
|
|
|
import shared.controls 1.0
|
|
|
|
|
2024-07-04 11:38:13 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
2024-09-03 12:57:07 +00:00
|
|
|
StatusDropdown {
|
2024-05-06 17:55:11 +00:00
|
|
|
id: root
|
|
|
|
|
|
|
|
objectName: "dappsPopup"
|
|
|
|
|
2024-06-19 13:13:32 +00:00
|
|
|
required property DelegateModel delegateModel
|
2024-05-06 17:55:11 +00:00
|
|
|
|
2024-09-03 12:57:07 +00:00
|
|
|
signal connectDapp()
|
2024-05-06 17:55:11 +00:00
|
|
|
|
2024-06-19 13:13:32 +00:00
|
|
|
width: 312
|
2024-07-04 11:38:13 +00:00
|
|
|
padding: 0
|
2024-06-19 13:13:32 +00:00
|
|
|
|
2024-05-06 17:55:11 +00:00
|
|
|
modal: false
|
2024-08-05 13:41:20 +00:00
|
|
|
|
2024-06-19 13:13:32 +00:00
|
|
|
contentItem: ColumnLayout {
|
2024-05-21 10:42:50 +00:00
|
|
|
id: mainLayout
|
2024-08-05 13:41:20 +00:00
|
|
|
|
2024-07-04 11:38:13 +00:00
|
|
|
spacing: 0
|
2024-08-05 13:41:20 +00:00
|
|
|
|
2024-05-06 17:55:11 +00:00
|
|
|
ShapeRectangle {
|
2024-05-21 10:42:50 +00:00
|
|
|
id: listPlaceholder
|
|
|
|
|
|
|
|
text: qsTr("Connected dApps will appear here")
|
|
|
|
|
2024-05-06 17:55:11 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: implicitHeight
|
2024-07-04 11:38:13 +00:00
|
|
|
Layout.leftMargin: Style.current.halfPadding
|
|
|
|
Layout.rightMargin: Layout.leftMargin
|
|
|
|
Layout.topMargin: Layout.leftMargin
|
|
|
|
Layout.bottomMargin: 4
|
2024-05-21 10:42:50 +00:00
|
|
|
|
|
|
|
visible: listView.count === 0
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
2024-07-04 11:38:13 +00:00
|
|
|
Layout.preferredHeight: 36
|
|
|
|
Layout.leftMargin: Style.current.padding
|
|
|
|
Layout.rightMargin: Layout.leftMargin
|
|
|
|
Layout.topMargin: Style.current.halfPadding
|
2024-05-21 10:42:50 +00:00
|
|
|
|
|
|
|
visible: !listPlaceholder.visible
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
text: qsTr("Connected dApps")
|
|
|
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
|
|
font.pixelSize: 12
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-04 11:38:13 +00:00
|
|
|
Item {
|
|
|
|
id: listViewWrapper
|
2024-05-21 10:42:50 +00:00
|
|
|
Layout.fillWidth: true
|
2024-07-04 11:38:13 +00:00
|
|
|
Layout.preferredHeight: listView.contentHeight
|
2024-08-06 13:55:00 +00:00
|
|
|
|
|
|
|
// TODO: uncomment maximumHeight: 290 and remove fillHeight: true
|
|
|
|
// after status app upgrades to
|
|
|
|
// a Qt version that has ListView scrolling with mouse wheel and
|
|
|
|
// touchpad fixed.
|
|
|
|
// https://github.com/status-im/status-desktop/issues/15595
|
|
|
|
// Layout.maximumHeight: 290
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
2024-05-21 10:42:50 +00:00
|
|
|
visible: !listPlaceholder.visible
|
|
|
|
|
2024-07-04 11:38:13 +00:00
|
|
|
Rectangle {
|
|
|
|
id: header
|
|
|
|
width: parent.width
|
|
|
|
height: 4
|
|
|
|
color: Theme.palette.directColor8
|
|
|
|
visible: !listView.atYBeginning
|
|
|
|
}
|
|
|
|
StatusListView {
|
|
|
|
id: listView
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.leftMargin: Style.current.halfPadding
|
|
|
|
anchors.rightMargin: anchors.leftMargin
|
|
|
|
model: root.delegateModel
|
|
|
|
}
|
|
|
|
Rectangle {
|
|
|
|
id: footer
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
width: parent.width
|
|
|
|
height: 4
|
|
|
|
color: Theme.palette.directColor8
|
|
|
|
visible: !listView.atYEnd
|
|
|
|
}
|
2024-05-06 17:55:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusButton {
|
2024-07-04 11:38:13 +00:00
|
|
|
id: connectDappButton
|
2024-05-31 09:34:59 +00:00
|
|
|
objectName: "connectDappButton"
|
2024-05-06 17:55:11 +00:00
|
|
|
Layout.fillWidth: true
|
2024-07-04 11:38:13 +00:00
|
|
|
Layout.preferredHeight: 38
|
|
|
|
Layout.leftMargin: Style.current.halfPadding
|
|
|
|
Layout.rightMargin: Layout.leftMargin
|
|
|
|
Layout.bottomMargin: Layout.leftMargin
|
|
|
|
Layout.topMargin: 4
|
|
|
|
|
|
|
|
size: StatusButton.Size.Small
|
2024-05-06 17:55:11 +00:00
|
|
|
|
2024-09-03 12:57:07 +00:00
|
|
|
text: qsTr("Connect a dApp")
|
|
|
|
onClicked: root.connectDapp()
|
2024-05-06 17:55:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|