|
| 1 | +/* |
| 2 | +Copyright (C) 2014 Krisztian Olah |
| 3 | +
|
| 4 | + email: fasza2mobile@gmail.com |
| 5 | +
|
| 6 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | +of this software and associated documentation files (the "Software"), to deal |
| 8 | +in the Software without restriction, including without limitation the rights |
| 9 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | +copies of the Software, and to permit persons to whom the Software is |
| 11 | +furnished to do so, subject to the following conditions: |
| 12 | +
|
| 13 | +The above copyright notice and this permission notice shall be included in |
| 14 | +all copies or substantial portions of the Software. |
| 15 | +
|
| 16 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | +THE SOFTWARE. |
| 23 | +*/ |
| 24 | + |
| 25 | +import QtQuick 2.0 |
| 26 | +import Sailfish.Silica 1.0 |
| 27 | + |
| 28 | +Item { |
| 29 | + id: self |
| 30 | + property string title: "Title" |
| 31 | + property alias text: searchHeader.text |
| 32 | + property string placeholderText: "Search/Filter" |
| 33 | + |
| 34 | + signal filterChanged() |
| 35 | + height: searchHeader.height + 2 * Theme.paddingLarge |
| 36 | + anchors { |
| 37 | + left: parent.left |
| 38 | + right: parent.right |
| 39 | + } |
| 40 | + |
| 41 | + SearchHeader { |
| 42 | + id: searchHeader |
| 43 | + title: self.title |
| 44 | + placeholderText: self.placeholderText |
| 45 | + state: "invisible" |
| 46 | + |
| 47 | + onTextChanged: filterChanged() |
| 48 | + } |
| 49 | + |
| 50 | + state: "" |
| 51 | + |
| 52 | + states: [ |
| 53 | + State { |
| 54 | + name: "" |
| 55 | + PropertyChanges { |
| 56 | + target: searchHeader |
| 57 | + state: "invisible" |
| 58 | + } |
| 59 | + }, |
| 60 | + State { |
| 61 | + name: "searchable" |
| 62 | + PropertyChanges { |
| 63 | + target: searchHeader |
| 64 | + state: "visible" |
| 65 | + } |
| 66 | + }, |
| 67 | + State { |
| 68 | + name: "Traffic Disruptions" |
| 69 | + PropertyChanges { |
| 70 | + target: self |
| 71 | + title: "Traffic Disruptions" |
| 72 | + } |
| 73 | + PropertyChanges { |
| 74 | + target: searchHeader |
| 75 | + state: "visible" |
| 76 | + } |
| 77 | + }, |
| 78 | + State { |
| 79 | + name: "Scheduled" |
| 80 | + PropertyChanges { |
| 81 | + target: self |
| 82 | + title: "Scheduled" |
| 83 | + } |
| 84 | + PropertyChanges { |
| 85 | + target: searchHeader |
| 86 | + state: "visible" |
| 87 | + } |
| 88 | + }, |
| 89 | + State { |
| 90 | + name: "Recurring Works" |
| 91 | + PropertyChanges { |
| 92 | + target: self |
| 93 | + title: "Recurring Works" |
| 94 | + } |
| 95 | + PropertyChanges { |
| 96 | + target: searchHeader |
| 97 | + state: "visible" |
| 98 | + } |
| 99 | + }, |
| 100 | + State { |
| 101 | + name: "Recently Cleared" |
| 102 | + PropertyChanges { |
| 103 | + target: self |
| 104 | + title: "Recently Cleared" |
| 105 | + } |
| 106 | + PropertyChanges { |
| 107 | + target: searchHeader |
| 108 | + state: "visible" |
| 109 | + } |
| 110 | + } |
| 111 | + ] |
| 112 | +} |
0 commit comments