~ken-vandine/address-book-app/add_profile

« back to all changes in this revision

Viewing changes to src/imports/Ubuntu/Contacts/ContactSimpleListView.qml

  • Committer: CI bot
  • Author(s): Tarmac, Renato Araujo Oliveira Filho
  • Date: 2014-07-04 14:55:22 UTC
  • mfrom: (169.22.12 release-2014-07-02)
  • Revision ID: ps-jenkins@lists.canonical.com-20140704145522-7r65oy9m1zarc7yz
* Implemented MostCalledContactsModel in C++ as a proxy model for HistoryEventModel;
* Enabled share button again.
* Fixed build warning: comparison with string literal results in unspecified behavior;
* Implemented swipe to delete. Fixes: 1323577

Show diffs side-by-side

added added

removed removed

Lines of Context:
268
268
    listDelegate: ContactDelegate {
269
269
        id: contactDelegate
270
270
 
 
271
        property var removalAnimation
 
272
 
 
273
        function remove()
 
274
        {
 
275
            removalAnimation.start()
 
276
        }
 
277
 
271
278
        width: parent.width
272
279
        selected: contactListView.multiSelectionEnabled && contactListView.isSelected(contactDelegate)
273
280
        defaultAvatarUrl: contactListView.defaultAvatarImageUrl
275
282
        titleFields: contactListView.titleFields
276
283
        isCurrentItem: ListView.isCurrentItem
277
284
 
 
285
        // actions
 
286
        leftSideAction: contactListView.leftSideAction
 
287
        rightSideActions: contactListView.rightSideActions
 
288
 
278
289
        onDetailClicked: contactListView.detailClicked(contact, detail, action)
279
290
        onInfoRequested: contactListView._fetchContact(index, contact)
280
291
 
281
292
        // collapse the item before remove it, to avoid crash
282
 
        ListView.onRemove: SequentialAnimation {
 
293
        ListView.onRemove: ScriptAction {
 
294
            script: {
 
295
                if (contactDelegate.state !== "") {
 
296
                    contactListView.currentIndex = -1
 
297
                }
 
298
            }
 
299
        }
 
300
 
 
301
        // used by swipe to delete
 
302
        removalAnimation: SequentialAnimation {
 
303
            alwaysRunToEnd: true
 
304
 
 
305
            PropertyAction {
 
306
                target: contactDelegate
 
307
                property: "ListView.delayRemove"
 
308
                value: true
 
309
            }
 
310
            UbuntuNumberAnimation {
 
311
                target: contactDelegate
 
312
                property: "height"
 
313
                to: 1
 
314
            }
 
315
            PropertyAction {
 
316
                target: contactDelegate
 
317
                property: "ListView.delayRemove"
 
318
                value: false
 
319
            }
283
320
            ScriptAction {
284
 
                script: {
285
 
                    if (contactDelegate.state !== "") {
286
 
                        contactListView.currentIndex = -1
287
 
                    }
288
 
                }
 
321
                script: contactListView.listModel.removeContact(contact.contactId)
289
322
            }
290
323
        }
291
324