diff options
author | Arne Schwabe <arne@rfc2549.org> | 2012-05-06 18:13:09 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2012-05-06 18:13:09 +0200 |
commit | ef4fd36f5d38e82ba6165be2468d985d62f1d32f (patch) | |
tree | 8cd65adb7b37b6c968f39112ba03c3fe5e2f5c3a /src/de/blinkt/openvpn/LogWindow.java | |
parent | ec7e6b920257e52a24f9fc56150c05f3bbc6da7d (diff) |
Add ability to send the log (closes issue #9)
protect fd over unix socket
Diffstat (limited to 'src/de/blinkt/openvpn/LogWindow.java')
-rw-r--r-- | src/de/blinkt/openvpn/LogWindow.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/de/blinkt/openvpn/LogWindow.java b/src/de/blinkt/openvpn/LogWindow.java index 65e8c66c..f3809e27 100644 --- a/src/de/blinkt/openvpn/LogWindow.java +++ b/src/de/blinkt/openvpn/LogWindow.java @@ -1,13 +1,19 @@ package de.blinkt.openvpn; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.charset.Charset; import java.util.Vector; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.app.ListActivity; import android.content.DialogInterface; +import android.content.Intent; import android.content.DialogInterface.OnClickListener; import android.database.DataSetObserver; +import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.Handler.Callback; @@ -20,6 +26,7 @@ import android.view.ViewGroup; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.TextView; +import android.widget.Toast; import de.blinkt.openvpn.OpenVPN.LogListener; public class LogWindow extends ListActivity { @@ -56,6 +63,22 @@ public class LogWindow extends ListActivity { } } + String getLogStr() { + String str = ""; + for(String entry:myEntries) { + str+=entry + '\n'; + } + return str; + } + + private void shareLog() { + Intent shareIntent = new Intent(Intent.ACTION_SEND); + shareIntent.putExtra(Intent.EXTRA_TEXT, getLogStr()); + shareIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.ics_openvpn_log_file)); + shareIntent.setType("text/plain"); + startActivity(Intent.createChooser(shareIntent, "Send Logfile")); + } + @Override public void registerDataSetObserver(DataSetObserver observer) { observers.add(observer); @@ -190,6 +213,8 @@ public class LogWindow extends ListActivity { } else if(item.getItemId()==R.id.info) { if(mBconfig==null) OpenVPN.triggerLogBuilderConfig(); + } else if(item.getItemId()==R.id.send) { + ladapter.shareLog(); } return super.onOptionsItemSelected(item); |