diff options
-rw-r--r-- | res/layout/config_converter.xml | 8 | ||||
-rwxr-xr-x | res/values/strings.xml | 1 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/activities/ConfigConverter.java | 3 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/activities/FileSelect.java | 19 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/fragments/InlineFileTab.java | 2 |
5 files changed, 23 insertions, 10 deletions
diff --git a/res/layout/config_converter.xml b/res/layout/config_converter.xml index c2927efd..f43d463e 100644 --- a/res/layout/config_converter.xml +++ b/res/layout/config_converter.xml @@ -1,9 +1,17 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/config_convert_root" android:orientation="vertical" > + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/files_missing_hint" + android:visibility="gone" + android:id="@+id/files_missing_hint" + tools:visibilty="visible"/> <CheckBox android:id="@+id/importpkcs12" diff --git a/res/values/strings.xml b/res/values/strings.xml index f4f7f6eb..deeb096c 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -315,4 +315,5 @@ <string name="blocklocal_title">Bypass VPN for local networks</string> <string name="userpw_file">Username/Password file</string> <string name="imported_from_file">[Imported from: %s]</string> + <string name="files_missing_hint">Some files could not be found. Please select the files to import the profile:</string> </resources> diff --git a/src/de/blinkt/openvpn/activities/ConfigConverter.java b/src/de/blinkt/openvpn/activities/ConfigConverter.java index 792c9796..cc84076d 100644 --- a/src/de/blinkt/openvpn/activities/ConfigConverter.java +++ b/src/de/blinkt/openvpn/activities/ConfigConverter.java @@ -329,7 +329,8 @@ public class ConfigConverter extends ListActivity implements FileSelectCallback fileSelectMap.put(type, fl); fl.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); - ((LinearLayout) findViewById(R.id.config_convert_root)).addView(fl, 1); + ((LinearLayout) findViewById(R.id.config_convert_root)).addView(fl, 2); + findViewById(R.id.files_missing_hint).setVisibility(View.VISIBLE); fl.setData(value, this); int i = getFileLayoutOffset(type); fl.setCaller(this, i, type); diff --git a/src/de/blinkt/openvpn/activities/FileSelect.java b/src/de/blinkt/openvpn/activities/FileSelect.java index 8967b1bf..511dc736 100644 --- a/src/de/blinkt/openvpn/activities/FileSelect.java +++ b/src/de/blinkt/openvpn/activities/FileSelect.java @@ -128,18 +128,18 @@ public class FileSelect extends Activity { String data = ""; - byte[] filedata = readBytesFromFile(ifile) ; + byte[] fileData = readBytesFromFile(ifile) ; if(mBase64Encode) - data += Base64.encodeToString(filedata, Base64.DEFAULT); + data += Base64.encodeToString(fileData, Base64.DEFAULT); else - data += new String(filedata); + data += new String(fileData); mData =data; /* mInlineFragment.setData(data); getActionBar().selectTab(inlineFileTab); */ - saveInlineData(data); + saveInlineData(ifile.getName(), data); } catch (FileNotFoundException e) { fe = e; } catch (IOException e) { @@ -206,11 +206,14 @@ public class FileSelect extends Activity { } - public void saveInlineData(String string) { + public void saveInlineData(String fileName, String string) { Intent intent = new Intent(); - - intent.putExtra(RESULT_DATA,VpnProfile.INLINE_TAG + string); - setResult(Activity.RESULT_OK,intent); + + if(fileName==null) + intent.putExtra(RESULT_DATA, VpnProfile.INLINE_TAG + string); + else + intent.putExtra(RESULT_DATA,VpnProfile.DISPLAYNAME_TAG + fileName + VpnProfile.INLINE_TAG + string); + setResult(Activity.RESULT_OK, intent); finish(); } diff --git a/src/de/blinkt/openvpn/fragments/InlineFileTab.java b/src/de/blinkt/openvpn/fragments/InlineFileTab.java index bd0b70b1..bea22442 100644 --- a/src/de/blinkt/openvpn/fragments/InlineFileTab.java +++ b/src/de/blinkt/openvpn/fragments/InlineFileTab.java @@ -57,7 +57,7 @@ public class InlineFileTab extends Fragment @Override public boolean onOptionsItemSelected(MenuItem item) { if(item.getItemId()==MENU_SAVE){ - ((FileSelect)getActivity()).saveInlineData(mInlineData.getText().toString()); + ((FileSelect)getActivity()).saveInlineData(null, mInlineData.getText().toString()); return true; } return super.onOptionsItemSelected(item); |