From 27b8dec122522b71057c5bf97a9c762305117c11 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Sun, 8 Feb 2015 17:29:36 +0100 Subject: Fix bug that servers are shared between copies of profiles --- main/src/main/java/de/blinkt/openvpn/VpnProfile.java | 6 +++++- main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java | 4 +++- main/src/main/res/values/strings.xml | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'main/src') diff --git a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java index 088acbbe..1587e2cd 100644 --- a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java +++ b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java @@ -695,7 +695,11 @@ public class VpnProfile implements Serializable, Cloneable { protected VpnProfile clone() throws CloneNotSupportedException { VpnProfile copy = (VpnProfile) super.clone(); copy.mUuid = UUID.randomUUID(); - copy.mConnections = mConnections.clone(); + copy.mConnections = new Connection[mConnections.length]; + int i=0; + for (Connection conn: mConnections) { + copy.mConnections[i++]=conn.clone(); + } copy.mAllowedAppsVpn = (HashSet) mAllowedAppsVpn.clone(); return copy; } diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java b/main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java index 01352916..e15fe509 100644 --- a/main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java +++ b/main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java @@ -256,8 +256,10 @@ public class VPNProfileList extends ListFragment { AlertDialog.Builder dialog = new AlertDialog.Builder(context); if (mCopyProfile == null) dialog.setTitle(R.string.menu_add_profile); - else + else { dialog.setTitle(context.getString(R.string.duplicate_profile_title, mCopyProfile.mName)); + entry.setText(getString(R.string.copy_of_profile, mCopyProfile.mName)); + } dialog.setMessage(R.string.add_profile_name_prompt); dialog.setView(entry); diff --git a/main/src/main/res/values/strings.xml b/main/src/main/res/values/strings.xml index fd39aa99..c7529049 100755 --- a/main/src/main/res/values/strings.xml +++ b/main/src/main/res/values/strings.xml @@ -365,5 +365,6 @@ Proxy behaviour for VPNs Reinstalling VPN apps %s and earlier + Copy of %s -- cgit v1.2.3