Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
KDebugSettings
Commits
6508ca9e
Commit
6508ca9e
authored
Dec 25, 2020
by
Laurent Montel
😁
Browse files
Update item
parent
6b413bfa
Pipeline
#45312
canceled with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/groupmanagementwidget.cpp
View file @
6508ca9e
...
...
@@ -60,14 +60,15 @@ void GroupManagementWidget::slotCustomContextMenu()
menu
.
addAction
(
QIcon
::
fromTheme
(
QStringLiteral
(
"edit"
)),
i18n
(
"Rename Groups"
),
this
,
[
this
,
item
]()
{
const
QString
fullPath
=
item
->
data
(
FullPathRole
).
toString
();
QFile
f
(
fullPath
);
QFileInfo
fileInfo
(
f
);
const
QString
filePath
=
fileInfo
.
path
();
const
QString
newName
=
QInputDialog
::
getText
(
this
,
i18n
(
"Rename Group"
),
i18n
(
"New Name:"
));
const
QString
newNameTrimmed
=
newName
.
trimmed
();
if
(
!
newNameTrimmed
.
isEmpty
())
{
if
(
!
f
.
rename
(
filePath
+
QLatin1Char
(
'/'
)
+
newNameTrimmed
))
{
const
QString
newFullPath
{
LoadGroupMenu
::
defaultWritableGroupPath
()
+
QLatin1Char
(
'/'
)
+
newNameTrimmed
};
if
(
!
f
.
rename
(
newFullPath
))
{
KMessageBox
::
error
(
this
,
i18n
(
"Impossible to rename group as
\'
%1
\'
"
,
newNameTrimmed
),
i18n
(
"Rename Group"
));
}
else
{
item
->
setText
(
newNameTrimmed
);
item
->
setData
(
FullPathRole
,
newFullPath
);
}
}
});
...
...
Write
Preview
Supports
Markdown
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