Commit d7e08cb0 authored by George Florea Bănuș's avatar George Florea Bănuș
Browse files

Add setting to toggle tabs close button and expansion

parent 46c26d36
......@@ -144,6 +144,19 @@ void KateConfigDialog::addBehaviorPage()
m_tabLimit->setValue(cgGeneral.readEntry("Tabbar Tab Limit", 0));
connect(m_tabLimit, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &KateConfigDialog::slotChanged);
m_showTabCloseButton = new QCheckBox(i18n("&Show close button"), buttonGroup);
m_showTabCloseButton->setChecked(cgGeneral.readEntry("Show Tabs Close Button", true));
m_showTabCloseButton->setToolTip(i18n("When checked each tab will display a close button."));
connect(m_showTabCloseButton, &QCheckBox::toggled, this, &KateConfigDialog::slotChanged);
m_expandTabs = new QCheckBox(i18n("&Expand tabs"), buttonGroup);
m_expandTabs->setChecked(cgGeneral.readEntry("Expand Tabs", true));
m_expandTabs->setToolTip(i18n("When checked tabs take as much size as possible."));
connect(m_expandTabs, &QCheckBox::toggled, this, &KateConfigDialog::slotChanged);
layout->addStretch(1); // :-] works correct without autoadd
......@@ -344,6 +357,10 @@ void KateConfigDialog::slotApply()
cg.writeEntry("Tabbar Tab Limit", m_tabLimit->value());
cg.writeEntry("Show Tabs Close Button", m_showTabCloseButton->isChecked());
cg.writeEntry("Expand Tabs", m_expandTabs->isChecked());
// patch document modified warn state
const QList<KTextEditor::Document *> &docs = KateApp::self()->documentManager()->documentList();
for (KTextEditor::Document *doc : docs)
......@@ -82,6 +82,8 @@ private:
QComboBox *m_cmbQuickOpenMatchMode;
QComboBox *m_cmbQuickOpenListMode;
QSpinBox *m_tabLimit;
QCheckBox *m_showTabCloseButton;
QCheckBox *m_expandTabs;
Ui::SessionConfigWidget sessionConfigUi;
......@@ -33,6 +33,9 @@ Q_DECLARE_METATYPE(KateTabButtonData)
KateTabBar::KateTabBar(QWidget *parent)
: QTabBar(parent)
KSharedConfig::Ptr config = KSharedConfig::openConfig();
KConfigGroup cgGeneral = KConfigGroup(config, "General");
// enable document mode, docs tell this will trigger:
// On macOS this will look similar to the tabs in Safari or Sierra's
// this seems reasonable for our document tabs
......@@ -42,10 +45,10 @@ KateTabBar::KateTabBar(QWidget *parent)
// use as much size as possible for each tab
setExpanding(cgGeneral.readEntry("Expand Tabs", true));
// document close function should be there
setTabsClosable(cgGeneral.readEntry("Show Tabs Close Button", true));
// allow users to re-arrange the tabs
......@@ -55,6 +58,10 @@ KateTabBar::KateTabBar(QWidget *parent)
// handle config changes
connect(KateApp::self(), &KateApp::configurationChanged, this, &KateTabBar::readTabCountLimitConfig);
connect(KateApp::self(), &KateApp::configurationChanged, this, [=]() {
setExpanding(cgGeneral.readEntry("Expand Tabs", true));
setTabsClosable(cgGeneral.readEntry("Show Tabs Close Button", true));
void KateTabBar::readTabCountLimitConfig()
Supports Markdown
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