Fix export for new unified key list #409
This commit is contained in:
@@ -322,8 +322,10 @@ public class EditKeyActivity extends ActionBarActivity {
|
||||
cancelClicked();
|
||||
return true;
|
||||
case R.id.menu_key_edit_export_file:
|
||||
long[] ids = new long[]{Long.valueOf(mDataUri.getLastPathSegment())};
|
||||
mExportHelper.showExportKeysDialog(ids, Id.type.secret_key, Constants.Path.APP_DIR_FILE_SEC);
|
||||
long masterKeyId = ProviderHelper.getMasterKeyId(this, mDataUri);
|
||||
long[] ids = new long[]{masterKeyId};
|
||||
mExportHelper.showExportKeysDialog(ids, Id.type.secret_key, Constants.Path.APP_DIR_FILE_SEC,
|
||||
null);
|
||||
return true;
|
||||
case R.id.menu_key_edit_delete: {
|
||||
// Message is received after key is deleted
|
||||
|
||||
@@ -58,8 +58,7 @@ public class KeyListActivity extends DrawerActivity {
|
||||
|
||||
return true;
|
||||
case R.id.menu_key_list_export:
|
||||
// TODO fix this for unified keylist
|
||||
mExportHelper.showExportKeysDialog(null, Id.type.public_key, Constants.Path.APP_DIR_FILE_PUB);
|
||||
mExportHelper.showExportKeysDialog(null, Id.type.public_key, Constants.Path.APP_DIR_FILE_PUB, null);
|
||||
|
||||
return true;
|
||||
case R.id.menu_key_list_create:
|
||||
@@ -71,7 +70,7 @@ public class KeyListActivity extends DrawerActivity {
|
||||
|
||||
return true;
|
||||
case R.id.menu_key_list_secret_export:
|
||||
mExportHelper.showExportKeysDialog(null, Id.type.secret_key, Constants.Path.APP_DIR_FILE_SEC);
|
||||
mExportHelper.showExportKeysDialog(null, Id.type.secret_key, Constants.Path.APP_DIR_FILE_SEC, null);
|
||||
|
||||
return true;
|
||||
default:
|
||||
|
||||
@@ -49,6 +49,7 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyTypes;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainDatabase;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.HighlightQueryCursorAdapter;
|
||||
import org.sufficientlysecure.keychain.ui.dialog.DeleteKeyDialogFragment;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
@@ -183,13 +184,22 @@ public class KeyListFragment extends Fragment
|
||||
break;
|
||||
}
|
||||
case R.id.menu_key_list_multi_export: {
|
||||
// todo: public/secret needs to be handled differently here
|
||||
ids = mStickyList.getWrappedList().getCheckedItemIds();
|
||||
long[] masterKeyIds = new long[2*ids.length];
|
||||
ArrayList<Long> allPubRowIds =
|
||||
ProviderHelper.getPublicKeyRingsRowIds(getActivity());
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
if (allPubRowIds.contains(ids[i])) {
|
||||
masterKeyIds[i] = ProviderHelper.getPublicMasterKeyId(getActivity(), ids[i]);
|
||||
} else {
|
||||
masterKeyIds[i] = ProviderHelper.getSecretMasterKeyId(getActivity(), ids[i]);
|
||||
}
|
||||
}
|
||||
ExportHelper mExportHelper = new ExportHelper((ActionBarActivity) getActivity());
|
||||
mExportHelper
|
||||
.showExportKeysDialog(ids,
|
||||
Id.type.public_key,
|
||||
Constants.Path.APP_DIR_FILE_PUB);
|
||||
.showExportKeysDialog(masterKeyIds, Id.type.public_key,
|
||||
Constants.Path.APP_DIR_FILE_PUB,
|
||||
getString(R.string.also_export_secret_keys));
|
||||
break;
|
||||
}
|
||||
case R.id.menu_key_list_multi_select_all: {
|
||||
|
||||
@@ -124,8 +124,11 @@ public class ViewKeyActivity extends ActionBarActivity {
|
||||
uploadToKeyserver(mDataUri);
|
||||
return true;
|
||||
case R.id.menu_key_view_export_file:
|
||||
long[] ids = new long[]{Long.valueOf(mDataUri.getLastPathSegment())};
|
||||
mExportHelper.showExportKeysDialog(ids, Id.type.public_key, Constants.Path.APP_DIR_FILE_PUB);
|
||||
long masterKeyId =
|
||||
ProviderHelper.getPublicMasterKeyId(this, Long.valueOf(mDataUri.getLastPathSegment()));
|
||||
long[] ids = new long[]{masterKeyId};
|
||||
mExportHelper.showExportKeysDialog(ids, Id.type.public_key,
|
||||
Constants.Path.APP_DIR_FILE_PUB, null);
|
||||
return true;
|
||||
case R.id.menu_key_view_share_default_fingerprint:
|
||||
shareKey(mDataUri, true);
|
||||
|
||||
Reference in New Issue
Block a user