2
* Copyright (C) 2012-2014 Canonical, Ltd.
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.
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.
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/>.
22
property alias parentView: scrollAnimation.target
23
readonly property alias count: callerRepeat.count
26
property int _nextCurrentIndex: -1
29
function makeItemVisible(item)
35
var itemY = parent.y + root.y + item.y
36
var areaY = parentView.contentY
39
scrollAnimation.to = itemY
40
} else if ((areaY + parentView.height) < (itemY + item.height)) {
42
scrollAnimation.to = itemY + item.height
46
scrollAnimation.restart()
53
velocity: parentView.highlightMoveVelocity
54
duration: parentView.highlightMoveDuration
63
text: i18n.dtr("address-book-app", "Frequently called")
64
visible: (root.count > 0)
70
model: MostCalledModel {
73
onInfoRequested: parentView.infoRequested(contact)
74
onDetailClicked: parentView.detailClicked(contact, detail, action)
75
onAddDetailClicked: parentView.addDetailClicked(contact, detailType)
76
onAddContactClicked: parentView.addContactClicked(label)
77
onCurrentIndexChanged: {
78
if (currentIndex !== -1) {
79
parentView.currentIndex = -1
80
root._nextCurrentIndex = currentIndex
84
// WORKAROUND: The SDK header causes the contactY to move to a wrong postion
85
// calling the positionViewAtBeginning after the list created fix that
86
onLoaded: moveToBegining.restart()
92
onCurrentIndexChanged: {
93
if (parentView.currentIndex !== -1) {
94
calledModel.currentIndex = -1
100
if (root._nextCurrentIndex != -1) {
101
heightChangedTimeout.restart()
106
id: heightChangedTimeout
109
makeItemVisible(callerRepeat.itemAt(root._nextCurrentIndex))
110
root._nextCurrentIndex = -1
115
// update the model every time that it became visible
116
// in fact calling update only reloads the model data if it has changed
118
calledModel.model.update()