[Libreoffice-commits] core.git: android/source

Mert Tumer merttumer at outlook.com
Mon Sep 19 06:16:18 UTC 2016


 android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java |   29 +++++++++-
 1 file changed, 27 insertions(+), 2 deletions(-)

New commits:
commit 7d794b193ef517de979bc1e481f655eb1124103c
Author: Mert Tumer <merttumer at outlook.com>
Date:   Wed Aug 3 16:46:00 2016 +0300

    tdf#96797 - Android: Viewer file filter is not working on ownCloud
    
    Change-Id: I6ffb450d935ae1f7b4900243b9ff2f8df408628f
    Reviewed-on: https://gerrit.libreoffice.org/27829
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: jan iversen <jani at documentfoundation.org>

diff --git a/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java b/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java
index 73b3b2c..c218961 100644
--- a/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java
+++ b/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java
@@ -93,8 +93,33 @@ public class OwnCloudFile implements IFile {
 
     @Override
     public List<IFile> listFiles(FileFilter filter) {
-        // TODO no filtering yet
-        return listFiles();
+        List<IFile> children = new ArrayList<IFile>();
+        if (isDirectory()) {
+            ReadRemoteFolderOperation refreshOperation = new ReadRemoteFolderOperation(
+                    file.getRemotePath());
+            RemoteOperationResult result = refreshOperation.execute(provider
+                    .getClient());
+            if (!result.isSuccess()) {
+                throw provider.buildRuntimeExceptionForResultCode(result.getCode());
+            }
+
+            for (Object obj : result.getData()) {
+                RemoteFile child = (RemoteFile) obj;
+                if (!child.getRemotePath().equals(file.getRemotePath())){
+                    OwnCloudFile ownCloudFile = new OwnCloudFile(provider, child);
+                    if(!ownCloudFile.isDirectory()){
+                        File f = new File(provider.getCacheDir().getAbsolutePath(),
+                                ownCloudFile.getName());
+                        if(filter.accept(f))
+                            children.add(ownCloudFile);
+                        f.delete();
+                    }else{
+                        children.add(ownCloudFile);
+                    }
+                }
+            }
+        }
+        return children;
     }
 
     @Override


More information about the Libreoffice-commits mailing list