mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
New profile blocks started. Info block fully ready.
All block widgets added (currently empty). About text and phone number PeerUpdateFlag added for observers.
This commit is contained in:
@@ -33,16 +33,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#include "observer_peer.h"
|
||||
|
||||
AddContactBox::AddContactBox(QString fname, QString lname, QString phone) : AbstractBox(st::boxWidth)
|
||||
, _user(0)
|
||||
, _save(this, lang(lng_add_contact), st::defaultBoxButton)
|
||||
, _cancel(this, lang(lng_cancel), st::cancelBoxButton)
|
||||
, _retry(this, lang(lng_try_other_contact), st::defaultBoxButton)
|
||||
, _first(this, st::defaultInputField, lang(lng_signup_firstname), fname)
|
||||
, _last(this, st::defaultInputField, lang(lng_signup_lastname), lname)
|
||||
, _phone(this, st::defaultInputField, lang(lng_contact_phone), phone)
|
||||
, _invertOrder(langFirstNameGoesSecond())
|
||||
, _contactId(0)
|
||||
, _addRequest(0) {
|
||||
, _invertOrder(langFirstNameGoesSecond()) {
|
||||
if (!phone.isEmpty()) {
|
||||
_phone.setDisabled(true);
|
||||
}
|
||||
@@ -57,10 +54,8 @@ AddContactBox::AddContactBox(UserData *user) : AbstractBox(st::boxWidth)
|
||||
, _retry(this, lang(lng_try_other_contact), st::defaultBoxButton)
|
||||
, _first(this, st::defaultInputField, lang(lng_signup_firstname), user->firstName)
|
||||
, _last(this, st::defaultInputField, lang(lng_signup_lastname), user->lastName)
|
||||
, _phone(this, st::defaultInputField, lang(lng_contact_phone), user->phone)
|
||||
, _invertOrder(langFirstNameGoesSecond())
|
||||
, _contactId(0)
|
||||
, _addRequest(0) {
|
||||
, _phone(this, st::defaultInputField, lang(lng_contact_phone), user->phone())
|
||||
, _invertOrder(langFirstNameGoesSecond()) {
|
||||
_phone.setDisabled(true);
|
||||
initBox();
|
||||
}
|
||||
@@ -191,7 +186,7 @@ void AddContactBox::onSave() {
|
||||
_sentName = firstName;
|
||||
if (_user) {
|
||||
_contactId = rand_value<uint64>();
|
||||
QVector<MTPInputContact> v(1, MTP_inputPhoneContact(MTP_long(_contactId), MTP_string(_user->phone), MTP_string(firstName), MTP_string(lastName)));
|
||||
QVector<MTPInputContact> v(1, MTP_inputPhoneContact(MTP_long(_contactId), MTP_string(_user->phone()), MTP_string(firstName), MTP_string(lastName)));
|
||||
_addRequest = MTP::send(MTPcontacts_ImportContacts(MTP_vector<MTPInputContact>(v), MTP_bool(false)), rpcDone(&AddContactBox::onSaveUserDone), rpcFail(&AddContactBox::onSaveUserFail));
|
||||
} else {
|
||||
_contactId = rand_value<uint64>();
|
||||
@@ -1181,7 +1176,7 @@ EditChannelBox::EditChannelBox(ChannelData *channel) : AbstractBox()
|
||||
, _save(this, lang(lng_settings_save), st::defaultBoxButton)
|
||||
, _cancel(this, lang(lng_cancel), st::cancelBoxButton)
|
||||
, _title(this, st::defaultInputField, lang(lng_dlg_new_channel_name), _channel->name)
|
||||
, _description(this, st::newGroupDescription, lang(lng_create_group_description), _channel->about)
|
||||
, _description(this, st::newGroupDescription, lang(lng_create_group_description), _channel->about())
|
||||
, _sign(this, lang(lng_edit_sign_messages), channel->addsSignature())
|
||||
, _publicLink(this, lang(channel->isPublic() ? lng_profile_edit_public_link : lng_profile_create_public_link), st::defaultBoxLinkButton)
|
||||
, _saveTitleRequestId(0)
|
||||
@@ -1322,7 +1317,7 @@ void EditChannelBox::onPublicLink() {
|
||||
}
|
||||
|
||||
void EditChannelBox::saveDescription() {
|
||||
if (_sentDescription == _channel->about) {
|
||||
if (_sentDescription == _channel->about()) {
|
||||
saveSign();
|
||||
} else {
|
||||
_saveDescriptionRequestId = MTP::send(MTPchannels_EditAbout(_channel->inputChannel, MTP_string(_sentDescription)), rpcDone(&EditChannelBox::onSaveDescriptionDone), rpcFail(&EditChannelBox::onSaveFail));
|
||||
@@ -1357,9 +1352,11 @@ bool EditChannelBox::onSaveFail(const RPCError &error, mtpRequestId req) {
|
||||
} else if (req == _saveDescriptionRequestId) {
|
||||
_saveDescriptionRequestId = 0;
|
||||
if (err == qstr("CHAT_ABOUT_NOT_MODIFIED")) {
|
||||
_channel->about = _sentDescription;
|
||||
if (App::api()) {
|
||||
emit App::api()->fullPeerUpdated(_channel);
|
||||
if (_channel->setAbout(_sentDescription)) {
|
||||
if (App::api()) {
|
||||
emit App::api()->fullPeerUpdated(_channel);
|
||||
}
|
||||
Notify::peerUpdatedSendDelayed();
|
||||
}
|
||||
saveSign();
|
||||
return true;
|
||||
@@ -1386,9 +1383,11 @@ void EditChannelBox::onSaveTitleDone(const MTPUpdates &updates) {
|
||||
|
||||
void EditChannelBox::onSaveDescriptionDone(const MTPBool &result) {
|
||||
_saveDescriptionRequestId = 0;
|
||||
_channel->about = _sentDescription;
|
||||
if (App::api()) {
|
||||
emit App::api()->fullPeerUpdated(_channel);
|
||||
if (_channel->setAbout(_sentDescription)) {
|
||||
if (App::api()) {
|
||||
emit App::api()->fullPeerUpdated(_channel);
|
||||
}
|
||||
Notify::peerUpdatedSendDelayed();
|
||||
}
|
||||
saveSign();
|
||||
}
|
||||
|
Reference in New Issue
Block a user