Fixed issues discussed in #713

This commit is contained in:
Daniel Albert 2014-07-12 18:12:03 +02:00
parent 7a3fe61a1f
commit 079194abe5
3 changed files with 15 additions and 14 deletions

View File

@ -60,8 +60,8 @@ public class PassphraseCacheService extends Service {
+ "PASSPHRASE_CACHE_ADD";
public static final String ACTION_PASSPHRASE_CACHE_GET = Constants.INTENT_PREFIX
+ "PASSPHRASE_CACHE_GET";
public static final String ACTION_PASSPHRASE_CACHE_PURGE = Constants.INTENT_PREFIX
+ "PASSPHRASE_CACHE_PURGE";
public static final String ACTION_PASSPHRASE_CACHE_CLEAR = Constants.INTENT_PREFIX
+ "PASSPHRASE_CACHE_CLEAR";
public static final String BROADCAST_ACTION_PASSPHRASE_CACHE_SERVICE = Constants.INTENT_PREFIX
+ "PASSPHRASE_CACHE_BROADCAST";
@ -177,7 +177,7 @@ public class PassphraseCacheService extends Service {
if (cachedPassphrase == null) {
return null;
}
addCachedPassphrase(this, Constants.key.symmetric, cachedPassphrase, "Password");
addCachedPassphrase(this, Constants.key.symmetric, cachedPassphrase, getString(R.string.passp_cache_notif_pwd));
return cachedPassphrase;
}
@ -309,7 +309,7 @@ public class PassphraseCacheService extends Service {
} catch (RemoteException e) {
Log.e(Constants.TAG, "PassphraseCacheService Sending message failed", e);
}
} else if (ACTION_PASSPHRASE_CACHE_PURGE.equals(intent.getAction())) {
} else if (ACTION_PASSPHRASE_CACHE_CLEAR.equals(intent.getAction())) {
AlarmManager am = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
// Stop all ttl alarms
@ -375,10 +375,10 @@ public class PassphraseCacheService extends Service {
// Add purging action
Intent intent = new Intent(getApplicationContext(), PassphraseCacheService.class);
intent.setAction(ACTION_PASSPHRASE_CACHE_PURGE);
intent.setAction(ACTION_PASSPHRASE_CACHE_CLEAR);
builder.addAction(
R.drawable.abc_ic_clear_normal,
getString(R.string.passp_cache_notif_purge),
getString(R.string.passp_cache_notif_clear),
PendingIntent.getService(
getApplicationContext(),
0,
@ -393,10 +393,10 @@ public class PassphraseCacheService extends Service {
builder.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle(String.format(getString(R.string.passp_cache_notif_n_keys, mPassphraseCache.size())))
.setContentText(getString(R.string.passp_cache_notif_click_to_purge));
.setContentText(getString(R.string.passp_cache_notif_click_to_clear));
Intent intent = new Intent(getApplicationContext(), PassphraseCacheService.class);
intent.setAction(ACTION_PASSPHRASE_CACHE_PURGE);
intent.setAction(ACTION_PASSPHRASE_CACHE_CLEAR);
builder.setContentIntent(
PendingIntent.getService(
@ -444,8 +444,8 @@ public class PassphraseCacheService extends Service {
private final IBinder mBinder = new PassphraseCacheBinder();
public class CachedPassphrase {
private String primaryUserID = "";
private String passphrase = "";
private String primaryUserID;
private String passphrase;
public CachedPassphrase(String passphrase, String primaryUserID) {
setPassphrase(passphrase);

View File

@ -190,7 +190,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
// Early breakout if we are dealing with a symmetric key
if (secretRing == null) {
PassphraseCacheService.addCachedPassphrase(activity, Constants.key.symmetric,
passphrase, "Password");
passphrase, getString(R.string.passp_cache_notif_pwd));
// also return passphrase back to activity
Bundle data = new Bundle();
data.putString(MESSAGE_DATA_PASSPHRASE, passphrase);
@ -234,7 +234,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
PassphraseCacheService.addCachedPassphrase(activity, masterKeyId, passphrase,
secretRing.getPrimaryUserId());
} catch(PgpGeneralException e) {
Log.e(Constants.TAG, e.getMessage());
Log.e(Constants.TAG, "adding of a passhrase failed", e);
}
if (unlockedSecretKey.getKeyId() != masterKeyId) {

View File

@ -661,10 +661,11 @@
<string name="msg_mf_unlock">Unlocking keyring</string>
<!-- PassphraseCache -->
<string name="passp_cache_notif_click_to_purge">Click to purge cached passphrases</string>
<string name="passp_cache_notif_click_to_clear">Click to clear cached passphrases</string>
<string name="passp_cache_notif_n_keys">OpenKeychain has cached %i keys</string>
<string name="passp_cache_notif_keys">Cached Keys:</string>
<string name="passp_cache_notif_purge">Purge Cache</string>
<string name="passp_cache_notif_clear">Clear Cache</string>
<string name="passp_cache_notif_pwd">Password</string>
<!-- unsorted -->
<string name="section_certifier_id">Certifier</string>