diff options
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); |