本文整理汇总了C++中QMessageId::toString方法的典型用法代码示例。如果您正苦于以下问题:C++ QMessageId::toString方法的具体用法?C++ QMessageId::toString怎么用?C++ QMessageId::toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMessageId
的用法示例。
在下文中一共展示了QMessageId::toString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: idType
EngineType idType(const QMessageId& id)
{
if (id.toString().startsWith(mtmPrefix)) {
return EngineTypeMTM;
} else if (id.toString().startsWith(freestylePrefix)) {
return EngineTypeFreestyle;
} else {
return EngineTypeMTM;
}
}
示例2: addIdPrefix
QMessageId addIdPrefix(const QMessageId& id, const EngineType& type)
{
switch (type) {
case EngineTypeFreestyle:
Q_ASSERT(!id.toString().startsWith(freestylePrefix));
return QMessageId(freestylePrefix + id.toString());
case EngineTypeMTM:
Q_ASSERT(!id.toString().startsWith(mtmPrefix));
return QMessageId(mtmPrefix + id.toString());
default:
return QMessageId(id);
}
}
示例3: removeMessage
bool QMessageStore::removeMessage(const QMessageId& id, QMessageManager::RemovalOption option)
{
if (id.toString().startsWith("MO_")) {
return ModestEngine::instance()->removeMessage(id, option);
}
return EventLoggerEngine::instance()->deleteMessage(id);
}
示例4: byId
QMessageFilter QMessageFilter::byId(const QMessageId &id, QMessageDataComparator::EqualityComparator cmp)
{
QMessageFilter result;
result.d_ptr->_field = QMessageFilterPrivate::Id;
result.d_ptr->_value = id.toString();
result.d_ptr->_comparatorType = QMessageFilterPrivate::Equality;
result.d_ptr->_comparatorValue = static_cast<int>(cmp);
result.d_ptr->_valid = true;
return result;
}
示例5: message
QMessage QMessageStore::message(const QMessageId& id) const
{
QMessage message = MessageCache::instance()->message(id);
if (message.type() != QMessage::NoType) {
return message;
}
if (id.toString().startsWith("MO_")) {
return ModestEngine::instance()->message(id);
} else {
return d_ptr->p_ptr->el->message(id);
}
}
示例6: stripIdPrefix
QMessageId stripIdPrefix(const QMessageId& id)
{
if (id.toString().startsWith(freestylePrefix))
return QMessageId(id.toString().right(id.toString().length() - QString(freestylePrefix).length()));
else if (id.toString().startsWith(mtmPrefix))
return QMessageId(id.toString().right(id.toString().length() - QString(mtmPrefix).length()));
else
return QMessageId(id);
}
示例7: show
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));
}
示例8: message
QMessage EventLoggerEngine::message(const QMessageId& id)
{
QMessage message;
// qDebug() << "EventLoggerEngine::getMessage id=" << id.toString();
RTComElEvent ev;
bzero(&ev,sizeof(ev));
RTComElQuery *q=rtcom_el_query_new(el);
rtcom_el_query_prepare(q,"id",id.toString().remove("el").toInt(),RTCOM_EL_OP_EQUAL,NULL);
RTComElIter *iter=rtcom_el_get_events(el,q);
g_object_unref(q);
if(iter && rtcom_el_iter_first(iter))
{
gboolean res=rtcom_el_iter_get_full(iter,&ev);
if(res) {
#if 0
printf("got event id=%d service_id=%d event_typ_id=%d\n\
local_uid=%s local_name=%s\n\
remote_uid=%s remote_name=%s remote_ebook_uid=%s\n\
channel=%s free_text=%s group_uid=%s\n\
service=%s event_type=%s\n\
additional_text=%s icon_name=%s pango_markup=%s\n",
ev.fld_id,ev.fld_service_id,ev.fld_event_type_id,
ev.fld_local_uid,ev.fld_local_name,
ev.fld_remote_uid,ev.fld_remote_name,ev.fld_remote_ebook_uid,
ev.fld_channel,ev.fld_free_text,ev.fld_group_uid,
ev.fld_service,ev.fld_event_type,
ev.fld_additional_text,ev.fld_icon_name,ev.fld_pango_markup);
#endif
if (!strcmp(ev.fld_service, "RTCOM_EL_SERVICE_SMS")) {
message.setType(QMessage::Sms);
} else if (!strcmp(ev.fld_service,"RTCOM_EL_SERVICE_CHAT")) {
message.setType(QMessage::InstantMessage);
} else {
message.setType(QMessage::NoType); // Other type, as exampele voice Call
};
//QMessageAccount account = TelepathyEngine::instance()->account(QMessageAccountId(QString("/y/Account%1").arg(ev.fld_local_uid)));
message.setParentAccountId(QMessageAccountId(QString("/y/Account/%1").arg(ev.fld_local_uid)));
if (!ev.fld_is_read) {
message.setStatus(QMessage::Read);
};
message.setPriority(QMessage::NormalPriority);
message.setDate(QDateTime::fromTime_t(ev.fld_start_time));
message.setReceivedDate(QDateTime::fromTime_t(ev.fld_start_time));
if (ev.fld_outgoing) QMessagePrivate::setStandardFolder(message,QMessage::SentFolder);
else
QMessagePrivate::setStandardFolder(message,QMessage::InboxFolder);
if (ev.fld_outgoing) {
// Outgoing message
message.setFrom(QMessageAddress(QMessageAddress::Phone, QString(ev.fld_local_uid)));
QMessagePrivate::setSenderName(message, QString(ev.fld_local_uid));
message.setTo(QMessageAddress(QMessageAddress::Phone, QString(ev.fld_remote_uid)));
} else {
// Incoming message
message.setFrom(QMessageAddress(QMessageAddress::Phone, QString(ev.fld_remote_uid)));
QMessagePrivate::setSenderName(message, QString(ev.fld_remote_uid));
QMessageAddressList messageAddresslist;
messageAddresslist.append(QMessageAddress(QMessageAddress::Phone, QString(ev.fld_local_uid)));
message.setTo(messageAddresslist);
}
message.setBody(QString::fromUtf8(ev.fld_free_text));
QMessagePrivate* privateMessage = QMessagePrivate::implementation(message);
privateMessage->_id = id;
privateMessage->_modified = false;
// qDebug() << "id:" << message.id().toString() << "From:" << message.from().addressee() << "Text:" << message.textContent();
};
};
示例9: deleteMessage
bool EventLoggerEngine::deleteMessage(const QMessageId& id)
{
int status=rtcom_el_delete_event(el,id.toString().remove("el").toInt(),NULL);
return status==0;
}