From 39fa663cd08bd2b7d46ed170d49ac794c531c42e Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Fri, 10 Aug 2012 16:06:14 +0200 Subject: watchlet edit UI --- sowatchui/qml/AddWatchletSheet.qml | 48 +++++++++++++++++++++++++++++ sowatchui/qml/WatchPage.qml | 62 ++++++++++++++++++++++++++++++++++---- 2 files changed, 104 insertions(+), 6 deletions(-) create mode 100644 sowatchui/qml/AddWatchletSheet.qml (limited to 'sowatchui/qml') diff --git a/sowatchui/qml/AddWatchletSheet.qml b/sowatchui/qml/AddWatchletSheet.qml new file mode 100644 index 0000000..e052350 --- /dev/null +++ b/sowatchui/qml/AddWatchletSheet.qml @@ -0,0 +1,48 @@ +import QtQuick 1.1 +import com.nokia.meego 1.1 +import com.nokia.extras 1.1 +import com.javispedro.sowatch 1.0 + +Sheet { + id: sheet + anchors.margins: UiConstants.DefaultMargin + + property string configKey; + + rejectButtonText: qsTr("Cancel") + + content: ListView { + id: listView + anchors.fill: parent + anchors.margins: UiConstants.DefaultMargin + + flickableDirection: Flickable.VerticalFlick + + model: WatchletsModel { + id: watchletsModel + configKey: sheet.configKey + displayUnadded: true + } + + header: Column { + width: parent.width + + GroupHeader { + width: parent.width + text: qsTr("Available watchlets") + } + } + + delegate: ListDelegate { + onClicked: { + watchletsModel.addWatchlet(model.name); + close(); + accepted(); + } + } + + ScrollDecorator { + flickableItem: listView + } + } +} diff --git a/sowatchui/qml/WatchPage.qml b/sowatchui/qml/WatchPage.qml index 21c4543..4799085 100644 --- a/sowatchui/qml/WatchPage.qml +++ b/sowatchui/qml/WatchPage.qml @@ -14,10 +14,55 @@ Page { tools: ToolBarLayout { ToolIcon { + id: backToolIcon platformIconId: "toolbar-back" anchors.left: parent.left onClicked: pageStack.pop() } + ToolIcon { + id: menuToolIcon + platformIconId: "toolbar-view-menu" + anchors.right: parent.right + onClicked: (watchMenu.status === DialogStatus.Closed) ? watchMenu.open() : watchMenu.close(); + } + } + + Menu { + id: watchMenu + MenuLayout { + MenuItem { + text: qsTr("Remove watch") + onClicked: { + watchMenu.close(); + watches.removeWatch(watchPage.configKey); + pageStack.pop(); + } + } + } + } + + Menu { + id: watchletMenu + property string watchlet; + MenuLayout { + MenuItem { + text: qsTr("Move up") + onClicked: watchletsModel.moveWatchletUp(watchletMenu.watchlet) + } + MenuItem { + text: qsTr("Move down") + onClicked: watchletsModel.moveWatchletDown(watchletMenu.watchlet) + } + MenuItem { + text: qsTr("Remove watchlet") + onClicked: watchletsModel.removeWatchlet(watchletMenu.watchlet) + } + } + } + + AddWatchletSheet { + id: addWatchletSheet + configKey: watchPage.configKey } GConfKey { @@ -84,7 +129,7 @@ Page { height: UiConstants.ListItemHeightDefault * count model: ProvidersModel { id: providersModel - configKey: watchPage.configKey + "/providers" + configKey: watchPage.configKey } delegate: ListDelegate { CheckBox { @@ -107,19 +152,24 @@ Page { interactive: false width: parent.width height: UiConstants.ListItemHeightDefault * count - model: ListModel { - ListElement { - title: "Test" - } + model: WatchletsModel { + id: watchletsModel + configKey: watchPage.configKey + displayUnadded: false } - delegate: ListDelegate { + delegate: ListDelegate { + onClicked: { + watchletMenu.watchlet = model.name; + watchletMenu.open(); + } } } Button { anchors.horizontalCenter: parent.horizontalCenter text: qsTr("Add new watchlet") + onClicked: addWatchletSheet.open() } } } -- cgit v1.2.3