コード例 #1
1
LoginDialog::LoginDialog()
        : LoginDlgBase(NULL, "logindlg", false, WDestructiveClose)
{
    SET_WNDPROC("login")
    setCaption(caption());
    setButtonsPict(this);
    setIcon(Pict("licq"));
    bLogin = false;
    bMyInit = false;
    cmbUIN->setEditable(true);
    cmbUIN->lineEdit()->setValidator(new QIntValidator(100000, 0x7FFFFFFF, this));
    loadUins();
    edtPasswd->setEchoMode(QLineEdit::Password);
    connect(cmbUIN->lineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(uinChanged(const QString&)));
    connect(edtPasswd, SIGNAL(textChanged(const QString&)), this, SLOT(pswdChanged(const QString&)));
    connect(btnClose, SIGNAL(clicked()), this, SLOT(close()));
    connect(btnLogin, SIGNAL(clicked()), this, SLOT(login()));
    connect(btnDelete, SIGNAL(clicked()), this, SLOT(deleteUin()));
    connect(btnProxy, SIGNAL(clicked()), this, SLOT(proxySetup()));
    connect(chkSave, SIGNAL(toggled(bool)), this, SLOT(saveChanged(bool)));
    QSize s = sizeHint();
    QWidget *desktop = QApplication::desktop();
    move((desktop->width() - s.width()) / 2, (desktop->height() - s.height()) / 2);
    chkSave->setChecked(pSplash->isSavePassword());
    chkNoShow->setChecked(pSplash->isNoShowLogin());
    uinChanged("");
    bPswdChanged = true;
    if (pSplash->isSavePassword()){
        unsigned long uin = cmbUIN->lineEdit()->text().toULong();
        if (uin){
            pClient->load(uin);
            QString pswd;
            for (const char *p = pClient->EncryptedPassword.c_str(); *p; p++){
                if (*p == '\\') continue;
                pswd += '*';
            }
            edtPasswd->setText(pswd);
            pswdChanged("");
            if (!pswd.isEmpty()) bPswdChanged = false;
        }
    }
    bCloseMain = true;
};
コード例 #2
0
LoginDialog::LoginDialog()
        : LoginDlgBase(NULL, "logindlg", true)
{
    setIcon(Pict("licq"));
    bLogin = false;
    edtUIN->setValidator(new QIntValidator(100000, 0x7FFFFFFF, this));
    connect(edtUIN, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    edtPasswd->setEchoMode(QLineEdit::Password);
    connect(edtPasswd, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(chkOldUser, SIGNAL(toggled(bool)), this, SLOT(setOldUser(bool)));
    connect(btnClose, SIGNAL(clicked()), this, SLOT(close()));
    connect(btnLogin, SIGNAL(clicked()), this, SLOT(login()));
    connect(btnProxy, SIGNAL(clicked()), this, SLOT(proxySetup()));
    setOldUser(false);
    textChanged("");
    QSize s = sizeHint();
    QWidget *desktop = QApplication::desktop();
    move((desktop->width() - s.width()) / 2, (desktop->height() - s.height()) / 2);
    setResult(0);
};