summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-07-21 00:23:13 +0200
committerArne Schwabe <arne@rfc2549.org>2012-07-21 00:23:13 +0200
commit7ef4e9634718245fb2e9e01412119b96ef368441 (patch)
tree51bf077e670ce17de401255d92f8ea00726bd90e /src/de/blinkt/openvpn
parent10d0c34e8b4a5aa3626b5bbd0d3bcedc12cb8ddb (diff)
Allow clearing of the CA Cert (closes issue #57)
Diffstat (limited to 'src/de/blinkt/openvpn')
-rw-r--r--src/de/blinkt/openvpn/FileSelect.java20
-rw-r--r--src/de/blinkt/openvpn/FileSelectLayout.java6
-rw-r--r--src/de/blinkt/openvpn/FileSelectionFragment.java10
-rw-r--r--src/de/blinkt/openvpn/Settings_Basic.java1
4 files changed, 32 insertions, 5 deletions
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<T extends Fragment> 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();
diff --git a/src/de/blinkt/openvpn/FileSelectLayout.java b/src/de/blinkt/openvpn/FileSelectLayout.java
index 1a60d135..fb563f5d 100644
--- a/src/de/blinkt/openvpn/FileSelectLayout.java
+++ b/src/de/blinkt/openvpn/FileSelectLayout.java
@@ -21,6 +21,7 @@ public class FileSelectLayout extends LinearLayout implements OnClickListener {
private Button mSelectButton;
private boolean mNoInline;
private String mTitle;
+ private boolean mShowClear;
public FileSelectLayout( Context context,AttributeSet attrset) {
super(context,attrset);
@@ -51,6 +52,8 @@ public class FileSelectLayout extends LinearLayout implements OnClickListener {
startFC.putExtra(FileSelect.WINDOW_TITLE,mTitle);
if(mNoInline)
startFC.putExtra(FileSelect.NO_INLINE_SELECTION, true);
+ if(mShowClear)
+ startFC.putExtra(FileSelect.SHOW_CLEAR_BUTTON, true);
mFragment.startActivityForResult(startFC,mTaskId);
}
@@ -81,5 +84,8 @@ public class FileSelectLayout extends LinearLayout implements OnClickListener {
mNoInline=true;
}
+ public void setShowClear() {
+ mShowClear=true;
+ }
}
diff --git a/src/de/blinkt/openvpn/FileSelectionFragment.java b/src/de/blinkt/openvpn/FileSelectionFragment.java
index 1761c395..2d8110e1 100644
--- a/src/de/blinkt/openvpn/FileSelectionFragment.java
+++ b/src/de/blinkt/openvpn/FileSelectionFragment.java
@@ -73,15 +73,17 @@ public class FileSelectionFragment extends ListFragment {
});
mClearButton = (Button) v.findViewById(R.id.fdClear);
- mClearButton.setEnabled(false);
mClearButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
-
+ ((FileSelect) getActivity()).clearData();
}
});
- mClearButton.setVisibility(View.GONE);
+ if(!((FileSelect) getActivity()).showClear()) {
+ mClearButton.setVisibility(View.GONE);
+ mClearButton.setEnabled(false);
+ }
mImportFile = (Button) v.findViewById(R.id.importfile);
@@ -108,7 +110,7 @@ public class FileSelectionFragment extends ListFragment {
super.onActivityCreated(savedInstanceState);
mStartPath = ((FileSelect) getActivity()).getSelectPath();
- getDir(mStartPath);
+ getDir(mStartPath);
}
@Override
diff --git a/src/de/blinkt/openvpn/Settings_Basic.java b/src/de/blinkt/openvpn/Settings_Basic.java
index 3ac00a66..c99bb4df 100644
--- a/src/de/blinkt/openvpn/Settings_Basic.java
+++ b/src/de/blinkt/openvpn/Settings_Basic.java
@@ -127,6 +127,7 @@ public class Settings_Basic extends Fragment implements View.OnClickListener, On
addFileSelectLayout(mClientKey);
addFileSelectLayout(mpkcs12);
mpkcs12.setNoline();
+ mCaCert.setShowClear();
mType.setOnItemSelectedListener(this);