sync option in filelist menu
[pub/Android/ownCloud.git] / src / eu / alefzero / owncloud / syncadapter / FileSyncAdapter.java
index 816e79e..a97d59d 100644 (file)
@@ -33,6 +33,7 @@ import android.content.Intent;
 import android.content.SyncResult;\r
 import android.content.IntentSender.SendIntentException;\r
 import android.os.Bundle;\r
+import android.util.Log;\r
 import eu.alefzero.owncloud.datamodel.FileDataStorageManager;\r
 import eu.alefzero.owncloud.datamodel.OCFile;\r
 import eu.alefzero.webdav.WebdavEntry;\r
@@ -45,10 +46,6 @@ import eu.alefzero.webdav.WebdavEntry;
  */\r
 public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {\r
 \r
-  public static final String SYNC_MESSAGE = "eu.alefzero.owncloud.files.ACCOUNT_SYNC";\r
-  public static final String IN_PROGRESS = "sync_in_progress";\r
-  public static final String ACCOUNT_NAME = "account_name";\r
-  \r
        public FileSyncAdapter(Context context, boolean autoInitialize) {\r
                super(context, autoInitialize);\r
        }\r
@@ -65,17 +62,19 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
                        this.setContentProvider(provider);\r
                        this.setStorageManager(new FileDataStorageManager(account, getContentProvider()));\r
 \r
-                       Intent i = new Intent(SYNC_MESSAGE);\r
-                       i.putExtra(IN_PROGRESS, true);\r
-                       i.putExtra("ACCOUNT_NAME", account.name);\r
+                       Intent i = new Intent(FileSyncService.SYNC_MESSAGE);\r
+                       i.putExtra(FileSyncService.IN_PROGRESS, true);\r
+                       i.putExtra(FileSyncService.ACCOUNT_NAME, account.name);\r
                        getContext().sendStickyBroadcast(i);\r
                        \r
                        PropFindMethod query;\r
       try {\r
-        query = new PropFindMethod(getUri().toString());\r
+        Log.e("ASD", getUri().toString());\r
+        query = new PropFindMethod(getUri().toString()+"/");\r
         getClient().executeMethod(query);\r
         MultiStatus resp = null;\r
         resp = query.getResponseBodyAsMultiStatus();\r
+        \r
         if (resp.getResponses().length > 0) {\r
           WebdavEntry we = new WebdavEntry(resp.getResponses()[0]);\r
           OCFile file = fillOCFile(we);\r
@@ -95,7 +94,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
         syncResult.stats.numIoExceptions++;\r
         e.printStackTrace();\r
       }\r
-      i.putExtra(IN_PROGRESS, false);\r
+      i.putExtra(FileSyncService.IN_PROGRESS, false);\r
       getContext().sendStickyBroadcast(i);\r
        }\r
 \r