383
375
left: parent.left
384
376
right: parent.right
387
if (calledModel.currentIndex != -1) {
388
mostCalledView.makeItemVisible(callerRepeat.itemAt(calledModel.currentIndex))
378
height: childrenRect.height
394
384
left: parent.left
395
385
right: parent.right
397
388
height: childrenRect.height
398
389
children: root.header
402
function makeItemVisible(item)
404
var itemY = mostCalledView.y + item.y
405
var areaY = view.contentY
407
view.contentY = itemY
408
view.returnToBounds()
412
visible: view.favouritesIsSelected && (callerRepeat.count > 0)
414
395
left: parent.left
415
396
right: parent.right
417
height: visible ? childrenRect.height : 0
420
color: Theme.palette.normal.background
429
verticalAlignment: Text.AlignVCenter
430
text: i18n.dtr("address-book-app", "Frequently called")
433
ListItem.ThinDivider {
437
bottom: parent.bottom
444
model: MostCalledModel {
447
readonly property bool visible: view.favouritesIsSelected
450
// update the model every time that it became visible
451
// in fact calling update only reloads the model data if it has changed
456
onInfoRequested: root.infoRequested(contact)
457
onDetailClicked: root.detailClicked(contact, detail, action)
458
onAddDetailClicked: root.addDetailClicked(contact, detailType)
459
onAddContactClicked: root.addContactClicked(label)
460
onCurrentIndexChanged: {
461
if (currentIndex !== -1) {
462
view.currentIndex = -1
466
// WORKAROUND: The SDK header causes the contactY to move to a wrong postion
467
// calling the positionViewAtBeginning after the list created fix that
468
onLoaded: moveToBegining.restart()
474
onCurrentIndexChanged: {
475
if (view.currentIndex !== -1) {
476
calledModel.currentIndex = -1
399
visible: view.favouritesIsSelected
400
height: visible && (count > 0) ? childrenRect.height : 0
482
403
onError: root.error(message)
488
409
onContactDisappeared: root.contactDisappeared(contact)
498
detail: ContactDetail.Favorite
499
field: Favorite.Favorite
501
matchFlags: DetailFilter.MatchExactly
505
id: contactTermFilter
507
property string value: ""
510
detail: ContactDetail.DisplayLabel
511
field: DisplayLabel.Label
512
value: contactTermFilter.value
513
matchFlags: DetailFilter.MatchContains
517
detail: ContactDetail.PhoneNumber
518
field: PhoneNumber.Number
519
value: contactTermFilter.value
520
matchFlags: DetailFilter.MatchPhoneNumber
524
detail: ContactDetail.PhoneNumber
525
field: PhoneNumber.Number
526
value: contactTermFilter.value
527
matchFlags: DetailFilter.MatchContains
535
// avoid runtime warning "depends on non-NOTIFYable properties"
536
readonly property alias filtersProxy: contactsFilter.filters
538
property bool active: {
540
if (contactTermFilter.value.length > 0) {
541
filters_.push(contactTermFilter)
542
} else if (view.favouritesIsSelected) {
543
filters_.push(favouritesFilter)
547
filters_.push(root.filter)
550
// check if the filter has changed
551
var oldFilters = filtersProxy
552
if (oldFilters.length !== filters_.length) {
553
contactsFilter.filters = filters_
555
for(var i=0; i < oldFilters.length; i++) {
556
if (filters_.indexOf(oldFilters[i]) === -1) {
557
contactsFilter.filters = filters_
562
return (filters_.length > 0)
567
id: contactSearchTimeout
573
view.positionViewAtBeginning()
575
root.changeFilter(root.filter)
576
contactTermFilter.value = root.filterTerm
578
// manually update if autoUpdate is disabled
579
if (!root.autoUpdate) {
580
contactsModel.update()
585
listModel: ContactModel {
412
listModel: ContactListModel {
586
413
id: contactsModel
588
property bool _clearModel: false
590
415
manager: root.manager
591
416
sortOrders: root.sortOrders
592
417
fetchHint: root.fetchHint
594
if (contactsModel._clearModel) {
596
} else if (contactsFilter.active) {
597
return contactsFilter
605
console.error("Contact List error:" + error)
610
//WORKAROUND: clear the model before start populate it with the new contacts
611
//otherwise the model will wait for all contacts before show any new contact
613
//after all contacts get removed we can populate the model again, this will show
614
//new contacts as soon as it arrives in the model
615
if (contactsModel._clearModel && contacts.length === 0) {
616
contactsModel._clearModel = false
617
// do a new update if autoUpdate is false
618
if (!contactsModel.autoUpdate) {
619
contactsModel.update()