From e8261bbc90f46dad1a7c0bb8bd998ebf9107f0f9 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Sat, 21 Jul 2012 00:23:13 +0200 Subject: Allow clearing of the CA Cert (closes issue #57) --- src/de/blinkt/openvpn/FileSelect.java | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/de/blinkt/openvpn/FileSelect.java') diff --git a/src/de/blinkt/openvpn/FileSelect.java b/src/de/blinkt/openvpn/FileSelect.java index bbad5cfd..30d6628e 100644 --- a/src/de/blinkt/openvpn/FileSelect.java +++ b/src/de/blinkt/openvpn/FileSelect.java @@ -22,12 +22,14 @@ public class FileSelect extends Activity { public static final String START_DATA = "START_DATA"; public static final String WINDOW_TITLE = "WINDOW_TILE"; public static final String NO_INLINE_SELECTION = "de.blinkt.openvpn.NO_INLINE_SELECTION"; + public static final String SHOW_CLEAR_BUTTON = "de.blinkt.openvpn.SHOW_CLEAR_BUTTON"; private FileSelectionFragment mFSFragment; private InlineFileTab mInlineFragment; private String mData; private Tab inlineFileTab; private Tab fileExplorerTab; private boolean mNoInline; + private boolean mShowClear; public void onCreate(Bundle savedInstanceState) @@ -47,6 +49,7 @@ public class FileSelect extends Activity { setTitle(title); mNoInline = getIntent().getBooleanExtra(NO_INLINE_SELECTION, false); + mShowClear = getIntent().getBooleanExtra(SHOW_CLEAR_BUTTON, false); ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); @@ -67,6 +70,13 @@ public class FileSelect extends Activity { } + + protected boolean showClear() { + if(mData == null || mData.equals("")) + return false; + else + return mShowClear; + } protected class MyTabsListener implements ActionBar.TabListener { @@ -139,7 +149,7 @@ public class FileSelect extends Activity { } public String getSelectPath() { - if(mData.startsWith(VpnProfile.INLINE_TAG)) + if(!mData.startsWith(VpnProfile.INLINE_TAG)) return mData; else return "/mnt/sdcard"; @@ -151,6 +161,14 @@ public class FileSelect extends Activity { else return ""; } + + public void clearData() { + Intent intent = new Intent(); + intent.putExtra(RESULT_DATA, (String)null); + setResult(Activity.RESULT_OK,intent); + finish(); + + } public void saveInlineData(String string) { Intent intent = new Intent(); -- cgit v1.2.3