diff --git a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_inner.cpp b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_inner.cpp index 42d89a8621..33e2b19952 100644 --- a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_inner.cpp +++ b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_inner.cpp @@ -1424,7 +1424,6 @@ void InnerWidget::mouseActionCancel() _mouseAction = MouseAction::None; _dragStartPosition = QPoint(0, 0); _wasSelectedText = false; - //_widget->noSelectingScroll(); // TODO } void InnerWidget::mouseActionFinish(const QPoint &screenPos, Qt::MouseButton button) @@ -1640,99 +1639,6 @@ void InnerWidget::updateSelected() void InnerWidget::performDrag() { if (_mouseAction != MouseAction::Dragging) return; - - //auto uponSelected = false; - //if (_mouseActionItem) { - // if (!_selected.isEmpty() && _selected.cbegin().value() == FullSelection) { - // uponSelected = _selected.contains(_mouseActionItem); - // } else { - // StateRequest request; - // request.flags |= Ui::Text::StateRequest::Flag::LookupSymbol; - // auto dragState = _mouseActionItem->textState(_dragStartPosition.x(), _dragStartPosition.y(), request); - // uponSelected = (dragState.cursor == CursorState::Text); - // if (uponSelected) { - // if (_selected.isEmpty() || - // _selected.cbegin().value() == FullSelection || - // _selected.cbegin().key() != _mouseActionItem - // ) { - // uponSelected = false; - // } else { - // uint16 selFrom = _selected.cbegin().value().from, selTo = _selected.cbegin().value().to; - // if (dragState.symbol < selFrom || dragState.symbol >= selTo) { - // uponSelected = false; - // } - // } - // } - // } - //} - //auto pressedHandler = ClickHandler::getPressed(); - - //if (dynamic_cast(pressedHandler.data())) { - // return; - //} - - //TextWithEntities sel; - //QList urls; - //if (uponSelected) { - // sel = getSelectedText(); - //} else if (pressedHandler) { - // sel = { pressedHandler->dragText(), EntitiesInText() }; - // //if (!sel.isEmpty() && sel.at(0) != '/' && sel.at(0) != '@' && sel.at(0) != '#') { - // // urls.push_back(QUrl::fromEncoded(sel.toUtf8())); // Google Chrome crashes in Mac OS X O_o - // //} - //} - //if (auto mimeData = mimeDataFromTextWithEntities(sel)) { - // updateDragSelection(0, 0, false); - // _widget->noSelectingScroll(); - - // if (!urls.isEmpty()) mimeData->setUrls(urls); - // if (uponSelected && !Adaptive::OneColumn()) { - // auto selectedState = getSelectionState(); - // if (selectedState.count > 0 && selectedState.count == selectedState.canForwardCount) { - // session().data().setMimeForwardIds(getSelectedItems()); - // mimeData->setData(u"application/x-td-forward"_q, "1"); - // } - // } - // _controller->window()->launchDrag(std::move(mimeData)); - // return; - //} else { - // auto forwardMimeType = QString(); - // auto pressedMedia = static_cast(nullptr); - // if (auto pressedItem = Element::Pressed()) { - // pressedMedia = pressedItem->media(); - // if (_mouseCursorState == CursorState::Date) { - // forwardMimeType = u"application/x-td-forward"_q; - // session().data().setMimeForwardIds( - // session().data().itemOrItsGroup(pressedItem->data())); - // } - // } - // if (auto pressedLnkItem = Element::PressedLink()) { - // if ((pressedMedia = pressedLnkItem->media())) { - // if (forwardMimeType.isEmpty() - // && pressedMedia->dragItemByHandler(pressedHandler)) { - // forwardMimeType = u"application/x-td-forward"_q; - // session().data().setMimeForwardIds( - // { 1, pressedLnkItem->fullId() }); - // } - // } - // } - // if (!forwardMimeType.isEmpty()) { - // auto mimeData = std::make_unique(); - // mimeData->setData(forwardMimeType, "1"); - // if (auto document = (pressedMedia ? pressedMedia->getDocument() : nullptr)) { - // auto filepath = document->filepath(true); - // if (!filepath.isEmpty()) { - // QList urls; - // urls.push_back(QUrl::fromLocalFile(filepath)); - // mimeData->setUrls(urls); - // } - // } - - // // This call enters event loop and can destroy any QObject. - // _controller->window()->launchDrag(std::move(mimeData)); - // return; - // } - //} // TODO } int InnerWidget::itemTop(not_null view) const @@ -1758,6 +1664,7 @@ void InnerWidget::resizeItem(not_null view) void InnerWidget::refreshItem(not_null view) { // No need to refresh views in admin log. + // sogl } QPoint InnerWidget::mapPointToItem(QPoint point, const Element *view) const diff --git a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_item.cpp b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_item.cpp index 9c4c026645..4133c1b197 100644 --- a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_item.cpp +++ b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_item.cpp @@ -791,7 +791,16 @@ void GenerateItems( { const auto session = &history->session(); const auto id = message.fakeId; - const auto from = history->owner().user(message.fromId); + PeerData* from = history->owner().userLoaded(message.fromId); + if (!from) { + from = history->owner().channelLoaded(message.fromId); + } + if (!from) { + from = reinterpret_cast(history->owner().chatLoaded(message.fromId)); + } + if (!from) { + return; + } const auto date = message.entityCreateDate; const auto addPart = [&]( not_null item, diff --git a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_section.cpp b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_section.cpp index fe962e7661..efb4df95c5 100644 --- a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_section.cpp +++ b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_section.cpp @@ -82,7 +82,7 @@ FixedBar::FixedBar( : TWidget(parent), _controller(controller), _peer(peer), _backButton( this, &controller->session(), - tr::lng_admin_log_title_all(tr::now), + tr::lng_terms_back(tr::now), controller->adaptive().oneColumnValue()), _cancel(this, st::historyAdminLogCancelSearch) { _backButton->moveToLeft(0, 0); @@ -160,10 +160,6 @@ Widget::Widget( _scroll(this, st::historyScroll, false), _fixedBar(this, controller, peer), _fixedBarShadow(this), - _whatIsThis( - this, - tr::lng_admin_log_about(tr::now), - st::historyComposeButton), _item(item) { _fixedBar->move(0, 0); @@ -193,13 +189,6 @@ Widget::Widget( onScroll(); }, lifetime()); - _whatIsThis->setClickedCallback([=] - { - controller->show(Ui::MakeInformBox(peer->isMegagroup() - ? tr::lng_admin_log_about_text() - : tr::lng_admin_log_about_text_channel())); - }); - setupShortcuts(); } @@ -297,7 +286,7 @@ void Widget::resizeEvent(QResizeEvent *e) _fixedBarShadow->resize(contentWidth, st::lineWidth); auto bottom = height(); - auto scrollHeight = bottom - _fixedBar->height() - _whatIsThis->height(); + auto scrollHeight = bottom - _fixedBar->height(); auto scrollSize = QSize(contentWidth, scrollHeight); if (_scroll->size() != scrollSize) { _scroll->resize(scrollSize); @@ -312,8 +301,6 @@ void Widget::resizeEvent(QResizeEvent *e) auto scrollTop = _scroll->scrollTop(); _inner->setVisibleTopBottom(scrollTop, scrollTop + _scroll->height()); } - auto fullWidthButtonRect = myrtlrect(0, bottom - _whatIsThis->height(), contentWidth, _whatIsThis->height()); - _whatIsThis->setGeometry(fullWidthButtonRect); } void Widget::paintEvent(QPaintEvent *e) diff --git a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_section.h b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_section.h index b35c41382f..49cd7de728 100644 --- a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_section.h +++ b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_section.h @@ -80,7 +80,6 @@ private: QPointer _inner; object_ptr _fixedBar; object_ptr _fixedBarShadow; - object_ptr _whatIsThis; not_null _item; };