浏览代码

Cleaned stuff , add a history delete button and renamed
Log2EmailActivity in LogHistoryActivity

zerginator 12 年之前
父节点
当前提交
5a22c7e79f

+ 167 - 166
AndroidManifest.xml

@@ -1,166 +1,167 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 
-  ownCloud Android client application
-
-  Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
-
-  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.
-
-  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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- -->
-<manifest package="com.owncloud.android"
-    android:versionCode="103020"
-    android:versionName="1.3.20" xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
-    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
-    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
-    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
-    <uses-permission android:name="android.permission.INTERNET" />
-    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
-    <uses-permission android:name="android.permission.READ_SYNC_STATS" />
-    <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
-    <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
-    <uses-permission android:name="android.permission.BROADCAST_STICKY" />
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
-    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
-
-    <uses-sdk
-        android:minSdkVersion="8"
-        android:targetSdkVersion="13" />
-
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" >
-    </uses-permission>
-
-    <application
-        android:icon="@drawable/icon"
-        android:label="@string/app_name"
-        android:theme="@style/Theme.ownCloud"> 
-        <activity
-            android:name=".ui.activity.FileDisplayActivity"
-            android:label="@string/app_name">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-        <activity android:name=".ui.activity.UploadFilesActivity">
-        </activity>
- 		<activity android:name=".ui.activity.InstantUploadActivity">
-        </activity>
-        <activity android:name=".Uploader" >
-            <intent-filter>
-                <action android:name="android.intent.action.SEND" >
-                </action>
-
-                <category android:name="android.intent.category.DEFAULT" >
-                </category>
-
-                <data android:mimeType="*/*" >
-                </data>
-            </intent-filter>
-            <intent-filter>
-                <action android:name="android.intent.action.SEND_MULTIPLE" >
-                </action>
-
-                <category android:name="android.intent.category.DEFAULT" >
-                </category>
-
-                <data android:mimeType="*/*" >
-                </data>
-            </intent-filter>
-        </activity>
-        <activity
-            android:name=".ui.activity.Preferences"
-            android:theme="@style/Theme.ownCloud" >
-        </activity>
-        <activity android:name=".ui.activity.PreferencesNewSessionewSession" >
-        </activity>
-
-        <service
-            android:name=".authenticator.AccountAuthenticatorService"
-            android:exported="true">
-            <intent-filter  android:priority="100">
-                <action android:name="android.accounts.AccountAuthenticator" />
-            </intent-filter>
-
-            <meta-data
-                android:name="android.accounts.AccountAuthenticator"
-                android:resource="@xml/authenticator" />
-        </service>
-        <service
-            android:name=".syncadapter.FileSyncService"
-            android:exported="true" >
-            <intent-filter>
-                <action android:name="android.content.SyncAdapter" />
-            </intent-filter>
-
-            <meta-data
-                android:name="android.content.SyncAdapter"
-                android:resource="@xml/syncadapter_files" />
-        </service>
-
-        <provider
-            android:name=".providers.FileContentProvider"
-            android:authorities="org.owncloud"
-            android:enabled="true"
-            android:exported="false"
-            android:label="@string/sync_string_files"
-            android:syncable="true" >
-        </provider>
-
-        <activity
-            android:name=".ui.activity.AuthenticatorActivity"
-            android:exported="true"
-            android:theme="@style/Theme.ownCloud.noActionBar" >
-            <intent-filter>
-                <action android:name="com.owncloud.android.workaround.accounts.CREATE" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-        </activity>
-
-        <service android:name=".files.services.FileDownloader" >
-        </service>
-
-        <activity android:name=".ui.activity.FileDetailActivity" />
-        <activity android:name=".ui.activity.PinCodeActivity" />
-        <activity android:name=".extensions.ExtensionsAvailableActivity"></activity>
-        <activity android:name=".extensions.ExtensionsListActivity"></activity>
-        <activity android:name=".ui.activity.AccountSelectActivity" android:uiOptions="none" android:label="@string/prefs_accounts"></activity>
-        <activity android:name=".ui.activity.ConflictsResolveActivity"/>
-        <activity android:name=".ui.activity.GenericExplanationActivity"/>
-        <activity android:name=".ui.activity.ErrorsWhileCopyingHandlerActivity"/>
-        
-        <service android:name=".files.services.FileUploader" >
-        </service>
-        <service android:name=".files.services.InstantUploadService" />
-        <receiver android:name=".files.InstantUploadBroadcastReceiver">
-            <intent-filter>
-                <action android:name="com.android.camera.NEW_PICTURE" />
-                <data android:mimeType="image/*" />
-            </intent-filter>
-            <intent-filter>
-                <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
-            </intent-filter>
-        </receiver>
-        <receiver android:name=".files.BootupBroadcastReceiver">
-            <intent-filter>
-                <action android:name="android.intent.action.BOOT_COMPLETED"/>
-            </intent-filter>
-        </receiver>
-        <service android:name=".files.services.FileObserverService"/>
-    </application>
-
-</manifest>
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 
+  ownCloud Android client application
+
+  Copyright (C) 2012  Bartek Przybylski
+  Copyright (C) 2012-2013 ownCloud Inc.
+
+  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.
+
+  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.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ -->
+<manifest package="com.owncloud.android"
+    android:versionCode="103020"
+    android:versionName="1.3.20" xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
+    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
+    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
+    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
+    <uses-permission android:name="android.permission.READ_SYNC_STATS" />
+    <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
+    <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
+    <uses-permission android:name="android.permission.BROADCAST_STICKY" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
+
+    <uses-sdk
+        android:minSdkVersion="8"
+        android:targetSdkVersion="13" />
+
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" >
+    </uses-permission>
+
+    <application
+        android:icon="@drawable/icon"
+        android:label="@string/app_name"
+        android:theme="@style/Theme.ownCloud"> 
+        <activity
+            android:name=".ui.activity.FileDisplayActivity"
+            android:label="@string/app_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+        <activity android:name=".ui.activity.UploadFilesActivity">
+        </activity>
+ 		<activity android:name=".ui.activity.InstantUploadActivity">
+        </activity>
+        <activity android:name=".Uploader" >
+            <intent-filter>
+                <action android:name="android.intent.action.SEND" >
+                </action>
+
+                <category android:name="android.intent.category.DEFAULT" >
+                </category>
+
+                <data android:mimeType="*/*" >
+                </data>
+            </intent-filter>
+            <intent-filter>
+                <action android:name="android.intent.action.SEND_MULTIPLE" >
+                </action>
+
+                <category android:name="android.intent.category.DEFAULT" >
+                </category>
+
+                <data android:mimeType="*/*" >
+                </data>
+            </intent-filter>
+        </activity>
+        <activity
+            android:name=".ui.activity.Preferences"
+            android:theme="@style/Theme.ownCloud" >
+        </activity>
+        <activity android:name=".ui.activity.PreferencesNewSessionewSession" >
+        </activity>
+
+        <service
+            android:name=".authenticator.AccountAuthenticatorService"
+            android:exported="true">
+            <intent-filter  android:priority="100">
+                <action android:name="android.accounts.AccountAuthenticator" />
+            </intent-filter>
+
+            <meta-data
+                android:name="android.accounts.AccountAuthenticator"
+                android:resource="@xml/authenticator" />
+        </service>
+        <service
+            android:name=".syncadapter.FileSyncService"
+            android:exported="true" >
+            <intent-filter>
+                <action android:name="android.content.SyncAdapter" />
+            </intent-filter>
+
+            <meta-data
+                android:name="android.content.SyncAdapter"
+                android:resource="@xml/syncadapter_files" />
+        </service>
+
+        <provider
+            android:name=".providers.FileContentProvider"
+            android:authorities="org.owncloud"
+            android:enabled="true"
+            android:exported="false"
+            android:label="@string/sync_string_files"
+            android:syncable="true" >
+        </provider>
+
+        <activity
+            android:name=".ui.activity.AuthenticatorActivity"
+            android:exported="true"
+            android:theme="@style/Theme.ownCloud.noActionBar" >
+            <intent-filter>
+                <action android:name="com.owncloud.android.workaround.accounts.CREATE" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+        </activity>
+
+        <service android:name=".files.services.FileDownloader" >
+        </service>
+
+        <activity android:name=".ui.activity.FileDetailActivity" />
+        <activity android:name=".ui.activity.PinCodeActivity" />
+        <activity android:name=".extensions.ExtensionsAvailableActivity"></activity>
+        <activity android:name=".extensions.ExtensionsListActivity"></activity>
+        <activity android:name=".ui.activity.AccountSelectActivity" android:uiOptions="none" android:label="@string/prefs_accounts"></activity>
+        <activity android:name=".ui.activity.ConflictsResolveActivity"/>
+        <activity android:name=".ui.activity.GenericExplanationActivity"/>
+        <activity android:name=".ui.activity.ErrorsWhileCopyingHandlerActivity"/>
+        <activity android:name=".ui.activity.LogHistoryActivity"/>
+        
+        <service android:name=".files.services.FileUploader" >
+        </service>
+        <service android:name=".files.services.InstantUploadService" />
+        <receiver android:name=".files.InstantUploadBroadcastReceiver">
+            <intent-filter>
+                <action android:name="com.android.camera.NEW_PICTURE" />
+                <data android:mimeType="image/*" />
+            </intent-filter>
+            <intent-filter>
+                <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
+            </intent-filter>
+        </receiver>
+        <receiver android:name=".files.BootupBroadcastReceiver">
+            <intent-filter>
+                <action android:name="android.intent.action.BOOT_COMPLETED"/>
+            </intent-filter>
+        </receiver>
+        <service android:name=".files.services.FileObserverService"/>
+    </application>
+
+</manifest>

+ 19 - 0
res/layout/log_item.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="horizontal" >
+    
+     <TextView android:id="@+id/log_item_single"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent"
+        android:gravity="center_vertical"
+        android:layout_alignParentTop="true"
+        android:layout_alignParentBottom="true"
+        android:textStyle="bold"
+        android:textSize="22dp"
+        android:textColor="#000000"
+        android:layout_marginTop="5dp"
+        android:layout_marginBottom="5dp" />
+
+</LinearLayout>

+ 34 - 0
res/layout/log_send_file.xml

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+ <LinearLayout 
+      	 xmlns:android="http://schemas.android.com/apk/res/android"
+         android:orientation="vertical"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:paddingLeft="8dp"
+         android:paddingRight="8dp">
+      
+
+     <ListView 	android:id="@android:id/list"
+               	android:layout_width="match_parent"
+               	android:layout_height="wrap_content"
+               />
+
+     <TextView 	android:id="@android:id/empty"
+               	android:layout_width="match_parent"
+               	android:layout_height="wrap_content"
+               	android:background="#FF0000"
+               	android:text="No data"/>
+     <LinearLayout 
+         android:orientation="vertical"
+         android:layout_width="match_parent"
+         android:layout_height="wrap_content"
+         android:gravity="bottom">
+        
+     <Button   	android:id="@+id/deleteLogHistoryButton"
+         		android:layout_width="match_parent"
+     		   	android:layout_height="wrap_content"
+     		   	android:text="@string/prefs_log_delete_history_button"/>
+     
+     </LinearLayout>
+     
+ </LinearLayout>

+ 6 - 2
res/values/strings.xml

@@ -43,6 +43,10 @@
     <string name="prefs_instant_upload_summary">Instantly upload photos taken by camera</string>
     <string name="prefs_log_title">Enable Logging</string>
     <string name="prefs_log_summary">This is used to log problems</string>
+    <string name="prefs_log_title_history">Logging History</string>
+    <string name="prefs_log_summary_history">This shows the recorded logs</string>
+    <string name="prefs_log_delete_history_button">Delete History</string>
+    
     <string name="auth_host_url">URL</string>
     <string name="auth_username">Username</string>
     <string name="auth_password">Password</string>
@@ -147,14 +151,14 @@
         <item>60</item>
     </string-array>
 
-    <string name="auth_trying_to_login">Trying to login</string>
+    <string name="auth_trying_to_login">Trying to login...</string>
     <string name="auth_no_net_conn_title">No network connection</string>
     <string name="auth_no_net_conn_message">No network connection has been detected, check your Internet connection and try again.</string>
     <string name="auth_connect_anyway">Connect anyway</string>
     <string name="auth_nossl_plain_ok_title">Secure connection unavailable.</string>
     <string name="auth_nossl_plain_ok_message">The Application cannot establish a secure connection to the server. A non secure connection is available. You may continue or cancel.</string>
     <string name="auth_connection_established">Connection established</string>
-    <string name="auth_testing_connection">Testing connection</string>
+    <string name="auth_testing_connection">Testing connection...</string>
     <string name="auth_not_configured_title">Malformed server configuration</string>
     <string name="auth_not_configured_message">It seems that your server instance is not correctly configured. Contact your administrator for more details.</string>
     <string name="auth_unknown_error_title">Unknown error occurred!</string>

+ 10 - 4
res/xml/preferences.xml

@@ -32,13 +32,19 @@
     <CheckBoxPreference android:key="instant_uploading" 
                         android:title="@string/prefs_instant_upload"  
                         android:summary="@string/prefs_instant_upload_summary"/>
-    <CheckBoxPreference android:dependency="instant_uploading" android:disableDependentsState="true" android:title="@string/instant_upload_on_wifi" android:key="instant_upload_on_wifi"/>
-    <Preference 		android:id="@+id/about_app" 
-        				android:title="@string/about_title" 
-        				android:key="about_app" />
+    <CheckBoxPreference android:dependency="instant_uploading" 
+        				android:disableDependentsState="true" 
+        				android:title="@string/instant_upload_on_wifi" 
+        				android:key="instant_upload_on_wifi"/>
     <CheckBoxPreference android:key="log_to_file" 
                         android:title="@string/prefs_log_title"  
                         android:summary="@string/prefs_log_summary"/>
+	<Preference 		android:key="log_history" 
+                        android:title="@string/prefs_log_title_history"  
+                        android:summary="@string/prefs_log_summary_history"/>
+	<Preference 		android:id="@+id/about_app" 
+        				android:title="@string/about_title" 
+        				android:key="about_app" />
 	</PreferenceCategory>
     
 

+ 7 - 5
src/com/owncloud/android/Log_OC.java

@@ -11,8 +11,10 @@ import java.util.Locale;
 import android.util.Log;
 
 
+
 public class Log_OC {
     
+
     private static boolean isEnabled = false;
     private static File logFile;
     private static File folder;
@@ -59,8 +61,7 @@ public class Log_OC {
     }
     
     public static void startLogging(String logPath) {
-        
-        folder = new File(logPath+File.separator+"log");
+        folder = new File(logPath);
         logFile = new File(folder+File.separator+"log.txt");
         
         if (!folder.exists()) {
@@ -83,7 +84,8 @@ public class Log_OC {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss",Locale.getDefault());
         String currentDateandTime = sdf.format(new Date());
         if (logFile != null) {
-            logFile.renameTo(new File(folder+File.separator+"log_"+currentDateandTime));
+            logFile.renameTo(new File(folder+File.separator+"Owncloud_"+currentDateandTime+".log"));
+          
             isEnabled = false;
             try {
                 buf.close();
@@ -111,8 +113,8 @@ public class Log_OC {
                buf.newLine(); 
            } catch (IOException e) { 
                e.printStackTrace(); 
-           } 
-      }
+        } 
+    }
 }
 
     

+ 1 - 1
src/com/owncloud/android/db/DbHandler.java

@@ -36,7 +36,7 @@ public class DbHandler {
     private SQLiteDatabase mDB;
     private OpenerHelper mHelper;
     private final String mDatabaseName = "ownCloud";
-    private final int mDatabaseVersion = 2;
+    private final int mDatabaseVersion = 3;
 
     private final String TABLE_INSTANT_UPLOAD = "instant_upload";
 

+ 119 - 0
src/com/owncloud/android/ui/activity/LogHistoryActivity.java

@@ -0,0 +1,119 @@
+/* ownCloud Android client application
+ *   Copyright (C) 2012-2013 ownCloud Inc.
+ *
+ *   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.
+ *
+ *   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.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package com.owncloud.android.ui.activity;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Environment;
+import android.preference.Preference;
+import android.preference.Preference.OnPreferenceChangeListener;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.ListView;
+
+import com.actionbarsherlock.app.ActionBar;
+import com.actionbarsherlock.app.SherlockPreferenceActivity;
+import com.actionbarsherlock.view.MenuItem;
+import com.owncloud.android.R;
+import com.owncloud.android.ui.adapter.LogListAdapter;
+
+
+
+public class LogHistoryActivity extends SherlockPreferenceActivity implements OnPreferenceChangeListener {
+    String logpath = Environment.getExternalStorageDirectory()+File.separator+"owncloud"+File.separator+"log";
+    File logDIR = null;
+    
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        
+        setContentView(R.layout.log_send_file);
+        setTitle("Log History");
+        ActionBar actionBar = getSherlock().getActionBar();
+        actionBar.setDisplayHomeAsUpEnabled(true);
+        ListView listView = (ListView) findViewById(android.R.id.list);
+        Button deleteHistoryButton = (Button) findViewById(R.id.deleteLogHistoryButton);
+        deleteHistoryButton.setOnClickListener(new OnClickListener() {
+            
+            @Override
+            public void onClick(View v) {
+                File dir = new File(logpath);
+                if (dir != null) {
+                    File[] files = dir.listFiles();
+                    if(files!=null) { 
+                        for(File f: files) {
+                                f.delete();
+                        }
+                    }
+                    dir.delete();
+                }
+                Intent intent = new Intent(getBaseContext(), Preferences.class);
+                intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+                startActivity(intent);
+            }
+            
+        });
+        
+       
+        if(logpath != null){
+        logDIR = new File(logpath);
+        }
+        
+        if(logDIR != null && logDIR.isDirectory()) {
+            File[] files = logDIR.listFiles();
+          
+            if (files != null && files.length != 0) {
+                ArrayList<String> logfiles_name = new ArrayList<String>();
+                for (File file : files) {
+                    logfiles_name.add(file.getName());
+                }
+                    String[] logFiles2Array = logfiles_name.toArray(new String[logfiles_name.size()]);
+                    LogListAdapter listadapter = new LogListAdapter(this,logFiles2Array);
+                    listView.setAdapter(listadapter);
+            }
+        }
+    }
+
+    
+    @Override
+    public boolean onMenuItemSelected(int featureId, MenuItem item) {
+        super.onMenuItemSelected(featureId, item);
+        Intent intent;
+
+        switch (item.getItemId()) {
+       
+        case android.R.id.home:
+            intent = new Intent(getBaseContext(), Preferences.class);
+            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+            startActivity(intent);
+            break;
+        default:
+            return false;
+        }
+        return true;
+    }
+    @Override
+    public boolean onPreferenceChange(Preference arg0, Object arg1) {
+        return false;
+    }
+}

+ 17 - 2
src/com/owncloud/android/ui/activity/Preferences.java

@@ -18,6 +18,7 @@
  */
 package com.owncloud.android.ui.activity;
 
+import java.io.File;
 import java.util.Vector;
 
 import android.content.Intent;
@@ -25,6 +26,7 @@ import android.content.SharedPreferences;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.os.Bundle;
+import android.os.Environment;
 import android.preference.CheckBoxPreference;
 import android.preference.ListPreference;
 import android.preference.Preference;
@@ -59,6 +61,7 @@ public class Preferences extends SherlockPreferenceActivity implements OnPrefere
     private CheckBoxPreference mDeviceTracking;
     private CheckBoxPreference pCode;
     private CheckBoxPreference pLogging;
+    private Preference pLoggingHistory;
     private Preference pAboutApp;
     private int mSelectedMenuItem;
 
@@ -109,14 +112,14 @@ public class Preferences extends SherlockPreferenceActivity implements OnPrefere
                    Log_OC.e(TAG, "Error while showing about dialog", e);
                }
        }
-       pLogging = (CheckBoxPreference) findPreference("log_to_file");
        
+       pLogging = (CheckBoxPreference) findPreference("log_to_file");
        if (pLogging != null) {
            pLogging.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
                @Override
                public boolean onPreferenceChange(Preference preference, Object newValue) {
                    
-                   String logpath = getApplicationContext().getFilesDir().getAbsolutePath();
+                   String logpath = Environment.getExternalStorageDirectory()+File.separator+"owncloud"+File.separator+"log";
                 
                    if(!pLogging.isChecked()) {
                        Log_OC.d("Debug", "start logging");
@@ -130,7 +133,19 @@ public class Preferences extends SherlockPreferenceActivity implements OnPrefere
                    return true;
                }
            });
+       }
        
+       pLoggingHistory = (Preference) findPreference("log_history");
+       if (pLoggingHistory != null) {
+           pLoggingHistory.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+            
+            @Override
+            public boolean onPreferenceClick(Preference preference) {
+                Intent intent = new Intent(getApplicationContext(),LogHistoryActivity.class);
+                startActivity(intent);
+                return true;
+            }
+        });
        }
       }
     }

+ 54 - 0
src/com/owncloud/android/ui/adapter/LogListAdapter.java

@@ -0,0 +1,54 @@
+package com.owncloud.android.ui.adapter;
+
+import java.io.File;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Environment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.TextView;
+
+import com.owncloud.android.R;
+
+
+public class LogListAdapter extends ArrayAdapter<String> {
+    private Context context = null;
+    private String[] values;
+    private Uri fileUri = null;
+   
+    
+    public LogListAdapter(Context context, String[] values) {
+        super(context, R.layout.log_item, values);
+        this.context = context;
+        this.values = values;
+    }
+
+    @Override
+    public View getView(final int position, View convertView, ViewGroup parent) {
+        LayoutInflater inflater = (LayoutInflater) context
+                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+        View rowView = inflater.inflate(R.layout.log_item, parent, false);
+        TextView listText = (TextView) rowView.findViewById(R.id.log_item_single);
+        listText.setText(values[position]);
+        listText.setTextSize(15);
+        fileUri = Uri.fromFile(new File(Environment.getExternalStorageDirectory()+File.separator+"owncloud"+File.separator+"log"+File.separator+values[position]));
+        listText.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
+                emailIntent.setType("text/rtf");
+                emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "OwnCloud Logfile");
+                emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "This is a automatic E-mail send by owncloud/android");
+                emailIntent.putExtra(android.content.Intent.EXTRA_STREAM, fileUri);
+                emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                context.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
+            }
+        });
+        return rowView;
+    }
+}