Changeset View
Changeset View
Standalone View
Standalone View
src/ViewContainer.cpp
Show First 20 Lines • Show All 80 Lines • ▼ Show 20 Line(s) | 65 | { | |||
---|---|---|---|---|---|
81 | _closeTabButton->setAutoRaise(true); | 81 | _closeTabButton->setAutoRaise(true); | ||
82 | connect(_closeTabButton, &QToolButton::clicked, this, [this]{ | 82 | connect(_closeTabButton, &QToolButton::clicked, this, [this]{ | ||
83 | closeCurrentTab(); | 83 | closeCurrentTab(); | ||
84 | }); | 84 | }); | ||
85 | 85 | | |||
86 | connect(tabBar(), &QTabBar::tabBarDoubleClicked, this, | 86 | connect(tabBar(), &QTabBar::tabBarDoubleClicked, this, | ||
87 | &Konsole::TabbedViewContainer::tabDoubleClicked); | 87 | &Konsole::TabbedViewContainer::tabDoubleClicked); | ||
88 | connect(tabBar(), &QTabBar::customContextMenuRequested, this, | 88 | connect(tabBar(), &QTabBar::customContextMenuRequested, this, | ||
89 | &Konsole::TabbedViewContainer::openTabContextMenu); | 89 | &Konsole::TabbedViewContainer::openTabContextMenu); | ||
90 | 90 | | |||
anthonyfieroniUnsubmitted Done anthonyfieroni: ```
connect(tabBarWidget, &DetachableTabBar::detachTab, this, &TabbedViewContainer::detachTab)… | |||||
91 | //TODO: Fix Detach. | 91 | //TODO: Fix Detach. | ||
92 | // connect(tabBarWidget, &DetachableTabBar::detachTab, this, [this](int idx) { | 92 | // connect(tabBarWidget, &DetachableTabBar::detachTab, this, [this](int idx) { | ||
93 | // emit detachTab(this, terminalAt(idx)); | 93 | // emit detachTab(this, terminalAt(idx)); | ||
94 | //}); | 94 | //}); | ||
95 | 95 | | |||
anthonyfieroni: Connecting signal to signal should work, same as above. | |||||
96 | connect(this, &TabbedViewContainer::currentChanged, this, &TabbedViewContainer::currentTabChanged); | 96 | connect(this, &TabbedViewContainer::currentChanged, this, &TabbedViewContainer::currentTabChanged); | ||
97 | 97 | | |||
98 | // The context menu of tab bar | 98 | // The context menu of tab bar | ||
99 | _contextPopupMenu = new QMenu(tabBar()); | 99 | _contextPopupMenu = new QMenu(tabBar()); | ||
100 | connect(_contextPopupMenu, &QMenu::aboutToHide, this, [this]() { | 100 | connect(_contextPopupMenu, &QMenu::aboutToHide, this, [this]() { | ||
101 | // Remove the read-only action when the popup closes | 101 | // Remove the read-only action when the popup closes | ||
102 | for (auto &action : _contextPopupMenu->actions()) { | 102 | for (auto &action : _contextPopupMenu->actions()) { | ||
103 | if (action->objectName() == QStringLiteral("view-readonly")) { | 103 | if (action->objectName() == QStringLiteral("view-readonly")) { | ||
▲ Show 20 Lines • Show All 333 Lines • ▼ Show 20 Line(s) | 436 | if (action->objectName() == QStringLiteral("tab-detach")) { | |||
437 | action->setEnabled(count() > 1); | 437 | action->setEnabled(count() > 1); | ||
438 | } | 438 | } | ||
439 | } | 439 | } | ||
440 | #endif | 440 | #endif | ||
441 | 441 | | |||
442 | /* This needs to nove away fro the tab or to lock every thing inside of it. | 442 | /* This needs to nove away fro the tab or to lock every thing inside of it. | ||
443 | * for now, disable. | 443 | * for now, disable. | ||
444 | * */ | 444 | * */ | ||
445 | // | 445 | // | ||
So the tab right click menu no longer has 'Read Only' - do you plan on fixing this before this is committed? hindenburg: So the tab right click menu no longer has 'Read Only' - do you plan on fixing this before this… | |||||
Yes and no: the read only should apply to a TerminalDisplay, if it's in the Tab does it make sense to apply to all of the TerminalDisplays or just to the currently focused one? I'll add it to the context menu for the TerminalDisplay. tcanabrava: Yes and no: the read only should apply to a TerminalDisplay, if it's in the Tab does it make… | |||||
446 | // Add the read-only action | 446 | // Add the read-only action | ||
447 | #if 0 | 447 | #if 0 | ||
448 | auto sessionController = terminalAt(_contextMenuTabIndex)->sessionController(); | 448 | auto sessionController = terminalAt(_contextMenuTabIndex)->sessionController(); | ||
449 | 449 | | |||
450 | if (sessionController != nullptr) { | 450 | if (sessionController != nullptr) { | ||
451 | auto collection = sessionController->actionCollection(); | 451 | auto collection = sessionController->actionCollection(); | ||
452 | auto readonlyAction = collection->action(QStringLiteral("view-readonly")); | 452 | auto readonlyAction = collection->action(QStringLiteral("view-readonly")); | ||
453 | if (readonlyAction != nullptr) { | 453 | if (readonlyAction != nullptr) { | ||
Show All 11 Lines | |||||
465 | } | 465 | } | ||
466 | #endif | 466 | #endif | ||
467 | _contextPopupMenu->exec(tabBar()->mapToGlobal(point)); | 467 | _contextPopupMenu->exec(tabBar()->mapToGlobal(point)); | ||
468 | } | 468 | } | ||
469 | 469 | | |||
470 | void TabbedViewContainer::currentTabChanged(int index) | 470 | void TabbedViewContainer::currentTabChanged(int index) | ||
471 | { | 471 | { | ||
472 | if (index != -1) { | 472 | if (index != -1) { | ||
473 | auto view = widget(index)->findChild<TerminalDisplay*>(); | 473 | auto splitview = qobject_cast<ViewSplitter*>(widget(index)); | ||
474 | view->setFocus(); | 474 | auto view = splitview->activeTerminalDisplay(); | ||
475 | updateTabHistory(view); | 475 | updateTabHistory(view); | ||
476 | emit activeViewChanged(view); | 476 | emit activeViewChanged(view); | ||
477 | setTabActivity(index, false); | 477 | setTabActivity(index, false); | ||
478 | } else { | 478 | } else { | ||
479 | deleteLater(); | 479 | deleteLater(); | ||
480 | } | 480 | } | ||
481 | } | 481 | } | ||
482 | 482 | | |||
▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines |