Delegated display of ShowInviteLinkBox to caller.
This commit is contained in:
		
							parent
							
								
									f48cf2e27a
								
							
						
					
					
						commit
						5ddb9f9097
					
				
					 3 changed files with 19 additions and 16 deletions
				
			
		| 
						 | 
					@ -1092,7 +1092,9 @@ void AddPermanentLinkBlock(
 | 
				
			||||||
		st::inviteLinkJoinedRowPadding
 | 
							st::inviteLinkJoinedRowPadding
 | 
				
			||||||
	)->setClickedCallback([=] {
 | 
						)->setClickedCallback([=] {
 | 
				
			||||||
		if (!currentLinkFields->link.isEmpty()) {
 | 
							if (!currentLinkFields->link.isEmpty()) {
 | 
				
			||||||
			ShowInviteLinkBox(peer, *currentLinkFields);
 | 
								show->showBox(
 | 
				
			||||||
 | 
									ShowInviteLinkBox(peer, *currentLinkFields),
 | 
				
			||||||
 | 
									Ui::LayerOption::KeepOther);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1207,10 +1209,11 @@ void EditLink(
 | 
				
			||||||
	using Fields = Ui::InviteLinkFields;
 | 
						using Fields = Ui::InviteLinkFields;
 | 
				
			||||||
	const auto done = [=](Fields result) {
 | 
						const auto done = [=](Fields result) {
 | 
				
			||||||
		const auto finish = [=](Api::InviteLink finished) {
 | 
							const auto finish = [=](Api::InviteLink finished) {
 | 
				
			||||||
			if (creating) {
 | 
					 | 
				
			||||||
				ShowInviteLinkBox(peer, finished);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if (*box) {
 | 
								if (*box) {
 | 
				
			||||||
 | 
									if (creating) {
 | 
				
			||||||
 | 
										(*box)->getDelegate()->show(
 | 
				
			||||||
 | 
											ShowInviteLinkBox(peer, finished));
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
				(*box)->closeBox();
 | 
									(*box)->closeBox();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		};
 | 
							};
 | 
				
			||||||
| 
						 | 
					@ -1292,7 +1295,7 @@ void DeleteLink(
 | 
				
			||||||
		Ui::LayerOption::KeepOther);
 | 
							Ui::LayerOption::KeepOther);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ShowInviteLinkBox(
 | 
					object_ptr<Ui::BoxContent> ShowInviteLinkBox(
 | 
				
			||||||
		not_null<PeerData*> peer,
 | 
							not_null<PeerData*> peer,
 | 
				
			||||||
		const Api::InviteLink &link) {
 | 
							const Api::InviteLink &link) {
 | 
				
			||||||
	const auto admin = link.admin;
 | 
						const auto admin = link.admin;
 | 
				
			||||||
| 
						 | 
					@ -1332,15 +1335,13 @@ void ShowInviteLinkBox(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		box->addButton(tr::lng_about_done(), [=] { box->closeBox(); });
 | 
							box->addButton(tr::lng_about_done(), [=] { box->closeBox(); });
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	Ui::show(
 | 
						return Box<PeerListBox>(
 | 
				
			||||||
		Box<PeerListBox>(
 | 
							std::make_unique<Controller>(
 | 
				
			||||||
			std::make_unique<Controller>(
 | 
								peer,
 | 
				
			||||||
				peer,
 | 
								link.admin,
 | 
				
			||||||
				link.admin,
 | 
								std::move(data),
 | 
				
			||||||
				std::move(data),
 | 
								Controller::Role::Joined),
 | 
				
			||||||
				Controller::Role::Joined),
 | 
							std::move(initBox));
 | 
				
			||||||
			std::move(initBox)),
 | 
					 | 
				
			||||||
		Ui::LayerOption::KeepOther);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QString PrepareRequestedRowStatus(TimeId date) {
 | 
					QString PrepareRequestedRowStatus(TimeId date) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,7 +49,7 @@ void DeleteLink(
 | 
				
			||||||
	not_null<UserData*> admin,
 | 
						not_null<UserData*> admin,
 | 
				
			||||||
	const QString &link);
 | 
						const QString &link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ShowInviteLinkBox(
 | 
					[[nodiscard]] object_ptr<Ui::BoxContent> ShowInviteLinkBox(
 | 
				
			||||||
	not_null<PeerData*> peer,
 | 
						not_null<PeerData*> peer,
 | 
				
			||||||
	const Api::InviteLink &link);
 | 
						const Api::InviteLink &link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -542,7 +542,9 @@ void LinksController::appendSlice(const InviteLinksSlice &slice) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void LinksController::rowClicked(not_null<PeerListRow*> row) {
 | 
					void LinksController::rowClicked(not_null<PeerListRow*> row) {
 | 
				
			||||||
	ShowInviteLinkBox(_peer, static_cast<Row*>(row.get())->data());
 | 
						delegate()->peerListShowBox(
 | 
				
			||||||
 | 
							ShowInviteLinkBox(_peer, static_cast<Row*>(row.get())->data()),
 | 
				
			||||||
 | 
							Ui::LayerOption::KeepOther);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void LinksController::rowRightActionClicked(not_null<PeerListRow*> row) {
 | 
					void LinksController::rowRightActionClicked(not_null<PeerListRow*> row) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue