Renaming confussing token
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / fragment / FileDetailFragment.java
index 01fc186..b5d4a02 100644 (file)
@@ -292,7 +292,7 @@ public class FileDetailFragment extends SherlockFragment implements
                     }\r
                     \r
                 } else {\r
-                    mLastRemoteOperation = new SynchronizeFileOperation(mFile.getRemotePath(), fdsm, mAccount, true, false, getActivity());\r
+                    mLastRemoteOperation = new SynchronizeFileOperation(mFile, fdsm, mAccount, true, false, getActivity());\r
                     WebdavClient wc = OwnCloudClientUtils.createOwnCloudClient(mAccount, getSherlockActivity().getApplicationContext());\r
                     mLastRemoteOperation.execute(wc, this, mHandler);\r
                 \r
@@ -309,19 +309,6 @@ public class FileDetailFragment extends SherlockFragment implements
                 mFile.setKeepInSync(cb.isChecked());\r
                 fdsm.saveFile(mFile);\r
                 \r
-                /* NOT HERE\r
-                 * now that FileObserverService is involved, the easiest way to coordinate it with the download service\r
-                 * in every possible case is let the FileObserverService decide if the download should be started at\r
-                 * this moment or not\r
-                 * \r
-                 * see changes at FileObserverService#addObservedFile\r
-                 \r
-                   if (mFile.keepInSync()) {\r
-                    onClick(getView().findViewById(R.id.fdDownloadBtn));\r
-                } else {\r
-                    mContainerActivity.onFileStateChanged();    // put inside 'else' to not call it twice (here, and in the virtual click on fdDownloadBtn)\r
-                }*/\r
-                \r
                 /// register the OCFile instance in the observer service to monitor local updates;\r
                 /// if necessary, the file is download \r
                 Intent intent = new Intent(getActivity().getApplicationContext(),\r
@@ -335,7 +322,9 @@ public class FileDetailFragment extends SherlockFragment implements
                 Log.e(TAG, "starting observer service");\r
                 getActivity().startService(intent);\r
                 \r
-                mContainerActivity.onFileStateChanged();                \r
+                if (mFile.keepInSync()) {\r
+                    onClick(getView().findViewById(R.id.fdDownloadBtn));    // force an immediate synchronization\r
+                }\r
                 break;\r
             }\r
             case R.id.fdRenameBtn: {\r
@@ -594,7 +583,7 @@ public class FileDetailFragment extends SherlockFragment implements
     private void setButtonsForDown() {\r
         if (!isEmpty()) {\r
             Button downloadButton = (Button) getView().findViewById(R.id.fdDownloadBtn);\r
-            downloadButton.setText(R.string.filedetails_redownload);\r
+            downloadButton.setText(R.string.filedetails_sync_file);\r
             //downloadButton.setEnabled(true);\r
         \r
             ((Button) getView().findViewById(R.id.fdOpenBtn)).setEnabled(true);\r