summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/blinkt/openvpn')
-rw-r--r--src/de/blinkt/openvpn/ConfigConverter.java21
-rw-r--r--src/de/blinkt/openvpn/LaunchVPN.java2
-rw-r--r--src/de/blinkt/openvpn/OpenVpnPreferencesFragment.java11
-rw-r--r--src/de/blinkt/openvpn/ProfileManager.java7
-rw-r--r--src/de/blinkt/openvpn/Settings_Basic.java3
-rw-r--r--src/de/blinkt/openvpn/VPNPreferences.java4
-rw-r--r--src/de/blinkt/openvpn/VpnProfile.java2
7 files changed, 39 insertions, 11 deletions
diff --git a/src/de/blinkt/openvpn/ConfigConverter.java b/src/de/blinkt/openvpn/ConfigConverter.java
index 8aebc664..5e0a6eb3 100644
--- a/src/de/blinkt/openvpn/ConfigConverter.java
+++ b/src/de/blinkt/openvpn/ConfigConverter.java
@@ -5,6 +5,8 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.util.List;
+import java.util.Vector;
import android.app.Activity;
import android.app.ListActivity;
@@ -24,6 +26,8 @@ public class ConfigConverter extends ListActivity {
private VpnProfile mResult;
private ArrayAdapter<String> mArrayAdapter;
+ private List<String> mPathsegments;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -91,7 +95,20 @@ public class ConfigConverter extends ListActivity {
// Try diffent path relative to /mnt/sdcard
File sdcard = Environment.getExternalStorageDirectory();
File root = new File("/");
- File[] dirlist = {root, sdcard};
+
+ Vector<File> dirlist = new Vector<File>();
+
+ for(int i=mPathsegments.size()-1;i >=0 ;i--){
+ String path = "";
+ for (int j = 0;j<=i;j++) {
+ path += "/" + mPathsegments.get(j);
+ }
+ dirlist.add(new File(path));
+ }
+ dirlist.add(sdcard);
+ dirlist.add(root);
+
+
String[] fileparts = filename.split("/");
for(File rootdir:dirlist){
String suffix="";
@@ -159,6 +176,8 @@ public class ConfigConverter extends ListActivity {
log(R.string.importing_config,data.toString());
try {
InputStream is = getContentResolver().openInputStream(data);
+ mPathsegments = data.getPathSegments();
+
doImport(is);
} catch (FileNotFoundException e) {
log(R.string.import_content_resolve_error);
diff --git a/src/de/blinkt/openvpn/LaunchVPN.java b/src/de/blinkt/openvpn/LaunchVPN.java
index b7b010a4..4b21c959 100644
--- a/src/de/blinkt/openvpn/LaunchVPN.java
+++ b/src/de/blinkt/openvpn/LaunchVPN.java
@@ -301,7 +301,7 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener {
}
} else if (resultCode == Activity.RESULT_CANCELED) {
- // User does want us to start, so we just vanish
+ // User does not want us to start, so we just vanish
finish();
}
}
diff --git a/src/de/blinkt/openvpn/OpenVpnPreferencesFragment.java b/src/de/blinkt/openvpn/OpenVpnPreferencesFragment.java
index 10378a80..4cf3b10b 100644
--- a/src/de/blinkt/openvpn/OpenVpnPreferencesFragment.java
+++ b/src/de/blinkt/openvpn/OpenVpnPreferencesFragment.java
@@ -13,11 +13,11 @@ public abstract class OpenVpnPreferencesFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- // Make sure there is an instance of the profile manager
- ProfileManager.getInstance(getActivity());
-
+
String profileUUID = getArguments().getString(getActivity().getPackageName() + ".profileUUID");
- mProfile = ProfileManager.get(profileUUID);
+ mProfile = ProfileManager.get(getActivity(),profileUUID);
+ getActivity().setTitle(getString(R.string.edit_profile_title, mProfile.getName()));
+
}
@Override
@@ -31,8 +31,7 @@ public abstract class OpenVpnPreferencesFragment extends PreferenceFragment {
super.onActivityCreated(savedInstanceState);
if(savedInstanceState!=null) {
String profileUUID=savedInstanceState.getString(VpnProfile.EXTRA_PROFILEUUID);
- ProfileManager.getInstance(getActivity());
- mProfile = ProfileManager.get(profileUUID);
+ mProfile = ProfileManager.get(getActivity(),profileUUID);
loadSettings();
}
}
diff --git a/src/de/blinkt/openvpn/ProfileManager.java b/src/de/blinkt/openvpn/ProfileManager.java
index 0164fe53..b1321b97 100644
--- a/src/de/blinkt/openvpn/ProfileManager.java
+++ b/src/de/blinkt/openvpn/ProfileManager.java
@@ -150,4 +150,11 @@ public class ProfileManager {
}
+
+
+ public static VpnProfile get(Context context, String profileUUID) {
+ checkInstance(context);
+ return get(profileUUID);
+ }
+
}
diff --git a/src/de/blinkt/openvpn/Settings_Basic.java b/src/de/blinkt/openvpn/Settings_Basic.java
index 2c478b70..bafee229 100644
--- a/src/de/blinkt/openvpn/Settings_Basic.java
+++ b/src/de/blinkt/openvpn/Settings_Basic.java
@@ -16,8 +16,6 @@
package de.blinkt.openvpn;
-import java.util.HashMap;
-
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
@@ -98,6 +96,7 @@ public class Settings_Basic extends Fragment implements View.OnClickListener, On
super.onCreate(savedInstanceState);
String profileuuid =getArguments().getString(getActivity().getPackageName() + ".profileUUID");
mProfile=ProfileManager.get(profileuuid);
+ getActivity().setTitle(getString(R.string.edit_profile_title, mProfile.getName()));
}
@Override
diff --git a/src/de/blinkt/openvpn/VPNPreferences.java b/src/de/blinkt/openvpn/VPNPreferences.java
index f128270a..a2c8407c 100644
--- a/src/de/blinkt/openvpn/VPNPreferences.java
+++ b/src/de/blinkt/openvpn/VPNPreferences.java
@@ -28,6 +28,10 @@ public class VPNPreferences extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
mProfileUUID = getIntent().getStringExtra(getPackageName() + ".profileUUID");
+ VpnProfile profile = ProfileManager.get(this,mProfileUUID);
+ if(profile!=null) {
+ setTitle(getString(R.string.edit_profile_title, profile.getName()));
+ }
super.onCreate(savedInstanceState);
}
diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java
index b862bb8c..d9c39cab 100644
--- a/src/de/blinkt/openvpn/VpnProfile.java
+++ b/src/de/blinkt/openvpn/VpnProfile.java
@@ -102,6 +102,7 @@ public class VpnProfile implements Serializable{
mUsePull=false;
mUseLzo=false;
mUseDefaultRoute=false;
+ mUseDefaultRoutev6=false;
mExpectTLSCert=false;
}
@@ -130,7 +131,6 @@ public class VpnProfile implements Serializable{
}
public String getName() {
- // TODO Auto-generated method stub
return mName;
}