mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-25 04:38:23 +00:00
fixed some possible crashes, fixed copy selected text to clipboard
This commit is contained in:
parent
9fec887044
commit
fb0f2971c0
@ -346,7 +346,9 @@ void ApiWrap::gotUserFull(PeerData *peer, const MTPUserFull &result, mtpRequestI
|
||||
App::feedUsers(MTP_vector<MTPUser>(1, d.vuser), false);
|
||||
App::feedPhoto(d.vprofile_photo);
|
||||
App::feedUserLink(MTP_int(peerToUser(peer->id)), d.vlink.c_contacts_link().vmy_link, d.vlink.c_contacts_link().vforeign_link, false);
|
||||
App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), d.vnotify_settings);
|
||||
if (App::main()) {
|
||||
App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), d.vnotify_settings);
|
||||
}
|
||||
|
||||
peer->asUser()->setBotInfo(d.vbot_info);
|
||||
peer->asUser()->blocked = mtpIsTrue(d.vblocked) ? UserIsBlocked : UserIsNotBlocked;
|
||||
|
@ -925,7 +925,9 @@ void AppClass::checkLocalTime() {
|
||||
|
||||
void AppClass::onAppStateChanged(Qt::ApplicationState state) {
|
||||
checkLocalTime();
|
||||
_window->updateIsActive((state == Qt::ApplicationActive) ? cOnlineFocusTimeout() : cOfflineBlurTimeout());
|
||||
if (_window) {
|
||||
_window->updateIsActive((state == Qt::ApplicationActive) ? cOnlineFocusTimeout() : cOfflineBlurTimeout());
|
||||
}
|
||||
if (state != Qt::ApplicationActive) {
|
||||
PopupTooltip::Hide();
|
||||
}
|
||||
|
@ -1366,6 +1366,8 @@ void DialogsInner::selectSkipPage(int32 pixels, int32 direction) {
|
||||
}
|
||||
|
||||
void DialogsInner::loadPeerPhotos(int32 yFrom) {
|
||||
if (!parentWidget()) return;
|
||||
|
||||
int32 yTo = yFrom + parentWidget()->height() * 5;
|
||||
MTP::clearLoaderPriorities();
|
||||
if (_state == DefaultState) {
|
||||
|
@ -844,10 +844,10 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||
} else {
|
||||
uint16 symbol, selFrom = (_selected.cbegin().value() >> 16) & 0xFFFF, selTo = _selected.cbegin().value() & 0xFFFF;
|
||||
hasSelected = (selTo > selFrom) ? 1 : 0;
|
||||
if (_dragItem && _dragItem == App::hoveredItem()) {
|
||||
QPoint mousePos(mapMouseToItem(mapFromGlobal(_dragPos), _dragItem));
|
||||
if (App::mousedItem() && App::mousedItem() == App::hoveredItem()) {
|
||||
QPoint mousePos(mapMouseToItem(mapFromGlobal(_dragPos), App::mousedItem()));
|
||||
bool afterDragSymbol, uponSymbol;
|
||||
_dragItem->getSymbol(symbol, afterDragSymbol, uponSymbol, mousePos.x(), mousePos.y());
|
||||
App::mousedItem()->getSymbol(symbol, afterDragSymbol, uponSymbol, mousePos.x(), mousePos.y());
|
||||
if (uponSymbol && symbol >= selFrom && symbol < selTo) {
|
||||
isUponSelected = 1;
|
||||
}
|
||||
@ -7148,7 +7148,7 @@ void HistoryWidget::drawRecording(Painter &p) {
|
||||
}
|
||||
|
||||
void HistoryWidget::paintEvent(QPaintEvent *e) {
|
||||
if (App::wnd() && App::wnd()->contentOverlapped(this, e)) return;
|
||||
if (!App::main() || (App::wnd() && App::wnd()->contentOverlapped(this, e))) return;
|
||||
|
||||
Painter p(this);
|
||||
QRect r(e->rect());
|
||||
|
@ -1077,6 +1077,15 @@ void ProfileInner::mouseReleaseEvent(QMouseEvent *e) {
|
||||
connect(box, SIGNAL(confirmed()), this, SLOT(onKickConfirm()));
|
||||
Ui::showLayer(box);
|
||||
}
|
||||
|
||||
_kickDown = 0;
|
||||
if (!_photoLink && (_peerUser || (_peerChat && !_peerChat->canEdit()) || (_peerChannel && !_amCreator))) {
|
||||
setCursor((_kickOver || _kickDown || textlnkOver()) ? style::cur_pointer : style::cur_default);
|
||||
} else {
|
||||
setCursor((_kickOver || _kickDown || _photoOver || textlnkOver()) ? style::cur_pointer : style::cur_default);
|
||||
}
|
||||
update();
|
||||
|
||||
if (textlnkDown()) {
|
||||
TextLinkPtr lnk = textlnkDown();
|
||||
textlnkDown(TextLinkPtr());
|
||||
@ -1087,17 +1096,10 @@ void ProfileInner::mouseReleaseEvent(QMouseEvent *e) {
|
||||
if (reBotCommand().match(lnk->encoded()).hasMatch()) {
|
||||
Ui::showPeerHistory(_peer, ShowAtTheEndMsgId);
|
||||
}
|
||||
lnk->onClick(e->button());
|
||||
App::activateTextLink(lnk, e->button());
|
||||
}
|
||||
}
|
||||
}
|
||||
_kickDown = 0;
|
||||
if (!_photoLink && (_peerUser || (_peerChat && !_peerChat->canEdit()) || (_peerChannel && !_amCreator))) {
|
||||
setCursor((_kickOver || _kickDown || textlnkOver()) ? style::cur_pointer : style::cur_default);
|
||||
} else {
|
||||
setCursor((_kickOver || _kickDown || _photoOver || textlnkOver()) ? style::cur_pointer : style::cur_default);
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
void ProfileInner::onKickConfirm() {
|
||||
|
@ -688,11 +688,12 @@ void PhotoCancelLink::onClick(Qt::MouseButton button) const {
|
||||
if (!data->date) return;
|
||||
|
||||
if (data->uploading()) {
|
||||
HistoryItem *item = App::hoveredLinkItem() ? App::hoveredLinkItem() : (App::contextItem() ? App::contextItem() : 0);
|
||||
if (HistoryMessage *msg = item->toHistoryMessage()) {
|
||||
if (msg->getMedia() && msg->getMedia()->type() == MediaTypePhoto && static_cast<HistoryPhoto*>(msg->getMedia())->photo() == data) {
|
||||
App::contextItem(item);
|
||||
App::main()->deleteLayer(-2);
|
||||
if (HistoryItem *item = App::hoveredLinkItem() ? App::hoveredLinkItem() : (App::contextItem() ? App::contextItem() : 0)) {
|
||||
if (HistoryMessage *msg = item->toHistoryMessage()) {
|
||||
if (msg->getMedia() && msg->getMedia()->type() == MediaTypePhoto && static_cast<HistoryPhoto*>(msg->getMedia())->photo() == data) {
|
||||
App::contextItem(item);
|
||||
App::main()->deleteLayer(-2);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -964,11 +965,12 @@ void DocumentCancelLink::onClick(Qt::MouseButton button) const {
|
||||
if (!data->date) return;
|
||||
|
||||
if (data->uploading()) {
|
||||
HistoryItem *item = App::hoveredLinkItem() ? App::hoveredLinkItem() : (App::contextItem() ? App::contextItem() : 0);
|
||||
if (HistoryMessage *msg = item->toHistoryMessage()) {
|
||||
if (msg->getMedia() && msg->getMedia()->getDocument() == data) {
|
||||
App::contextItem(item);
|
||||
App::main()->deleteLayer(-2);
|
||||
if (HistoryItem *item = App::hoveredLinkItem() ? App::hoveredLinkItem() : (App::contextItem() ? App::contextItem() : 0)) {
|
||||
if (HistoryMessage *msg = item->toHistoryMessage()) {
|
||||
if (msg->getMedia() && msg->getMedia()->getDocument() == data) {
|
||||
App::contextItem(item);
|
||||
App::main()->deleteLayer(-2);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -2730,7 +2730,7 @@ void LastCrashedWindow::onUpdateFailed() {
|
||||
void LastCrashedWindow::onContinue() {
|
||||
if (SignalHandlers::restart() == SignalHandlers::CantOpen) {
|
||||
new NotStartedWindow();
|
||||
} else {
|
||||
} else if (!Global::started()) {
|
||||
Sandbox::launch();
|
||||
}
|
||||
close();
|
||||
|
Loading…
Reference in New Issue
Block a user