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

Commit d40a046b authored by Vincent Breitmoser's avatar Vincent Breitmoser
Browse files

move sign-only into a mode of its own

parent cedaecb3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg id="Capa_1" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" style="enable-background:new 0 0 457.47 457.469;" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" height="457.47px" viewBox="0 0 457.47 457.469" width="457.47px" version="1.1" y="0px" x="0px" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata id="metadata41"><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/><dc:title/></cc:Work></rdf:RDF></metadata><g id="g3" transform="matrix(0.57627118,0,0,0.57627118,96.921399,96.921399)"><path id="path5" d="M228.75,96.906c-72.8,0-131.84,59.044-131.84,131.84,0,72.8,59.044,131.81,131.84,131.81,72.8,0,131.81-59.01,131.81-131.81s-59.01-131.84-131.81-131.84zm0,76.594c30.51,0,55.22,24.74,55.22,55.25s-24.71,55.22-55.22,55.22-55.25-24.71-55.25-55.22,24.74-55.25,55.25-55.25z" transform="matrix(1.7352942,0,0,1.7352942,-168.18714,-168.18714)"/></g></svg>
+11 −0
Original line number Diff line number Diff line
@@ -256,6 +256,7 @@ public class K9 extends Application {
    private static boolean sMessageViewSpamActionVisible = false;

    private static int sPgpInlineDialogCounter;
    private static int sPgpSignOnlyDialogCounter;


    /**
@@ -495,6 +496,7 @@ public class K9 extends Application {
        editor.putBoolean("messageViewSpamActionVisible", sMessageViewSpamActionVisible);

        editor.putInt("pgpInlineDialogCounter", sPgpInlineDialogCounter);
        editor.putInt("pgpSignOnlyDialogCounter", sPgpSignOnlyDialogCounter);

        fontSizes.save(editor);
    }
@@ -743,6 +745,7 @@ public class K9 extends Application {
        sMessageViewSpamActionVisible = storage.getBoolean("messageViewSpamActionVisible", false);

        sPgpInlineDialogCounter = storage.getInt("pgpInlineDialogCounter", 0);
        sPgpSignOnlyDialogCounter = storage.getInt("pgpSignOnlyDialogCounter", 0);

        K9.setK9Language(storage.getString("language", ""));

@@ -1329,6 +1332,14 @@ public class K9 extends Application {
        K9.sPgpInlineDialogCounter = pgpInlineDialogCounter;
    }

    public static int getPgpSignOnlyDialogCounter() {
        return sPgpSignOnlyDialogCounter;
    }

    public static void setPgpSignOnlyDialogCounter(int pgpSignOnlyDialogCounter) {
        K9.sPgpSignOnlyDialogCounter = pgpSignOnlyDialogCounter;
    }

    /**
     * Check if we already know whether all databases are using the current database schema.
     *
+13 −1
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ import com.fsck.k9.activity.compose.CryptoSettingsDialog.OnCryptoModeChangedList
import com.fsck.k9.activity.compose.IdentityAdapter;
import com.fsck.k9.activity.compose.IdentityAdapter.IdentityContainer;
import com.fsck.k9.activity.compose.PgpInlineDialog.OnOpenPgpInlineChangeListener;
import com.fsck.k9.activity.compose.PgpSignOnlyDialog.OnOpenPgpSignOnlyChangeListener;
import com.fsck.k9.activity.compose.RecipientMvpView;
import com.fsck.k9.activity.compose.RecipientPresenter;
import com.fsck.k9.activity.compose.RecipientPresenter.CryptoMode;
@@ -98,7 +99,7 @@ import com.fsck.k9.ui.compose.QuotedMessagePresenter;
@SuppressWarnings("deprecation")
public class MessageCompose extends K9Activity implements OnClickListener,
        CancelListener, OnFocusChangeListener, OnCryptoModeChangedListener,
        OnOpenPgpInlineChangeListener, MessageBuilder.Callback {
        OnOpenPgpInlineChangeListener, OnOpenPgpSignOnlyChangeListener, MessageBuilder.Callback {

    private static final int DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE = 1;
    private static final int DIALOG_CONFIRM_DISCARD_ON_BACK = 2;
@@ -211,6 +212,11 @@ public class MessageCompose extends K9Activity implements OnClickListener,
        recipientPresenter.onCryptoPgpInlineChanged(enabled);
    }

    @Override
    public void onOpenPgpSignOnlyChange(boolean enabled) {
        recipientPresenter.onCryptoPgpSignOnlyDisabled();
    }

    public enum Action {
        COMPOSE(R.string.compose_title_compose),
        REPLY(R.string.compose_title_reply),
@@ -996,6 +1002,12 @@ public class MessageCompose extends K9Activity implements OnClickListener,
                recipientPresenter.onMenuSetPgpInline(false);
                updateMessageFormat();
                break;
            case R.id.openpgp_sign_only:
                recipientPresenter.onMenuSetSignOnly(true);
                break;
            case R.id.openpgp_sign_only_disable:
                recipientPresenter.onMenuSetSignOnly(false);
                break;
            case R.id.add_attachment:
                attachmentPresenter.onClickAddAttachment(recipientPresenter);
                break;
+4 −0
Original line number Diff line number Diff line
@@ -104,6 +104,10 @@ public class ComposeCryptoStatus {
        return cryptoSupportSignOnly;
    }

    public boolean isSignOnly() {
        return cryptoMode == CryptoMode.SIGN_ONLY;
    }

    public boolean isSigningEnabled() {
        return cryptoMode != CryptoMode.DISABLE && signingKeyId != null;
    }
+6 −13
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import com.fsck.k9.view.LinearViewAnimator;

public class CryptoSettingsDialog extends DialogFragment implements CryptoStatusSelectedListener {
    private static final String ARG_CURRENT_MODE = "current_mode";
    private static final String ARG_SUPPORT_SIGN_ONLY = "support_sing_only";


    private CryptoModeSelector cryptoModeSelector;
@@ -31,12 +30,11 @@ public class CryptoSettingsDialog extends DialogFragment implements CryptoStatus
    private CryptoMode currentMode;


    public static CryptoSettingsDialog newInstance(CryptoMode initialMode, boolean supportSignOnly) {
    public static CryptoSettingsDialog newInstance(CryptoMode initialMode) {
        CryptoSettingsDialog dialog = new CryptoSettingsDialog();

        Bundle args = new Bundle();
        args.putString(ARG_CURRENT_MODE, initialMode.toString());
        args.putBoolean(ARG_SUPPORT_SIGN_ONLY, supportSignOnly);
        dialog.setArguments(args);

        return dialog;
@@ -45,12 +43,10 @@ public class CryptoSettingsDialog extends DialogFragment implements CryptoStatus
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        Bundle arguments = savedInstanceState != null ? savedInstanceState : getArguments();
        boolean supportSignOnly = arguments.getBoolean(ARG_SUPPORT_SIGN_ONLY);
        currentMode = CryptoMode.valueOf(arguments.getString(ARG_CURRENT_MODE));

        @SuppressLint("InflateParams")
        View view = LayoutInflater.from(getActivity()).inflate(supportSignOnly ?
                R.layout.crypto_settings_dialog_sign_only : R.layout.crypto_settings_dialog, null);
        View view = LayoutInflater.from(getActivity()).inflate(R.layout.crypto_settings_dialog, null);
        cryptoModeSelector = (CryptoModeSelector) view.findViewById(R.id.crypto_status_selector);
        cryptoStatusText = (LinearViewAnimator) view.findViewById(R.id.crypto_status_text);

@@ -98,16 +94,14 @@ public class CryptoSettingsDialog extends DialogFragment implements CryptoStatus
                cryptoStatusText.setDisplayedChild(0, animate);
                break;
            case SIGN_ONLY:
                cryptoModeSelector.setCryptoStatus(CryptoModeSelectorState.SIGN_ONLY);
                cryptoStatusText.setDisplayedChild(1, animate);
                break;
                throw new IllegalStateException("This state can't be set here!");
            case OPPORTUNISTIC:
                cryptoModeSelector.setCryptoStatus(CryptoModeSelectorState.OPPORTUNISTIC);
                cryptoStatusText.setDisplayedChild(2, animate);
                cryptoStatusText.setDisplayedChild(1, animate);
                break;
            case PRIVATE:
                cryptoModeSelector.setCryptoStatus(CryptoModeSelectorState.PRIVATE);
                cryptoStatusText.setDisplayedChild(3, animate);
                cryptoStatusText.setDisplayedChild(2, animate);
                break;
        }
    }
@@ -126,8 +120,7 @@ public class CryptoSettingsDialog extends DialogFragment implements CryptoStatus
                currentMode = CryptoMode.DISABLE;
                break;
            case SIGN_ONLY:
                currentMode = CryptoMode.SIGN_ONLY;
                break;
                throw new IllegalStateException("This widget doesn't support sign-only state!");
            case OPPORTUNISTIC:
                currentMode = CryptoMode.OPPORTUNISTIC;
                break;
Loading