aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain/src/main/java
diff options
context:
space:
mode:
authorAshley Hughes <spirit.returned@gmail.com>2014-02-14 17:40:11 +0000
committerAshley Hughes <spirit.returned@gmail.com>2014-02-14 17:40:11 +0000
commitba62d30563ee5dd316528decd272f1bbdcbee5bd (patch)
tree34d8a70c8ff832eb528b6cf3fcf2002ae341aff9 /OpenPGP-Keychain/src/main/java
parent076a7ec4a16a6db5df0bbe5490d44cbd514f10c1 (diff)
downloadopen-keychain-ba62d30563ee5dd316528decd272f1bbdcbee5bd.tar.gz
open-keychain-ba62d30563ee5dd316528decd272f1bbdcbee5bd.tar.bz2
open-keychain-ba62d30563ee5dd316528decd272f1bbdcbee5bd.zip
propgate through
Diffstat (limited to 'OpenPGP-Keychain/src/main/java')
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java7
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java29
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/UserIdEditor.java7
3 files changed, 33 insertions, 10 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java
index 5adb65342..9ebe73197 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java
@@ -586,9 +586,10 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
getKeysExpiryDates(mKeysView));
data.putLong(KeychainIntentService.SAVE_KEYRING_MASTER_KEY_ID, getMasterKeyId());
data.putBoolean(KeychainIntentService.SAVE_KEYRING_CAN_SIGN, masterCanSign);
- data.putStringArrayList(KeychainIntentService.SAVE_KEYRING_ORIGINAL_IDS, );
- data.putBooleanArray(KeychainIntentService.SAVE_KEYRING_ORIGINAL_IDS,
- toPrimitiveArray(mUserIdsView.getNeedsSavingArray()));
+ data.putStringArrayList(KeychainIntentService.SAVE_KEYRING_DELETED_IDS,
+ mUserIdsView.getDeletedIDs());
+ data.putStringArrayList(KeychainIntentService.SAVE_KEYRING_ORIGINAL_IDS,
+ mUserIdsView.getOriginalIDs());
data.putBooleanArray(KeychainIntentService.SAVE_KEYRING_MODDED_KEYS,
toPrimitiveArray(mKeysView.getNeedsSavingArray()));
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java
index 5eaf54841..788a80a60 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java
@@ -65,6 +65,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
private int mNewKeySize;
private boolean canEdit = true;
private boolean oldItemDeleted = false;
+ private ArrayList<String> mDeletedIDs = new ArrayList<String>();
private ActionBarActivity mActivity;
@@ -135,6 +136,8 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
/** {@inheritDoc} */
public void onDeleted(Editor editor, boolean wasNewItem) {
oldItemDeleted |= !wasNewItem;
+ if (oldItemDeleted && mType == Id.type.user_id)
+ mDeletedIDs.add(((UserIdEditor)editor).getOriginalID());
this.updateEditorsVisible();
if (mEditorListener != null) {
mEditorListener.onEdited();
@@ -164,18 +167,30 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
return ret;
}
+ public ArrayList<String> getOriginalIDs()
+ {
+ ArrayList<String> orig = new ArrayList<String>();
+ if (mType == Id.type.user_id) {
+ for (int i = 0; i < mEditors.getChildCount(); ++i) {
+ UserIdEditor editor = (UserIdEditor) mEditors.getChildAt(i);
+ orig.add(editor.getOriginalID());
+ }
+ return orig;
+ } else {
+ return null;
+ }
+ }
+
+ public ArrayList<String> getDeletedIDs()
+ {
+ return mDeletedIDs;
+ }
+
public List<Boolean> getNeedsSavingArray()
{
ArrayList<Boolean> mList = new ArrayList<Boolean>();
for (int i = 0; i < mEditors.getChildCount(); ++i) {
Editor editor = (Editor) mEditors.getChildAt(i);
- if (mType == Id.type.user_id) {
- try {
- if (((UserIdEditor)editor).getValue().equals("")) //other code ignores empty user id
- continue;
- } catch (UserIdEditor.InvalidEmailException e) {
- }
- }
mList.add(editor.needsSaving());
}
return mList;
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/UserIdEditor.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/UserIdEditor.java
index b499a429a..37ab0e051 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/UserIdEditor.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/UserIdEditor.java
@@ -40,6 +40,7 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
private BootstrapButton mDeleteButton;
private RadioButton mIsMainUserId;
+ private String mOriginalID;
private EditText mName;
private String mOriginalName;
private EditText mEmail;
@@ -130,6 +131,7 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
mEmail.setText("");
mOriginalEmail = "";
mIsNewId = isNewId;
+ mOriginalID = userId;
String[] result = PgpKeyHelper.splitUserId(userId);
if (result[0] != null) {
@@ -226,4 +228,9 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
retval |= mIsNewId;
return retval;
}
+
+ public String getOriginalID()
+ {
+ return mOriginalID;
+ }
}