Commit b0cbc84f authored by Kåre Särs's avatar Kåre Särs Committed by Christoph Cullmann
Browse files

Hide/show history jump buttons with the tab-bar

Also add the actions to an extra navigation toolbar
parent 1575d8b0
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
<gui name="kate" version="86" translationDomain="kate">
<gui name="kate" version="87" translationDomain="kate">
<MenuBar>
<Menu name="file" noMerge="1">
<text>&amp;File</text>
......@@ -126,6 +126,11 @@
<Separator/>
<DefineGroup name="zoom_operations"/>
</ToolBar>
<ToolBar name="extraToolBar" noMerge="1">
<text>Navigation Toolbar</text>
<Action name="view_history_back"/>
<Action name="view_history_forward"/>
</ToolBar>
<Menu name="ktexteditor_popup" noMerge="1">
<DefineGroup name="popup_operations"/>
<DefineGroup name="popup_operations2"/>
......
......@@ -48,25 +48,25 @@ KateViewSpace::KateViewSpace(KateViewManager *viewManager, QWidget *parent, cons
hLayout->setContentsMargins(0, 0, 0, 0);
// add left <-> right history buttons
auto historyLeft = new QToolButton(this);
m_historyBack = new QToolButton(this);
auto hlAct = m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_history_back"));
historyLeft->setDefaultAction(hlAct);
historyLeft->setToolTip(hlAct->text());
historyLeft->setIcon(hlAct->icon());
historyLeft->setAutoRaise(true);
KAcceleratorManager::setNoAccel(historyLeft);
historyLeft->installEventFilter(this); // on click, active this view space
hLayout->addWidget(historyLeft);
auto historyRight = new QToolButton(this);
m_historyBack->setDefaultAction(hlAct);
m_historyBack->setToolTip(hlAct->text());
m_historyBack->setIcon(hlAct->icon());
m_historyBack->setAutoRaise(true);
KAcceleratorManager::setNoAccel(m_historyBack);
m_historyBack->installEventFilter(this); // on click, active this view space
hLayout->addWidget(m_historyBack);
m_historyForward = new QToolButton(this);
auto hrAct = m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_history_forward"));
historyRight->setDefaultAction(hrAct);
historyRight->setIcon(hrAct->icon());
historyRight->setToolTip(hrAct->text());
historyRight->setAutoRaise(true);
KAcceleratorManager::setNoAccel(historyRight);
historyRight->installEventFilter(this); // on click, active this view space
hLayout->addWidget(historyRight);
m_historyForward->setDefaultAction(hrAct);
m_historyForward->setIcon(hrAct->icon());
m_historyForward->setToolTip(hrAct->text());
m_historyForward->setAutoRaise(true);
KAcceleratorManager::setNoAccel(m_historyForward);
m_historyForward->installEventFilter(this); // on click, active this view space
hLayout->addWidget(m_historyForward);
// add tab bar
m_tabBar = new KateTabBar(this);
......@@ -173,6 +173,8 @@ void KateViewSpace::statusBarToggled()
void KateViewSpace::tabBarToggled()
{
KateUpdateDisabler updatesDisabled(m_viewManager->mainWindow());
m_historyBack->setVisible(m_viewManager->mainWindow()->showTabBar());
m_historyForward->setVisible(m_viewManager->mainWindow()->showTabBar());
m_tabBar->setVisible(m_viewManager->mainWindow()->showTabBar());
m_split->setVisible(m_viewManager->mainWindow()->showTabBar());
m_quickOpen->setVisible(m_viewManager->mainWindow()->showTabBar());
......
......@@ -171,6 +171,12 @@ private:
// quick open action
QToolButton *m_quickOpen;
// go back in history button (only visible when the tab bar is visible)
QToolButton *m_historyBack;
// go forward in history button (only visible when the tab bar is visible)
QToolButton *m_historyForward;
};
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment