diff options
Diffstat (limited to 'src/de/blinkt/openvpn/ConfigConverter.java')
-rw-r--r-- | src/de/blinkt/openvpn/ConfigConverter.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/de/blinkt/openvpn/ConfigConverter.java b/src/de/blinkt/openvpn/ConfigConverter.java index 952ab968..8aebc664 100644 --- a/src/de/blinkt/openvpn/ConfigConverter.java +++ b/src/de/blinkt/openvpn/ConfigConverter.java @@ -41,8 +41,11 @@ public class ConfigConverter extends ListActivity { log("Importing the config had error, cannot save it");
return true;
}
+
Intent result = new Intent();
ProfileManager vpl = ProfileManager.getInstance(this);
+
+ setUniqueProfileName(vpl);
vpl.addProfile(mResult);
vpl.saveProfile(this, mResult);
vpl.saveProfileList(this);
@@ -56,6 +59,19 @@ public class ConfigConverter extends ListActivity { }
+
+ private void setUniqueProfileName(ProfileManager vpl) {
+ int i=1;
+ String newname = getString(R.string.converted_profile);
+
+ while(vpl.getProfileByName(newname)!=null) {
+ i++;
+ newname = getString(R.string.converted_profile_i,i);
+ }
+
+ mResult.mName=newname;
+ }
+
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
|