Unity 8
ScopeSettingsPage.qml
1 /*
2  * Copyright (C) 2014 Canonical, Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 import QtQuick 2.4
18 import Ubuntu.Components 1.3
19 import Unity 0.2
20 import "../Components"
21 import "ScopeSettings"
22 
23 Item {
24  id: root
25 
26  property var scope: null
27  property var scopeStyle: null
28 
29  signal backClicked()
30 
31  DashPageHeader {
32  id: header
33  objectName: "pageHeader"
34  width: parent.width
35  title: scope ? scope.name : ""
36  showBackButton: true
37  scopeStyle: root.scopeStyle
38 
39  onBackClicked: root.backClicked()
40  }
41 
42  ListView {
43  id: scopeSettings
44  objectName: "scopeSettings"
45  anchors {
46  top: header.bottom
47  bottom: parent.bottom
48  left: parent.left
49  right: parent.right
50  }
51  model: root.scope ? root.scope.settings : null
52  clip: true
53 
54  ListViewOSKScroller {
55  id: oskScroller
56  list: scopeSettings
57  }
58 
59  delegate: ScopeSettingsWidgetFactory {
60  objectName: "scopeSettingItem" + index
61  width: root.width
62  widgetData: model
63  scopeStyle: root.scopeStyle
64 
65  onUpdated: model.value = value;
66 
67  onMakeSureVisible: { // var item
68  oskScroller.setMakeSureVisibleItem(item);
69  }
70  }
71  }
72 }