Example #1
0
void ChangePasswordDlg::finished()
{
	ui_.busy->stop();

	JT_Register *reg = (JT_Register *)sender();
	QString err = reg->statusString();
	int code = reg->statusCode();
	bool ok = reg->success();
	if(ok) {
		UserAccount acc = pa->userAccount();
		acc.pass = ui_.le_pwnew->text();
		pa->setUserAccount(acc);
		AccountModifyDlg *amd = pa->findDialog<AccountModifyDlg*>();
		if(amd)
			amd->setPassword(acc.pass);

		QMessageBox::information(this, tr("Success"), tr("Successfully changed password."));
		close();
	}
	else {
		// ignore task disconnect error
		if(code == Task::ErrDisc)
			return;

		QMessageBox::critical(this, tr("Error"), QString(tr("There was an error when trying to set the password.\nReason: %1")).arg(QString(err).replace('\n', "<br>")));
		restoreWidgets();
	}
}
void TransportRegistrationManager::transportUnRegistrationFinished()
{
	JT_Register *task = (JT_Register *)sender();
	
	if (task->success()) {
		_registered = false;
		emit registrationStatusChanged(_registered, "");
		emit unregistrationFinished();
	}
}
void TransportRegistrationManager::transportRegistrationFinished()
{
	JT_Register *task = (JT_Register *)sender();
	
	if (task->success()) {
		_registered = true;
		emit registrationStatusChanged(_registered, _usernamesForTasks[task]);
		emit registrationFinished();
	}
	
	_usernamesForTasks.remove(task);
}