diff options
| author | Kevin Wu Won <kevin.wu-won@nokia.com> | 2010-02-05 17:03:48 +1000 |
|---|---|---|
| committer | Kevin Wu Won <kevin.wu-won@nokia.com> | 2010-02-05 17:04:26 +1000 |
| commit | c795c73d28416d2e429b2ec2df730c4969f893dc (patch) | |
| tree | 2cb3dd5298fed65e7bb6b047ec86c9da68980592 /doc/src/snippets/qtcontactsdocsample/qtcontactsdocsample.cpp | |
| parent | f45f56c8209234a39834a9c67843a538ad7440d9 (diff) | |
Updated qtcontactdocsample snippet for new API.
Diffstat (limited to 'doc/src/snippets/qtcontactsdocsample/qtcontactsdocsample.cpp')
| -rw-r--r-- | doc/src/snippets/qtcontactsdocsample/qtcontactsdocsample.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/doc/src/snippets/qtcontactsdocsample/qtcontactsdocsample.cpp b/doc/src/snippets/qtcontactsdocsample/qtcontactsdocsample.cpp index 05143379fd..b7ae65c46d 100644 --- a/doc/src/snippets/qtcontactsdocsample/qtcontactsdocsample.cpp +++ b/doc/src/snippets/qtcontactsdocsample/qtcontactsdocsample.cpp @@ -332,7 +332,9 @@ void RequestExample::performRequest() // m_fetchRequest was created with m_fetchRequest = new QContactFetchRequest() in the ctor. m_fetchRequest->setManager(this->m_manager); // m_manager is a QContactManager*. m_fetchRequest->setFilter(dfil); - connect(m_fetchRequest, SIGNAL(progress(QContactFetchRequest*,bool)), this, SLOT(printContacts(QContactFetchRequest*,bool))); + connect(m_fetchRequest, SIGNAL(resultsAvailable()), this, SLOT(printContacts())); + connect(m_fetchRequest, SIGNAL(stateChanged(QContactAbstractRequest::State)), + this, SLOT(stateChanged(QContactAbstractRequest::State))); if (!m_fetchRequest->start()) { qDebug() << "Unable to request contacts!"; QCoreApplication::exit(0); @@ -341,23 +343,19 @@ void RequestExample::performRequest() } } -void RequestExample::printContacts(QContactFetchRequest* request, bool appendOnly) +void RequestExample::printContacts() { - QList<QContact> results = request->contacts(); - if (appendOnly) { - // we know that the results are still in the same order; just display the new results. - for (m_previousLastIndex += 1; m_previousLastIndex < results.size(); m_previousLastIndex++) { - qDebug() << "Found another Alice:" << results.at(m_previousLastIndex).displayLabel(); - } - } else { - // the order of results has changed; display them all. - for (m_previousLastIndex = 0; m_previousLastIndex < results.size(); m_previousLastIndex++) { - qDebug() << "Found another Alice:" << results.at(m_previousLastIndex).displayLabel(); - } + QList<QContact> results = m_fetchRequest->contacts(); + for (m_previousLastIndex = 0; m_previousLastIndex < results.size(); m_previousLastIndex++) { + qDebug() << "Found an Alice:" << results.at(m_previousLastIndex).displayLabel(); } +} +void RequestExample::stateChanged(QContactAbstractRequest::State state) +{ // once we've finished retrieving results, stop processing events. - if (request->state() == QContactAbstractRequest::FinishedState || request->state() == QContactAbstractRequest::CanceledState) { + if (state == QContactAbstractRequest::FinishedState + || state == QContactAbstractRequest::CanceledState) { qDebug() << "Finished displaying asynchronously retrieved contacts!"; QCoreApplication::exit(0); } |
