void QGalleryTrackerResultSetPrivate::query() { flags &= ~(Refresh | SyncFinished); flags |= Active; flags |= Reset; updateTimer.stop(); rCache.count = iCache.count; rCache.offset = 0; iCache.count = 0; iCache.cutoff = 0; qSwap(rCache.values, iCache.values); const int limit = queryLimit < 1 || queryLimit > 1024 ? 1024 : queryLimit; QDBusPendingCall call = queryInterface->asyncCallWithArgumentList( queryMethod, QVariantList(queryArguments) << queryOffset << limit); if (call.isFinished()) { queryFinished(call); } else { queryWatcher.reset(new QDBusPendingCallWatcher(call)); QObject::connect( queryWatcher.data(), SIGNAL(finished(QDBusPendingCallWatcher*)), q_func(), SLOT(_q_queryFinished(QDBusPendingCallWatcher*))); progressMaximum = 2; emit q_func()->progressChanged(0, progressMaximum); } }
void QGalleryTrackerResultSetPrivate::_q_parseFinished() { processSyncEvents(); if (parseWatcher.result()) { Q_ASSERT(rCache.offset == rCache.count); Q_ASSERT(iCache.cutoff == iCache.count); rCache.values.clear(); rCache.count = 0; flags &= ~Active; if (flags & Refresh) update(); else emit q_func()->progressChanged(progressMaximum, progressMaximum); q_func()->finish(flags & Live); } else if (flags & Canceled) { iCache.count = 0; flags &= ~Active; q_func()->QGalleryAbstractResponse::cancel(); } else { const int offset = queryOffset + iCache.count; const int limit = queryLimit < 1 || queryLimit - iCache.count > 1024 ? 1024 : queryLimit - iCache.count; QDBusPendingCall call = queryInterface->asyncCallWithArgumentList( queryMethod, QVariantList(queryArguments) << offset << limit); if (call.isFinished()) { queryFinished(call); } else { queryWatcher.reset(new QDBusPendingCallWatcher(call)); QObject::connect( queryWatcher.data(), SIGNAL(finished(QDBusPendingCallWatcher*)), q_func(), SLOT(_q_queryFinished(QDBusPendingCallWatcher*))); progressMaximum += 2; emit q_func()->progressChanged(progressMaximum - 2, progressMaximum); } } }
void QGalleryTrackerTypeResultSetPrivate::queryCount() { QVariantList arguments = queryArguments; if (accumulative) arguments << currentOffset << int(0); QDBusPendingCall call = queryInterface->asyncCallWithArgumentList(queryMethod, arguments); if (call.isFinished()) { queryFinished(call); } else { queryWatcher = new QDBusPendingCallWatcher(call, q_func()); QObject::connect(queryWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)), q_func(), SLOT(_q_queryFinished(QDBusPendingCallWatcher*))); } }