diff options
author | Tobias Brunner <tobias@strongswan.org> | 2012-08-07 14:02:38 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2012-08-13 11:00:25 +0200 |
commit | c8b942a1e218d0984c02b266994a6ef6855f9fdb (patch) | |
tree | a4dee52d5dc5d52484101a7e73f0b773e0d31f03 /src | |
parent | 9756cf22f21c3e3e8bcf1f63df4e14070bd0e6c2 (diff) | |
download | strongswan-c8b942a1e218d0984c02b266994a6ef6855f9fdb.tar.bz2 strongswan-c8b942a1e218d0984c02b266994a6ef6855f9fdb.tar.xz |
Menu option added to reload cached CA certificates
This might be required if the user installs a new CA certificate.
Diffstat (limited to 'src')
-rw-r--r-- | src/frontends/android/res/menu/main.xml | 23 | ||||
-rw-r--r-- | src/frontends/android/res/values/strings.xml | 1 | ||||
-rw-r--r-- | src/frontends/android/src/org/strongswan/android/ui/MainActivity.java | 41 |
3 files changed, 64 insertions, 1 deletions
diff --git a/src/frontends/android/res/menu/main.xml b/src/frontends/android/res/menu/main.xml new file mode 100644 index 000000000..f5d1e31cf --- /dev/null +++ b/src/frontends/android/res/menu/main.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2012 Tobias Brunner + Hochschule fuer Technik Rapperswil + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. +--> +<menu xmlns:android="http://schemas.android.com/apk/res/android" > + + <item + android:id="@+id/menu_reload_certs" + android:title="@string/reload_trusted_certs" + android:showAsAction="withText" /> + +</menu>
\ No newline at end of file diff --git a/src/frontends/android/res/values/strings.xml b/src/frontends/android/res/values/strings.xml index 53a94bb30..761b16a69 100644 --- a/src/frontends/android/res/values/strings.xml +++ b/src/frontends/android/res/values/strings.xml @@ -19,6 +19,7 @@ <!-- Application --> <string name="app_name">strongSwan VPN Client</string> + <string name="reload_trusted_certs">Reload CA certificates</string> <!-- VPN profile list --> <string name="no_profiles">No VPN profiles.</string> diff --git a/src/frontends/android/src/org/strongswan/android/ui/MainActivity.java b/src/frontends/android/src/org/strongswan/android/ui/MainActivity.java index 063d7a961..6a2988904 100644 --- a/src/frontends/android/src/org/strongswan/android/ui/MainActivity.java +++ b/src/frontends/android/src/org/strongswan/android/ui/MainActivity.java @@ -17,6 +17,7 @@ package org.strongswan.android.ui; +import org.strongswan.android.R; import org.strongswan.android.logic.TrustedCertificateManager; import android.app.ActionBar; @@ -24,6 +25,9 @@ import android.app.Activity; import android.content.Intent; import android.net.VpnService; import android.os.Bundle; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.view.Window; public class MainActivity extends Activity @@ -57,7 +61,42 @@ public class MainActivity extends Activity }).start(); } - private void startVpnService() + @Override + public boolean onCreateOptionsMenu(Menu menu) + { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.main, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) + { + switch (item.getItemId()) + { + case R.id.menu_reload_certs: + setProgressBarIndeterminateVisibility(true); + new Thread(new Runnable() { + @Override + public void run() + { + TrustedCertificateManager.getInstance().reload(); + runOnUiThread(new Runnable() { + @Override + public void run() + { + setProgressBarIndeterminateVisibility(false); + } + }); + } + }).start(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } + + protected void prepareVpnService() { Intent intent = VpnService.prepare(this); if (intent != null) |