diff options
| author | Javier <dev.git@javispedro.com> | 2014-12-21 21:03:18 +0100 |
|---|---|---|
| committer | Javier <dev.git@javispedro.com> | 2014-12-21 21:03:18 +0100 |
| commit | e1d94fc21ecbce16815810c4f274f349b49e82a3 (patch) | |
| tree | bf4c286ab01c5bb35e04fcd643f6fdd4e9730db8 | |
| parent | 8f0905197f7cead299c00006ada482095fe9d1a4 (diff) | |
add itemselector to the appconfig webview
| -rw-r--r-- | app/app.pro | 1 | ||||
| -rw-r--r-- | app/qml/pages/AppConfigDialog.qml | 18 | ||||
| -rw-r--r-- | app/qml/pages/WebItemSelDialog.qml | 45 | ||||
| -rw-r--r-- | app/translations/pebble-es.ts | 2 | ||||
| -rw-r--r-- | app/translations/pebble.ts | 2 |
5 files changed, 65 insertions, 3 deletions
diff --git a/app/app.pro b/app/app.pro index ca03ab1..97c6232 100644 --- a/app/app.pro +++ b/app/app.pro @@ -25,6 +25,7 @@ OTHER_FILES += \ qml/pages/AboutPage.qml \ qml/pages/InstallAppDialog.qml \ qml/pages/AppConfigDialog.qml \ + qml/pages/WebItemSelDialog.qml \ qml/pebble.qml \ qml/images/* \ translations/*.ts \ diff --git a/app/qml/pages/AppConfigDialog.qml b/app/qml/pages/AppConfigDialog.qml index 92f188f..304bced 100644 --- a/app/qml/pages/AppConfigDialog.qml +++ b/app/qml/pages/AppConfigDialog.qml @@ -19,6 +19,8 @@ Dialog { title: "Configuring " + name } + VerticalScrollDecorator { flickable: webview } + onNavigationRequested: { console.log("appconfig navigation requested to " + request.url); var url = request.url.toString(); @@ -34,7 +36,21 @@ Dialog { } } - VerticalScrollDecorator { flickable: webview } + experimental.itemSelector: Component { + Item { + Component.onCompleted: { + var dialog = pageStack.push(Qt.resolvedUrl("WebItemSelDialog.qml"), { + model: model.items + }); + dialog.onRejected.connect(function() { + model.reject(); + }); + dialog.onAccepted.connect(function() { + model.accept(dialog.selectedIndex); + }); + } + } + } } ProgressBar { diff --git a/app/qml/pages/WebItemSelDialog.qml b/app/qml/pages/WebItemSelDialog.qml new file mode 100644 index 0000000..f8c49f2 --- /dev/null +++ b/app/qml/pages/WebItemSelDialog.qml @@ -0,0 +1,45 @@ +import QtQuick 2.0 +import QtQml 2.1 +import Sailfish.Silica 1.0 + +Dialog { + id: itemSelDialog + property alias model: listView.model + property int selectedIndex: -1 + + SilicaListView { + id: listView + anchors.fill: parent + + VerticalScrollDecorator { flickable: webview } + + header: PageHeader { + } + + delegate: ListItem { + id: itemDelegate + contentHeight: Theme.itemSizeSmall + + Label { + anchors { + left: parent.left + leftMargin: Theme.paddingMedium + right: parent.right + rightMargin: Theme.paddingMedium + verticalCenter: parent.verticalCenter + } + text: model.text + color: model.enabled ? + (itemDelegate.highlighted ? Theme.highlightColor : Theme.primaryColor) + : Theme.secondaryColor + truncationMode: TruncationMode.Fade + } + + enabled: model.enabled + onClicked: { + selectedIndex = model.index; + accept(); + } + } + } +} diff --git a/app/translations/pebble-es.ts b/app/translations/pebble-es.ts index 3a8da7d..18b1ec2 100644 --- a/app/translations/pebble-es.ts +++ b/app/translations/pebble-es.ts @@ -22,7 +22,7 @@ <context> <name>AppConfigDialog</name> <message> - <location filename="../qml/pages/AppConfigDialog.qml" line="57"/> + <location filename="../qml/pages/AppConfigDialog.qml" line="74"/> <source>No configuration settings available</source> <translation>No hay opciones disponibles para configurar</translation> </message> diff --git a/app/translations/pebble.ts b/app/translations/pebble.ts index 0c61f38..222645c 100644 --- a/app/translations/pebble.ts +++ b/app/translations/pebble.ts @@ -22,7 +22,7 @@ <context> <name>AppConfigDialog</name> <message> - <location filename="../qml/pages/AppConfigDialog.qml" line="57"/> + <location filename="../qml/pages/AppConfigDialog.qml" line="74"/> <source>No configuration settings available</source> <translation type="unfinished"></translation> </message> |
