Files
amnezia-client/client/ui/qml/Components/CountrySearchField.qml
T
yp c5ecf6281f feat: location separation (#3181)
* Feat: location separation

* remove temp code

* remove tab filter

* fixed models

* remove settings button in native configs

* reset & fixed crash focus

* derive country list use-case set from listId

* fixed: search field: Esc on empty field -> passed on, page closes

* country list: three levels, split by full catalog

* favorites: keep unstarred row until list refresh

* favorites on configuration files screen

* split country list by visible locations

* hysteresis for region split: split above 15, merge below 13

* section counters ignore search, follow chip

* empty state: suggest switching keyboard layout

* section header: counter in parentheses on collapsed sections only

* country list: scroll-linked large title header

* current section expanded on entry without overwriting saved collapse

* country list: raise scrollbar above pinned overlays, drawer above it

* qml: collapsing header component, config files header, country list parts extracted

* country list: ignore unknown use case ids from catalog

* country list: use case names from catalog (nameLocalized), ui language in model

* country list: collapsed sections kept for the session only, as in the task

* country list: design review fixes

* favorites limit: toast from the mockup with 'show' action

* toast: geometry, typography, shadow and action button from figma
2026-10-08 23:31:05 +08:00

108 lines
2.5 KiB
QML

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Style 1.0
import "../Controls2"
Rectangle {
id: root
property alias textField: input
property alias text: input.text
readonly property alias displayText: input.displayText
signal cleared()
implicitHeight: 64
color: AmneziaStyle.color.surfaceBase
radius: 16
border.width: 1
border.color: input.activeFocus ? AmneziaStyle.color.paleGray : AmneziaStyle.color.borderSoft
Behavior on border.color {
PropertyAnimation { duration: 200 }
}
function clear() {
input.text = ""
root.cleared()
}
RowLayout {
anchors.fill: parent
anchors.leftMargin: 16
anchors.rightMargin: 8
spacing: 8
TextField {
id: input
property bool isFocusable: true
Keys.onTabPressed: {
FocusController.nextKeyTabItem()
}
Keys.onBacktabPressed: {
FocusController.previousKeyTabItem()
}
Layout.fillWidth: true
color: AmneziaStyle.color.textPrimary
placeholderText: qsTr("Country or region")
placeholderTextColor: AmneziaStyle.color.mutedGray
selectionColor: AmneziaStyle.color.richBrown
selectedTextColor: AmneziaStyle.color.textPrimary
font.pixelSize: 16
font.weight: 400
font.family: "PT Root UI VF"
inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText
maximumLength: 64
topPadding: 0
bottomPadding: 0
leftPadding: 0
rightPadding: 0
background: Rectangle {
color: AmneziaStyle.color.transparent
}
Keys.onEscapePressed: function(event) {
if (input.text === "") {
event.accepted = false
return
}
root.clear()
}
ContextMenu.menu: ContextMenuType {
textObj: input
}
}
ImageButtonType {
visible: input.text !== ""
implicitWidth: 40
implicitHeight: 40
hoverEnabled: true
image: "qrc:/images/controls/close.svg"
imageColor: AmneziaStyle.color.paleGray
onClicked: root.clear()
Keys.onEnterPressed: root.clear()
Keys.onReturnPressed: root.clear()
}
}
}