当前位置: 首页>>代码示例>>C++>>正文


C++ Contact::getTemporary方法代码示例

本文整理汇总了C++中Contact::getTemporary方法的典型用法代码示例。如果您正苦于以下问题:C++ Contact::getTemporary方法的具体用法?C++ Contact::getTemporary怎么用?C++ Contact::getTemporary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Contact的用法示例。


在下文中一共展示了Contact::getTemporary方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: closed

UserWnd::~UserWnd()
{
    emit closed(this);
    free_data(userWndData, &data);
    Contact *contact = getContacts()->contact(id());
    if (contact && contact->getTemporary()){
        m_id = 0;
        delete contact;
    }
}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例2: getContacts

ContactDragObject::~ContactDragObject()
{
    ListView *view = static_cast<ListView*>(parent());
    if (view->m_pressedItem){
        QListViewItem *item = view->m_pressedItem;
        view->m_pressedItem = NULL;
        item->repaint();
    }
    Contact *contact = getContacts()->contact(m_id);
    if (contact && (contact->getTemporary() & CONTACT_DRAG))
        delete contact;
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例3: e

void *UserListBase::processEvent(Event *e)
{
    if (e->type() == EventRepaintView)
        viewport()->repaint();
    if (m_bInit){
        switch (e->type()){
        case EventGroupCreated:{
                Group *g = (Group*)(e->param());
                addGroupForUpdate(g->id());
                break;
            }
        case EventGroupChanged:{
                Group *g = (Group*)(e->param());
                addGroupForUpdate(g->id());
                break;
            }
        case EventGroupDeleted:{
                Group *g = (Group*)(e->param());
                for (list<unsigned long>::iterator it = updGroups.begin(); it != updGroups.end(); ++it){
                    if (*it == g->id()){
                        updGroups.erase(it);
                        break;
                    }
                }
                QListViewItem *item = findGroupItem(g->id());
                deleteItem(item);
                break;
            }
        case EventContactCreated:{
                Contact *c = (Contact*)(e->param());
                if (!c->getIgnore() && (c->getTemporary() == 0))
                    addContactForUpdate(c->id());
                break;
            }
        case EventContactStatus:
        case EventContactChanged:{
                Contact *c = (Contact*)(e->param());
                if (!c->getIgnore() && (c->getTemporary() == 0)){
                    addContactForUpdate(c->id());
                }else{
                    Event e(EventContactDeleted, c);
                    processEvent(&e);
                }
                break;
            }
        case EventMessageReceived:{
                Message *msg = (Message*)(e->param());
                if (msg->type() == MessageStatus){
                    Contact *contact = getContacts()->contact(msg->contact());
                    if (contact)
                        addContactForUpdate(contact->id());
                }
                break;
            }
        case EventContactDeleted:{
                Contact *g = (Contact*)(e->param());
                for (list<unsigned long>::iterator it = updContacts.begin(); it != updContacts.end(); ++it){
                    if (*it == g->id()){
                        updContacts.erase(it);
                        break;
                    }
                }
                ContactItem *item = findContactItem(g->id());
                if (item){
                    if (m_groupMode){
                        GroupItem *grpItem = static_cast<GroupItem*>(item->parent());
                        grpItem->m_nContacts--;
                        if (item->m_bOnline)
                            grpItem->m_nContactsOnline--;
                        addGroupForUpdate(grpItem->id());
                        deleteItem(item);
                        if ((m_groupMode == 2) &&
                                (grpItem->firstChild() == NULL) &&
                                m_bShowOnline){
                            DivItem *div = static_cast<DivItem*>(grpItem->parent());
                            if (div->state() == DIV_OFFLINE){
                                deleteItem(grpItem);
                                if (div->firstChild() == NULL)
                                    deleteItem(div);
                            }
                        }
                    }else{
                        QListViewItem *p = item->parent();
                        deleteItem(item);
                        if (p->firstChild() == NULL)
                            deleteItem(p);
                    }
                }
                break;
            }
        }
    }
    return ListView::processEvent(e);
}
开发者ID:,项目名称:,代码行数:94,代码来源:

示例4: fill

void UserListBase::fill()
{
    m_pressedItem = NULL;
    clear();
    GroupItem *grpItem;
    ContactItem *contactItem;
    UserViewItemBase *divItem;
    UserViewItemBase *divItemOnline = NULL;
    UserViewItemBase *divItemOffline = NULL;
    ContactList *list = getContacts();
    ContactList::GroupIterator grp_it;
    ContactList::ContactIterator contact_it;
    Group *grp;
    Contact *contact;
    switch (m_groupMode){
    case 0:
        divItemOnline  = NULL;
        divItemOffline = NULL;
        while ((contact = ++contact_it) != NULL){
            if (contact->getIgnore() || contact->getTemporary())
                continue;
            unsigned style;
            string icons;
            unsigned status = getUserStatus(contact, style, icons);
            unsigned unread = getUnread(contact->id());
			bool bShow = false;
			ListUserData *data = (ListUserData*)contact->getUserData(CorePlugin::m_plugin->list_data_id);
			if (data && data->ShowAllways)
				bShow = true;
            if ((unread == 0) && !bShow && (status == STATUS_OFFLINE) && m_bShowOnline)
                continue;
            divItem = (status == STATUS_OFFLINE) ? divItemOffline : divItemOnline;
            if (divItem == NULL){
                if (status == STATUS_OFFLINE){
                    divItemOffline = new DivItem(this, DIV_OFFLINE);
                    setOpen(divItemOffline, true);
                    divItem = divItemOffline;
                }else{
                    divItemOnline = new DivItem(this, DIV_ONLINE);
                    setOpen(divItemOnline, true);
                    divItem = divItemOnline;
                }
            }
            new ContactItem(divItem, contact, status, style, icons.c_str(), unread);
        }
        break;
    case 1:
        while ((grp = ++grp_it) != NULL){
            if (grp->id() == 0)
                continue;
            grpItem = new GroupItem(this, grp, true);
        }
        grp = list->group(0);
        if (grp){
            grpItem = new GroupItem(this, grp, true);
        }
        while ((contact = ++contact_it) != NULL){
            if (contact->getIgnore() || contact->getTemporary())
                continue;
            unsigned style;
            string icons;
            unsigned status = getUserStatus(contact, style, icons);
            unsigned unread = getUnread(contact->id());
			bool bShow = false;
			ListUserData *data = (ListUserData*)contact->getUserData(CorePlugin::m_plugin->list_data_id);
			if (data && data->ShowAllways)
				bShow = true;
            if ((status == STATUS_OFFLINE) && !bShow && (unread == 0) && m_bShowOnline)
                continue;
            grpItem = findGroupItem(contact->getGroup());
            if (grpItem == NULL)
                continue;
            contactItem = new ContactItem(grpItem, contact, status, style, icons.c_str(), unread);
            grpItem->m_nContacts++;
            if ((status != STATUS_OFFLINE) && !m_bShowOnline){
                grpItem->m_nContactsOnline++;
                contactItem->m_bOnline = true;
            }
        }
        break;
    case 2:
        divItemOnline = new DivItem(this, DIV_ONLINE);
        setOpen(divItemOnline, true);
        while ((grp = ++grp_it) != NULL){
            if (grp->id() == 0)
                continue;
            grpItem = new GroupItem(divItemOnline, grp, false);
        }
        grp = list->group(0);
        if (grp){
            grpItem = new GroupItem(divItemOnline, grp, false);
        }
        if (!m_bShowOnline){
            divItemOffline = new DivItem(this, DIV_OFFLINE);
            setOpen(divItemOffline, true);
            grp_it.reset();
            while ((grp = ++grp_it) != NULL){
                if (grp->id() == 0)
                    continue;
                grpItem = new GroupItem(divItemOffline, grp, true);
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例5: eTmpl

void *MsgSMS::processEvent(Event *e)
{
    if (e->type() == EventTemplateExpanded){
        TemplateExpand *t = (TemplateExpand*)(e->param());
        if (m_bExpand){
            m_edit->m_edit->append(t->tmpl);
        }else{
            m_edit->m_edit->setText(t->tmpl);
            m_edit->m_edit->moveCursor(QTextEdit::MoveEnd, false);
            m_bExpand = true;
            Contact *contact = getContacts()->contact(m_id);
            if (contact){
                SMSUserData *data = (SMSUserData*)(contact->getUserData(CorePlugin::m_plugin->sms_data_id));
                if (data->SMSSignatureAfter){
                    t->tmpl = QString::fromUtf8(data->SMSSignatureAfter);
                    Event eTmpl(EventTemplateExpand, t);
                    eTmpl.process();
                }
            }
        }
        return e->param();
    }
    if (e->type() == EventCommandExec){
        CommandDef *cmd = (CommandDef*)(e->param());
        if ((cmd->id == CmdSend) && (cmd->param == m_edit)){
            unsigned flags = 0;
            if (btnTranslit->isOn())
                flags |= MESSAGE_TRANSLIT;
            QString msgText = m_edit->m_edit->text();
            QString phone = lineEdit()->text();
            if (!msgText.isEmpty() && !phone.isEmpty()){
                SMSMessage *msg = new SMSMessage;
                msg->setText(msgText);
                msg->setFlags(flags);
                msg->setPhone(phone);
                msg->setContact(m_edit->m_userWnd->id());
                if (m_edit->sendMessage(msg)){
                    Contact *contact = getContacts()->contact(m_edit->m_userWnd->id());
                    if (contact){
                        if (contact->getTemporary()){
                            contact->setName(phone);
                            if (m_panel && m_panel->chkSave->isChecked()){
                                contact->setTemporary(0);
                                delete m_panel;
                            }
                            Event e(EventContactChanged, contact);
                            e.process();
                        }
                        SMSUserData *data = (SMSUserData*)(contact->userData.getUserData(CorePlugin::m_plugin->sms_data_id, true));
                        data->SMSTranslit = btnTranslit->isOn();
                        QString newPhones;
                        QString phones = contact->getPhones();
                        QString type = "Private Cellular";
                        QString src  = "-";
                        while (phones.length()){
                            QString phoneItem = getToken(phones, ';', false);
                            QString item = phoneItem;
                            QString phoneStr  = getToken(phoneItem, '/', false);
                            QString phone     = getToken(phoneStr, ',');
                            QString phoneType = getToken(phoneStr, ',');
                            if ((phone != msg->getPhone()) || (phoneStr.toUInt() != CELLULAR)){
                                if (!newPhones.isEmpty())
                                    newPhones += ";";
                                newPhones += item;
                                continue;
                            }
                            type = phoneType;
                            src  = phoneItem;
                        }
                        phone += ",";
                        phone += type;
                        phone += ",";
                        phone += QString::number(CELLULAR);
                        phone += "/";
                        phone += src;
                        if (!newPhones.isEmpty())
                            phone += ";";
                        newPhones = phone + newPhones;
                        if (contact->setPhones(newPhones)){
                            Event e(EventContactChanged, contact);
                            e.process();
                        }
                    }
                }
            }
            return e->param();
        }
    }
    return NULL;
}
开发者ID:,项目名称:,代码行数:90,代码来源:


注:本文中的Contact::getTemporary方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。