summaryrefslogtreecommitdiff
path: root/sowatchui/qml
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2012-08-10 16:06:14 +0200
committerJavier S. Pedro <maemo@javispedro.com>2012-08-10 16:06:14 +0200
commit39fa663cd08bd2b7d46ed170d49ac794c531c42e (patch)
tree92131388053eadbfca4b8917ab1e1f87ffe30fdd /sowatchui/qml
parentb9082fda48bb026fc4e6148efeba9aabf608373a (diff)
downloadsowatch-39fa663cd08bd2b7d46ed170d49ac794c531c42e.tar.gz
sowatch-39fa663cd08bd2b7d46ed170d49ac794c531c42e.zip
watchlet edit UI
Diffstat (limited to 'sowatchui/qml')
-rw-r--r--sowatchui/qml/AddWatchletSheet.qml48
-rw-r--r--sowatchui/qml/WatchPage.qml62
2 files changed, 104 insertions, 6 deletions
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()
}
}
}