bool QMessageId::operator==(const QMessageId& other) const { if (isValid()) { return (other.isValid() ? (d_ptr->_id == other.d_ptr->_id) : false); } else { return !other.isValid(); } }
bool QMessageId::operator<(const QMessageId& 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 }
bool QMessageService::retrieve(const QMessageId &messageId, const QMessageContentContainerId& id) { if (d_ptr->_active) { return false; } if (!messageId.isValid() || !id.isValid()) { d_ptr->_error = QMessageManager::InvalidId; return false; } d_ptr->_active = true; d_ptr->_error = QMessageManager::NoError; bool retVal = true; d_ptr->_state = QMessageService::ActiveState; emit stateChanged(d_ptr->_state); retVal = d_ptr->retrieve(messageId, id); if (retVal == false) { d_ptr->setFinished(retVal); } return retVal; }
MapiEntryId QMessageIdPrivate::storeRecordKey(const QMessageId &id) { if (id.isValid()) { return id.d_ptr->_storeRecordKey; } return MapiEntryId(); }
MapiEntryId QMessageIdPrivate::entryId(const QMessageId &id) { if (id.isValid()) { return id.d_ptr->_entryId; } return MapiEntryId(); }
bool QMessageId::operator==(const QMessageId& other) const { if (isValid()) { if (other.isValid()) { bool result(d_ptr->_storeRecordKey == other.d_ptr->_storeRecordKey); if (result) { QMessageManager::Error ignoredError(QMessageManager::NoError); MapiSessionPtr session(MapiSession::createSession(&ignoredError)); if (ignoredError == QMessageManager::NoError) { result &= session->equal(d_ptr->_entryId, other.d_ptr->_entryId); } else { result = false; qWarning() << "Unable to compare entry IDs."; } } return result; } return false; } else { return !other.isValid(); } }
bool QMFService::show(const QMessageId& id) { if (isBusy()) { return false; } m_active = 0; setError(QMessageManager::NoError); if (!(id.toString().startsWith("QMF_") && id.isValid())) { setError(QMessageManager::InvalidId); return false; } //QMessage m(id); return compose(QMessage(id)); }
MapiEntryId QMessageIdPrivate::folderRecordKey(const QMessageId &id) { if (id.isValid()) { if (!id.d_ptr->_folderRecordKey.isEmpty()) { return id.d_ptr->_folderRecordKey; } else { // Look up the folder record key for this ID QMessageManager::Error ignoredError(QMessageManager::NoError); MapiSessionPtr session(MapiSession::createSession(&ignoredError)); if (ignoredError == QMessageManager::NoError) { return session->folderEntryId(&ignoredError, id); } } } return MapiEntryId(); }
QMessage QMessageStore::message(const QMessageId& id) const { if (!id.isValid()) { d_ptr->error = QMessageManager::InvalidId; return QMessage(); } d_ptr->error = QMessageManager::NoError; if (id.toString().startsWith("QMF_")) { return QMFStore::instance()->message(id, d_ptr->error); } else if (id.toString().startsWith("SMS_")) { return StorageEngine::instance()->message(id); } d_ptr->error = QMessageManager::InvalidId; return QMessage(); }
MapiRecordKey QMessageIdPrivate::messageRecordKey(const QMessageId &id) { MapiRecordKey result; if (id.isValid()) { if (id.d_ptr->_messageRecordKey.isEmpty()) { // Look up the message record key for this ID QMessageManager::Error ignoredError(QMessageManager::NoError); MapiSessionPtr session(MapiSession::createSession(&ignoredError)); if (ignoredError == QMessageManager::NoError) { id.d_ptr->_messageRecordKey = session->messageRecordKey(&ignoredError, id); } } result = id.d_ptr->_messageRecordKey; } return result; }
bool QMessageStore::removeMessage(const QMessageId& id, QMessageManager::RemovalOption option) { bool ret = false; if (!id.isValid()) { d_ptr->error = QMessageManager::InvalidId; return false; } d_ptr->error = QMessageManager::NoError; if (id.toString().startsWith("QMF_")) { ret = QMFStore::instance()->removeMessage(id, option, d_ptr->error); } else if (id.toString().startsWith("SMS_")) { ret = StorageEngine::instance()->removeMessage(id); } else { d_ptr->error = QMessageManager::InvalidId; } return ret; }
bool QMessageService::show(const QMessageId& id) { if (d_ptr->_active) { return false; } if (!id.isValid()) { d_ptr->_error = QMessageManager::InvalidId; return false; } d_ptr->_active = true; d_ptr->_error = QMessageManager::NoError; bool retVal = true; d_ptr->_state = QMessageService::ActiveState; emit stateChanged(d_ptr->_state); retVal = d_ptr->show(id); d_ptr->setFinished(retVal); return retVal; }