コード例 #1
0
bool QMessageFolderId::operator==(const QMessageFolderId& other) const
{
    if (isValid()) {
        return (other.isValid() ? (d_ptr->_id == other.d_ptr->_id) : false);
    } else {
        return !other.isValid();
    }
}
コード例 #2
0
 EngineType idType(const QMessageFolderId& id)
 {
     if (id.toString().startsWith(mtmPrefix)) {
         return EngineTypeMTM;
     } else if (id.toString().startsWith(freestylePrefix)) {
         return EngineTypeFreestyle;
     } else {
         return EngineTypeMTM;
     }
 }
コード例 #3
0
bool QMessageFolderId::operator<(const QMessageFolderId& other) const
{
    if (isValid() && other.isValid())
        return (d_ptr->_id < other.d_ptr->_id);

    if (isValid()) {
        return false; // other is invalid, valid > invalid
    } else if (other.isValid()) {
        return true; // invalid < valid
    }
    return false; // both invalid
}
コード例 #4
0
 QMessageFolderId addIdPrefix(const QMessageFolderId& id, const EngineType& type)
 {
     switch (type) {
     case EngineTypeFreestyle:
         Q_ASSERT(!id.toString().startsWith(freestylePrefix));
         return QMessageFolderId(QString(freestylePrefix) + id.toString());
     case EngineTypeMTM:
         Q_ASSERT(!id.toString().startsWith(mtmPrefix));
         return QMessageFolderId(QString(mtmPrefix) + id.toString());
     default:
         return QMessageFolderId(id);
     }
 }
コード例 #5
0
QMessageFolder QMessageStore::folder(const QMessageFolderId& id) const
{
    if (id.toString().startsWith("MO_")) {
        return ModestEngine::instance()->folder(id);
    }

    return QMessageFolder();
}
コード例 #6
0
QMessageFolder QMessageStore::folder(const QMessageFolderId& id) const
{
    if (!id.isValid()) {
	d_ptr->error = QMessageManager::InvalidId;
	return QMessageFolder();
    }

    d_ptr->error = QMessageManager::NoError;

    if (id.toString().startsWith("QMF_")) {
	return QMFStore::instance()->folder(id, d_ptr->error);     
    } else if (id.toString().startsWith(FOLDER_PREFIX_SMS)) {
        return StorageEngine::instance()->folder(id);
    }

    d_ptr->error = QMessageManager::InvalidId;
    return QMessageFolder();
}
コード例 #7
0
QMessageFolderFilter QMessageFolderFilter::byId(const QMessageFolderId &id, QMessageDataComparator::EqualityComparator cmp)
{
    QMessageFolderFilter result;
    result.d_ptr->_field = QMessageFolderFilterPrivate::Id;
    result.d_ptr->_value = id.toString();
    result.d_ptr->_comparatorType = QMessageFolderFilterPrivate::Equality;
    result.d_ptr->_comparatorValue = static_cast<int>(cmp);
    result.d_ptr->_valid = true;
    return result;
}
コード例 #8
0
 QMessageFolderId stripIdPrefix(const QMessageFolderId& id)
 {
     if (id.toString().startsWith(freestylePrefix))
         return QMessageFolderId(id.toString().right(id.toString().length() - QString(freestylePrefix).length()));
     else if (id.toString().startsWith(mtmPrefix))
         return QMessageFolderId(id.toString().right(id.toString().length() - QString(mtmPrefix).length()));
     else
         return QMessageFolderId(id);
 }
コード例 #9
0
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;
}
コード例 #10
0
QMailFolderId convert(const QMessageFolderId &id)
{
    return QMailFolderId(stripIdentifierPrefix(id.toString()).toULongLong());
}
コード例 #11
0
uint qHash(const QMessageFolderId &id)
{
    return qHash(id.toString());
}