/* * Copyright 2012-2018 Morgan McMillian * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import bb.cascades 1.0 Page { id: filterPage property alias filterModel: filterModel property alias warningtext: warningtext signal resetFilter() titleBar: TitleBar { id: titleBar title: " Filter List" } Container { Container { id: warningtext leftPadding: 30.0 topPadding: 30.0 rightPadding: 30.0 bottomPadding: 30.0 visible: false Label { text: "There are no project or context tags in your task list to " + "filter on. You can define a project tag by prefixing some text " + "with the + symbol or a context tag with the @ symbol in your tasks." multiline: true textStyle.fontStyle: FontStyle.Italic } } ListView { id: filterList dataModel: GroupDataModel { id: filterModel sortingKeys: [ "type" ] grouping: ItemGrouping.ByFullValue signal changeFilter(string filter, bool enabled) } listItemComponents: [ ListItemComponent { type: "listItem" Container { id: filterItem layout: StackLayout { } Container { layout: DockLayout { } horizontalAlignment: HorizontalAlignment.Fill topPadding: 15.0 leftPadding: 20.0 rightPadding: 30.0 Label { text: ListItemData.title } CheckBox { id: filterCheck horizontalAlignment: HorizontalAlignment.Right // TODO: checked: need it out of the taskModel checked: ListItemData.checked onCheckedChanged: { //console.log(filterCheck.checked) filterItem.ListItem.view.dataModel.changeFilter(ListItemData.title, filterCheck.checked) } } } Divider { } } } ] function itemType(data, indexPath) { if (indexPath.length == 1) { return "header"; } else { return "listItem"; } } } } actions: [ ActionItem { title: "Reset" imageSource: "icons/Delete.png" ActionBar.placement: ActionBarPlacement.OnBar onTriggered: { resetFilter(); navi.pop(); } } ] }