Example #1
0
bool MsgEdit::sendMessage(Message *msg)
{
    if (m_retry.msg){
        delete m_retry.msg;
        m_retry.msg = NULL;
    }

    if (m_msg){
        delete msg;
        Event e(EventMessageCancel, m_msg);
        if (e.process())
            m_msg = NULL;
        stopSend(false);
        return false;
    }
    bool bClose = true;
    if (CorePlugin::m_plugin->getContainerMode()){
        bClose = false;
        Command cmd;
        cmd->id		= CmdSendClose;
        cmd->param	= this;
        Event e(EventCommandWidget, cmd);
        QToolButton *btnClose = (QToolButton*)(e.process());
        if (btnClose)
            bClose = btnClose->isOn();
    }
    CorePlugin::m_plugin->setCloseSend(bClose);

    msg->setFlags(msg->getFlags() | m_flags);
    m_flags = 0;

    if (m_userWnd->m_list){
        multiply = m_userWnd->m_list->selected;
        if (multiply.empty())
            return false;
        multiply_it = multiply.begin();
        msg->setContact(*multiply_it);
        msg->setClient(NULL);
        ++multiply_it;
        if (multiply_it != multiply.end())
            msg->setFlags(msg->getFlags() | MESSAGE_MULTIPLY);
    }

    editLostFocus();
    Command cmd;
    cmd->id		= CmdSend;
    cmd->text	= I18N_NOOP("Cancel");
    cmd->icon	= "cancel";
    cmd->flags	= BTN_PICT;
    cmd->param	= this;
    Event eCmd(EventCommandChange, cmd);
    eCmd.process();
    m_msg = msg;
    return send();
}
Example #2
0
void CityTime::slotNewTz( const QString & strNewCountry,
                              const QString & strNewCity )
{
    // determine what to do based on what putton is pressed...
    QListIterator<QToolButton> itCity(listCities);
    int i;
    // go through the list and make adjustments based on which button is on
    for ( i = 0, itCity.toFirst(); itCity.current(), i < CITIES; i++, ++itCity ) {
        QToolButton *cmdTmp = itCity.current();
        if ( cmdTmp->isOn() ) {
            strCityTz[i] = strNewCountry + strNewCity;
            QString s = strNewCity;
            cmdTmp->setText( s.replace( QRegExp("_"), " " ) );
            cmdTmp->toggle();
            // we can actually break, since there is only one button
            // that is ever pressed!
            changed = TRUE;
            break;
        }
    }
    showTime();
    buttonWidget->show();
    selWidget->hide();
}
Example #3
0
bool MsgEdit::sendMessage(Message *msg)
{
    if (m_retry.msg){
        delete m_retry.msg;
        m_retry.msg = NULL;
    }
    if (m_msg){
        delete msg;
        Event e(EventMessageCancel, m_msg);
        if (e.process())
            m_msg = NULL;
        stopSend(false);
        return false;
    }
    bool bClose = true;
    if (CorePlugin::m_plugin->getContainerMode()){
        bClose = false;
        Command cmd;
        cmd->id		= CmdSendClose;
        cmd->param	= this;
        Event e(EventCommandWidget, cmd);
        QToolButton *btnClose = (QToolButton*)(e.process());
        if (btnClose)
            bClose = btnClose->isOn();
    }
    CorePlugin::m_plugin->setCloseSend(bClose);

    Contact *contact = getContacts()->contact(m_userWnd->id());
    if (contact){
        TranslitUserData *data = (TranslitUserData*)(contact->getUserData(CorePlugin::m_plugin->translit_data_id));
        if (data && data->Translit.bValue)
            msg->setFlags(msg->getFlags() | MESSAGE_TRANSLIT);
    }

    msg->setFlags(msg->getFlags() | m_flags);
    m_flags = 0;

    if (m_userWnd->m_list){
        multiply = m_userWnd->m_list->selected;
        if (multiply.empty())
            return false;
        multiply_it = multiply.begin();
        msg->setContact(*multiply_it);
        msg->setClient(NULL);
        ++multiply_it;
        if (multiply_it != multiply.end())
            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){
            string resources = c->resources(data);
            while (!resources.empty()){
                string res = getToken(resources, ';');
                getToken(res, ',');
                if (m_resource == QString::fromUtf8(res.c_str())){
                    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;
    Event eCmd(EventCommandChange, cmd);
    eCmd.process();
    m_msg = msg;
    return send();
}