From 160e6972d8366e4b0b8d72fa838434629588c930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 5 Aug 2014 17:25:22 +0200 Subject: [PATCH] Create key: make single user id primary user id, other cleanup --- .../keychain/service/SaveKeyringParcel.java | 1 + .../keychain/ui/CreateKeyFinalFragment.java | 1 + .../ui/dialog/EditSubkeyExpiryDialogFragment.java | 11 +++++------ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java index abc377b7e..442746feb 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java @@ -207,6 +207,7 @@ public class SaveKeyringParcel implements Parcelable { public String toString() { String out = "mMasterKeyId: " + mMasterKeyId + "\n"; out += "mNewPassphrase: " + mNewPassphrase + "\n"; + out += "mAddUserIds: " + mAddUserIds + "\n"; out += "mAddSubKeys: " + mAddSubKeys + "\n"; out += "mChangeSubKeys: " + mChangeSubKeys + "\n"; out += "mChangePrimaryUserId: " + mChangePrimaryUserId + "\n"; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java index 662ba4ce1..abbc3f199 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java @@ -174,6 +174,7 @@ public class CreateKeyFinalFragment extends Fragment { parcel.mAddSubKeys.add(new SaveKeyringParcel.SubkeyAdd(Constants.choice.algorithm.rsa, 4096, KeyFlags.ENCRYPT_COMMS | KeyFlags.ENCRYPT_STORAGE, null)); String userId = KeyRing.createUserId(mName, mEmail, null); parcel.mAddUserIds.add(userId); + parcel.mChangePrimaryUserId = userId; parcel.mNewPassphrase = mPassphrase; // get selected key entries diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/EditSubkeyExpiryDialogFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/EditSubkeyExpiryDialogFragment.java index 1712b922f..8482c0b37 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/EditSubkeyExpiryDialogFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/EditSubkeyExpiryDialogFragment.java @@ -48,7 +48,6 @@ public class EditSubkeyExpiryDialogFragment extends DialogFragment { public static final String MESSAGE_DATA_EXPIRY_DATE = "expiry_date"; private Messenger mMessenger; - private Calendar mCreationCal; private Calendar mExpiryCal; private DatePicker mDatePicker; @@ -79,8 +78,8 @@ public class EditSubkeyExpiryDialogFragment extends DialogFragment { Date creationDate = new Date(getArguments().getLong(ARG_CREATION_DATE) * 1000); Date expiryDate = new Date(getArguments().getLong(ARG_EXPIRY_DATE) * 1000); - mCreationCal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); - mCreationCal.setTime(creationDate); + Calendar creationCal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); + creationCal.setTime(creationDate); mExpiryCal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); mExpiryCal.setTime(expiryDate); @@ -101,11 +100,11 @@ public class EditSubkeyExpiryDialogFragment extends DialogFragment { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { // will crash with IllegalArgumentException if we set a min date // that is not before expiry - if (mCreationCal != null && mCreationCal.before(mExpiryCal)) { - mDatePicker.setMinDate(mCreationCal.getTime().getTime() + if (creationCal.before(mExpiryCal)) { + mDatePicker.setMinDate(creationCal.getTime().getTime() + DateUtils.DAY_IN_MILLIS); } else { - // When created date isn't available + // when creation date isn't available mDatePicker.setMinDate(mExpiryCal.getTime().getTime() + DateUtils.DAY_IN_MILLIS); }