summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Cullmann <cullmann@kde.org>2014-01-25 00:25:02 (GMT)
committerChristoph Cullmann <cullmann@kde.org>2014-01-25 00:26:55 (GMT)
commitb7cffaee7e064f9f03ddc6f871b5988a5b8b13ff (patch)
tree4fefc5c91ed6fb02903fc107573003b1e3fb9781
parentb2f42a5150adbc3fda4e9c76c706f90c8d7eccd2 (diff)
allow to show/hide tabs
-rw-r--r--kate/data/kateui.rc1
-rw-r--r--kate/src/katemainwindow.cpp19
-rw-r--r--kate/src/katemainwindow.h4
-rw-r--r--kate/src/kateviewspace.cpp48
-rw-r--r--kate/src/kateviewspace.h8
5 files changed, 61 insertions, 19 deletions
diff --git a/kate/data/kateui.rc b/kate/data/kateui.rc
index 093854b..bbb637b 100644
--- a/kate/data/kateui.rc
+++ b/kate/data/kateui.rc
@@ -100,6 +100,7 @@
</Menu>
<Menu name="settings"><text>&amp;Settings</text>
+ <Action name="settings_show_tab_bar" append="show_merge"/>
<Action name="settings_show_full_path" append="show_merge"/>
</Menu>
diff --git a/kate/src/katemainwindow.cpp b/kate/src/katemainwindow.cpp
index 59d8752..8c0242e 100644
--- a/kate/src/katemainwindow.cpp
+++ b/kate/src/katemainwindow.cpp
@@ -232,10 +232,14 @@ KateMainWindow::~KateMainWindow()
void KateMainWindow::setupImportantActions()
{
- // settings
m_paShowStatusBar = KStandardAction::showStatusbar(this, SLOT(toggleShowStatusBar()), actionCollection());
m_paShowStatusBar->setWhatsThis(i18n("Use this command to show or hide the view's statusbar"));
+ m_paShowTabBar = new KToggleAction(i18n("Sho&w Tabs"), this);
+ actionCollection()->addAction(QStringLiteral("settings_show_tab_bar"), m_paShowTabBar);
+ connect(m_paShowTabBar, SIGNAL(toggled(bool)), this, SLOT(toggleShowTabBar()));
+ m_paShowTabBar->setWhatsThis(i18n("Use this command to show or hide the tabs for the views"));
+
m_paShowPath = new KToggleAction(i18n("Sho&w Path in Titlebar"), this);
actionCollection()->addAction(QStringLiteral("settings_show_full_path"), m_paShowPath);
connect(m_paShowPath, SIGNAL(toggled(bool)), this, SLOT(updateCaption()));
@@ -546,9 +550,11 @@ void KateMainWindow::readOptions()
m_paShowPath->setChecked(generalGroup.readEntry("Show Full Path in Title", false));
m_paShowStatusBar->setChecked(generalGroup.readEntry("Show Status Bar", true));
+ m_paShowTabBar->setChecked(generalGroup.readEntry("Show Tab Bar", true));
// emit signal to hide/show statusbars
toggleShowStatusBar();
+ toggleShowTabBar();
}
void KateMainWindow::saveOptions()
@@ -563,6 +569,7 @@ void KateMainWindow::saveOptions()
generalGroup.writeEntry("Show Full Path in Title", m_paShowPath->isChecked());
generalGroup.writeEntry("Show Status Bar", m_paShowStatusBar->isChecked());
+ generalGroup.writeEntry("Show Tab Bar", m_paShowTabBar->isChecked());
}
void KateMainWindow::toggleShowStatusBar()
@@ -575,6 +582,16 @@ bool KateMainWindow::showStatusBar()
return m_paShowStatusBar->isChecked();
}
+void KateMainWindow::toggleShowTabBar()
+{
+ emit tabBarToggled();
+}
+
+bool KateMainWindow::showTabBar()
+{
+ return m_paShowTabBar->isChecked();
+}
+
void KateMainWindow::slotWindowActivated()
{
if (m_viewManager->activeView()) {
diff --git a/kate/src/katemainwindow.h b/kate/src/katemainwindow.h
index c0fef7c..e5d8901 100644
--- a/kate/src/katemainwindow.h
+++ b/kate/src/katemainwindow.h
@@ -202,12 +202,15 @@ private Q_SLOTS:
private Q_SLOTS:
void toggleShowStatusBar();
+ void toggleShowTabBar();
public:
bool showStatusBar();
+ bool showTabBar();
Q_SIGNALS:
void statusBarToggled();
+ void tabBarToggled();
void unhandledShortcutOverride(QEvent *e);
public:
@@ -466,6 +469,7 @@ private:
// options: show statusbar + show path
KToggleAction *m_paShowPath;
KToggleAction *m_paShowStatusBar;
+ KToggleAction *m_paShowTabBar;
QWidget *m_bottomViewBarContainer;
KateContainerStackedLayout *m_bottomContainerStack;
diff --git a/kate/src/kateviewspace.cpp b/kate/src/kateviewspace.cpp
index e3c97b8..d6740ab 100644
--- a/kate/src/kateviewspace.cpp
+++ b/kate/src/kateviewspace.cpp
@@ -29,6 +29,7 @@
#include "katedebug.h"
#include "katetabbar.h"
#include "kactioncollection.h"
+#include "kateupdatedisabler.h"
#include <KLocalizedString>
#include <KConfigGroup>
@@ -64,25 +65,25 @@ KateViewSpace::KateViewSpace(KateViewManager *viewManager,
hLayout->addWidget(m_tabBar);
// add vertical split view space
- QToolButton *split = new QToolButton(this);
- split->setAutoRaise(true);
- split->setPopupMode(QToolButton::InstantPopup);
- split->setIcon(QIcon::fromTheme(QStringLiteral("view-split-left-right")));
- split->addAction(m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_split_vert")));
- split->addAction(m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_split_horiz")));
- split->addAction(m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_close_current_space")));
- split->addAction(m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_close_others")));
- split->addAction(m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_hide_others")));
- split->setWhatsThis(i18n("Control view space splitting"));
- split->installEventFilter(this); // on click, active this view space
- hLayout->addWidget(split);
+ m_split = new QToolButton(this);
+ m_split->setAutoRaise(true);
+ m_split->setPopupMode(QToolButton::InstantPopup);
+ m_split->setIcon(QIcon::fromTheme(QStringLiteral("view-split-left-right")));
+ m_split->addAction(m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_split_vert")));
+ m_split->addAction(m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_split_horiz")));
+ m_split->addAction(m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_close_current_space")));
+ m_split->addAction(m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_close_others")));
+ m_split->addAction(m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_hide_others")));
+ m_split->setWhatsThis(i18n("Control view space splitting"));
+ m_split->installEventFilter(this); // on click, active this view space
+ hLayout->addWidget(m_split);
// add quick open
- QToolButton *quickOpen = new QToolButton(this);
- quickOpen->setAutoRaise(true);
- quickOpen->setDefaultAction(m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_quick_open")));
- quickOpen->installEventFilter(this); // on click, active this view space
- hLayout->addWidget(quickOpen);
+ m_quickOpen = new QToolButton(this);
+ m_quickOpen->setAutoRaise(true);
+ m_quickOpen->setDefaultAction(m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_quick_open")));
+ m_quickOpen->installEventFilter(this); // on click, active this view space
+ hLayout->addWidget(m_quickOpen);
// FIXME: better additional size
// m_tabBar->setMinimumHeight(int (QFontMetrics(font()).height() * 1.2));
@@ -101,9 +102,11 @@ KateViewSpace::KateViewSpace(KateViewManager *viewManager,
// connect signal to hide/show statusbar
connect(m_viewManager->mainWindow(), SIGNAL(statusBarToggled()), this, SLOT(statusBarToggled()));
+ connect(m_viewManager->mainWindow(), SIGNAL(tabBarToggled()), this, SLOT(tabBarToggled()));
- // init the statusbar...
+ // init the bars...
statusBarToggled();
+ tabBarToggled();
}
bool KateViewSpace::eventFilter(QObject *obj, QEvent *event)
@@ -130,6 +133,7 @@ bool KateViewSpace::eventFilter(QObject *obj, QEvent *event)
void KateViewSpace::statusBarToggled()
{
+ KateUpdateDisabler updatesDisabled (m_viewManager->mainWindow());
Q_FOREACH(KTextEditor::Document * doc, m_lruDocList) {
if (m_docToView.contains(doc)) {
m_docToView[doc]->setStatusBarEnabled(m_viewManager->mainWindow()->showStatusBar());
@@ -155,6 +159,14 @@ void KateViewSpace::mergeLruList(const QVector<KTextEditor::Document*> & lruList
}
}
+void KateViewSpace::tabBarToggled()
+{
+ KateUpdateDisabler updatesDisabled (m_viewManager->mainWindow());
+ m_tabBar->setVisible(m_viewManager->mainWindow()->showTabBar());
+ m_split->setVisible(m_viewManager->mainWindow()->showTabBar());
+ m_quickOpen->setVisible(m_viewManager->mainWindow()->showTabBar());
+}
+
KTextEditor::View *KateViewSpace::createView(KTextEditor::Document *doc)
{
// should only be called if a view does not yet exist
diff --git a/kate/src/kateviewspace.h b/kate/src/kateviewspace.h
index c7ea294..779eabf 100644
--- a/kate/src/kateviewspace.h
+++ b/kate/src/kateviewspace.h
@@ -34,6 +34,7 @@ class KateViewManager;
class KateViewSpace;
class QStackedWidget;
class QLabel;
+class QToolButton;
class KateTabBar;
class KateViewSpace : public QWidget
@@ -93,6 +94,7 @@ public Q_SLOTS:
private Q_SLOTS:
void statusBarToggled();
+ void tabBarToggled();
void changeView(int buttonId);
/**
@@ -147,6 +149,12 @@ private:
// tab bar that contains viewspace tabs
KateTabBar *m_tabBar;
+
+ // split action
+ QToolButton *m_split;
+
+ // quick open action
+ QToolButton *m_quickOpen;
// map from Document to button id
QHash<KTextEditor::Document *, int> m_docToTabId;