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

rename readTabCountLimitConfig to readConfig

and handle setExpanding and setTabsClosable inside it
parent d7e08cb0
......@@ -33,9 +33,6 @@ 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 Terminal.app.
// this seems reasonable for our document tabs
......@@ -44,27 +41,17 @@ KateTabBar::KateTabBar(QWidget *parent)
// we want drag and drop
setAcceptDrops(true);
// 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
setMovable(true);
// enforce configured limit
readTabCountLimitConfig();
readConfig();
// 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));
});
connect(KateApp::self(), &KateApp::configurationChanged, this, &KateTabBar::readConfig);
}
void KateTabBar::readTabCountLimitConfig()
void KateTabBar::readConfig()
{
KSharedConfig::Ptr config = KSharedConfig::openConfig();
KConfigGroup cgGeneral = KConfigGroup(config, "General");
......@@ -87,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