18 import Ubuntu.Components 0.1
21 import
"../Components"
26 property var model: null
27 property var scopes: null
28 readonly
property alias currentIndex: dashContentList.currentIndex
30 signal scopeLoaded(
string scopeId)
31 signal gotoScope(
string scopeId)
32 signal openScope(var scope)
37 property var set_current_index: undefined
41 if (scopes.loaded && set_current_index != undefined) {
42 setCurrentScopeAtIndex(set_current_index[0], set_current_index[1], set_current_index[2]);
43 set_current_index = undefined;
48 function setCurrentScopeAtIndex(index, animate, reset) {
51 set_current_index = [ index, animate, reset ]
55 var storedMoveDuration = dashContentList.highlightMoveDuration
56 var storedMoveSpeed = dashContentList.highlightMoveVelocity
58 dashContentList.highlightMoveVelocity = units.gu(4167)
59 dashContentList.highlightMoveDuration = 0
62 set_current_index = undefined;
64 if (dashContentList.count > index)
66 dashContentList.currentIndex = index
69 dashContentList.currentItem.item.positionAtBeginning()
74 dashContentList.highlightMoveDuration = storedMoveDuration
75 dashContentList.highlightMoveVelocity = storedMoveSpeed
79 function closeScope(scope) {
80 dashContentList.currentItem.theScope.closeScope(scope)
84 id: dashContentListHolder
90 objectName:
"dashContentList"
92 interactive: dashContent.scopes.loaded && currentItem && !currentItem.moving
95 model: dashContent.model
96 orientation: ListView.Horizontal
97 boundsBehavior: Flickable.DragAndOvershootBounds
98 flickDeceleration: units.gu(625)
99 maximumFlickVelocity: width * 5
100 snapMode: ListView.SnapOneItem
101 highlightMoveDuration: 250
102 highlightRangeMode: ListView.StrictlyEnforceRange
104 cacheBuffer: 1073741823
105 onMovementStarted: currentItem.item.showHeader();
111 if (currentIndex >= count) {
112 dashContent.setCurrentScopeAtIndex(count-1,
true,
true)
113 }
else if (currentIndex < 0) {
115 dashContentList.currentIndex = 0
122 width: ListView.view.width
123 height: ListView.view.height
127 source: (scope.id ==
"clickscope") ?
"DashApps.qml" :
"GenericScopeView.qml"
128 objectName: scope.id +
" loader"
130 readonly property
bool moving: item ? item.moving :
false
131 readonly property var categoryView: item ? item.categoryView : null
132 readonly property var theScope: scope
135 readonly property
string scopeId: scope.id
136 readonly property
bool isCurrent: ListView.isCurrentItem
137 readonly property
bool isLoaded: status == Loader.Ready
140 item.objectName = scope.id
141 item.scope = Qt.binding(
function() { return scope })
142 item.isCurrent = Qt.binding(
function() {
return visible && ListView.isCurrentItem })
143 dashContent.scopeLoaded(item.scope.id)
146 target: isCurrent ? scope : null
149 dashContent.gotoScope(scopeId);
152 dashContent.openScope(scope);
157 onClosePreview:
if (item) item.closePreview()
160 Component.onDestruction: active =
false