don't disable save button, show message if nothing needs to be done

This commit is contained in:
Ashley Hughes 2014-04-01 00:37:18 +01:00
parent 5bc902dbb1
commit 9283205ea8
2 changed files with 5 additions and 3 deletions

View File

@ -42,6 +42,8 @@ import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.Toast; import android.widget.Toast;
import com.beardedhen.androidbootstrap.BootstrapButton; import com.beardedhen.androidbootstrap.BootstrapButton;
import com.devspark.appmsg.AppMsg;
import org.spongycastle.openpgp.PGPSecretKey; import org.spongycastle.openpgp.PGPSecretKey;
import org.spongycastle.openpgp.PGPSecretKeyRing; import org.spongycastle.openpgp.PGPSecretKeyRing;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
@ -105,7 +107,6 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
private boolean mIsPassPhraseSet; private boolean mIsPassPhraseSet;
private boolean mNeedsSaving; private boolean mNeedsSaving;
private boolean mIsBrandNewKeyring = false; private boolean mIsBrandNewKeyring = false;
private MenuItem mSaveButton;
private BootstrapButton mChangePassphrase; private BootstrapButton mChangePassphrase;
@ -323,8 +324,6 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu); super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.key_edit, menu); getMenuInflater().inflate(R.menu.key_edit, menu);
mSaveButton = menu.findItem(R.id.menu_key_edit_save);
mSaveButton.setEnabled(needsSaving());
//totally get rid of some actions for new keys //totally get rid of some actions for new keys
if (mDataUri == null) { if (mDataUri == null) {
MenuItem mButton = menu.findItem(R.id.menu_key_edit_export_file); MenuItem mButton = menu.findItem(R.id.menu_key_edit_export_file);
@ -569,6 +568,8 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
Toast.makeText(this, getString(R.string.error_message, e.getMessage()), Toast.makeText(this, getString(R.string.error_message, e.getMessage()),
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
} }
} else {
AppMsg.makeText(this, R.string.error_change_something_first, AppMsg.STYLE_ALERT).show();
} }
} }

View File

@ -327,6 +327,7 @@
<item quantity="one">part of the loaded file is a valid OpenPGP object but not a OpenPGP key</item> <item quantity="one">part of the loaded file is a valid OpenPGP object but not a OpenPGP key</item>
<item quantity="other">parts of the loaded file are valid OpenPGP objects but not OpenPGP keys</item> <item quantity="other">parts of the loaded file are valid OpenPGP objects but not OpenPGP keys</item>
</plurals> </plurals>
<string name="error_change_something_first">You must make changes to the keyring before you can save it</string>
<!-- progress dialogs, usually ending in '…' --> <!-- progress dialogs, usually ending in '…' -->
<string name="progress_done">Done.</string> <string name="progress_done">Done.</string>