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


C++ FileMessage::setClient方法代码示例

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


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

示例1: eWidget

void *MsgFile::processEvent(Event *e)
{
    if (e->type() == EventCheckState){
        CommandDef *cmd = (CommandDef*)(e->param());
        if (cmd->param == m_edit){
            unsigned id = cmd->bar_grp;
            if ((id >= MIN_INPUT_BAR_ID) && (id < MAX_INPUT_BAR_ID)){
                cmd->flags |= BTN_HIDE;
                if (cmd->id == CmdFileName)
                    cmd->flags &= ~BTN_HIDE;
                return e->param();
            }
            switch (cmd->id){
            case CmdTranslit:
            case CmdSmile:
            case CmdSend:
            case CmdSendClose:
                e->process(this);
                cmd->flags &= ~BTN_HIDE;
                return e->param();
            case CmdNextMessage:
            case CmdMsgAnswer:
                e->process(this);
                cmd->flags |= BTN_HIDE;
                return e->param();
            }
        }
    }
    if (e->type() == EventCommandExec){
        CommandDef *cmd = (CommandDef*)(e->param());
        if (cmd->param == m_edit){
            if (cmd->id == CmdSend){
                Command cmd;
                cmd->id		= CmdFileName;
                cmd->param	= m_edit;
                Event eWidget(EventCommandWidget, cmd);
                CToolEdit *edtName = (CToolEdit*)(eWidget.process());
                if (edtName == NULL)
                    return NULL;
                QString msgText = m_edit->m_edit->text();
                QString file = edtName->text();
                QStringList files;
                QString f;
                for (int i = 0; i < (int)file.length(); i++){
                    if (file[i] == '\"'){
                        f = trim(f);
                        if (!f.isEmpty())
                            files.append(f);
                        f = "";
                        for (i++; i < (int)file.length(); i++){
                            if (file[i] == '\"')
                                break;
                            f += file[i];
                        }
                        f = trim(f);
                        if (!f.isEmpty())
                            files.append(f);
                        f = "";
                        continue;
                    }
                    f += file[i];
                }
                f = trim(f);
                if (!f.isEmpty())
                    files.append(f);
                file = "";
                for (QStringList::Iterator it = files.begin(); it != files.end(); ++it){
                    if (!file.isEmpty())
                        file += ";";
                    file += quoteChars(*it, ";");
                }
                if (!file.isEmpty()){
                    FileMessage *msg = new FileMessage;
                    msg->setText(msgText);
                    msg->setFile(file);
                    msg->setContact(m_edit->m_userWnd->id());
                    msg->setClient(m_client.c_str());
                    m_edit->sendMessage(msg);
                }
                return e->param();
            }
            if (cmd->id == CmdFileName){
                selectFile();
                return e->param();
            }
        }
    }
    return NULL;
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:89,代码来源:msgfile.cpp

示例2: processEvent

bool MsgFile::processEvent(Event *e)
{
    if (e->type() == eEventCheckCommandState){
        EventCheckCommandState *ecs = static_cast<EventCheckCommandState*>(e);
        CommandDef *cmd = ecs->cmd();
        if (cmd->param == m_edit){
            unsigned id = cmd->bar_grp;
            if ((id >= MIN_INPUT_BAR_ID) && (id < MAX_INPUT_BAR_ID)){
                cmd->flags |= BTN_HIDE;
                if (cmd->id == CmdFileName)
                    cmd->flags &= ~BTN_HIDE;
                return true;
            }
            switch (cmd->id){
            case CmdTranslit:
            case CmdSmile:
            case CmdSend:
            case CmdSendClose:
                e->process(this);
                cmd->flags &= ~BTN_HIDE;
                return true;
            case CmdNextMessage:
            case CmdMsgAnswer:
                e->process(this);
                cmd->flags |= BTN_HIDE;
                return true;
            }
        }
    } else
    if (e->type() == eEventCommandExec){
        EventCommandExec *ece = static_cast<EventCommandExec*>(e);
        CommandDef *cmd = ece->cmd();
        if (cmd->param == m_edit){
            if (cmd->id == CmdSend){
                Command cmd;
                cmd->id		= CmdFileName;
                cmd->param	= m_edit;
                EventCommandWidget eWidget(cmd);
                eWidget.process();
                CToolEdit *edtName = qobject_cast<CToolEdit*>(eWidget.widget());
                if (edtName == NULL)
                    return false;
                QString msgText = m_edit->m_edit->toPlainText();
                QString file = edtName->text();
                QStringList files;
                QString f;
                for (int i = 0; i < (int)file.length(); i++){
                    if (file[i] == '\"'){
                        f = f.trimmed();
                        if (!f.isEmpty())
                            files.append(f);
                        f = QString::null;
                        for (i++; i < (int)file.length(); i++){
                            if (file[i] == '\"')
                                break;
                            f += file[i];
                        }
                        f = f.trimmed();
                        if (!f.isEmpty())
                            files.append(f);
                        f = QString::null;
                        continue;
                    }
                    f += file[i];
                }
                f = f.trimmed();
                if (!f.isEmpty())
                    files.append(f);
                file = QString::null;
                for (QStringList::Iterator it = files.begin(); it != files.end(); ++it){
                    if (!file.isEmpty())
                        file += ';';
                    file += quoteChars(*it, ";");
                }
                if (!file.isEmpty()){
                    FileMessage *msg = new FileMessage;
                    msg->setText(msgText);
                    msg->setFile(file);
                    msg->setContact(m_edit->m_userWnd->id());
                    msg->setClient(m_client);
                    m_edit->sendMessage(msg);
                }
                return true;
            }
            if (cmd->id == CmdFileName){
                selectFile();
                return true;
            }
        }
    }
    return false;
}
开发者ID:BackupTheBerlios,项目名称:sim-im,代码行数:92,代码来源:msgfile.cpp


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