2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Make tabbed selector working in scheduled section.

This commit is contained in:
John Preston
2019-08-16 15:44:20 +03:00
parent 385a7eb00d
commit 3e895d0e85
27 changed files with 341 additions and 250 deletions

View File

@@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_channel.h"
#include "data/data_chat.h"
#include "passport/passport_form_controller.h"
#include "chat_helpers/tabbed_selector.h"
#include "core/shortcuts.h"
#include "base/unixtime.h"
#include "boxes/calendar_box.h"
@@ -99,9 +100,11 @@ void SessionNavigation::showSettings(const SectionShow &params) {
SessionController::SessionController(
not_null<Main::Session*> session,
not_null<MainWindow*> window)
not_null<::MainWindow*> window)
: SessionNavigation(session)
, _window(window) {
, _window(window)
, _tabbedSelector(
std::make_unique<ChatHelpers::TabbedSelector>(window, this)) {
init();
subscribe(session->api().fullPeerUpdated(), [=](PeerData *peer) {
@@ -122,6 +125,28 @@ SessionController::SessionController(
}, lifetime());
}
auto SessionController::tabbedSelector() const
-> not_null<ChatHelpers::TabbedSelector*> {
return _tabbedSelector.get();
}
void SessionController::takeTabbedSelectorOwnershipFrom(
not_null<QWidget*> parent) {
if (_tabbedSelector->parent() == parent) {
if (const auto chats = _window->chatsWidget()) {
chats->returnTabbedSelector();
}
if (_tabbedSelector->parent() == parent) {
_tabbedSelector->hide();
_tabbedSelector->setParent(window());
}
}
}
bool SessionController::hasTabbedSelectorOwnership() const {
return (_tabbedSelector->parent() == window());
}
void SessionController::showEditPeerBox(PeerData *peer) {
_showEditPeer = peer;
session().api().requestFullPeer(peer);