mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-05 08:45:08 -05:00
edit key: work on saving
This commit is contained in:
parent
a66c6b5b7a
commit
3d34eb8ca4
@ -328,8 +328,6 @@ public class EditKeyFragment extends LoaderFragment implements
|
||||
}
|
||||
|
||||
private void save() {
|
||||
Log.d(Constants.TAG, "data: " + mUserIdsAddedAdapter.getDataAsStringList());
|
||||
|
||||
String passphrase = PassphraseCacheService.getCachedPassphrase(getActivity(),
|
||||
mSaveKeyringParcel.mMasterKeyId);
|
||||
if (passphrase == null) {
|
||||
@ -338,17 +336,23 @@ public class EditKeyFragment extends LoaderFragment implements
|
||||
@Override
|
||||
public void handleMessage(Message message) {
|
||||
if (message.what == PassphraseDialogFragment.MESSAGE_OKAY) {
|
||||
saveFinal();
|
||||
String passphrase =
|
||||
message.getData().getString(PassphraseDialogFragment.MESSAGE_DATA_PASSPHRASE);
|
||||
Log.d(Constants.TAG, "after caching passphrase");
|
||||
saveFinal(passphrase);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
} else {
|
||||
saveFinal(passphrase);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private void saveFinal(String passphrase) {
|
||||
Log.d(Constants.TAG, "add userids to parcel: " + mUserIdsAddedAdapter.getDataAsStringList());
|
||||
mSaveKeyringParcel.addUserIds = mUserIdsAddedAdapter.getDataAsStringList();
|
||||
|
||||
private void saveFinal() {
|
||||
// Message is received after importing is done in KeychainIntentService
|
||||
KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(
|
||||
getActivity(),
|
||||
@ -386,6 +390,7 @@ public class EditKeyFragment extends LoaderFragment implements
|
||||
|
||||
// fill values for this action
|
||||
Bundle data = new Bundle();
|
||||
data.putString(KeychainIntentService.SAVE_KEYRING_PASSPHRASE, passphrase);
|
||||
data.putParcelable(KeychainIntentService.SAVE_KEYRING_PARCEL, mSaveKeyringParcel);
|
||||
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
|
||||
|
||||
|
@ -439,7 +439,6 @@ public class KeyListFragment extends LoaderFragment
|
||||
private class ItemViewHolder {
|
||||
TextView mMainUserId;
|
||||
TextView mMainUserIdRest;
|
||||
View mStatusDivider;
|
||||
FrameLayout mStatusLayout;
|
||||
TextView mRevoked;
|
||||
ImageView mVerified;
|
||||
@ -451,7 +450,6 @@ public class KeyListFragment extends LoaderFragment
|
||||
ItemViewHolder holder = new ItemViewHolder();
|
||||
holder.mMainUserId = (TextView) view.findViewById(R.id.mainUserId);
|
||||
holder.mMainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest);
|
||||
holder.mStatusDivider = (View) view.findViewById(R.id.status_divider);
|
||||
holder.mStatusLayout = (FrameLayout) view.findViewById(R.id.status_layout);
|
||||
holder.mRevoked = (TextView) view.findViewById(R.id.revoked);
|
||||
holder.mVerified = (ImageView) view.findViewById(R.id.verified);
|
||||
@ -489,14 +487,12 @@ public class KeyListFragment extends LoaderFragment
|
||||
{ // set edit button and revoked info, specific by key type
|
||||
|
||||
if (cursor.getInt(KeyListFragment.INDEX_HAS_ANY_SECRET) != 0) {
|
||||
// this is a secret key - show the edit mButton
|
||||
h.mStatusDivider.setVisibility(View.VISIBLE);
|
||||
// this is a secret key
|
||||
h.mStatusLayout.setVisibility(View.VISIBLE);
|
||||
h.mRevoked.setVisibility(View.GONE);
|
||||
h.mVerified.setVisibility(View.GONE);
|
||||
} else {
|
||||
// this is a public key - hide the edit mButton, show if it's revoked
|
||||
h.mStatusDivider.setVisibility(View.GONE);
|
||||
// this is a public key - show if it's revoked
|
||||
|
||||
boolean isRevoked = cursor.getInt(INDEX_IS_REVOKED) > 0;
|
||||
boolean isExpired = !cursor.isNull(INDEX_EXPIRY)
|
||||
|
@ -55,16 +55,13 @@ public class UserIdsAddedAdapter extends ArrayAdapter<UserIdsAddedAdapter.UserId
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String userId = null;
|
||||
if (!TextUtils.isEmpty(name)) {
|
||||
userId = name;
|
||||
String userId = name;
|
||||
if (!TextUtils.isEmpty(comment)) {
|
||||
userId += " (" + comment + ")";
|
||||
}
|
||||
if (!TextUtils.isEmpty(address)) {
|
||||
userId += " <" + address + ">";
|
||||
}
|
||||
}
|
||||
return userId;
|
||||
}
|
||||
}
|
||||
@ -84,11 +81,14 @@ public class UserIdsAddedAdapter extends ArrayAdapter<UserIdsAddedAdapter.UserId
|
||||
);
|
||||
}
|
||||
|
||||
public List<String> getDataAsStringList() {
|
||||
public ArrayList<String> getDataAsStringList() {
|
||||
ArrayList<String> out = new ArrayList<String>();
|
||||
for (UserIdModel id : mData) {
|
||||
// ignore empty user ids
|
||||
if (!TextUtils.isEmpty(id.toString())) {
|
||||
out.add(id.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
@ -38,14 +38,6 @@
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/status_divider"
|
||||
android:layout_width="1dip"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="?android:attr/listDivider" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/status_layout"
|
||||
android:layout_width="wrap_content"
|
||||
|
Loading…
Reference in New Issue
Block a user