Commit 446e13dc authored by Mario Aichinger's avatar Mario Aichinger

Merge invent.kde.org:utilities/kate into master

parents f51ab25a 0b61ede2
......@@ -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);
vbox->addLayout(hlayout);
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);
vbox->addWidget(m_showTabCloseButton);
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);
vbox->addWidget(m_expandTabs);
layout->addWidget(buttonGroup);
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;
......
......@@ -41,23 +41,17 @@ KateTabBar::KateTabBar(QWidget *parent)
// we want drag and drop
setAcceptDrops(true);
// use as much size as possible for each tab
setExpanding(true);
// document close function should be there
setTabsClosable(true);
// allow users to re-arrange the tabs
setMovable(true);
// enforce configured limit
readTabCountLimitConfig();
readConfig();
// handle config changes
connect(KateApp::self(), &KateApp::configurationChanged, this, &KateTabBar::readTabCountLimitConfig);
connect(KateApp::self(), &KateApp::configurationChanged, this, &KateTabBar::readConfig);
}
void KateTabBar::readTabCountLimitConfig()
void KateTabBar::readConfig()
{
KSharedConfig::Ptr config = KSharedConfig::openConfig();
KConfigGroup cgGeneral = KConfigGroup(config, "General");
......@@ -80,6 +74,10 @@ void KateTabBar::readTabCountLimitConfig()
}
setCurrentIndex(0);
}
// handle tab close button and expansion
setExpanding(cgGeneral.readEntry("Expand Tabs", true));
setTabsClosable(cgGeneral.readEntry("Show Tabs Close Button", true));
}
void KateTabBar::setActive(bool active)
......
......@@ -37,7 +37,7 @@ public:
/**
* Read and apply tab limit as configured
*/
void readTabCountLimitConfig();
void readConfig();
void tabInserted(int idx) override;
......
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