summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Haumann <dhaumann@kde.org>2014-01-22 12:41:16 (GMT)
committerDominik Haumann <dhaumann@kde.org>2014-01-22 12:41:16 (GMT)
commit4a3e0d86762ff8bda3e28d9146ddfc9348171263 (patch)
treea58c595a8bd63129ea043c1f6a8bfd5f7f624418
parent3255ca929dd82e70a907cca66454e3a809c431bc (diff)
tab bar: make switching work, make quick open work
-rw-r--r--kate/app/katetabbar.cpp12
-rw-r--r--kate/app/katetabbar.h11
-rw-r--r--kate/app/kateviewspace.cpp3
3 files changed, 18 insertions, 8 deletions
diff --git a/kate/app/katetabbar.cpp b/kate/app/katetabbar.cpp
index 5811a92..f6d5a60 100644
--- a/kate/app/katetabbar.cpp
+++ b/kate/app/katetabbar.cpp
@@ -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()
diff --git a/kate/app/katetabbar.h b/kate/app/katetabbar.h
index e34d765..93e95a2 100644
--- a/kate/app/katetabbar.h
+++ b/kate/app/katetabbar.h
@@ -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;
diff --git a/kate/app/kateviewspace.cpp b/kate/app/kateviewspace.cpp
index 4716bb6..71c6716 100644
--- a/kate/app/kateviewspace.cpp
+++ b/kate/app/kateviewspace.cpp
@@ -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()