Disable Create New menu and button when Trash dir is active
AbandonedPublic

Authored by elvisangelaccio on Mar 14 2018, 5:40 PM.

Details

Reviewers
rominf
Group Reviewers
Dolphin
Summary

Trash dir doesn't support file creation, thus disable the Create New menu and button.
BUG: 332463
BUG: 332464

Test Plan
  1. Go to Trash dir
  2. Observe disabled button and menu

Diff Detail

Repository
R318 Dolphin
Branch
trash-disable-buttons
Lint
No Linters Available
Unit
No Unit Test Coverage
rominf requested review of this revision.Mar 14 2018, 5:40 PM
rominf created this revision.
rominf edited the summary of this revision. (Show Details)Mar 14 2018, 5:47 PM

+1 for concept and function! One code comment below:

ngraham added inline comments.Mar 14 2018, 8:19 PM
src/dolphinmainwindow.cpp
1369 ↗(On Diff #29515)

Is this needed, given the writability check in dolphinviewactionhandler.cpp? And if it is, should it be same same writability check here, instead of a string comparison for "trash"?

elvisangelaccio requested changes to this revision.Mar 14 2018, 11:11 PM
elvisangelaccio added a subscriber: elvisangelaccio.
elvisangelaccio added inline comments.
src/dolphinmainwindow.cpp
1369 ↗(On Diff #29515)

This should be handled by KIO (knewfilemenu.cpp)

This revision now requires changes to proceed.Mar 14 2018, 11:11 PM
rominf updated this revision to Diff 29568.Mar 15 2018, 6:49 AM
  • Remove unnecessary line
rominf added inline comments.Mar 15 2018, 6:53 AM
src/dolphinmainwindow.cpp
1369 ↗(On Diff #29515)

This line is indeed unnecessary, thank you @ngraham. Removed it.

Thanks! Still works for me, and the change is nice and small now. I'll let Dolphin's experienced reviewers do the final code review and sign-off.

src/views/dolphinviewactionhandler.cpp
487–488

In theory an ioslave could support creating new files but not new folders, so this is wrong.

As I said, this problem should be addressed in KNewFileMenu.

The short-term workaround is to check whether the url is a trash:/ url. The proper fix would be to implement what was discussed here: https://git.reviewboard.kde.org/r/129741/

rominf added inline comments.Mar 18 2018, 12:12 PM
src/views/dolphinviewactionhandler.cpp
487–488

In theory an ioslave could support creating new files but not new folders, so this is wrong

What's the purpose to create new files in the trash at all?

elvisangelaccio commandeered this revision.Jun 2 2018, 1:31 PM
elvisangelaccio edited reviewers, added: rominf; removed: elvisangelaccio.
Restricted Application added a project: Dolphin. · View Herald TranscriptJun 2 2018, 1:31 PM
Restricted Application added a subscriber: kfm-devel. · View Herald Transcript
elvisangelaccio abandoned this revision.Jun 2 2018, 1:31 PM

Superseded by D12731.

Heh, I forgot all about this.