aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThialfihar <thialfihar@gmail.com>2010-07-24 18:54:40 +0000
committerThialfihar <thialfihar@gmail.com>2010-07-24 18:54:40 +0000
commit46fb6fc61343c8a9740d38736f81c890948bd88d (patch)
tree8bfff2d547c6f8ed2871e6e495fbf8fec7ad34ac /src
parentf65888046e29ea07dea2616b3b0d3c16068524cc (diff)
downloadopen-keychain-46fb6fc61343c8a9740d38736f81c890948bd88d.tar.gz
open-keychain-46fb6fc61343c8a9740d38736f81c890948bd88d.tar.bz2
open-keychain-46fb6fc61343c8a9740d38736f81c890948bd88d.zip
change the text of encrypt buttons according to selected signature or keys, making sign-only less confusing
Update issue 39 New strings to give the encrypt buttons more meaningful and fitting texts: <string name="btn_signToClipboard">Sign To Clipboard</string> <string name="btn_signAndEmail">Sign And Email</string> <string name="btn_sign">Sign</string>
Diffstat (limited to 'src')
-rw-r--r--src/org/thialfihar/android/apg/EncryptActivity.java79
1 files changed, 70 insertions, 9 deletions
diff --git a/src/org/thialfihar/android/apg/EncryptActivity.java b/src/org/thialfihar/android/apg/EncryptActivity.java
index 5d69d8563..a42cc66c1 100644
--- a/src/org/thialfihar/android/apg/EncryptActivity.java
+++ b/src/org/thialfihar/android/apg/EncryptActivity.java
@@ -376,12 +376,10 @@ public class EncryptActivity extends BaseActivity {
mSourceLabel.setClickable(false);
mSourceLabel.setEnabled(false);
-
- mEncryptToClipboardButton.setEnabled(false);
- mEncryptToClipboardButton.setVisibility(View.INVISIBLE);
- mEncryptButton.setText(R.string.btn_encrypt);
}
+ updateButtons();
+
if (mReturnResult &&
mMessage.getText().length() > 0 &&
((mEncryptionKeyIds != null &&
@@ -419,17 +417,77 @@ public class EncryptActivity extends BaseActivity {
switch (mSource.getCurrentView().getId()) {
case R.id.sourceFile: {
mSourceLabel.setText(R.string.label_file);
- mEncryptButton.setText(R.string.btn_encrypt);
- mEncryptToClipboardButton.setEnabled(false);
+ break;
+ }
+
+ case R.id.sourceMessage: {
+ mSourceLabel.setText(R.string.label_message);
+ break;
+ }
+
+ default: {
+ break;
+ }
+ }
+ updateButtons();
+ }
+
+ private void updateButtons() {
+ switch (mSource.getCurrentView().getId()) {
+ case R.id.sourceFile: {
mEncryptToClipboardButton.setVisibility(View.INVISIBLE);
+ mEncryptButton.setText(R.string.btn_encrypt);
break;
}
case R.id.sourceMessage: {
mSourceLabel.setText(R.string.label_message);
- mEncryptButton.setText(R.string.btn_send);
- mEncryptToClipboardButton.setEnabled(true);
- mEncryptToClipboardButton.setVisibility(View.VISIBLE);
+ if (mReturnResult) {
+ mEncryptToClipboardButton.setVisibility(View.INVISIBLE);
+ } else {
+ mEncryptToClipboardButton.setVisibility(View.VISIBLE);
+ }
+ if (mMode.getCurrentView().getId() == R.id.modeSymmetric) {
+ if (mReturnResult) {
+ mEncryptButton.setText(R.string.btn_encrypt);
+ } else {
+ mEncryptButton.setText(R.string.btn_encryptAndEmail);
+ }
+ mEncryptButton.setEnabled(true);
+ mEncryptToClipboardButton.setText(R.string.btn_encryptToClipboard);
+ mEncryptToClipboardButton.setEnabled(true);
+ } else {
+ if (mEncryptionKeyIds == null || mEncryptionKeyIds.length == 0) {
+ if (getSecretKeyId() == 0) {
+ if (mReturnResult) {
+ mEncryptButton.setText(R.string.btn_encrypt);
+ } else {
+ mEncryptButton.setText(R.string.btn_encryptAndEmail);
+ }
+ mEncryptButton.setEnabled(false);
+ mEncryptToClipboardButton.setText(R.string.btn_encryptToClipboard);
+ mEncryptToClipboardButton.setEnabled(false);
+ } else {
+ if (mReturnResult) {
+ mEncryptButton.setText(R.string.btn_sign);
+ } else {
+ mEncryptButton.setText(R.string.btn_signAndEmail);
+ }
+ mEncryptButton.setEnabled(true);
+ mEncryptToClipboardButton.setText(R.string.btn_signToClipboard);
+ mEncryptToClipboardButton.setEnabled(true);
+ }
+ } else {
+ if (mReturnResult) {
+ mEncryptButton.setText(R.string.btn_encrypt);
+ } else {
+ mEncryptButton.setText(R.string.btn_encryptAndEmail);
+ }
+ mEncryptButton.setEnabled(true);
+ mEncryptToClipboardButton.setText(R.string.btn_encryptToClipboard);
+ mEncryptToClipboardButton.setEnabled(true);
+ }
+ }
break;
}
@@ -455,6 +513,7 @@ public class EncryptActivity extends BaseActivity {
break;
}
}
+ updateButtons();
}
private void encryptToClipboardClicked() {
@@ -679,6 +738,8 @@ public class EncryptActivity extends BaseActivity {
mMainUserIdRest.setText(uidExtra);
mSign.setChecked(true);
}
+
+ updateButtons();
}
private void selectPublicKeys() {