aboutsummaryrefslogtreecommitdiffstats
path: root/package/firmware
diff options
context:
space:
mode:
authorLeon M. Busch-George <leon@georgemail.eu>2023-06-16 14:58:48 +0200
committerLeon M. Busch-George <leon@georgemail.eu>2023-09-25 15:02:49 +0200
commit59e681eea1fbf969ff6f2da315f18142b70424bd (patch)
treeaf993b5520ec23f4037aa3cbac9cccb3abb13650 /package/firmware
parent9b2f8a33b6b247d4232d48a1d18aea3769590083 (diff)
downloadupstream-59e681eea1fbf969ff6f2da315f18142b70424bd.tar.gz
upstream-59e681eea1fbf969ff6f2da315f18142b70424bd.tar.bz2
upstream-59e681eea1fbf969ff6f2da315f18142b70424bd.zip
base-files: ipcalc.sh: don't print broadcast addr for prefix > 30
Printing a broadcast address doesn't make any sense for /31 and /32 prefixes. Strictly speaking, the same goes for the network address but it is useful to get the first address in the prefix, e.g. to create a canonical CIDR notation "$NETWORK/$PREFIX". Signed-off-by: Leon M. Busch-George <leon@georgemail.eu>
Diffstat (limited to 'package/firmware')
0 files changed, 0 insertions, 0 deletions
ref='#n67'>67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
/*
 * Copyright (C) 2012-2014 Dominik Schürmann <dominik@dominikschuermann.de>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.sufficientlysecure.keychain.ui.dialog;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
import com.beardedhen.androidbootstrap.BootstrapButton;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.helper.FileHelper;
import org.sufficientlysecure.keychain.util.Log;

public class FileDialogFragment extends DialogFragment {
    private static final String ARG_MESSENGER = "messenger";
    private static final String ARG_TITLE = "title";
    private static final String ARG_MESSAGE = "message";
    private static final String ARG_DEFAULT_FILE = "default_file";
    private static final String ARG_CHECKBOX_TEXT = "checkbox_text";

    public static final int MESSAGE_OKAY = 1;

    public static final String MESSAGE_DATA_FILENAME = "filename";
    public static final String MESSAGE_DATA_CHECKED = "checked";

    private Messenger mMessenger;

    private EditText mFilename;
    private BootstrapButton mBrowse;
    private CheckBox mCheckBox;
    private TextView mMessageTextView;

    private static final int REQUEST_CODE = 0x00007004;

    /**
     * Creates new instance of this file dialog fragment
     */
    public static FileDialogFragment newInstance(Messenger messenger, String title, String message,
                                                 String defaultFile, String checkboxText) {
        FileDialogFragment frag = new FileDialogFragment();
        Bundle args = new Bundle();
        args.putParcelable(ARG_MESSENGER, messenger);

        args.putString(ARG_TITLE, title);
        args.putString(ARG_MESSAGE, message);
        args.putString(ARG_DEFAULT_FILE, defaultFile);
        args.putString(ARG_CHECKBOX_TEXT, checkboxText);

        frag.setArguments(args);

        return frag;
    }

    /**
     * Creates dialog
     */
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        final Activity activity = getActivity();

        mMessenger = getArguments().getParcelable(ARG_MESSENGER);

        String title = getArguments().getString(ARG_TITLE);
        String message = getArguments().getString(ARG_MESSAGE);
        String defaultFile = getArguments().getString(ARG_DEFAULT_FILE);
        String checkboxText = getArguments().getString(ARG_CHECKBOX_TEXT);