diff options
author | Arne Schwabe <arne@rfc2549.org> | 2013-07-03 14:10:59 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2013-07-03 14:10:59 +0200 |
commit | 56889cd25ff1762fca0e30d99eab0a572dbc2fab (patch) | |
tree | 0feba21e6fee1b30191e80a409e5bfebcd2eb7df /src/de/blinkt/openvpn | |
parent | d06b048b29d9e7f200bcb1d572b4572176b0beb7 (diff) |
Restructure global settings
--HG--
extra : amend_source : 1b4e0ac86c557993b0195c4b1bad968f3f27aac1
Diffstat (limited to 'src/de/blinkt/openvpn')
-rw-r--r-- | src/de/blinkt/openvpn/FileSelectLayout.java | 4 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/core/X509Utils.java | 7 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/fragments/Settings_Basic.java | 10 |
3 files changed, 12 insertions, 9 deletions
diff --git a/src/de/blinkt/openvpn/FileSelectLayout.java b/src/de/blinkt/openvpn/FileSelectLayout.java index d7bcc475..f5a01e10 100644 --- a/src/de/blinkt/openvpn/FileSelectLayout.java +++ b/src/de/blinkt/openvpn/FileSelectLayout.java @@ -66,7 +66,7 @@ public class FileSelectLayout extends LinearLayout implements OnClickListener { return mData; } - public void setData(String data) { + public void setData(String data, Context c) { mData = data; if(data==null) { mDataView.setText(mFragment.getString(R.string.no_data)); @@ -76,7 +76,7 @@ public class FileSelectLayout extends LinearLayout implements OnClickListener { mDataView.setText(R.string.inline_file_data); else mDataView.setText(data); - mDataDetails.setText(X509Utils.getCertificateFriendlyName(data)); + mDataDetails.setText(X509Utils.getCertificateFriendlyName(c,data)); } } diff --git a/src/de/blinkt/openvpn/core/X509Utils.java b/src/de/blinkt/openvpn/core/X509Utils.java index b533c886..4d2e6668 100644 --- a/src/de/blinkt/openvpn/core/X509Utils.java +++ b/src/de/blinkt/openvpn/core/X509Utils.java @@ -1,6 +1,9 @@ package de.blinkt.openvpn.core; +import android.content.Context; import android.text.TextUtils; + +import de.blinkt.openvpn.R; import de.blinkt.openvpn.VpnProfile; import org.spongycastle.util.io.pem.PemObject; import org.spongycastle.util.io.pem.PemReader; @@ -52,7 +55,7 @@ public class X509Utils { - public static String getCertificateFriendlyName (String filename) { + public static String getCertificateFriendlyName (Context c, String filename) { if(!TextUtils.isEmpty(filename)) { try { X509Certificate cert = (X509Certificate) getCertificateFromFile(filename); @@ -63,7 +66,7 @@ public class X509Utils { OpenVPN.logError("Could not read certificate" + e.getLocalizedMessage()); } } - return "Cannot display certificate information"; + return c.getString(R.string.cannotparsecert); } public static String getCertificateFriendlyName(X509Certificate cert) { diff --git a/src/de/blinkt/openvpn/fragments/Settings_Basic.java b/src/de/blinkt/openvpn/fragments/Settings_Basic.java index 05e4a2a8..77025dbd 100644 --- a/src/de/blinkt/openvpn/fragments/Settings_Basic.java +++ b/src/de/blinkt/openvpn/fragments/Settings_Basic.java @@ -131,7 +131,7 @@ public class Settings_Basic extends Fragment implements View.OnClickListener, On if (result == Activity.RESULT_OK && request >= CHOOSE_FILE_OFFSET) { String filedata = data.getStringExtra(FileSelect.RESULT_DATA); FileSelectLayout fsl = fileselects.get(request); - fsl.setData(filedata); + fsl.setData(filedata, getActivity()); savePreferences(); @@ -207,16 +207,16 @@ public class Settings_Basic extends Fragment implements View.OnClickListener, On private void loadPreferences() { mProfileName.setText(mProfile.mName); - mClientCert.setData(mProfile.mClientCertFilename); - mClientKey.setData(mProfile.mClientKeyFilename); - mCaCert.setData(mProfile.mCaFilename); + mClientCert.setData(mProfile.mClientCertFilename, getActivity()); + mClientKey.setData(mProfile.mClientKeyFilename, getActivity()); + mCaCert.setData(mProfile.mCaFilename, getActivity()); mUseLzo.setChecked(mProfile.mUseLzo); mServerPort.setText(mProfile.mServerPort); mServerAddress.setText(mProfile.mServerName); mTcpUdp.setChecked(mProfile.mUseUdp); mType.setSelection(mProfile.mAuthenticationType); - mpkcs12.setData(mProfile.mPKCS12Filename); + mpkcs12.setData(mProfile.mPKCS12Filename, getActivity()); mPKCS12Password.setText(mProfile.mPKCS12Password); mUserName.setText(mProfile.mUsername); mPassword.setText(mProfile.mPassword); |