2020-06-07 12:06:14 +03:00
|
|
|
import QtQuick 2.0
|
|
|
|
import Sailfish.Silica 1.0
|
|
|
|
import "../pages/utils.js" as Utils
|
|
|
|
|
|
|
|
Dialog {
|
|
|
|
id: dialog
|
2020-08-06 18:34:14 +03:00
|
|
|
allowedOrientations: Orientation.All
|
2020-06-07 12:06:14 +03:00
|
|
|
|
|
|
|
property string name
|
|
|
|
property string choice
|
|
|
|
property string new_choice: choice
|
|
|
|
property var choices
|
2021-06-21 22:31:36 +03:00
|
|
|
property var preferred_choices
|
|
|
|
property string preferred_choice_suffix
|
2020-06-07 12:06:14 +03:00
|
|
|
canAccept: false
|
|
|
|
|
|
|
|
SilicaListView
|
|
|
|
{
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
header: DialogHeader {}
|
|
|
|
|
|
|
|
model: choices
|
|
|
|
delegate: BackgroundItem {
|
|
|
|
onClicked: {
|
|
|
|
new_choice=choices[index]
|
|
|
|
dialog.canAccept = true
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
x: Theme.paddingLarge
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
highlighted: choices[index]==new_choice
|
|
|
|
text: Utils.ippName(name, choices[index])
|
2021-06-21 22:31:36 +03:00
|
|
|
+ (Utils.has(preferred_choices, choices[index]) ? " "+preferred_choice_suffix : "")
|
2020-06-07 12:06:14 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onDone: {
|
|
|
|
if (result == DialogResult.Accepted) {
|
|
|
|
choice = new_choice
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|