mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-11 11:35:07 -05:00
use usage argument if needed
This commit is contained in:
parent
fe3db8f0e6
commit
6d40bc3c0c
@ -146,7 +146,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValue(PGPSecretKey key, boolean isMasterKey, int usage) {
|
public void setValue(PGPSecretKey key, boolean isMasterKey, int usage, boolean isNewKey) {
|
||||||
mKey = key;
|
mKey = key;
|
||||||
|
|
||||||
mIsMasterKey = isMasterKey;
|
mIsMasterKey = isMasterKey;
|
||||||
@ -190,8 +190,10 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
|
|||||||
mChkSign.setChecked(PgpKeyHelper.isSigningKey(key));
|
mChkSign.setChecked(PgpKeyHelper.isSigningKey(key));
|
||||||
mChkEncrypt.setChecked(PgpKeyHelper.isEncryptionKey(key));
|
mChkEncrypt.setChecked(PgpKeyHelper.isEncryptionKey(key));
|
||||||
mChkAuthenticate.setChecked(PgpKeyHelper.isAuthenticationKey(key));
|
mChkAuthenticate.setChecked(PgpKeyHelper.isAuthenticationKey(key));
|
||||||
|
if (isNewKey)
|
||||||
|
mUsage = usage;
|
||||||
|
else
|
||||||
mUsage = PgpKeyHelper.getKeyUsage(key);
|
mUsage = PgpKeyHelper.getKeyUsage(key);
|
||||||
// TODO: use usage argument?
|
|
||||||
|
|
||||||
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
|
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
|
||||||
cal.setTime(PgpKeyHelper.getCreationDate(key));
|
cal.setTime(PgpKeyHelper.getCreationDate(key));
|
||||||
|
@ -272,7 +272,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
false);
|
false);
|
||||||
view.setEditorListener(this);
|
view.setEditorListener(this);
|
||||||
boolean isMasterKey = (mEditors.getChildCount() == 0);
|
boolean isMasterKey = (mEditors.getChildCount() == 0);
|
||||||
view.setValue(list.get(i), isMasterKey, usages.get(i));
|
view.setValue(list.get(i), isMasterKey, usages.get(i), false);
|
||||||
view.setCanEdit(canEdit);
|
view.setCanEdit(canEdit);
|
||||||
mEditors.addView(view);
|
mEditors.addView(view);
|
||||||
}
|
}
|
||||||
@ -344,7 +344,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
KeyEditor view = (KeyEditor) mInflater.inflate(R.layout.edit_key_key_item,
|
KeyEditor view = (KeyEditor) mInflater.inflate(R.layout.edit_key_key_item,
|
||||||
mEditors, false);
|
mEditors, false);
|
||||||
view.setEditorListener(SectionView.this);
|
view.setEditorListener(SectionView.this);
|
||||||
view.setValue(newKey, newKey.isMasterKey(), -1);
|
view.setValue(newKey, newKey.isMasterKey(), -1, true);
|
||||||
mEditors.addView(view);
|
mEditors.addView(view);
|
||||||
SectionView.this.updateEditorsVisible();
|
SectionView.this.updateEditorsVisible();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user