mirror of https://github.com/procxx/kepka.git
Fix returning of tabbed panel in third column.
This commit is contained in:
parent
0e16b3fe69
commit
1fa22398a9
|
@ -4066,20 +4066,22 @@ void HistoryWidget::onModerateKeyActivate(int index, bool *outHandled) {
|
|||
*outHandled = _keyboard->isHidden() ? false : _keyboard->moderateKeyActivate(index);
|
||||
}
|
||||
|
||||
void HistoryWidget::pushTabbedSelectorToThirdSection(
|
||||
bool HistoryWidget::pushTabbedSelectorToThirdSection(
|
||||
not_null<PeerData*> peer,
|
||||
const Window::SectionShow ¶ms) {
|
||||
if (!_history || !_tabbedPanel) {
|
||||
return;
|
||||
} else if (!_canSendMessages) {
|
||||
if (!_tabbedPanel) {
|
||||
return true;
|
||||
} else if (!peer->canWrite()) {
|
||||
session().settings().setTabbedReplacedWithInfo(true);
|
||||
controller()->showPeerInfo(_peer, params.withThirdColumn());
|
||||
return;
|
||||
controller()->showPeerInfo(peer, params.withThirdColumn());
|
||||
return false;
|
||||
}
|
||||
session().settings().setTabbedReplacedWithInfo(false);
|
||||
controller()->resizeForThirdSection();
|
||||
controller()->showSection(
|
||||
ChatHelpers::TabbedMemento(),
|
||||
params.withThirdColumn());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HistoryWidget::returnTabbedSelector() {
|
||||
|
@ -4109,11 +4111,15 @@ void HistoryWidget::setTabbedPanel(std::unique_ptr<TabbedPanel> panel) {
|
|||
}
|
||||
|
||||
void HistoryWidget::toggleTabbedSelectorMode() {
|
||||
if (!_peer) {
|
||||
return;
|
||||
}
|
||||
if (_tabbedPanel) {
|
||||
if (controller()->canShowThirdSection() && !Adaptive::OneColumn()) {
|
||||
session().settings().setTabbedSelectorSectionEnabled(true);
|
||||
session().saveSettingsDelayed();
|
||||
pushTabbedSelectorToThirdSection(
|
||||
_peer,
|
||||
Window::SectionShow::Way::ClearStack);
|
||||
} else {
|
||||
_tabbedPanel->toggleAnimated();
|
||||
|
|
|
@ -251,7 +251,8 @@ public:
|
|||
void hideInfoTooltip(anim::type animated);
|
||||
|
||||
// Tabbed selector management.
|
||||
void pushTabbedSelectorToThirdSection(
|
||||
bool pushTabbedSelectorToThirdSection(
|
||||
not_null<PeerData*> peer,
|
||||
const Window::SectionShow ¶ms) override;
|
||||
bool returnTabbedSelector() override;
|
||||
|
||||
|
|
|
@ -337,10 +337,11 @@ void ComposeControls::escape() {
|
|||
_cancelRequests.fire({});
|
||||
}
|
||||
|
||||
void ComposeControls::pushTabbedSelectorToThirdSection(
|
||||
bool ComposeControls::pushTabbedSelectorToThirdSection(
|
||||
not_null<PeerData*> peer,
|
||||
const Window::SectionShow ¶ms) {
|
||||
if (!_tabbedPanel) {
|
||||
return;
|
||||
return true;
|
||||
//} else if (!_canSendMessages) {
|
||||
// session().settings().setTabbedReplacedWithInfo(true);
|
||||
// _window->showPeerInfo(_peer, params.withThirdColumn());
|
||||
|
@ -355,6 +356,7 @@ void ComposeControls::pushTabbedSelectorToThirdSection(
|
|||
_window->showSection(
|
||||
ChatHelpers::TabbedMemento(),
|
||||
params.withThirdColumn());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ComposeControls::returnTabbedSelector() {
|
||||
|
@ -385,11 +387,15 @@ void ComposeControls::setTabbedPanel(
|
|||
}
|
||||
|
||||
void ComposeControls::toggleTabbedSelectorMode() {
|
||||
if (!_history) {
|
||||
return;
|
||||
}
|
||||
if (_tabbedPanel) {
|
||||
if (_window->canShowThirdSection() && !Adaptive::OneColumn()) {
|
||||
session().settings().setTabbedSelectorSectionEnabled(true);
|
||||
session().saveSettingsDelayed();
|
||||
pushTabbedSelectorToThirdSection(
|
||||
_history->peer,
|
||||
Window::SectionShow::Way::ClearStack);
|
||||
} else {
|
||||
_tabbedPanel->toggleAnimated();
|
||||
|
|
|
@ -76,7 +76,9 @@ public:
|
|||
[[nodiscard]] auto inlineResultChosen() const
|
||||
-> rpl::producer<ChatHelpers::TabbedSelector::InlineChosen>;
|
||||
|
||||
void pushTabbedSelectorToThirdSection(const Window::SectionShow ¶ms);
|
||||
bool pushTabbedSelectorToThirdSection(
|
||||
not_null<PeerData*> peer,
|
||||
const Window::SectionShow ¶ms);
|
||||
bool returnTabbedSelector();
|
||||
|
||||
void showForGrab();
|
||||
|
|
|
@ -706,9 +706,10 @@ void ScheduledWidget::setInternalState(
|
|||
restoreState(memento);
|
||||
}
|
||||
|
||||
void ScheduledWidget::pushTabbedSelectorToThirdSection(
|
||||
bool ScheduledWidget::pushTabbedSelectorToThirdSection(
|
||||
not_null<PeerData*> peer,
|
||||
const Window::SectionShow ¶ms) {
|
||||
_composeControls->pushTabbedSelectorToThirdSection(params);
|
||||
return _composeControls->pushTabbedSelectorToThirdSection(peer, params);
|
||||
}
|
||||
|
||||
bool ScheduledWidget::returnTabbedSelector() {
|
||||
|
|
|
@ -82,7 +82,8 @@ public:
|
|||
not_null<ScheduledMemento*> memento);
|
||||
|
||||
// Tabbed selector management.
|
||||
void pushTabbedSelectorToThirdSection(
|
||||
bool pushTabbedSelectorToThirdSection(
|
||||
not_null<PeerData*> peer,
|
||||
const Window::SectionShow ¶ms) override;
|
||||
bool returnTabbedSelector() override;
|
||||
|
||||
|
|
|
@ -2380,11 +2380,11 @@ void MainWidget::updateControlsGeometry() {
|
|||
Window::SectionShow::Way::ClearStack,
|
||||
anim::type::instant,
|
||||
anim::activation::background);
|
||||
if (session().settings().tabbedSelectorSectionEnabled()) {
|
||||
_history->pushTabbedSelectorToThirdSection(params);
|
||||
} else if (session().settings().thirdSectionInfoEnabled()) {
|
||||
const auto active = _controller->activeChatCurrent();
|
||||
if (const auto peer = active.peer()) {
|
||||
const auto active = _controller->activeChatCurrent();
|
||||
if (const auto peer = active.peer()) {
|
||||
if (session().settings().tabbedSelectorSectionEnabled()) {
|
||||
_history->pushTabbedSelectorToThirdSection(peer, params);
|
||||
} else if (session().settings().thirdSectionInfoEnabled()) {
|
||||
_controller->showSection(
|
||||
Info::Memento::Default(peer),
|
||||
params.withThirdColumn());
|
||||
|
@ -2633,9 +2633,9 @@ void MainWidget::updateThirdColumnToCurrentChat(
|
|||
std::move(*thirdSectionForCurrentMainSection(key)),
|
||||
params.withThirdColumn());
|
||||
};
|
||||
auto switchTabbedFast = [&] {
|
||||
auto switchTabbedFast = [&](not_null<PeerData*> peer) {
|
||||
saveOldThirdSection();
|
||||
_history->pushTabbedSelectorToThirdSection(params);
|
||||
return _history->pushTabbedSelectorToThirdSection(peer, params);
|
||||
};
|
||||
if (Adaptive::ThreeColumn()
|
||||
&& session().settings().tabbedSelectorSectionEnabled()
|
||||
|
@ -2644,9 +2644,10 @@ void MainWidget::updateThirdColumnToCurrentChat(
|
|||
switchInfoFast();
|
||||
session().settings().setTabbedSelectorSectionEnabled(true);
|
||||
session().settings().setTabbedReplacedWithInfo(true);
|
||||
} else if (session().settings().tabbedReplacedWithInfo()) {
|
||||
} else if (session().settings().tabbedReplacedWithInfo()
|
||||
&& key.history()
|
||||
&& switchTabbedFast(key.history()->peer)) {
|
||||
session().settings().setTabbedReplacedWithInfo(false);
|
||||
switchTabbedFast();
|
||||
}
|
||||
} else {
|
||||
session().settings().setTabbedReplacedWithInfo(false);
|
||||
|
|
|
@ -46,8 +46,10 @@ public:
|
|||
[[nodiscard]] Main::Session &session() const;
|
||||
|
||||
// Tabbed selector management.
|
||||
virtual void pushTabbedSelectorToThirdSection(
|
||||
const Window::SectionShow ¶ms) {
|
||||
virtual bool pushTabbedSelectorToThirdSection(
|
||||
not_null<PeerData*> peer,
|
||||
const Window::SectionShow ¶ms) {
|
||||
return false;
|
||||
}
|
||||
virtual bool returnTabbedSelector() {
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue