mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-11 08:48:14 +00:00
fixed show profile from chats list in single-column layout, requestFullPeer() used in Settings, empty popup menu not shown in HistoryInner, no chat list jump when returning to history, channel admins box layout fixed
This commit is contained in:
parent
e2da90e844
commit
6b565acbd6
@ -1826,7 +1826,7 @@ void MembersInner::paintEvent(QPaintEvent *e) {
|
||||
paintDialog(p, _rows[from], data(from), sel, kickSel, kickDown);
|
||||
p.translate(0, _rowHeight);
|
||||
}
|
||||
if (to == _rows.size() && (_rows.size() < _channel->count || _rows.size() >= cMaxGroupCount())) {
|
||||
if (to == _rows.size() && _filter == MembersFilterRecent && (_rows.size() < _channel->count || _rows.size() >= cMaxGroupCount())) {
|
||||
p.setPen(st::stickersReorderFg);
|
||||
_about.draw(p, st::contactsPadding.left(), st::stickersReorderPadding.top(), _aboutWidth, style::al_center);
|
||||
}
|
||||
@ -2005,7 +2005,7 @@ void MembersInner::refresh() {
|
||||
} else {
|
||||
_about.setText(st::boxTextFont, lng_channel_only_last_shown(lt_count, _rows.size()));
|
||||
_aboutHeight = st::stickersReorderPadding.top() + _about.countHeight(_aboutWidth) + st::stickersReorderPadding.bottom();
|
||||
if (_rows.size() >= _channel->count && _rows.size() < cMaxGroupCount()) {
|
||||
if (_filter != MembersFilterRecent || (_rows.size() >= _channel->count && _rows.size() < cMaxGroupCount())) {
|
||||
_aboutHeight = 0;
|
||||
}
|
||||
resize(width(), st::membersPadding.top() + _newItemHeight + _rows.size() * _rowHeight + st::membersPadding.bottom() + _aboutHeight);
|
||||
@ -2243,6 +2243,7 @@ void MembersInner::removeKicked() {
|
||||
--_channel->adminsCount;
|
||||
if (App::main()) emit App::main()->peerUpdated(_channel);
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
_kickConfirm = 0;
|
||||
}
|
||||
|
@ -874,6 +874,8 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||
isUponSelected = hasSelected;
|
||||
}
|
||||
|
||||
_menu = new PopupMenu();
|
||||
|
||||
_contextMenuLnk = textlnkOver();
|
||||
HistoryItem *item = App::hoveredItem() ? App::hoveredItem() : App::hoveredLinkItem();
|
||||
PhotoLink *lnkPhoto = dynamic_cast<PhotoLink*>(_contextMenuLnk.data());
|
||||
@ -881,7 +883,6 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||
AudioLink *lnkAudio = dynamic_cast<AudioLink*>(_contextMenuLnk.data());
|
||||
DocumentLink *lnkDocument = dynamic_cast<DocumentLink*>(_contextMenuLnk.data());
|
||||
if (lnkPhoto || lnkVideo || lnkAudio || lnkDocument) {
|
||||
_menu = new PopupMenu();
|
||||
if (isUponSelected > 0) {
|
||||
_menu->addAction(lang(lng_context_copy_selected), this, SLOT(copySelectedText()))->setEnabled(true);
|
||||
}
|
||||
@ -931,59 +932,49 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||
HistoryServiceMsg *srv = dynamic_cast<HistoryServiceMsg*>(item);
|
||||
|
||||
if (isUponSelected > 0) {
|
||||
if (!_menu) _menu = new PopupMenu();
|
||||
_menu->addAction(lang(lng_context_copy_selected), this, SLOT(copySelectedText()))->setEnabled(true);
|
||||
if (item && item->id > 0 && isUponSelected != 2 && canSendMessages) {
|
||||
_menu->addAction(lang(lng_context_reply_msg), _widget, SLOT(onReplyToMessage()));
|
||||
}
|
||||
} else {
|
||||
if (item && item->id > 0 && isUponSelected != -2 && canSendMessages) {
|
||||
if (!_menu) _menu = new PopupMenu();
|
||||
_menu->addAction(lang(lng_context_reply_msg), _widget, SLOT(onReplyToMessage()));
|
||||
}
|
||||
if (item && !isUponSelected && !_contextMenuLnk) {
|
||||
if (HistorySticker *sticker = dynamic_cast<HistorySticker*>(msg ? msg->getMedia() : 0)) {
|
||||
DocumentData *doc = sticker->document();
|
||||
if (doc && doc->sticker() && doc->sticker()->set.type() != mtpc_inputStickerSetEmpty) {
|
||||
if (!_menu) _menu = new PopupMenu();
|
||||
_menu->addAction(lang(doc->sticker()->setInstalled() ? lng_context_pack_info : lng_context_pack_add), _widget, SLOT(onStickerPackInfo()));
|
||||
}
|
||||
}
|
||||
QString contextMenuText = item->selectedText(FullItemSel);
|
||||
if (!contextMenuText.isEmpty() && (!msg || !msg->getMedia() || msg->getMedia()->type() != MediaTypeSticker)) {
|
||||
if (!_menu) _menu = new PopupMenu();
|
||||
_menu->addAction(lang(lng_context_copy_text), this, SLOT(copyContextText()))->setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_contextMenuLnk && dynamic_cast<TextLink*>(_contextMenuLnk.data())) {
|
||||
if (!_menu) _menu = new PopupMenu();
|
||||
_menu->addAction(lang(lng_context_open_link), this, SLOT(openContextUrl()))->setEnabled(true);
|
||||
_menu->addAction(lang(lng_context_copy_link), this, SLOT(copyContextUrl()))->setEnabled(true);
|
||||
} else if (_contextMenuLnk && dynamic_cast<EmailLink*>(_contextMenuLnk.data())) {
|
||||
if (!_menu) _menu = new PopupMenu();
|
||||
_menu->addAction(lang(lng_context_open_email), this, SLOT(openContextUrl()))->setEnabled(true);
|
||||
_menu->addAction(lang(lng_context_copy_email), this, SLOT(copyContextUrl()))->setEnabled(true);
|
||||
} else if (_contextMenuLnk && dynamic_cast<MentionLink*>(_contextMenuLnk.data())) {
|
||||
if (!_menu) _menu = new PopupMenu();
|
||||
_menu->addAction(lang(lng_context_open_mention), this, SLOT(openContextUrl()))->setEnabled(true);
|
||||
_menu->addAction(lang(lng_context_copy_mention), this, SLOT(copyContextUrl()))->setEnabled(true);
|
||||
} else if (_contextMenuLnk && dynamic_cast<HashtagLink*>(_contextMenuLnk.data())) {
|
||||
if (!_menu) _menu = new PopupMenu();
|
||||
_menu->addAction(lang(lng_context_open_hashtag), this, SLOT(openContextUrl()))->setEnabled(true);
|
||||
_menu->addAction(lang(lng_context_copy_hashtag), this, SLOT(copyContextUrl()))->setEnabled(true);
|
||||
} else {
|
||||
}
|
||||
if (isUponSelected > 1) {
|
||||
if (!_menu) _menu = new PopupMenu();
|
||||
_menu->addAction(lang(lng_context_forward_selected), _widget, SLOT(onForwardSelected()));
|
||||
if (selectedForDelete == selectedForForward) {
|
||||
_menu->addAction(lang(lng_context_delete_selected), _widget, SLOT(onDeleteSelected()));
|
||||
}
|
||||
_menu->addAction(lang(lng_context_clear_selection), _widget, SLOT(onClearSelected()));
|
||||
} else if (item && ((isUponSelected != -2 && (canForward || canDelete)) || item->id > 0)) {
|
||||
if (!_menu) _menu = new PopupMenu();
|
||||
if (isUponSelected != -2) {
|
||||
if (canForward) {
|
||||
_menu->addAction(lang(lng_context_forward_msg), _widget, SLOT(forwardMessage()))->setEnabled(true);
|
||||
@ -998,7 +989,6 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||
}
|
||||
} else {
|
||||
if (App::mousedItem() && !App::mousedItem()->serviceMsg() && App::mousedItem()->id > 0) {
|
||||
if (!_menu) _menu = new PopupMenu();
|
||||
_menu->addAction(lang(lng_context_select_msg), _widget, SLOT(selectMessage()))->setEnabled(true);
|
||||
item = App::mousedItem();
|
||||
}
|
||||
@ -1006,7 +996,10 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||
App::contextItem(item);
|
||||
}
|
||||
|
||||
if (_menu) {
|
||||
if (_menu->actions().isEmpty()) {
|
||||
delete _menu;
|
||||
_menu = 0;
|
||||
} else {
|
||||
connect(_menu, SIGNAL(destroyed(QObject*)), this, SLOT(onMenuDestroy(QObject*)));
|
||||
_menu->popup(e->globalPos());
|
||||
e->accept();
|
||||
|
@ -2346,7 +2346,9 @@ void MainWidget::showPeerHistory(quint64 peerId, qint32 showAtMsgId, bool back)
|
||||
//}
|
||||
|
||||
if (!dialogs.isHidden()) {
|
||||
dialogs.scrollToPeer(peerId, showAtMsgId);
|
||||
if (!back) {
|
||||
dialogs.scrollToPeer(peerId, showAtMsgId);
|
||||
}
|
||||
dialogs.update();
|
||||
}
|
||||
App::wnd()->getTitle()->updateBackButton();
|
||||
@ -2517,6 +2519,7 @@ void MainWidget::showPeerProfile(PeerData *peer, bool back, int32 lastScrollTop)
|
||||
if (back) clearBotStartToken(history.peer());
|
||||
history.showHistory(0, 0);
|
||||
history.hide();
|
||||
if (!cWideMode()) dialogs.hide();
|
||||
|
||||
orderWidgets();
|
||||
|
||||
|
@ -564,7 +564,7 @@ private:
|
||||
StackItems _stack;
|
||||
PeerData *_peerInStack;
|
||||
MsgId _msgIdInStack;
|
||||
|
||||
|
||||
int32 _playerHeight;
|
||||
int32 _contentScrollAddToY;
|
||||
|
||||
|
@ -203,11 +203,12 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : QWidget(parent),
|
||||
{
|
||||
if (self()) {
|
||||
connect(App::wnd(), SIGNAL(imageLoaded()), this, SLOT(update()));
|
||||
connect(App::api(), SIGNAL(fullPeerUpdated(PeerData*)), this, SLOT(onFullPeerUpdated(PeerData*)));
|
||||
|
||||
_nameText.setText(st::setNameFont, _nameCache, _textNameOptions);
|
||||
PhotoData *selfPhoto = (self()->photoId && self()->photoId != UnknownPeerPhotoId) ? App::photo(self()->photoId) : 0;
|
||||
if (selfPhoto && selfPhoto->date) _photoLink = TextLinkPtr(new PhotoLink(selfPhoto, self()));
|
||||
MTP::send(MTPusers_GetFullUser(self()->inputUser), rpcDone(&SettingsInner::gotFullSelf), RPCFailHandlerPtr(), 0, 10);
|
||||
App::api()->requestFullPeer(self());
|
||||
onReloadPassword();
|
||||
|
||||
connect(App::main(), SIGNAL(peerPhotoChanged(PeerData *)), this, SLOT(peerUpdated(PeerData *)));
|
||||
@ -346,7 +347,7 @@ void SettingsInner::peerUpdated(PeerData *data) {
|
||||
_photoLink = TextLinkPtr(new PhotoLink(selfPhoto, self()));
|
||||
} else {
|
||||
_photoLink = TextLinkPtr();
|
||||
MTP::send(MTPusers_GetFullUser(self()->inputUser), rpcDone(&SettingsInner::gotFullSelf));
|
||||
App::api()->requestFullPeer(self());
|
||||
}
|
||||
} else {
|
||||
_photoLink = TextLinkPtr();
|
||||
@ -897,10 +898,9 @@ void SettingsInner::updateBackgroundRect() {
|
||||
update(_left, _tileBackground.y() - st::setLittleSkip - st::setBackgroundSize, st::setBackgroundSize, st::setBackgroundSize);
|
||||
}
|
||||
|
||||
void SettingsInner::gotFullSelf(const MTPUserFull &selfFull) {
|
||||
if (!self()) return;
|
||||
App::feedPhoto(selfFull.c_userFull().vprofile_photo);
|
||||
App::feedUsers(MTP_vector<MTPUser>(1, selfFull.c_userFull().vuser));
|
||||
void SettingsInner::onFullPeerUpdated(PeerData *peer) {
|
||||
if (!self() || self() != peer) return;
|
||||
|
||||
PhotoData *selfPhoto = (self()->photoId && self()->photoId != UnknownPeerPhotoId) ? App::photo(self()->photoId) : 0;
|
||||
if (selfPhoto && selfPhoto->date) {
|
||||
_photoLink = TextLinkPtr(new PhotoLink(selfPhoto, self()));
|
||||
|
@ -77,8 +77,6 @@ public:
|
||||
|
||||
void updateOnlineDisplay();
|
||||
|
||||
void gotFullSelf(const MTPUserFull &self);
|
||||
|
||||
void showAll();
|
||||
|
||||
void chooseCustomLang();
|
||||
@ -107,6 +105,8 @@ public slots:
|
||||
#endif
|
||||
void onRestartNow();
|
||||
|
||||
void onFullPeerUpdated(PeerData *peer);
|
||||
|
||||
void onPasscode();
|
||||
void onPasscodeOff();
|
||||
void onAutoLock();
|
||||
|
Loading…
Reference in New Issue
Block a user