Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
2985f58d
Commit
2985f58d
authored
Sep 23, 2022
by
Eric Armbruster
🍁
Committed by
Christoph Cullmann
Sep 26, 2022
Browse files
filetree: fix closing when close button is disabled
parent
2f7a3f3b
Changes
2
Hide whitespace changes
Inline
Side-by-side
addons/filetree/katefiletree.cpp
View file @
2985f58d
...
...
@@ -323,15 +323,13 @@ void KateFileTree::slotCurrentChanged(const QModelIndex ¤t, const QModelIn
}
}
void
KateFileTree
::
mou
seClicked
(
const
QModelIndex
&
index
)
void
KateFileTree
::
clo
seClicked
(
const
QModelIndex
&
index
)
{
const
bool
closeButtonClicked
=
m_hasCloseButton
&&
index
.
column
()
==
1
;
if
(
m_proxyModel
->
isDir
(
index
)
&&
closeButtonClicked
)
{
if
(
m_proxyModel
->
isDir
(
index
))
{
const
QList
<
KTextEditor
::
Document
*>
list
=
m_proxyModel
->
docTreeFromIndex
(
index
);
closeDocs
(
list
);
return
;
}
else
if
(
m_proxyModel
->
isWidgetDir
(
index
)
&&
closeButtonClicked
)
{
}
else
if
(
m_proxyModel
->
isWidgetDir
(
index
))
{
const
auto
idx
=
index
.
siblingAtColumn
(
0
);
const
auto
count
=
m_proxyModel
->
rowCount
(
idx
);
QWidgetList
widgets
;
...
...
@@ -346,17 +344,23 @@ void KateFileTree::mouseClicked(const QModelIndex &index)
}
if
(
auto
*
doc
=
m_proxyModel
->
docFromIndex
(
index
))
{
if
(
closeButtonClicked
)
{
closeDocs
({
doc
});
return
;
}
closeDocs
({
doc
});
}
else
if
(
auto
*
w
=
index
.
data
(
KateFileTreeModel
::
WidgetRole
).
value
<
QWidget
*>
())
{
Q_EMIT
closeWidget
(
w
);
}
}
void
KateFileTree
::
mouseClicked
(
const
QModelIndex
&
index
)
{
if
(
m_hasCloseButton
&&
index
.
column
()
==
1
)
{
closeClicked
(
index
);
return
;
}
if
(
auto
*
doc
=
m_proxyModel
->
docFromIndex
(
index
))
{
Q_EMIT
activateDocument
(
doc
);
}
else
if
(
auto
*
w
=
index
.
data
(
KateFileTreeModel
::
WidgetRole
).
value
<
QWidget
*>
())
{
if
(
closeButtonClicked
)
{
Q_EMIT
closeWidget
(
w
);
}
else
{
Q_EMIT
activateWidget
(
w
);
}
Q_EMIT
activateWidget
(
w
);
}
}
...
...
@@ -511,7 +515,7 @@ void KateFileTree::slotDocumentClose()
return
;
}
const
auto
closeColumnIndex
=
m_indexContextMenu
.
sibling
(
m_indexContextMenu
.
row
(),
1
);
mou
seClicked
(
closeColumnIndex
);
clo
seClicked
(
closeColumnIndex
);
}
void
KateFileTree
::
addChildrenTolist
(
const
QModelIndex
&
index
,
QList
<
QPersistentModelIndex
>
*
worklist
)
...
...
addons/filetree/katefiletree.h
View file @
2985f58d
...
...
@@ -82,6 +82,7 @@ private Q_SLOTS:
void
onRowsMoved
(
const
QModelIndex
&
parent
,
int
start
,
int
end
,
const
QModelIndex
&
destination
,
int
row
);
private:
void
closeClicked
(
const
QModelIndex
&
index
);
void
setupContextMenuActionGroups
();
using
Func
=
void
(
KateFileTree
::*
)();
QAction
*
setupOption
(
QActionGroup
*
group
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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