예제 #1
0
QMessage::Priority QMessage::priority() const
{
    quint64 status(d_ptr->_message.status());

    if (status & highPriorityMask()) {
        return QMessage::HighPriority;
    } else if (status & lowPriorityMask()) {
        return QMessage::LowPriority;
    }

    return QMessage::NormalPriority;
}
QMessageFilter QMessageFilter::byPriority(QMessage::Priority value, QMessageDataComparator::EqualityComparator cmp)
{
    QMessageFilter result;

    switch (value)
    {
    case QMessage::HighPriority: 
        result.d_ptr->_key = QMailMessageKey::status(highPriorityMask(), (cmp == QMessageDataComparator::Equal ? QMailDataComparator::Includes : QMailDataComparator::Excludes)); 
        break;

    case QMessage::LowPriority: 
        result.d_ptr->_key = QMailMessageKey::status(lowPriorityMask(), (cmp == QMessageDataComparator::Equal ? QMailDataComparator::Includes : QMailDataComparator::Excludes)); 
        break;

    case QMessage::NormalPriority:
        result.d_ptr->_key = QMailMessageKey::status(lowPriorityMask() | highPriorityMask(), (cmp == QMessageDataComparator::Equal ? QMailDataComparator::Excludes : QMailDataComparator::Includes)); 
        break;
    }

    return result;
}
예제 #3
0
void QMessage::setPriority(Priority newPriority)
{
    quint64 setMask(0);
    quint64 unsetMask(0);

    if (newPriority == QMessage::HighPriority) {
        setMask = highPriorityMask();
        unsetMask = lowPriorityMask();
    } else if (newPriority == QMessage::LowPriority) {
        unsetMask = highPriorityMask();
        setMask = lowPriorityMask();
    } else {
        unsetMask = (highPriorityMask() | lowPriorityMask());
    }

    if (setMask) {
        d_ptr->_message.setStatus(setMask, true);
    }
    if (unsetMask) {
        d_ptr->_message.setStatus(unsetMask, false);
    }
}