MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / Inner

Method Inner

Telegram/SourceFiles/boxes/share_box.cpp:816–892  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

814}
815
816ShareBox::Inner::Inner(
817 QWidget *parent,
818 const Descriptor &descriptor,
819 std::shared_ptr<Ui::Show> show)
820: RpWidget(parent)
821, _descriptor(descriptor)
822, _show(std::move(show))
823, _st(_descriptor.st.peerList
824 ? *_descriptor.st.peerList
825 : st::shareBoxList)
826, _defaultChatsIndexed(
827 std::make_unique<Dialogs::IndexedList>(
828 Dialogs::SortMode::Add))
829, _chatsIndexed(_defaultChatsIndexed.get()) {
830 _rowsTop = st::shareRowsTop;
831 _rowHeight = st::shareRowHeight;
832 setAttribute(Qt::WA_OpaquePaintEvent);
833
834 if (_descriptor.moneyRestrictionError) {
835 const auto session = _descriptor.session;
836 rpl::merge(
837 Data::AmPremiumValue(session) | rpl::to_empty,
838 session->api().premium().someMessageMoneyRestrictionsResolved()
839 ) | rpl::on_next([=] {
840 refreshRestrictedRows();
841 }, lifetime());
842 }
843
844 const auto self = _descriptor.session->user();
845 const auto selfHistory = self->owner().history(self);
846 if (_descriptor.filterCallback(selfHistory)) {
847 _defaultChatsIndexed->addToEnd(selfHistory);
848 }
849 const auto addList = [&](not_null<Dialogs::IndexedList*> list) {
850 for (const auto &row : list->all()) {
851 if (const auto history = row->history()) {
852 if (!history->peer->isSelf()
853 && (history->asForum()
854 || _descriptor.filterCallback(history))) {
855 _defaultChatsIndexed->addToEnd(history);
856 }
857 }
858 }
859 };
860 addList(_descriptor.session->data().chatsList()->indexed());
861 const auto id = Data::Folder::kId;
862 if (const auto folder = _descriptor.session->data().folderLoaded(id)) {
863 addList(folder->chatsList()->indexed());
864 }
865 addList(_descriptor.session->data().contactsNoChatsList());
866
867 _filter = u"a"_q;
868 updateFilter();
869
870 _descriptor.session->changes().peerUpdates(
871 Data::PeerUpdate::Flag::Photo
872 ) | rpl::on_next([=](const Data::PeerUpdate &update) {
873 updateChat(update.peer);

Callers

nothing calls this directly

Calls 15

AmPremiumValueFunction · 0.85
PaletteChangedFunction · 0.85
apiMethod · 0.80
isSelfMethod · 0.80
asForumMethod · 0.80
indexedMethod · 0.80
folderLoadedMethod · 0.80
contactsNoChatsListMethod · 0.80
peerUpdatesMethod · 0.80
realtimeNameUpdatesMethod · 0.80
peerNameChangedMethod · 0.80

Tested by

no test coverage detected