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
Konsole
Commits
79711224
Commit
79711224
authored
Nov 30, 2021
by
Tomaz Canabrava
Browse files
Forbid deletions from imported data
parent
89ec496d
Pipeline
#103790
passed with stage
in 2 minutes and 3 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/SSHManager/sshmanagerpluginwidget.cpp
View file @
79711224
...
...
@@ -89,11 +89,27 @@ SSHManagerTreeWidget::SSHManagerTreeWidget(QWidget *parent)
ui
->
profile
->
setModelColumn
(
Konsole
::
ProfileModel
::
PROFILE
);
ui
->
treeView
->
setContextMenuPolicy
(
Qt
::
CustomContextMenu
);
connect
(
ui
->
treeView
,
&
QTreeView
::
customContextMenuRequested
,
[
this
](
const
QPoint
&
pos
)
{
if
(
!
ui
->
treeView
->
indexAt
(
pos
).
isValid
())
{
QModelIndex
idx
=
ui
->
treeView
->
indexAt
(
pos
);
if
(
!
idx
.
isValid
())
{
return
;
}
if
(
idx
.
data
(
Qt
::
DisplayRole
)
==
i18n
(
"SSH Config"
))
{
return
;
}
auto
sourceIdx
=
d
->
filterModel
->
mapToSource
(
idx
);
const
bool
isParent
=
sourceIdx
.
parent
()
==
d
->
model
->
invisibleRootItem
()
->
index
();
if
(
!
isParent
)
{
const
auto
item
=
d
->
model
->
itemFromIndex
(
sourceIdx
);
const
auto
data
=
item
->
data
(
SSHManagerModel
::
SSHRole
).
value
<
SSHConfigurationData
>
();
if
(
data
.
importedFromSshConfig
)
{
return
;
}
}
QMenu
*
menu
=
new
QMenu
(
this
);
auto
action
=
new
QAction
(
QStringLiteral
(
"Remove"
),
ui
->
treeView
);
menu
->
addAction
(
action
);
...
...
@@ -374,6 +390,13 @@ void SSHManagerTreeWidget::handleTreeClick(Qt::MouseButton btn, const QModelInde
if
(
isParent
)
{
setEditComponentsEnabled
(
false
);
if
(
sourceIdx
.
data
(
Qt
::
DisplayRole
).
toString
()
==
i18n
(
"SSH Config"
))
{
ui
->
btnRemove
->
setEnabled
(
false
);
ui
->
btnRemove
->
setToolTip
(
i18n
(
"Cannot remove this folder"
));
}
else
{
ui
->
btnRemove
->
setEnabled
(
true
);
ui
->
btnRemove
->
setToolTip
(
i18n
(
"Remove folder and all of it's contents"
));
}
ui
->
btnEdit
->
setEnabled
(
false
);
if
(
ui
->
sshInfoPane
->
isVisible
())
{
ui
->
errorPanel
->
setText
(
i18n
(
"Double click to change the folder name."
));
...
...
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