|
|
|
|
@ -435,47 +435,73 @@ TabbedViewContainer::TabbedViewContainer(NavigationPosition position , QObject* |
|
|
|
|
{ |
|
|
|
|
_containerWidget = new QWidget; |
|
|
|
|
_stackWidget = new QStackedWidget(); |
|
|
|
|
|
|
|
|
|
// The tab bar
|
|
|
|
|
_tabBar = new ViewContainerTabBar(_containerWidget,this); |
|
|
|
|
_tabBar->setDrawBase(true); |
|
|
|
|
_tabBar->setDocumentMode(true); |
|
|
|
|
_tabBar->setFocusPolicy(Qt::NoFocus); |
|
|
|
|
_tabBar->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab); |
|
|
|
|
|
|
|
|
|
connect( _tabBar , SIGNAL(currentChanged(int)) , this , SLOT(currentTabChanged(int)) ); |
|
|
|
|
connect( _tabBar , SIGNAL(tabDoubleClicked(int)) , this , SLOT(tabDoubleClicked(int)) ); |
|
|
|
|
connect( _tabBar , SIGNAL(newTabRequest()) , this , SIGNAL(newViewRequest()) ); |
|
|
|
|
connect( _tabBar , SIGNAL(wheelDelta(int)) , this , SLOT(wheelScrolled(int)) ); |
|
|
|
|
connect( _tabBar , SIGNAL(initiateDrag(int)) , this , SLOT(startTabDrag(int)) ); |
|
|
|
|
connect( _tabBar, SIGNAL(contextMenu(int,QPoint)), this, |
|
|
|
|
SLOT(openTabContextMenu(int,QPoint)) ); |
|
|
|
|
|
|
|
|
|
// The context menu of tab bar
|
|
|
|
|
_contextPopupMenu = new KMenu(_tabBar); |
|
|
|
|
|
|
|
|
|
_contextPopupMenu->addAction(KIcon("tab-detach"), |
|
|
|
|
i18nc("@action:inmenu", "&Detach Tab"), this, |
|
|
|
|
SLOT(tabContextMenuDetachTab())); |
|
|
|
|
|
|
|
|
|
_contextPopupMenu->addAction(KIcon(), |
|
|
|
|
i18nc("@action:inmenu", "&Rename Tab..."), this, |
|
|
|
|
SLOT(tabContextMenuRenameTab())); |
|
|
|
|
|
|
|
|
|
_contextPopupMenu->addAction(KIcon("tab-close"), |
|
|
|
|
i18nc("@action:inmenu", "&Close Tab"), this, |
|
|
|
|
SLOT(tabContextMenuCloseTab())); |
|
|
|
|
|
|
|
|
|
// The 'new tab' and 'close tab' button
|
|
|
|
|
_newTabButton = new QToolButton(_containerWidget); |
|
|
|
|
_newTabButton->setIcon(KIcon("tab-new")); |
|
|
|
|
_newTabButton->adjustSize(); |
|
|
|
|
// new tab button is initially hidden, it will be shown when setFeatures() is called
|
|
|
|
|
// with the QuickNewView flag enabled
|
|
|
|
|
_newTabButton->setHidden(true); |
|
|
|
|
|
|
|
|
|
_closeTabButton = new QToolButton(_containerWidget); |
|
|
|
|
_closeTabButton->setIcon(KIcon("tab-close")); |
|
|
|
|
_closeTabButton->adjustSize(); |
|
|
|
|
_closeTabButton->setHidden(true); |
|
|
|
|
|
|
|
|
|
connect( _tabBar , SIGNAL(currentChanged(int)) , this , SLOT(currentTabChanged(int)) ); |
|
|
|
|
connect( _tabBar , SIGNAL(tabDoubleClicked(int)) , this , SLOT(tabDoubleClicked(int)) ); |
|
|
|
|
connect( _tabBar , SIGNAL(newTabRequest()) , this , SIGNAL(newViewRequest()) ); |
|
|
|
|
connect( _tabBar , SIGNAL(wheelDelta(int)) , this , SLOT(wheelScrolled(int)) ); |
|
|
|
|
connect( _tabBar , SIGNAL(initiateDrag(int)) , this , SLOT(startTabDrag(int)) ); |
|
|
|
|
connect( _tabBar, SIGNAL(contextMenu(int,QPoint)), this, |
|
|
|
|
SLOT(openTabContextMenu(int,QPoint)) ); |
|
|
|
|
// 'new tab' button is initially hidden. It will be shown when setFeatures()
|
|
|
|
|
// is called with the QuickNewView flag enabled. The 'close tab' is the same.
|
|
|
|
|
_newTabButton->setHidden(true); |
|
|
|
|
_closeTabButton->setHidden(true); |
|
|
|
|
|
|
|
|
|
connect( _newTabButton , SIGNAL(clicked()) , this , SIGNAL(newViewRequest()) ); |
|
|
|
|
connect( _closeTabButton , SIGNAL(clicked()) , this , SLOT(closeCurrentTab()) ); |
|
|
|
|
|
|
|
|
|
_layout = new TabbedViewContainerLayout; |
|
|
|
|
_layout->setSpacing(0); |
|
|
|
|
_layout->setContentsMargins(0, 0, 0, 0); |
|
|
|
|
// Combin tab bar and 'new/close tab' buttons
|
|
|
|
|
_tabBarLayout = new QHBoxLayout; |
|
|
|
|
_tabBarLayout->setSpacing(0); |
|
|
|
|
_tabBarLayout->setContentsMargins(0, 0, 0, 0); |
|
|
|
|
_tabBarLayout->addWidget(_newTabButton); |
|
|
|
|
_tabBarLayout->addWidget(_tabBar); |
|
|
|
|
_tabBarLayout->addWidget(_closeTabButton);
|
|
|
|
|
_tabBarLayout->addWidget(_closeTabButton); |
|
|
|
|
|
|
|
|
|
_layout = new TabbedViewContainerLayout; |
|
|
|
|
_layout->setSpacing(0); |
|
|
|
|
_layout->setContentsMargins(0, 0, 0, 0); |
|
|
|
|
|
|
|
|
|
// The terminal area
|
|
|
|
|
_layout->addWidget(_stackWidget); |
|
|
|
|
|
|
|
|
|
// The search bar
|
|
|
|
|
searchBar()->setParent(_containerWidget); |
|
|
|
|
|
|
|
|
|
// The overall layout
|
|
|
|
|
if ( position == NavigationPositionTop ) |
|
|
|
|
{ |
|
|
|
|
_layout->insertLayout(0,_tabBarLayout); |
|
|
|
|
@ -489,23 +515,11 @@ TabbedViewContainer::TabbedViewContainer(NavigationPosition position , QObject* |
|
|
|
|
_tabBar->setShape(QTabBar::RoundedSouth); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
Q_ASSERT(false); // position not supported
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_containerWidget->setLayout(_layout); |
|
|
|
|
|
|
|
|
|
_contextPopupMenu = new KMenu(_tabBar); |
|
|
|
|
|
|
|
|
|
_contextPopupMenu->addAction(KIcon("tab-detach"), |
|
|
|
|
i18nc("@action:inmenu", "&Detach Tab"), this, |
|
|
|
|
SLOT(tabContextMenuDetachTab())); |
|
|
|
|
|
|
|
|
|
_contextPopupMenu->addAction(KIcon(), |
|
|
|
|
i18nc("@action:inmenu", "&Rename Tab..."), this, |
|
|
|
|
SLOT(tabContextMenuRenameTab())); |
|
|
|
|
|
|
|
|
|
_contextPopupMenu->addAction(KIcon("tab-close"), |
|
|
|
|
i18nc("@action:inmenu", "&Close Tab"), this, |
|
|
|
|
SLOT(tabContextMenuCloseTab())); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
void TabbedViewContainer::setNewViewMenu(QMenu* menu) |
|
|
|
|
|