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
System
Dolphin
Commits
6b64c7ff
Commit
6b64c7ff
authored
May 20, 2021
by
Saravanan K
Committed by
Nate Graham
May 20, 2021
Browse files
Add action to places panel context menu trash entry to open trash settings
BUG: 367583 FIXED-IN: 21.08
parent
2e536476
Pipeline
#62599
passed with stage
in 4 minutes and 33 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/panels/places/placespanel.cpp
View file @
6b64c7ff
...
...
@@ -23,6 +23,7 @@
#include "placesview.h"
#include "trash/dolphintrash.h"
#include "views/draganddrophelper.h"
#include "settings/dolphinsettingsdialog.h"
#include <KFilePlaceEditDialog>
#include <KFilePlacesModel>
...
...
@@ -181,6 +182,7 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
QMenu
menu
(
this
);
QAction
*
emptyTrashAction
=
nullptr
;
QAction
*
configureTrashAction
=
nullptr
;
QAction
*
editAction
=
nullptr
;
QAction
*
teardownAction
=
nullptr
;
QAction
*
ejectAction
=
nullptr
;
...
...
@@ -200,7 +202,7 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
if
(
item
->
url
().
isLocalFile
())
{
propertiesAction
=
menu
.
addAction
(
QIcon
::
fromTheme
(
QStringLiteral
(
"document-properties"
)),
i18nc
(
"@action:inmenu"
,
"Properties"
));
}
if
(
!
isDevice
&&
!
isTrash
)
{
if
(
!
isDevice
)
{
menu
.
addSeparator
();
}
...
...
@@ -236,6 +238,10 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
}
}
if
(
isTrash
)
{
configureTrashAction
=
menu
.
addAction
(
QIcon
::
fromTheme
(
QStringLiteral
(
"configure"
)),
i18nc
(
"@action:inmenu"
,
"Configure Trash..."
));
}
if
(
!
isDevice
)
{
editAction
=
menu
.
addAction
(
QIcon
::
fromTheme
(
QStringLiteral
(
"edit-entry"
)),
i18nc
(
"@item:inmenu"
,
"Edit..."
));
}
...
...
@@ -255,6 +261,11 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
if
(
action
)
{
if
(
action
==
emptyTrashAction
)
{
Trash
::
empty
(
this
);
}
else
if
(
action
==
configureTrashAction
)
{
DolphinSettingsDialog
*
settingsDialog
=
new
DolphinSettingsDialog
(
item
->
url
(),
this
);
settingsDialog
->
setCurrentPage
(
settingsDialog
->
trashSettings
);
settingsDialog
->
setAttribute
(
Qt
::
WA_DeleteOnClose
);
settingsDialog
->
show
();
}
else
{
// The index might have changed if devices were added/removed while
// the context menu was open.
...
...
src/settings/dolphinsettingsdialog.cpp
View file @
6b64c7ff
...
...
@@ -99,9 +99,9 @@ DolphinSettingsDialog::DolphinSettingsDialog(const QUrl& url, QWidget* parent, K
trashSettingsPage
=
createTrashSettingsPage
(
this
);
#endif
if
(
trashSettingsPage
)
{
KPageWidgetItem
*
trashSettings
Frame
=
addPage
(
trashSettingsPage
,
trashSettings
=
addPage
(
trashSettingsPage
,
i18nc
(
"@title:group"
,
"Trash"
));
trashSettings
Frame
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"user-trash"
)));
trashSettings
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"user-trash"
)));
connect
(
trashSettingsPage
,
&
TrashSettingsPage
::
changed
,
this
,
&
DolphinSettingsDialog
::
enableApply
);
}
...
...
src/settings/dolphinsettingsdialog.h
View file @
6b64c7ff
...
...
@@ -26,6 +26,8 @@ public:
explicit
DolphinSettingsDialog
(
const
QUrl
&
url
,
QWidget
*
parent
=
nullptr
,
KActionCollection
*
actions
=
{});
~
DolphinSettingsDialog
()
override
;
KPageWidgetItem
*
trashSettings
;
Q_SIGNALS:
void
settingsChanged
();
...
...
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