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
bf42612a
Commit
bf42612a
authored
Jul 18, 2022
by
Waqar Ahmed
Browse files
GitWidget: Create ContextMenu for index at pos
Additionally, disable action for staged if staged has no childern.
parent
910ebb12
Pipeline
#206522
passed with stage
in 9 minutes and 4 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
addons/project/gitwidget.cpp
View file @
bf42612a
...
...
@@ -1025,7 +1025,9 @@ void GitWidget::treeViewContextMenuEvent(QContextMenuEvent *e)
}
}
const
auto
idx
=
m_treeView
->
currentIndex
();
const
auto
idx
=
m_treeView
->
indexAt
(
e
->
pos
());
if
(
!
idx
.
isValid
())
return
;
auto
treeItem
=
idx
.
data
(
GitStatusModel
::
TreeItemType
);
if
(
treeItem
==
GitStatusModel
::
NodeChanges
||
treeItem
==
GitStatusModel
::
NodeUntrack
)
{
...
...
@@ -1128,6 +1130,11 @@ void GitWidget::treeViewContextMenuEvent(QContextMenuEvent *e)
QMenu
menu
;
auto
stage
=
menu
.
addAction
(
i18n
(
"Unstage All"
));
auto
diff
=
menu
.
addAction
(
i18n
(
"Show diff"
));
auto
model
=
m_treeView
->
model
();
bool
disable
=
model
->
rowCount
(
idx
)
==
0
;
stage
->
setDisabled
(
disable
);
diff
->
setDisabled
(
disable
);
auto
act
=
menu
.
exec
(
m_treeView
->
viewport
()
->
mapToGlobal
(
e
->
pos
()));
if
(
!
act
)
{
return
;
...
...
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