Permanent delete action

For any suggestion or feature request you may have, or simply to share your opinion about muCommander.

Permanent delete action

Postby arik » Fri Apr 25, 2008 1:55 am

Hey,

First, you are doing a wonderful work - muCommander is a really great tool.

My feature request is an action similar to "shift+del" at windows - a delete operation which is not through the recycle bin by default. This operation should be in addition to the existing delete operation which sends the deleted files to the recycle bin by default (while DEFAULT_DELETE_TO_TRASH = true, as it should be).

I implemented this in the following way:
1. changed the signature of the constructor of DeleteDialog to:
public DeleteDialog(MainFrame mainFrame, FileSet files, boolean permanent) ;
and added the following "if" in it:
Code: Select all
if (!permanent) {
           // Allow 'Move to trash' option only if:
           // - the current platform has a trash
           // - the base folder is not an archive
           // - the base folder of the to-be-deleted files is not a trash folder or one of its children
           // - the base folder can be moved to the trash (the eligibility conditions should be the same as the files to-be-deleted)
           AbstractTrash trash = FileFactory.getTrash();
           AbstractFile baseFolder = files.getBaseFolder();
                        if(trash!=null && !(baseFolder instanceof AbstractArchiveFile) && !trash.isTrashFile(baseFolder) && trash.canMoveToTrash(baseFolder)) {
               moveToTrash = MuConfiguration.getVariable(
                           MuConfiguration.DELETE_TO_TRASH,
                           MuConfiguration.DEFAULT_DELETE_TO_TRASH);
   
               moveToTrashCheckBox = new JCheckBox(Translator.get("delete_dialog.move_to_trash.option"), moveToTrash);
               moveToTrashCheckBox.addItemListener(this);
           }
        }

2. add to the action_keymap:
<!-- Action : Permanent delete selected file(s). -->
<!-- Default : SHIFT DELETE -->
<action class="com.mucommander.ui.action.PermanentDeleteAction"
alt_keystroke="shift DELETE"/>
3. At DeleteAction I added a "false" field for "permanent" at the call to DeleteDialog construction.
4. Create new action "PermanentDeleteAction" which differ from DeleteAction in one thing- it calls DeleteDialog constructor with permanent=true.

With my Implementation or another, hope it'll be added :)

Arik.
arik
 
Posts: 68
Joined: Sat Mar 01, 2008 10:48 am

Re: Permanent delete action

Postby maxence » Mon May 05, 2008 3:37 pm

Hi Arik,
Thank you very much for your contribution! I'm glad to report that your patch has been integrated, with the following additions :
- a label ('Delete permanently') and tooltip ('Delete marked files without using the system trash') have been assigned to this new action
- the command bar now displays (and triggers) this new action when the shift key is pressed.
- the 'Move to trash' checkbox has been left in the delete confirmation dialog when invoked by PermanentDeleteAction. It allows you to change your mind and doesn't really interfere with the core functionality.
- the state of the 'Move to trash' checkbox used to be saved in the preferences, this is not the case anymore since there are 2 separate actions. It's probably more intuitive and less accident-prone now.

The latest nightly build has the functionality, please let me know what you think about it and if you see anything else that should be added or modified.

Thanks again!
Maxence
User avatar
maxence
Site Admin
 
Posts: 436
Joined: Wed Aug 21, 2002 8:18 pm

Re: Permanent delete action

Postby arik » Sun May 18, 2008 6:32 pm

Hey,

Sorry for the late response- it works great.

Thanks,

Arik
arik
 
Posts: 68
Joined: Sat Mar 01, 2008 10:48 am


Return to Feedback

Who is online

Users browsing this forum: AccouraTauh, Amabborsinsar, Amenoalabesse, appesteShiels, Argurbsmume, BetTuroBory, CermClainia, CikeIncemeded, DeftEffonge, Fewadexia, jikeiwAssaufave, LevaHeviefs, LoopleGatte, neakexpem, OfferaDeere, serbabarcok, VekEtheks, Wrafefuri and 1 guest

cron