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

Commit 98f1dd77 authored by Raj Yengisetty's avatar Raj Yengisetty Committed by Jessica Wagantall
Browse files

System Profiles: Do not allow user to delete active profile

Change-Id: I6c643c13070ebbae3d7b999728f4a2fc65babb5e
(cherry picked from commit 7920296e)
parent c7cde090
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@
    <string name="profile_remove_dialog_message">Remove profile %1$s?</string>
    <string name="profile_populate_profile_from_state">Configure profile using current device settings?</string>
    <string name="profile_menu_fill_from_state">Import current device settings</string>
    <string name="profile_remove_current_profile">Cannot delete current profile!</string>

    <!-- Add Profile -->
    <string name="add_profile_dialog_title">Create new profile</string>
+14 −0
Original line number Diff line number Diff line
@@ -404,6 +404,20 @@ public class SetupActionsFragment extends SettingsPreferenceFragment
    }

    private void requestRemoveProfileDialog() {
        Profile current = mProfileManager.getActiveProfile();
        if (mProfile.getUuid().equals(current.getUuid())) {
            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
            builder.setMessage(getString(R.string.profile_remove_current_profile));
            builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            });
            builder.show();
            return;
        }

        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setMessage(getString(R.string.profile_remove_dialog_message, mProfile.getName()));
        builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {