Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Utilities
Kate
Commits
d7e08cb0
Commit
d7e08cb0
authored
Sep 30, 2020
by
George Florea Bănuș
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add setting to toggle tabs close button and expansion
parent
46c26d36
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
2 deletions
+28
-2
kate/kateconfigdialog.cpp
kate/kateconfigdialog.cpp
+17
-0
kate/kateconfigdialog.h
kate/kateconfigdialog.h
+2
-0
kate/katetabbar.cpp
kate/katetabbar.cpp
+9
-2
No files found.
kate/kateconfigdialog.cpp
View file @
d7e08cb0
...
...
@@ -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
)
...
...
kate/kateconfigdialog.h
View file @
d7e08cb0
...
...
@@ -82,6 +82,8 @@ private:
QComboBox
*
m_cmbQuickOpenMatchMode
;
QComboBox
*
m_cmbQuickOpenListMode
;
QSpinBox
*
m_tabLimit
;
QCheckBox
*
m_showTabCloseButton
;
QCheckBox
*
m_expandTabs
;
Ui
::
SessionConfigWidget
sessionConfigUi
;
...
...
kate/katetabbar.cpp
View file @
d7e08cb0
...
...
@@ -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 Terminal.app.
// this seems reasonable for our document tabs
...
...
@@ -42,10 +45,10 @@ KateTabBar::KateTabBar(QWidget *parent)
setAcceptDrops
(
true
);
// use as much size as possible for each tab
setExpanding
(
true
);
setExpanding
(
cgGeneral
.
readEntry
(
"Expand Tabs"
,
true
)
)
;
// document close function should be there
setTabsClosable
(
true
);
setTabsClosable
(
cgGeneral
.
readEntry
(
"Show Tabs Close Button"
,
true
)
)
;
// allow users to re-arrange the tabs
setMovable
(
true
);
...
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment