Пример #1
0
void AddContactBox::onImportDone(const MTPcontacts_ImportedContacts &res) {
	if (isHidden() || !App::main()) return;

	const MTPDcontacts_importedContacts &d(res.c_contacts_importedContacts());
	App::feedUsers(d.vusers);

	const QVector<MTPImportedContact> &v(d.vimported.c_vector().v);
	int32 uid = 0;
	if (!v.isEmpty()) {
		const MTPDimportedContact &c(v.front().c_importedContact());
		if (c.vclient_id.v != _contactId) return;

		uid = c.vuser_id.v;
		if (uid && !App::userLoaded(uid)) {
			uid = 0;
		}
	}
	if (uid) {
		App::main()->addNewContact(uid);
		App::wnd()->hideLayer();
	} else {
		_addButton.hide();
		_firstInput.hide();
		_lastInput.hide();
		_phoneInput.hide();
		_retryButton.show();
		int32 theight = st::boxTitleFont->m.boundingRect(0, 0, width() - st::boxPadding.left() - st::boxPadding.right(), 1, Qt::TextWordWrap, lng_contact_not_joined(lt_name, _sentName)).height();
		int32 h = st::boxPadding.top() * 2 + theight + _retryButton.height() + st::boxPadding.bottom();
		setMaxHeight(h);
		update();
	}
}
Пример #2
0
void AddContactBox::onImportDone(const MTPcontacts_ImportedContacts &res) {
	if (_hiding || !App::main()) return;

	const MTPDcontacts_importedContacts &d(res.c_contacts_importedContacts());
	App::feedUsers(d.vusers);

	const QVector<MTPImportedContact> &v(d.vimported.c_vector().v);
	int32 uid = 0;
	if (!v.isEmpty()) {
		const MTPDimportedContact &c(v.front().c_importedContact());
		if (c.vclient_id.v != _contactId) return;

		uid = c.vuser_id.v;
		if (uid && !App::userLoaded(uid)) {
			uid = 0;
		}
	}
	if (uid) {
		App::main()->addNewContact(uid);
		App::main()->showPeer(App::peerFromUser(uid));
		App::wnd()->hideLayer();
	} else {
		_addButton.hide();
		_firstInput.hide();
		_lastInput.hide();
		_phoneInput.hide();
		_retryButton.show();
		int32 theight = st::addContactTitleFont->m.boundingRect(0, 0, _width - st::boxPadding.left() - st::boxPadding.right(), 1, Qt::TextWordWrap, lang(lng_contact_not_joined).replace(qsl("{name}"), _sentName)).height();
		int32 h = st::boxPadding.top() * 2 + theight + _retryButton.height() + st::boxPadding.bottom();
		resize(_width, h);
		_retryButton.move(_retryButton.x(), h - _retryButton.height());
		_cancelButton.move(_cancelButton.x(), h - _retryButton.height());
		update();
	}
}
Пример #3
0
void AddContactBox::onImportDone(const MTPcontacts_ImportedContacts &res) {
	if (!isBoxShown() || !App::main()) return;

	auto &d = res.c_contacts_importedContacts();
	App::feedUsers(d.vusers);

	auto &v = d.vimported.c_vector().v;
	UserData *user = nullptr;
	if (!v.isEmpty()) {
		const auto &c(v.front().c_importedContact());
		if (c.vclient_id.v != _contactId) return;

		user = App::userLoaded(c.vuser_id.v);
	}
	if (user) {
		Notify::userIsContactChanged(user, true);
		Ui::hideLayer();
	} else {
		hideChildren();
		_retrying = true;
		updateButtons();
		update();
	}
}
Пример #4
0
void AddContactBox::onSaveUserDone(const MTPcontacts_ImportedContacts &res) {
	const MTPDcontacts_importedContacts &d(res.c_contacts_importedContacts());
	App::feedUsers(d.vusers);
	emit closed();
}
Пример #5
0
void AddContactBox::onSaveUserDone(const MTPcontacts_ImportedContacts &res) {
	auto &d = res.c_contacts_importedContacts();
	App::feedUsers(d.vusers);
	closeBox();
}