diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp b/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp index a68750269..6f169ce79 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp +++ b/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp @@ -98,8 +98,10 @@ void TabbedPanel::updateContentHeight() { } auto addedHeight = innerPadding().top() + innerPadding().bottom(); - auto wantedContentHeight = qRound(st::emojiPanHeightRatio * _bottom) - addedHeight; - auto contentHeight = snap(wantedContentHeight, st::emojiPanMinHeight, st::emojiPanMaxHeight); + auto marginsHeight = _selector->marginTop() + _selector->marginBottom(); + auto availableHeight = _bottom - marginsHeight; + auto wantedContentHeight = qRound(st::emojiPanHeightRatio * availableHeight) - addedHeight; + auto contentHeight = marginsHeight + snap(wantedContentHeight, st::emojiPanMinHeight, st::emojiPanMaxHeight); auto resultTop = _bottom - addedHeight - contentHeight; if (contentHeight == _contentHeight) { move(x(), resultTop); diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_selector.h b/Telegram/SourceFiles/chat_helpers/tabbed_selector.h index 8df73f7e3..27975bf0f 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_selector.h +++ b/Telegram/SourceFiles/chat_helpers/tabbed_selector.h @@ -61,6 +61,9 @@ public: void beforeHiding(); void afterShown(); + int marginTop() const; + int marginBottom() const; + bool preventAutoHide() const; bool isSliding() const { return _a_slide.animating(); @@ -135,8 +138,6 @@ private: }; - int marginTop() const; - int marginBottom() const; void paintSlideFrame(Painter &p, TimeMs ms); void paintContent(Painter &p); diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index 50bbe0ffc..1ffd6b747 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -1200,6 +1200,10 @@ void HistoryInner::mouseDoubleClickEvent(QMouseEvent *e) { } } +void HistoryInner::contextMenuEvent(QContextMenuEvent *e) { + showContextMenu(e); +} + void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { if (_menu) { _menu->deleteLater(); diff --git a/Telegram/SourceFiles/history/history_inner_widget.h b/Telegram/SourceFiles/history/history_inner_widget.h index 974ab4f50..29abe7800 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.h +++ b/Telegram/SourceFiles/history/history_inner_widget.h @@ -41,8 +41,6 @@ public: void messagesReceived(PeerData *peer, const QVector &messages); void messagesReceivedDown(PeerData *peer, const QVector &messages); - void showContextMenu(QContextMenuEvent *e, bool showFromTouch = false); - TextWithEntities getSelectedText() const; void dragActionStart(const QPoint &screenPos, Qt::MouseButton button = Qt::LeftButton); @@ -108,8 +106,9 @@ protected: void leaveEventHook(QEvent *e) override; void resizeEvent(QResizeEvent *e) override; void keyPressEvent(QKeyEvent *e) override; + void contextMenuEvent(QContextMenuEvent *e) override; - public slots: +public slots: void onUpdateSelected(); void onParentGeometryChanged(); @@ -126,11 +125,13 @@ protected: void onTouchScrollTimer(); void onDragExec(); - private slots: +private slots: void onScrollDateCheck(); void onScrollDateHideByTimer(); private: + void showContextMenu(QContextMenuEvent *e, bool showFromTouch = false); + void itemRemoved(HistoryItem *item); void savePhotoToFile(PhotoData *photo); void saveDocumentToFile(DocumentData *document); diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index a8e26af90..02c7ba39d 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -3610,12 +3610,6 @@ void HistoryWidget::onCmdStart() { setFieldText({ qsl("/"), TextWithTags::Tags() }, 0, Ui::FlatTextarea::AddToUndoHistory); } -void HistoryWidget::contextMenuEvent(QContextMenuEvent *e) { - if (!_list) return; - - return _list->showContextMenu(e); -} - void HistoryWidget::forwardMessage() { auto item = App::contextItem(); if (!item || item->id < 0 || item->serviceMsg()) return; diff --git a/Telegram/SourceFiles/historywidget.h b/Telegram/SourceFiles/historywidget.h index 7189e92b9..9f1dbbb37 100644 --- a/Telegram/SourceFiles/historywidget.h +++ b/Telegram/SourceFiles/historywidget.h @@ -363,7 +363,6 @@ protected: void leaveEventHook(QEvent *e) override; void mouseReleaseEvent(QMouseEvent *e) override; void mouseMoveEvent(QMouseEvent *e) override; - void contextMenuEvent(QContextMenuEvent *e) override; signals: void cancelled();