~renatofilho/address-book-app/attach-to-sync-monitor

« back to all changes in this revision

Viewing changes to src/imports/ContactList/ContactExporter.qml

  • Committer: Tarmac
  • Author(s): Renato Araujo Oliveira Filho
  • Date: 2014-10-03 13:59:16 UTC
  • mfrom: (307.4.5 fix-1371243)
  • Revision ID: tarmac-20141003135916-z91u9fmi7fxnazdi
Fetch the full contact before export it on contact list. Fixes: https://bugs.launchpad.net/bugs/1371243.

Approved by Michał Karnicki, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
Item {
21
21
    id: root
22
22
 
23
 
    property var contacts: []
24
23
    property var contactModel
25
24
    property var outputFile
26
25
 
27
 
    signal completed(int error)
 
26
    signal contactExported(int error, string url)
 
27
    signal contactsFetched(var contacts)
28
28
 
29
 
    function start() {
 
29
    function start(contacts) {
30
30
        if (!contactModel) {
31
 
            console.log("No contact model defined")
 
31
            console.error("No contact model defined")
32
32
            return
33
33
        }
34
34
 
48
48
            priv.currentQueryId = contactModel.fetchContacts(ids)
49
49
        }
50
50
    }
 
51
 
51
52
    Item {
52
53
        id: priv
53
54
 
58
59
 
59
60
            onExportCompleted: {
60
61
                priv.currentQueryId = -1
61
 
                root.completed(error)
 
62
                root.contactExported(error, root.outputFile)
62
63
            }
63
64
 
64
65
            onContactsFetched: {
65
66
                // currentQueryId == -2 is used during a fetch using "memory" manager
66
67
                if ((priv.currentQueryId == -2) || (requestId == priv.currentQueryId)) {
67
 
                    root.contactModel.exportContacts(root.outputFile,
68
 
                                                     [],
69
 
                                                     fetchedContacts)
 
68
                    if (root.outputFile !== "") {
 
69
                        root.contactModel.exportContacts(root.outputFile,
 
70
                                                         [],
 
71
                                                         fetchedContacts)
 
72
                    }
 
73
                    root.contactsFetched(fetchedContacts)
70
74
                }
71
75
            }
72
76
        }