aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2014-04-03 15:45:21 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2014-04-03 15:45:21 +0200
commit270c7ffa1fb3c796449eac832e6d4795b6e40fd3 (patch)
treeaa90aa34fe5d294eaa19954c5222841bae3c06ed /OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
parent098823bd525bdbf215060dba1ed248af853bbfac (diff)
parent34fca975d764cfdda61ae30c31fbb0ce81807df6 (diff)
downloadopen-keychain-270c7ffa1fb3c796449eac832e6d4795b6e40fd3.tar.gz
open-keychain-270c7ffa1fb3c796449eac832e6d4795b6e40fd3.tar.bz2
open-keychain-270c7ffa1fb3c796449eac832e6d4795b6e40fd3.zip
Merge branch 'db-overhaul' of git://github.com/Valodim/openpgp-keychain into Valodim-db-overhaul
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java')
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java36
1 files changed, 18 insertions, 18 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
index 1428a51f5..6dec5e56e 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
@@ -199,7 +199,8 @@ public class KeyListFragment extends Fragment
}
case R.id.menu_key_list_multi_export: {
ids = mStickyList.getWrappedList().getCheckedItemIds();
- long[] masterKeyIds = new long[2 * ids.length];
+ long[] masterKeyIds = new long[2*ids.length];
+ /* TODO! redo
ArrayList<Long> allPubRowIds =
ProviderHelper.getPublicKeyRingsRowIds(getActivity());
for (int i = 0; i < ids.length; i++) {
@@ -210,9 +211,8 @@ public class KeyListFragment extends Fragment
masterKeyIds[i] =
ProviderHelper.getSecretMasterKeyId(getActivity(), ids[i]);
}
- }
- ExportHelper mExportHelper =
- new ExportHelper((ActionBarActivity) getActivity());
+ }*/
+ ExportHelper mExportHelper = new ExportHelper((ActionBarActivity) getActivity());
mExportHelper
.showExportKeysDialog(masterKeyIds, Id.type.public_key,
Constants.Path.APP_DIR_FILE_PUB,
@@ -271,22 +271,22 @@ public class KeyListFragment extends Fragment
// These are the rows that we will retrieve.
static final String[] PROJECTION = new String[]{
KeychainContract.KeyRings._ID,
- KeychainContract.KeyRings.TYPE,
- KeychainContract.KeyRings.MASTER_KEY_ID,
+ KeychainContract.Keys.MASTER_KEY_ID,
KeychainContract.UserIds.USER_ID,
- KeychainContract.Keys.IS_REVOKED
+ KeychainContract.Keys.IS_REVOKED,
+ KeychainDatabase.Tables.KEY_RINGS_SECRET + "." + KeychainContract.KeyRings.MASTER_KEY_ID
};
- static final int INDEX_TYPE = 1;
- static final int INDEX_MASTER_KEY_ID = 2;
- static final int INDEX_USER_ID = 3;
- static final int INDEX_IS_REVOKED = 4;
+ static final int INDEX_MASTER_KEY_ID = 1;
+ static final int INDEX_USER_ID = 2;
+ static final int INDEX_IS_REVOKED = 3;
+ static final int INDEX_HAS_SECRET = 4;
static final String SORT_ORDER =
// show secret before public key
- KeychainDatabase.Tables.KEY_RINGS + "." + KeyRings.TYPE + " DESC, "
+ KeychainDatabase.Tables.KEY_RINGS_SECRET + "." + KeychainContract.KeyRings.MASTER_KEY_ID + " IS NULL ASC, " +
// sort by user id otherwise
- + UserIds.USER_ID + " ASC";
+ UserIds.USER_ID + " ASC";
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
@@ -343,7 +343,7 @@ public class KeyListFragment extends Fragment
}
viewIntent.setData(
KeychainContract
- .KeyRings.buildPublicKeyRingsByMasterKeyIdUri(
+ .KeyRings.buildPublicKeyRingUri(
Long.toString(mAdapter.getMasterKeyId(position))));
startActivity(viewIntent);
}
@@ -520,7 +520,7 @@ public class KeyListFragment extends Fragment
Button button = (Button) view.findViewById(R.id.edit);
TextView revoked = (TextView) view.findViewById(R.id.revoked);
- if (cursor.getInt(KeyListFragment.INDEX_TYPE) == KeyTypes.SECRET) {
+ if (!cursor.isNull(KeyListFragment.INDEX_HAS_SECRET)) {
// this is a secret key - show the edit button
statusDivider.setVisibility(View.VISIBLE);
statusLayout.setVisibility(View.VISIBLE);
@@ -533,7 +533,7 @@ public class KeyListFragment extends Fragment
Intent editIntent = new Intent(getActivity(), EditKeyActivity.class);
editIntent.setData(
KeychainContract.KeyRings
- .buildSecretKeyRingsByMasterKeyIdUri(Long.toString(id)));
+ .buildSecretKeyRingUri(Long.toString(id)));
editIntent.setAction(EditKeyActivity.ACTION_EDIT_KEY);
startActivityForResult(editIntent, 0);
}
@@ -594,7 +594,7 @@ public class KeyListFragment extends Fragment
throw new IllegalStateException("couldn't move cursor to position " + position);
}
- if (mCursor.getInt(KeyListFragment.INDEX_TYPE) == KeyTypes.SECRET) {
+ if (!mCursor.isNull(KeyListFragment.INDEX_HAS_SECRET)) {
{ // set contact count
int num = mCursor.getCount();
String contactsTotal = getResources().getQuantityString(R.plurals.n_contacts, num, num);
@@ -634,7 +634,7 @@ public class KeyListFragment extends Fragment
}
// early breakout: all secret keys are assigned id 0
- if (mCursor.getInt(KeyListFragment.INDEX_TYPE) == KeyTypes.SECRET) {
+ if (!mCursor.isNull(KeyListFragment.INDEX_HAS_SECRET)) {
return 1L;
}
// otherwise, return the first character of the name as ID