Esempio n. 1
0
void LoginDialog::makeInputs(unsigned &row, ClientPtr client)
{
    m_pict = new QLabel(groupBoxPasswords);
    m_pict->setPixmap(Pict(client->protocol()->description()->icon));
    picts.push_back(m_pict);

    m_vboxlayout = new QVBoxLayout;
    verticalLayout->addLayout(m_vboxlayout);
    m_hboxlayout = new QHBoxLayout;
    m_vboxlayout->addLayout(m_hboxlayout);
    m_hboxlayout->addWidget(m_pict);
    m_pict->show();

	m_txt = new QLabel(groupBoxPasswords);
    m_txt->setText(client->name());
    m_txt->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
    m_edt = new QLineEdit(groupBoxPasswords);
	m_edt->setText(client->getPassword());
	m_edt->setEchoMode(QLineEdit::Password);
	connect(m_edt, SIGNAL(textChanged(const QString&)), this, SLOT(pswdChanged(const QString&)));
	passwords.push_back(m_edt);
	texts.push_back(m_txt);
    m_hboxlayout->addWidget(m_txt);
    m_vboxlayout->addWidget(m_edt);
	m_txt->show();
	m_edt->show();
	QString helpUrl = client->protocol()->description()->accel;
	if (!helpUrl.isEmpty())
	{
        m_lnkHelp = new LinkLabel(groupBoxPasswords);
        m_vboxlayout->addWidget(m_lnkHelp);
		m_lnkHelp->setText(i18n("Forgot password?"));
		m_lnkHelp->setUrl(i18n(helpUrl));
		m_lnkHelp->show();
		links.push_back(m_lnkHelp);
	}

    m_line = new QFrame(groupBoxPasswords);
    m_line->setFrameShape(QFrame::HLine);
    m_line->setFrameShadow(QFrame::Sunken);
    m_vboxlayout->addWidget(m_line);
    lines.push_back(m_line);

	row++;
}
Esempio n. 2
0
LoginDialog::LoginDialog(bool bInit, ClientPtr client, const QString &text, const QString &loginProfile)
	: QDialog(NULL)
    , m_loginProfile(loginProfile)
    , m_newProfile(false)
    , m_bLogin(false)
    , m_bInit(bInit)
    , m_bProfileChanged(false)
	, m_client(client)
	, m_pict(NULL)
	, m_vboxlayout(NULL)
	, m_hboxlayout(NULL)
	, m_txt(NULL)
	, m_edt(NULL)
	, m_line(NULL)
	, m_lnkHelp(NULL)
{
	setupUi(this);
	setObjectName("logindlg");
    setModal(client ? false : true);
	//setAttribute(Qt::WA_DeleteOnClose, true);
	QSettings settings;
	m_profile = settings.value("Profile").toString();

	if(m_loginProfile.isEmpty())
		btnDelete->hide();
	SET_WNDPROC("login")
		setButtonsPict(this);
    lblMessage->setText(text);
    if( text.isEmpty() ) 
        lblMessage->hide();
	if (m_client)
	{
		setWindowTitle(windowTitle() + ' ' + client->name());
		setWindowIcon(Icon(m_client->protocol()->description()->icon));
		chkSave->hide();
		chkNoShow->hide();
		btnDelete->hide();
		btnRename->hide();
		cmbProfile->hide();
		lblProfile->hide();
	}
	else
	{
		setWindowTitle(i18n("Select profile"));
		setWindowIcon(Icon("SIM"));
	}
	for(int i = 0; i < cmbProfile->count(); i++)
	{
		if(cmbProfile->itemText(i) == m_profile)
		{
			cmbProfile->setCurrentIndex(i);
			break;
		}
	}
	
	chkSave->setChecked(settings.value("SavePasswd").toBool());
	chkNoShow->setChecked(settings.value("NoShow").toBool());
	connect(chkSave, SIGNAL(toggled(bool)), this, SLOT(saveToggled(bool)));
	saveToggled(settings.value("SavePasswd").toBool());
	fill();
	connect(cmbProfile, SIGNAL(activated(int)), this, SLOT(profileChanged(int)));
	connect(btnDelete, SIGNAL(clicked()), this, SLOT(profileDelete()));
	connect(btnRename, SIGNAL(clicked()), this, SLOT(profileRename()));

    labelNew->hide();
    e_newName->hide();
    profileChanged(cmbProfile->currentIndex());
    connect(e_newName,SIGNAL(textChanged(const QString&)),SLOT(newNameChanged(const QString&)));

    cmbProfile->setFocus();

	//CorePlugin::m_plugin->setProfile(CorePlugin::m_plugin->getProfile()); //This was a temporary testfix ;)
	//init setProfile with QString::null is here a bad idea because f.e. on icq-disconnect or any bad login/password combination this dialog comes up,
	//the profile-name is still the same, but get lost if empty initialized, and SIM saves all content, history, styles, pictures not in Profile but in GLOBAL Folder, this has to be prevented.

	//log(L_WARN, QString("PROFILE SET TO QString::null in File: %1 Function: %2 Line: %3").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
}