remove useless and confusing option from the preferences

This commit is contained in:
Mohamed Zenadi 2016-12-11 17:32:53 +01:00
parent 737d281927
commit 5644c06f2a
3 changed files with 14 additions and 28 deletions

View file

@ -415,6 +415,20 @@ public class PasswordStore extends AppCompatActivity {
return; return;
} }
if (settings.getStringSet("openpgp_key_ids_set", new HashSet<String>()).isEmpty()) {
new AlertDialog.Builder(this)
.setTitle("OpenPGP key not selected")
.setMessage("We will redirect you to settings. Please select your OpenPGP Key.")
.setPositiveButton(this.getResources().getString(R.string.dialog_ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Intent intent = new Intent(activity, UserPreference.class);
startActivity(intent);
}
}).show();
return;
}
this.currentDir = getCurrentDir(); this.currentDir = getCurrentDir();
Log.i("PWDSTR", "Adding file to : " + this.currentDir.getAbsolutePath()); Log.i("PWDSTR", "Adding file to : " + this.currentDir.getAbsolutePath());

View file

@ -40,7 +40,6 @@ import com.zeapo.pwdstore.utils.PasswordRepository;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.openintents.openpgp.util.OpenPgpKeyPreference;
import org.openintents.openpgp.util.OpenPgpUtils; import org.openintents.openpgp.util.OpenPgpUtils;
import java.io.File; import java.io.File;
@ -54,7 +53,6 @@ public class UserPreference extends AppCompatActivity {
private final static int IMPORT_SSH_KEY = 1; private final static int IMPORT_SSH_KEY = 1;
private final static int IMPORT_PGP_KEY = 2; private final static int IMPORT_PGP_KEY = 2;
private final static int EDIT_GIT_INFO = 3; private final static int EDIT_GIT_INFO = 3;
private OpenPgpKeyPreference mKey;
private final static int SELECT_GIT_DIRECTORY = 4; private final static int SELECT_GIT_DIRECTORY = 4;
private final static int REQUEST_EXTERNAL_STORAGE = 50; private final static int REQUEST_EXTERNAL_STORAGE = 50;
private PrefsFragment prefsFragment; private PrefsFragment prefsFragment;
@ -151,20 +149,6 @@ public class UserPreference extends AppCompatActivity {
} }
}); });
callingActivity.mKey = (OpenPgpKeyPreference) findPreference("openpgp_key");
if (sharedPreferences.getString("openpgp_provider_list", null) != null) {
((UserPreference) getActivity()).mKey.setOpenPgpProvider(sharedPreferences.getString("openpgp_provider_list", ""));
}
findPreference("openpgp_provider_list").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object o) {
callingActivity.mKey.setOpenPgpProvider((String) o);
return true;
}
});
final Preference externalRepo = findPreference("pref_select_external"); final Preference externalRepo = findPreference("pref_select_external");
externalRepo.setSummary(getPreferenceManager().getSharedPreferences().getString("git_external_repo", callingActivity.getString(R.string.no_repo_selected))); externalRepo.setSummary(getPreferenceManager().getSharedPreferences().getString("git_external_repo", callingActivity.getString(R.string.no_repo_selected)));
externalRepo.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { externalRepo.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@ -443,14 +427,6 @@ public class UserPreference extends AppCompatActivity {
break; break;
case EDIT_GIT_INFO: { case EDIT_GIT_INFO: {
}
break;
case OpenPgpKeyPreference.REQUEST_CODE_KEY_PREFERENCE: {
if (mKey.handleOnActivityResult(requestCode, resultCode, data)) {
// handled by OpenPgpKeyPreference
PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext()).edit().putLong("openpgp_sign_key", mKey.getValue()).apply();
return;
}
} }
break; break;
case SELECT_GIT_DIRECTORY: { case SELECT_GIT_DIRECTORY: {

View file

@ -31,10 +31,6 @@
<org.openintents.openpgp.util.OpenPgpAppPreference <org.openintents.openpgp.util.OpenPgpAppPreference
android:key="openpgp_provider_list" android:key="openpgp_provider_list"
android:title="@string/pref_provider_title" /> android:title="@string/pref_provider_title" />
<org.openintents.openpgp.util.OpenPgpKeyPreference
android:enabled="false"
android:key="openpgp_key"
android:title="Select key" />
<Preference <Preference
android:key="openpgp_key_id_pref" android:key="openpgp_key_id_pref"
android:title="@string/pref_key_title" /> android:title="@string/pref_key_title" />