Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6816a2d authored by Artem Shvadskiy's avatar Artem Shvadskiy
Browse files

Remove "Properties" from action menu for secure directory

Ideally we would allow the properties action to appear and
ask the user to unlock the directory first, but that seems
to be nigh impossible without refactoring SecureConsole.

Change-Id: If619062d3c3db1855ac865811cf6b48e5ae5812f
issue-id: FEIJ-692
(cherry picked from commit 9d2b05ef)
parent dee6e1f8
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -682,7 +682,8 @@ public class ActionsDialog implements OnItemClickListener, OnItemLongClickListen
        }

        //- Remove properties option if multiple files selected
        if (selection != null && selection.size() > 1) {
        // or this selection contains a secure folder.
        if ((selection != null && selection.size() > 1) || containsSecureDirectory(selection)) {
            menu.removeItem(R.id.mnu_actions_properties);
            menu.removeItem(R.id.mnu_actions_properties_current_folder);
        }
@@ -866,4 +867,22 @@ public class ActionsDialog implements OnItemClickListener, OnItemLongClickListen
        }
        return resources;
    }

    private boolean containsSecureDirectory(List<FileSystemObject> selection) {
        if (mFso != null && FileHelper.isDirectory(mFso) && mFso.isSecure()) {
            return true;
        }

        if (selection == null) {
            return false;
        }

        for (FileSystemObject fso : selection) {
            if (FileHelper.isDirectory(fso) && fso.isSecure()) {
                return true;
            }
        }

        return false;
    }
}