Commit 4a3e0d86 authored by Dominik Haumann's avatar Dominik Haumann

tab bar: make switching work, make quick open work

parent 3255ca92
......@@ -25,7 +25,9 @@
#include <kconfiggroup.h>
#include <kiconloader.h>
#include <kstringhandler.h>
#include <KLocalizedString>
#include <QToolButton>
#include <QApplication> // QApplication::sendEvent
#include <QtAlgorithms> // qSort
#include <QDebug>
......@@ -122,7 +124,11 @@ KateTabBar::KateTabBar(QWidget *parent)
m_activeButton = 0L;
// functions called in ::load() will set settings for the nav buttons
m_configureButton = new KateTabButton(QStringLiteral("Show Quick Open"), QStringLiteral("..."), -1, this);
m_moreButton = new QToolButton(this);
m_moreButton->setAutoRaise(true);
m_moreButton->setText(i18n("..."));
m_moreButton->setToolTip(i18n("Quick Open"));
connect(m_moreButton, SIGNAL(clicked()), this, SIGNAL(moreButtonClicked()));
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
updateFixedHeight();
......@@ -715,8 +721,8 @@ void KateTabBar::updateFixedHeight()
*/
void KateTabBar::updateHelperButtons(QSize new_size)
{
m_configureButton->setGeometry(new_size.width() - m_configureButton->minimumSizeHint().width(),
0, m_configureButton->minimumSizeHint().width(), tabHeight());
m_moreButton->setGeometry(new_size.width() - m_moreButton->minimumSizeHint().width(),
0, m_moreButton->minimumSizeHint().width(), tabHeight());
}
void KateTabBar::updateSort()
......
......@@ -30,6 +30,7 @@
class KateTabButton;
class KConfigBase;
class QToolButton;
/**
* The \p KateTabBar class provides a tab bar, e.g. for tabbed documents and
......@@ -114,14 +115,16 @@ Q_SIGNALS:
* This signal is emitted whenever the current activated tab changes.
*/
void currentChanged(int button_id);
/**
* This signal is emitted whenever a tab should be closed.
*/
void closeRequest(int button_id);
/**
* This signal is emitted whenever a setting entry changes.
* This signal is emitted whenever the more button is clicked.
*/
void settingsChanged(KateTabBar *tabbar);
void moreButtonClicked();
/**
* This signal is emitted whenever a highlight mark changes.
......@@ -155,8 +158,8 @@ private:
KateTabButton *m_activeButton;
// buttons on the right to navigate and configure
KateTabButton *m_configureButton;
// config/more button
QToolButton * m_moreButton;
int m_navigateSize;
int m_nextID;
......
......@@ -57,6 +57,7 @@ KateViewSpace::KateViewSpace( KateViewManager *viewManager,
m_tabBar = new KateTabBar(this);
layout->addWidget(m_tabBar);
connect(m_tabBar, &KateTabBar::currentChanged, this, &KateViewSpace::changeView);
connect(m_tabBar, &KateTabBar::moreButtonClicked, m_viewManager->mainWindow(), &KateMainWindow::slotQuickOpen);
stack = new QStackedWidget( this );
stack->setFocus();
......@@ -191,7 +192,7 @@ void KateViewSpace::changeView(int buttonId)
KTextEditor::Document * doc = m_docToTabId.key(buttonId);
Q_ASSERT(doc);
showView(doc);
m_viewManager->activateView(doc);
}
KTextEditor::View* KateViewSpace::currentView()
......
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