当前位置: 首页>>代码示例>>C++>>正文


C++ QMessageIdList类代码示例

本文整理汇总了C++中QMessageIdList的典型用法代码示例。如果您正苦于以下问题:C++ QMessageIdList类的具体用法?C++ QMessageIdList怎么用?C++ QMessageIdList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QMessageIdList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QMessageIdList

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;
            }
        }
    }
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:27,代码来源:qmfstore_maemo6.cpp

示例2: convert

QMessageIdList convert(const QList<QMailMessageId> &ids)
{
    QMessageIdList result;

    foreach (const QMailMessageId &id, ids) {
        result.append(convert(id));
    }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例3: useHelpers

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;
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例4: orderMessages

void MessagingHelper::orderMessages(QMessageIdList& messageIds,  const QMessageSortOrder &sortOrder)
{
    if (!sortOrder.isEmpty()) {
        messagingHelper()->m_MessageSortOrder = (QMessageSortOrder*)&sortOrder;
        qSort(messageIds.begin(), messageIds.end(), MessagingHelper::messageLessThan);
    }
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例5: 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);
                }
            }
        }
    }
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例6: byRecipients

QMessageFilter QMessageFilter::byRecipients(const QString &pattern, QMessageDataComparator::LikeComparator cmp)
{
    QMessageIdList ids;

    foreach (QMessageId const& id, QMessageManager().queryMessages()) {
        QMessage msg(id);
        QMessageAddressList addressList(msg.to());
        addressList.append(msg.cc());
        addressList.append(msg.bcc());

        bool matched(false);

        foreach (QMessageAddress const& addr, addressList) {
            if (MessagingUtil::globMatch(pattern, addr.addressee())) {
                matched = true;
                break;
            }
        }

        if ((matched && cmp == QMessageDataComparator::Like)
                || (!matched && cmp == QMessageDataComparator::NotLike)) {
            ids.push_back(id);
        }
    }

    return QMessageFilter::byId(ids);
}
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:27,代码来源:qmessagefilter.cpp

示例7: bySubject

QMessageFilter QMessageFilter::bySubject(const QString &pattern, QMessageDataComparator::LikeComparator cmp)
{
    QMessageIdList ids;
    foreach (QMessageId const& id, QMessageManager().queryMessages()) {
        bool matched(MessagingUtil::globMatch(pattern, QMessage(id).subject()));
        if ((matched && cmp == QMessageDataComparator::Like)
                || (!matched && cmp == QMessageDataComparator::NotLike)) {
            ids.push_back(id);
        }
    }

    return QMessageFilter::byId(ids);
}
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:13,代码来源:qmessagefilter.cpp

示例8: queryMessages

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;
}
开发者ID:zccrs,项目名称:qt-mobility,代码行数:14,代码来源:qmessagestore_maemo.cpp

示例9: QMessageSortOrder

bool QMessageStore::removeMessages(const QMessageFilter& filter, QMessageManager::RemovalOption option)
{
    bool noErrors;

    d_ptr->error = QMessageManager::NoError;

    noErrors = QMFStore::instance()->removeMessages(filter, option, d_ptr->error);

    QMessageIdList ids = StorageEngine::instance()->queryMessagesSync(filter, QMessageSortOrder(), 0, 0);
    for (int i = 0; i < ids.size(); i++) {
        if (!removeMessage(ids.at(i), option))
            noErrors = false;
    }
    
    return noErrors;
}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例10: 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;
}
开发者ID:zccrs,项目名称:qt-mobility,代码行数:18,代码来源:qmessagestore_maemo.cpp

示例11: QCOMPARE

void tst_QMessageFilter::testIdPreFilter()
{
    QMessageFilter filter = QMessageFilter::byId(QMessageId(email_prefix+"123"), QMessageDataComparator::Equal);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Email), true);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Sms), false);

    filter = QMessageFilter::byId(QMessageId(sms_prefix+"123"), QMessageDataComparator::Equal);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Sms), true);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Email), false);

    filter = QMessageFilter::byId(QMessageId(email_prefix+"123"), QMessageDataComparator::NotEqual);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Email), true);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Sms), true);

    filter = QMessageFilter::byId(QMessageId(), QMessageDataComparator::Equal);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Email), true);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Sms), true);

    filter = QMessageFilter::byId(QMessageId(), QMessageDataComparator::NotEqual);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Email), true);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Sms), true);

    QMessageIdList idList;
    idList.append(QMessageId(email_prefix+"123"));
    idList.append(QMessageId(email_prefix+"124"));
    filter = QMessageFilter::byId(idList, QMessageDataComparator::Includes);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Email), true);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Sms), false);

    filter = QMessageFilter::byId(idList, QMessageDataComparator::Excludes);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Email), true);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Sms), true);

    idList.clear();
    idList.append(QMessageId(sms_prefix+"123"));
    idList.append(QMessageId(sms_prefix+"124"));
    filter = QMessageFilter::byId(idList, QMessageDataComparator::Includes);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Email), false);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Sms), true);

    filter = QMessageFilter::byId(idList, QMessageDataComparator::Excludes);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Email), true);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Sms), true);

    idList.clear();
    idList.append(QMessageId(email_prefix+"123"));
    idList.append(QMessageId(sms_prefix+"124"));
    filter = QMessageFilter::byId(idList, QMessageDataComparator::Includes);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Email), true);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Sms), true);

    filter = QMessageFilter::byId(idList, QMessageDataComparator::Excludes);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Email), true);
    QCOMPARE(MessagingHelper::preFilter(filter, QMessage::Sms), true);
}
开发者ID:bavanisp,项目名称:qtmobility-1.1.0,代码行数:55,代码来源:tst_qmessagestorefiltercache.cpp

示例12: defined

void tst_QMessageFilter::testIdFilter()
{
#if defined(Q_WS_MAEMO_5)
    QMessage message;
    QMessagePrivate* privateMessage = QMessagePrivate::implementation(message);
    privateMessage->_id = QMessageId("123");

    QMessageFilter filter = QMessageFilter::byId(QMessageId("123"), QMessageDataComparator::Equal);
    QMessageFilterPrivate* pf = QMessageFilterPrivate::implementation(filter);
    QCOMPARE(pf->filter(message), true);

    filter = QMessageFilter::byId(QMessageId("124"), QMessageDataComparator::Equal);
    pf = QMessageFilterPrivate::implementation(filter);
    QCOMPARE(pf->filter(message), false);

    filter = QMessageFilter::byId(QMessageId("123"), QMessageDataComparator::NotEqual);
    pf = QMessageFilterPrivate::implementation(filter);
    QCOMPARE(pf->filter(message), false);

    filter = QMessageFilter::byId(QMessageId("124"), QMessageDataComparator::NotEqual);
    pf = QMessageFilterPrivate::implementation(filter);
    QCOMPARE(pf->filter(message), true);

    QMessageIdList idList;
    idList.append(QMessageId("123"));
    idList.append(QMessageId("124"));
    idList.append(QMessageId("125"));
    filter = QMessageFilter::byId(idList, QMessageDataComparator::Includes);
    pf = QMessageFilterPrivate::implementation(filter);
    QCOMPARE(pf->filter(message), true);

    filter = QMessageFilter::byId(idList, QMessageDataComparator::Excludes);
    pf = QMessageFilterPrivate::implementation(filter);
    QCOMPARE(pf->filter(message), false);

    idList.clear();
    idList.append(QMessageId("124"));
    idList.append(QMessageId("125"));
    idList.append(QMessageId("126"));
    filter = QMessageFilter::byId(idList, QMessageDataComparator::Includes);
    pf = QMessageFilterPrivate::implementation(filter);
    QCOMPARE(pf->filter(message), false);

    filter = QMessageFilter::byId(idList, QMessageDataComparator::Excludes);
    pf = QMessageFilterPrivate::implementation(filter);
    QCOMPARE(pf->filter(message), true);
#endif
}
开发者ID:bavanisp,项目名称:qtmobility-1.1.0,代码行数:48,代码来源:tst_qmessagestorefiltercache.cpp

示例13: 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;
}
开发者ID:,项目名称:,代码行数:38,代码来源:

示例14: 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();
    }
}
开发者ID:,项目名称:,代码行数:36,代码来源:

示例15: 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);
        }
    }
}
开发者ID:,项目名称:,代码行数:21,代码来源:


注:本文中的QMessageIdList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。