SearchBox component (needed for the AlbumsPage)
[mussorgsky] / ui / SearchBox.qml
diff --git a/ui/SearchBox.qml b/ui/SearchBox.qml
new file mode 100644 (file)
index 0000000..0712f72
--- /dev/null
@@ -0,0 +1,47 @@
+import QtQuick 1.1
+import com.nokia.meego 1.0
+
+Item {
+    id: searchBox
+
+    property alias text: custom.text
+    signal selected (string search_text)
+
+
+    anchors { left: parent.left; right: parent.right; 
+              bottomMargin: 10; leftMargin: 10; rightMargin: 10}
+    height: custom.height
+
+    TextField {
+         id: custom
+         anchors { left: parent.left; right: activateButton.left; rightMargin: 10}
+
+         platformSipAttributes: SipAttributes { actionKeyLabel: "Search" 
+                                                actionKeyHighlighted: true}
+
+         placeholderText: "free search"
+         platformStyle: TextFieldStyle { paddingRight: clearButton.width }
+         Image {
+              id: clearButton
+              anchors.right: parent.right
+              anchors.verticalCenter: parent.verticalCenter
+              source: "image://theme/icon-m-input-clear"
+              MouseArea {
+                  anchors.fill: parent
+                  onClicked: {
+                       inputContext.reset();
+                       custom.text = "";                                        
+                  }
+              }
+         }
+     }
+     Button {
+        id: activateButton
+        anchors.right: parent.right
+        width: 100
+        text: "Search"
+        onClicked: { console.log (custom.text);
+                     searchBox.selected (custom.text) }
+     }
+}