diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-04-06 17:40:16 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-04-06 17:40:16 +0200 |
commit | 834eb41932e87e340c7b4599dcedc5cfe356e167 (patch) | |
tree | 2eb8639bdfeaefb4359dcf6f7c2b6fbaf69d28b0 /OpenKeychain/src/main/java | |
parent | 454b9baf11f0bf551bc3444607fe006103810858 (diff) | |
parent | eb860212342ef9cef6a7265a7f9cc75a513dcb2f (diff) | |
download | open-keychain-834eb41932e87e340c7b4599dcedc5cfe356e167.tar.gz open-keychain-834eb41932e87e340c7b4599dcedc5cfe356e167.tar.bz2 open-keychain-834eb41932e87e340c7b4599dcedc5cfe356e167.zip |
Merge branch 'master' of github.com:open-keychain/open-keychain
Diffstat (limited to 'OpenKeychain/src/main/java')
3 files changed, 13 insertions, 13 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainDatabase.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainDatabase.java index 8674ad94b..3226d2d0b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainDatabase.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainDatabase.java @@ -179,7 +179,6 @@ public class KeychainDatabase extends SQLiteOpenHelper { // Enable foreign key constraints db.execSQL("PRAGMA foreign_keys=ON;"); // TODO remove, once we remove the "always migrate" debug stuff - // db.execSQL("DROP TABLE certs;"); // db.execSQL("DROP TABLE user_ids;"); db.execSQL(CREATE_USER_IDS); db.execSQL(CREATE_CERTS); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java index 5e6d37237..f39368e19 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java @@ -207,17 +207,12 @@ public class ProviderHelper { Log.e(Constants.TAG, "Key could not be deleted! Maybe we are creating a new one!", e); } + // insert new version of this keyRing ContentValues values = new ContentValues(); - // use exactly the same _ID again to replace key in-place. - // NOTE: If we would not use the same _ID again, - // getting back to the ViewKeyActivity would result in Nullpointer, - // because the currently loaded key would be gone from the database values.put(KeyRingData.MASTER_KEY_ID, masterKeyId); values.put(KeyRingData.KEY_RING_DATA, keyRing.getEncoded()); - - // insert new version of this keyRing Uri uri = KeyRingData.buildPublicKeyRingUri(Long.toString(masterKeyId)); - Uri insertedUri = context.getContentResolver().insert(uri, values); + context.getContentResolver().insert(uri, values); // save all keys and userIds included in keyRing object in database ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>(); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java index 3e2c96464..03a8413d4 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java @@ -68,6 +68,7 @@ import se.emilsjolander.stickylistheaders.ApiLevelTooLowException; import se.emilsjolander.stickylistheaders.StickyListHeadersAdapter; import se.emilsjolander.stickylistheaders.StickyListHeadersListView; +import java.util.Date; import java.util.HashMap; /** @@ -252,6 +253,7 @@ public class KeyListFragment extends Fragment KeyRings.MASTER_KEY_ID, KeyRings.USER_ID, KeyRings.IS_REVOKED, + KeyRings.EXPIRY, KeyRings.VERIFIED, KeyRings.HAS_SECRET }; @@ -259,8 +261,9 @@ public class KeyListFragment extends Fragment 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_VERIFIED = 4; - static final int INDEX_HAS_SECRET = 5; + static final int INDEX_EXPIRY = 4; + static final int INDEX_VERIFIED = 5; + static final int INDEX_HAS_SECRET = 6; @Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { @@ -519,10 +522,13 @@ public class KeyListFragment extends Fragment button.setVisibility(View.GONE); boolean isRevoked = cursor.getInt(INDEX_IS_REVOKED) > 0; - if(isRevoked) { - statusLayout.setVisibility(isRevoked ? View.VISIBLE : View.GONE); - revoked.setVisibility(isRevoked ? View.VISIBLE : View.GONE); + boolean isExpired = !cursor.isNull(INDEX_EXPIRY) + && new Date(cursor.getLong(INDEX_EXPIRY)*1000).before(new Date()); + if(isRevoked || isExpired) { + statusLayout.setVisibility(View.VISIBLE); + revoked.setVisibility(View.VISIBLE); verified.setVisibility(View.GONE); + revoked.setText(isRevoked ? R.string.revoked : R.string.expired); } else { boolean isVerified = cursor.getInt(INDEX_VERIFIED) > 0; statusLayout.setVisibility(isVerified ? View.VISIBLE : View.GONE); |