本文整理汇总了C++中sim::PropertyHubPtr::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyHubPtr::isNull方法的具体用法?C++ PropertyHubPtr::isNull怎么用?C++ PropertyHubPtr::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sim::PropertyHubPtr
的用法示例。
在下文中一共展示了PropertyHubPtr::isNull方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: userDataManipulation
void Test::userDataManipulation()
{
SIM::UserDataPtr data = SIM::UserData::create();
SIM::PropertyHubPtr hub = data->getUserData("nonexistant");
QVERIFY(hub.isNull());
hub = data->createUserData("alpha");
QVERIFY(!hub.isNull());
hub->setValue("foo", 12);
QCOMPARE(hub->value("foo").toInt(), 12);
SIM::PropertyHubPtr anotherhub = data->getUserData("alpha");
QCOMPARE(anotherhub->value("foo").toInt(), 12);
hub.clear();
anotherhub.clear();
data->destroyUserData("alpha");
hub = data->getUserData("alpha");
QVERIFY(hub.isNull());
}
示例2: sendMessage
bool MsgEdit::sendMessage(Message *msg)
{
if (m_retry.msg){
delete m_retry.msg;
m_retry.msg = NULL;
}
if (m_msg){
delete msg;
if (EventMessageCancel(m_msg).process())
m_msg = NULL;
stopSend(false);
return false;
}
bool bClose = true;
if (CorePlugin::instance()->getContainerMode()){
bClose = false;
Command cmd;
cmd->id = CmdSendClose;
cmd->param = this;
EventCommandWidget eWidget(cmd);
eWidget.process();
QToolButton *btnClose = qobject_cast<QToolButton*>(eWidget.widget());
if (btnClose)
bClose = btnClose->isChecked();
}
CorePlugin::instance()->setValue("CloseSend", bClose);
Contact *contact = getContacts()->contact(m_userWnd->id());
if (contact){
SIM::PropertyHubPtr data = contact->getUserData("translit");
if (!data.isNull() && data->value("Translit").toBool())
msg->setFlags(msg->getFlags() | MESSAGE_TRANSLIT);
}
msg->setFlags(msg->getFlags() | m_flags);
m_flags = 0;
if (m_userWnd->m_list){
if( !m_userWnd->m_list->isHaveSelected() )
return false;
multiply = m_userWnd->m_list->selected();
msg->setContact( multiply.first() );
multiply.pop_front();
msg->setClient(NULL);
if( multiply.count() > 0 )
msg->setFlags(msg->getFlags() | MESSAGE_MULTIPLY);
}else if (!m_resource.isEmpty()){
void *data = NULL;
Client *c = client(data, true, false, msg->contact(), true);
if (c){
QString resources = c->resources(data);
while (!resources.isEmpty()){
QString res = getToken(resources, ';');
getToken(res, ',');
if (m_resource == res){
msg->setResource(m_resource);
break;
}
}
}
}
editLostFocus();
Command cmd;
cmd->id = CmdSend;
cmd->text = I18N_NOOP("Cancel");
cmd->icon = "cancel";
cmd->flags = BTN_PICT;
cmd->param = this;
EventCommandChange(cmd).process();
m_msg = msg;
return send();
}
示例3: processEvent
bool MsgEdit::processEvent(Event *e)
{
switch (e->type()) {
case eEventContact: {
EventContact *ec = static_cast<EventContact*>(e);
if (ec->contact()->id() != m_userWnd->m_id)
break;
adjustType();
break;
}
case eEventClientChanged: {
adjustType();
break;
}
case eEventMessageReceived: {
EventMessage *em = static_cast<EventMessage*>(e);
Message *msg = em->msg();
if (msg->getFlags() & MESSAGE_NOVIEW)
return false;
if ((msg->contact() == m_userWnd->id()) && (msg->type() != MessageStatus)){
if (CorePlugin::instance()->getContainerMode()){
bool bSetFocus = false;
if (topLevelWidget() && topLevelWidget()->inherits("Container")){
Container *container = static_cast<Container*>(topLevelWidget());
if (container->wnd() == m_userWnd)
bSetFocus = true;
}
setMessage(msg, bSetFocus);
}else{
if (m_edit->isReadOnly())
QTimer::singleShot(0, this, SLOT(setupNext()));
}
}
break;
}
case eEventRealSendMessage: {
EventRealSendMessage *ersm = static_cast<EventRealSendMessage*>(e);
if (ersm->edit() == this){
sendMessage(ersm->msg());
return true;
}
break;
}
case eEventCheckCommandState: {
EventCheckCommandState *ecs = static_cast<EventCheckCommandState*>(e);
CommandDef *cmd = ecs->cmd();
if ((cmd->param == (TextEdit*)m_edit) && (cmd->id == CmdTranslit)){
Contact *contact = getContacts()->contact(m_userWnd->id());
if (contact){
SIM::PropertyHubPtr data = contact->getUserData("translit");
if(!data.isNull()) {
cmd->flags &= ~COMMAND_CHECKED;
if (data->value("Translit").toBool())
cmd->flags |= COMMAND_CHECKED;
// FIXME: return true; missing here?
}
}
return false;
}
if ((cmd->menu_id != MenuTextEdit) || (cmd->param != (TextEdit*)m_edit))
return false;
cmd->flags &= ~(COMMAND_CHECKED | COMMAND_DISABLED);
switch (cmd->id){
case CmdUndo:
if (m_edit->isReadOnly())
return false;
if (!m_edit->document()->isUndoAvailable())
cmd->flags |= COMMAND_DISABLED;
return true;
case CmdRedo:
if (m_edit->isReadOnly())
return false;
if (!m_edit->document()->isRedoAvailable())
cmd->flags |= COMMAND_DISABLED;
return true;
case CmdCut:
if (m_edit->isReadOnly())
return false;
case CmdCopy:
if (m_edit->textCursor().selectedText().isEmpty())
cmd->flags |= COMMAND_DISABLED;
return true;
case CmdPaste:
if (m_edit->isReadOnly())
return false;
if (QApplication::clipboard()->text().isEmpty())
cmd->flags |= COMMAND_DISABLED;
return true;
case CmdClear:
if (m_edit->isReadOnly())
return false;
case CmdSelectAll:
if (m_edit->toPlainText().isEmpty())
cmd->flags |= COMMAND_DISABLED;
return true;
}
break;
}
case eEventCommandExec: {
EventCommandExec *ece = static_cast<EventCommandExec*>(e);
//.........这里部分代码省略.........