コード例 #1
0
void ChangePasswordDlg::apply()
{
	// sanity check
	if(le_pwcur->text().isEmpty() || le_pwnew->text().isEmpty() || le_pwver->text().isEmpty()) {
		QMessageBox::information(this, tr("Error"), tr("You must fill out the fields properly before you can proceed."));
		return;
	}

	if(le_pwcur->text() != pa->userAccount().pass) {
		QMessageBox::information(this, tr("Error"), tr("You entered your old password incorrectly.  Try again."));
		le_pwcur->setText("");
		le_pwcur->setFocus();
		return;
	}

	if(le_pwnew->text() != le_pwver->text()) {
		QMessageBox::information(this, tr("Error"), tr("New password and confirmation do not match.  Please enter them again."));
		le_pwnew->setText("");
		le_pwver->setText("");
		le_pwnew->setFocus();
		return;
	}

	busy->start();
	blockWidgets();

	JT_Register *reg = new JT_Register(pa->client()->rootTask());
	connect(reg, SIGNAL(finished()), SLOT(finished()));
	Jid j = pa->userAccount().jid;
	reg->reg(j.user(), le_pwnew->text());
	reg->go(true);
}