Esempio n. 1
0
void LoginDialog::processEvent(ICQEvent *e)
{
    switch (e->type()){
    case EVENT_STATUS_CHANGED:
        if (pClient->m_state == ICQClient::Logged){
            bLogin = false;
            pClient->DecryptedPassword = "";
	    setResult(chkOldUser->isChecked() ? 0 : 1);
            close();
        }
        return;
    case EVENT_LOGIN_ERROR:
        BalloonMsg::message(i18n("Unknown login error"), btnLogin);
        stopLogin();
        return;
    case EVENT_RATE_LIMIT:
        BalloonMsg::message(i18n("Rate limit"), btnLogin);
        stopLogin();
        return;
    case EVENT_BAD_PASSWORD:
        BalloonMsg::message(i18n("Invalid password"), edtPasswd);
        stopLogin();
        return;
    }
}
Esempio n. 2
0
void LoginDialog::reject()
{
    if (m_bLogin){
        stopLogin();
        return;
    }
    LoginDialogBase::reject();
}
Esempio n. 3
0
void LoginDialog::closeEvent(QCloseEvent *e)
{
    if (m_bLogin){
        e->ignore();
        stopLogin();
        return;
    }
    LoginDialogBase::closeEvent(e);
}
Esempio n. 4
0
void LoginDialog::closeEvent(QCloseEvent *e)
{
    if (!bLogin){
        QDialog::closeEvent(e);
        return;
    }
    e->ignore();
    stopLogin();
}
Esempio n. 5
0
void PasswdDialog::processEvent(ICQEvent *e)
{
    if (pClient->m_state == ICQClient::Logged){
        bLogin = false;
        close();
        return;
    }
    if (e->type() == EVENT_BAD_PASSWORD){
        stopLogin();
    }
}
Esempio n. 6
0
void LoginDialog::closeEvent(QCloseEvent *e)
{
    if (!bLogin){
        if (bMyInit || !pMain->isLoad()){
            if (bCloseMain)
                pMain->quit();
        }
        QDialog::closeEvent(e);
        return;
    }
    e->ignore();
    stopLogin();
}
Esempio n. 7
0
void LoginDialog::accept()
{
    if (m_client){
        if (m_bLogin){
            stopLogin();
        }else{
            startLogin();
            m_client->setPassword(passwords[0]->text());
            unsigned status = m_client->getStatus();
            if (status  == STATUS_OFFLINE)
                status = STATUS_ONLINE;
            m_client->setStatus(status, m_client->getCommonStatus());
        }
        return;
    }
    LoginDialogBase::accept();
}
Esempio n. 8
0
void *LoginDialog::processEvent(Event *e)
{
    switch (e->type()){
    case EventClientChanged:
        if (m_bLogin && ((m_client == NULL) || ((Client*)(e->param()) == m_client))){
            if (((Client*)(e->param()))->getState() == Client::Connected){
                QTimer::singleShot(0, this, SLOT(loginComplete()));
                return NULL;
            }
        }
        break;
    case EventClientError:
        if (m_bLogin){
            clientErrorData *d = (clientErrorData*)(e->param());
            if (m_client){
                if (d->client != m_client)
                    return NULL;
            }else{
                for (unsigned i = 0; i < passwords.size(); i++){
                    Client *client = getContacts()->getClient(i);
                    if (client->getState() != Client::Error)
                        return e->param();
                }
            }
            stopLogin();
            QString msg;
            if (d->err_str && *d->err_str){
                msg = i18n(d->err_str);
                if (d->args){
                    msg = msg.arg(QString::fromUtf8(d->args));
                    free(d->args);
                }
            }else{
                msg = i18n("Login failed");
            }
            if (msg.length()){
                raiseWindow(this);
                BalloonMsg::message(msg, buttonOk);
            }
            return e->param();
        }
        break;
    }
    return NULL;
}
Esempio n. 9
0
void LoginDialog::processEvent(ICQEvent *e)
{
    switch (e->type()){
    case EVENT_STATUS_CHANGED:
        if (pClient->isLogged() && bLogin){
            bLogin = false;
            pClient->DecryptedPassword = "";
            pSplash->setLastUIN(pClient->owner->Uin);
            pSplash->setSavePassword(chkSave->isChecked());
            pSplash->setNoShowLogin(chkNoShow->isChecked());
            pSplash->save();
            if (!pMain->init()){
                BalloonMsg::message(i18n("Can't initialize main window"), btnLogin);
                stopLogin();
                return;
            }
            if (pMain->getManualStatus() == ICQ_STATUS_OFFLINE)
                pMain->setManualStatus(ICQ_STATUS_ONLINE);
            bCloseMain = false;
            close();
        }
        return;
    case EVENT_LOGIN_ERROR:
        BalloonMsg::message(i18n("Unknown login error"), btnLogin);
        stopLogin();
        return;
    case EVENT_RATE_LIMIT:
        BalloonMsg::message(i18n("Rate limit"), btnLogin);
        stopLogin();
        return;
    case EVENT_BAD_PASSWORD:
        BalloonMsg::message(i18n("Invalid password"), edtPasswd);
        stopLogin();
        return;
    case EVENT_PROXY_ERROR:{
            stopLogin();
            ProxyDialog d(this, i18n("Can't connect to proxy server"));
            d.exec();
            return;
        }
    case EVENT_PROXY_BAD_AUTH:{
            stopLogin();
            ProxyDialog d(this, pClient->factory()->ProxyAuth ?
                          i18n("Proxy server require authorization") :
                          i18n("Invalid password for proxy"));
            d.exec();
            return;
        }
    }
}
Esempio n. 10
0
void LoginDialog::accept()
{
    if (m_bLogin){
        stopLogin();
        return;
    }

    if (m_client){
        startLogin();
        QString prev = m_client->getPreviousPassword();
        if (prev.isEmpty())
            m_client->setPreviousPassword(m_client->getPassword());
        m_client->setPassword(passwords[0]->text());
        unsigned status = m_client->getStatus();
        if (status == STATUS_OFFLINE)
            status = STATUS_ONLINE;
        m_client->setStatus(status, m_client->getCommonStatus());
        LoginDialogBase::accept();
        return;
    }

    getContacts()->clearClients();
    int n = cmbProfile->currentItem();
    if ((n < 0) || (n >= cmbProfile->count() - 1)){
        CorePlugin::m_plugin->setSavePasswd(chkSave->isChecked());
        CorePlugin::m_plugin->setNoShow(chkNoShow->isChecked());
        CorePlugin::m_plugin->setProfile(NULL);
        CorePlugin::m_plugin->changeProfile();
        LoginDialogBase::accept();
        return;
    }

    CorePlugin::m_plugin->setProfile(CorePlugin::m_plugin->m_profiles[n].c_str());
    if (m_profile != CorePlugin::m_plugin->getProfile()){
        CorePlugin::m_plugin->changeProfile();
        m_bProfileChanged = true;
    }

    CorePlugin::m_plugin->setSavePasswd(chkSave->isChecked());
    CorePlugin::m_plugin->setNoShow(chkNoShow->isChecked());

    ClientList clients;
    CorePlugin::m_plugin->loadClients(clients);
    clients.addToContacts();
    getContacts()->load();

    m_bLogin = false;
    for (unsigned i = 0; i < passwords.size(); i++){
        Client *client = getContacts()->getClient(i);
        client->setSavePassword(chkSave->isChecked());
        QString pswd = client->getPassword();
        QString new_pswd = passwords[i]->text();
        if (pswd != new_pswd){
            QString prev = client->getPreviousPassword();
            if (!prev.isEmpty())
                client->setPreviousPassword(pswd);
            client->setPassword(new_pswd);
            m_bLogin = true;
        }
    }
    if (m_bLogin){
        startLogin();
        for (unsigned i = 0; i < passwords.size(); i++){
            Client *client = getContacts()->getClient(i);
            unsigned status = client->getStatus();
            if (status == STATUS_OFFLINE)
                status = STATUS_ONLINE;
            client->setStatus(status, client->getCommonStatus());
        }
        return;
    }
    LoginDialogBase::accept();
}
Esempio n. 11
0
void PasswdDialog::closeEvent(QCloseEvent *e)
{
    if (!bLogin) QDialog::closeEvent(e);
    e->ignore();
    stopLogin();
}
Esempio n. 12
0
void LoginDialog::accept()
{
    if (m_bLogin){
        stopLogin();
        return;
    }

    if (m_client){
        startLogin();
        QString prev = m_client->getPreviousPassword();
        if (prev.isEmpty())
            m_client->setPreviousPassword(m_client->getPassword());
        m_client->setPassword(passwords[0]->text());
        unsigned status = m_client->getStatus();
        if (status == STATUS_OFFLINE)
            status = STATUS_ONLINE;
        m_client->setStatus(status, m_client->getCommonStatus());
        LoginDialogBase::accept();
        return;
    }

    getContacts()->clearClients();
    int n = cmbProfile->currentItem();
    if ((n < 0) || (n >= cmbProfile->count() - 1)){
        CorePlugin::m_plugin->setSavePasswd(chkSave->isChecked());
        CorePlugin::m_plugin->setNoShow(chkNoShow->isChecked());
        CorePlugin::m_plugin->setProfile(NULL);
        CorePlugin::m_plugin->changeProfile();
        LoginDialogBase::accept();
        return;
    }

    CorePlugin::m_plugin->setProfile(CorePlugin::m_plugin->m_profiles[n].c_str());
    if (m_profile != CorePlugin::m_plugin->getProfile()){
        if (!CorePlugin::m_plugin->lockProfile(CorePlugin::m_plugin->m_profiles[n].c_str())){
            CorePlugin::m_plugin->setProfile(m_profile.c_str());
            BalloonMsg::message(i18n("Other instance of SIM use this profile"), buttonOk);
            return;
        }
        CorePlugin::m_plugin->changeProfile();
        m_bProfileChanged = true;
    }

    CorePlugin::m_plugin->setSavePasswd(chkSave->isChecked());
    CorePlugin::m_plugin->setNoShow(chkNoShow->isChecked());

    ClientList clients;
    CorePlugin::m_plugin->loadClients(clients);
    clients.addToContacts();
    getContacts()->load();

    m_bLogin = false;
    unsigned j = 0;
    for (unsigned i = 0; i < passwords.size(); i++){
        Client *client = NULL;
        while (j < getContacts()->nClients()){
            client = getContacts()->getClient(j++);
            if ((client->protocol()->description()->flags & PROTOCOL_NO_AUTH) == 0)
                break;
            client = NULL;
        }
        if (client == NULL)
            break;
        client->setSavePassword(chkSave->isChecked());
        QString pswd = client->getPassword();
        QString new_pswd = passwords[i]->text();
        if (pswd != new_pswd){
            QString prev = client->getPreviousPassword();
            if (!prev.isEmpty())
                client->setPreviousPassword(pswd);
            client->setPassword(new_pswd);
            m_bLogin = true;
        }
    }
    if (m_bLogin){
        startLogin();
        for (unsigned i = 0; i < passwords.size(); i++){
            Client *client = getContacts()->getClient(i);
            unsigned status = client->getStatus();
            if (status == STATUS_OFFLINE)
                status = STATUS_ONLINE;
            client->setStatus(status, client->getCommonStatus());
        }
        return;
    }
    LoginDialogBase::accept();
}