本文整理汇总了C++中QMessageIdList::count方法的典型用法代码示例。如果您正苦于以下问题:C++ QMessageIdList::count方法的具体用法?C++ QMessageIdList::count怎么用?C++ QMessageIdList::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMessageIdList
的用法示例。
在下文中一共展示了QMessageIdList::count方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: filterMessages
void MessagingHelper::filterMessages(QMessageIdList& messageIds, const QMessageFilter& filter)
{
if (messageIds.count() && !filter.isEmpty()) {
QMessageFilterPrivate* pf = QMessageFilterPrivate::implementation(filter);
if ((pf->_field == QMessageFilterPrivate::None) &&
(pf->_filterList.count() == 0)) {
if (pf->_notFilter) {
// There is only one filter: empty ~QMessageFilter()
// => accountIds must be cleared
messageIds.clear();
return;
} else {
// There is only one filter: empty QMessageFilter()
// => accountIds list can remain intact
return;
}
}
if (pf->_valid) {
QMessageStore* store = QMessageStore::instance();
for (int i=messageIds.count()-1; i >= 0; i--) {
QMessage message = store->message(messageIds[i]);
if (!pf->filter(message)) {
messageIds.removeAt(i);
}
}
}
}
}
示例2: queryMessages
QMessageIdList QMFStore::queryMessages(const QMessageFilter &filter, const QString &body, QMessageDataComparator::MatchFlags matchFlags,
const QMessageSortOrder &sortOrder, uint limit, uint offset, QMessageManager::Error &error) const
{
if (filter.matchFlags() != 0) {
error = QMessageManager::NotYetImplemented;
return QMessageIdList();
}
error = QMessageManager::NoError;
QMessageIdList ids(convert(d_ptr->_store->queryMessages(convert(filter), convert(sortOrder))));
Qt::CaseSensitivity searchOptions(Qt::CaseInsensitive);
if (matchFlags & QMessageDataComparator::MatchCaseSensitive) {
searchOptions = Qt::CaseSensitive;
}
QMessageIdList result;
foreach (QMessageId id, ids) {
QMessage message(id);
QMessageContentContainer bodyContainer(message.find(message.bodyId()));
if (bodyContainer.textContent().contains(body, searchOptions)) {
result.append(id);
if (limit && ((uint)result.count() >= offset + limit)) {
break;
}
}
}
示例3: queryMessages
QMessageIdList QMessageStore::queryMessages(const QMessageFilter &filter, const QString &body, QMessageDataComparator::MatchFlags matchFlags, const QMessageSortOrder &sortOrder, uint limit, uint offset) const
{
bool useHelpers(false);
QMessageIdList messageIds;
d_ptr->error = QMessageManager::NoError;
QMessageFilter handledFilter = filter;
MessagingHelper::handleNestedFiltersFromMessageFilter(handledFilter);
// returns the filtered but not ordered list
messageIds = StorageEngine::instance()->queryMessagesSync(handledFilter, body, matchFlags, sortOrder, limit, offset);
// QMFStore does not need to use helpers, but messages from StorageEngine needs to be sorted
if (messageIds.count() > 0)
useHelpers = true;
messageIds += QMFStore::instance()->queryMessages(handledFilter, body, matchFlags, sortOrder, limit, offset, d_ptr->error);
// since QMFStore does sorting and applies offset and limits,
// we need to do those here only if there are messages from StorageEngine as well
if (useHelpers) {
MessagingHelper::orderMessages(messageIds, sortOrder);
MessagingHelper::applyOffsetAndLimitToMessageIdList(messageIds, limit, offset);
}
return messageIds;
}
示例4: applyOffsetAndLimitToMessageIdList
void MessagingHelper::applyOffsetAndLimitToMessageIdList(QMessageIdList& messageIds, int limit, int offset)
{
if (messageIds.count() == 0) {
return;
}
if (offset > 0) {
if (offset > messageIds.count()) {
messageIds.clear();
} else {
for (int i = 0; i < offset; i++) {
messageIds.removeFirst();
}
}
}
if (limit > 0) {
for (int i = messageIds.count()-1; i >= limit; i--) {
messageIds.removeAt(i);
}
}
}
示例5: removeMessages
bool QMessageStore::removeMessages(const QMessageFilter& filter, QMessageManager::RemovalOption option)
{
QMessageIdList ids = queryMessages(filter, QMessageSortOrder(), 0, 0);
for (int i=0; i < ids.count(); i++) {
if (ids[i].toString().startsWith("MO_")) {
if (!ModestEngine::instance()->removeMessage(ids[i], option)) {
return false;
}
} else if(!EventLoggerEngine::instance()->deleteMessage(ids[i]))
return false;
}
return true;
}
示例6: countMessages
int QMessageStore::countMessages(const QMessageFilter& filter) const
{
int count = 0;
QMessageFilter handledFilter = filter;
MessagingHelper::handleNestedFiltersFromMessageFilter(handledFilter);
if (MessagingHelper::preFilter(handledFilter, QMessage::Email)) {
count += ModestEngine::instance()->countMessagesSync(handledFilter);
}
if (MessagingHelper::preFilter(handledFilter, QMessage::Sms)) {
QMessageIdList messageIds = EventLoggerEngine::instance()->filterAndOrderMessages(handledFilter,QMessageSortOrder(),QString(),QMessageDataComparator::MatchFlags());
count += messageIds.count();
}
return count;
}
示例7: moveMessages
bool QMessageService::moveMessages(const QMessageIdList &messageIds, const QMessageFolderId &toFolderId)
{
if (d_ptr->_active) {
return false;
}
if (!toFolderId.isValid()) {
d_ptr->_error = QMessageManager::InvalidId;
return false;
}
const int count = messageIds.count();
if ( count == 0) {
return false;
}
// verify that messages are of same type and valid
EngineType expectedType = idType(messageIds[0]);
for( int i = 1; i < count; ++i ) {
if( idType( messageIds[i] ) != expectedType ||
!messageIds[i].isValid() ) {
// invalid message id or inconsistent type found
d_ptr->_error = QMessageManager::InvalidId;
return false;
}
}
d_ptr->_active = true;
d_ptr->_error = QMessageManager::NoError;
d_ptr->_state = QMessageService::ActiveState;
emit stateChanged(d_ptr->_state);
bool retVal = d_ptr->moveMessages( messageIds, toFolderId );
if (!retVal) {
d_ptr->setFinished(retVal);
}
return retVal;
}
示例8: messagesFound
void QMessageServicePrivate::messagesFound(const QMessageIdList &ids, bool isFiltered, bool isSorted)
{
_pendingRequestCount--;
if (!isFiltered) {
_filtered = false;
}
if (!isSorted) {
_sorted = false;
} else {
if ((ids.count() > 0) && (_ids.count() > 0)) {
_sorted = false;
}
}
_ids.append(ids);
if (_pendingRequestCount == 0) {
if (!_filtered) {
MessagingHelper::filterMessages(_ids, _filter);
}
if (!_sorted) {
MessagingHelper::orderMessages(_ids, _sortOrder);
}
MessagingHelper::applyOffsetAndLimitToMessageIdList(_ids, _limit, _offset);
emit q_ptr->messagesFound(_ids);
setFinished(true);
_ids.clear();
_filter = QMessageFilter();
_sortOrder = QMessageSortOrder();
}
}