Quick patch to fix operations not ready for HTTPS
[pub/Android/ownCloud.git] / src / eu / alefzero / owncloud / ui / fragment / FileDetailFragment.java
index 2f694f2..ad6f604 100644 (file)
@@ -218,7 +218,6 @@ public class FileDetailFragment extends SherlockFragment implements
                 i.putExtra(FileDownloader.EXTRA_FILE_SIZE, mFile.getFileLength());\r
                 \r
                 // update ui \r
                 i.putExtra(FileDownloader.EXTRA_FILE_SIZE, mFile.getFileLength());\r
                 \r
                 // update ui \r
-                Toast.makeText(getActivity(), "Downloading", Toast.LENGTH_LONG).show();\r
                 setButtonsForDownloading();\r
                 \r
                 getActivity().startService(i);\r
                 setButtonsForDownloading();\r
                 \r
                 getActivity().startService(i);\r
@@ -241,7 +240,7 @@ public class FileDetailFragment extends SherlockFragment implements
                 break;\r
             }   \r
             case R.id.fdRemoveBtn: {\r
                 break;\r
             }   \r
             case R.id.fdRemoveBtn: {\r
-                ConfirmationDialogFragment confDialog = ConfirmationDialogFragment.newInstance("to remove " + mFile.getFileName());\r
+                ConfirmationDialogFragment confDialog = ConfirmationDialogFragment.newInstance(R.string.confirmation_remove_alert, new String[]{mFile.getFileName()});\r
                 confDialog.setOnConfirmationListener(this);\r
                 confDialog.show(getFragmentManager(), FTAG_CONFIRMATION);\r
                 break;\r
                 confDialog.setOnConfirmationListener(this);\r
                 confDialog.show(getFragmentManager(), FTAG_CONFIRMATION);\r
                 break;\r
@@ -362,7 +361,7 @@ public class FileDetailFragment extends SherlockFragment implements
             cb.setChecked(mFile.keepInSync());\r
 \r
             // configure UI for depending upon local state of the file\r
             cb.setChecked(mFile.keepInSync());\r
 \r
             // configure UI for depending upon local state of the file\r
-            if (mFile.isDownloading()) {\r
+            if (FileDownloader.isDownloading(mAccount, mFile.getRemotePath())) {\r
                 setButtonsForDownloading();\r
                 \r
             } else if (mFile.isDown()) {\r
                 setButtonsForDownloading();\r
                 \r
             } else if (mFile.isDown()) {\r
@@ -556,7 +555,7 @@ public class FileDetailFragment extends SherlockFragment implements
         public void onReceive(Context context, Intent intent) {\r
             String accountName = intent.getStringExtra(FileDownloader.ACCOUNT_NAME);\r
 \r
         public void onReceive(Context context, Intent intent) {\r
             String accountName = intent.getStringExtra(FileDownloader.ACCOUNT_NAME);\r
 \r
-            if (accountName.equals(mAccount.name) && mFile != null) {\r
+            if (!isEmpty() && accountName.equals(mAccount.name)) {\r
                 boolean downloadWasFine = intent.getBooleanExtra(FileDownloader.EXTRA_DOWNLOAD_RESULT, false);\r
                 String downloadedRemotePath = intent.getStringExtra(FileDownloader.EXTRA_REMOTE_PATH);\r
                 if (mFile.getRemotePath().equals(downloadedRemotePath)) {\r
                 boolean downloadWasFine = intent.getBooleanExtra(FileDownloader.EXTRA_DOWNLOAD_RESULT, false);\r
                 String downloadedRemotePath = intent.getStringExtra(FileDownloader.EXTRA_REMOTE_PATH);\r
                 if (mFile.getRemotePath().equals(downloadedRemotePath)) {\r
@@ -734,6 +733,7 @@ public class FileDetailFragment extends SherlockFragment implements
         \r
         public void run() {\r
             WebdavClient wc = new WebdavClient(mAccount, getSherlockActivity().getApplicationContext());\r
         \r
         public void run() {\r
             WebdavClient wc = new WebdavClient(mAccount, getSherlockActivity().getApplicationContext());\r
+            wc.allowSelfsignedCertificates();\r
             AccountManager am = AccountManager.get(getSherlockActivity());\r
             String baseUrl = am.getUserData(mAccount, AccountAuthenticator.KEY_OC_BASE_URL);\r
             OwnCloudVersion ocv = new OwnCloudVersion(am.getUserData(mAccount, AccountAuthenticator.KEY_OC_VERSION));\r
             AccountManager am = AccountManager.get(getSherlockActivity());\r
             String baseUrl = am.getUserData(mAccount, AccountAuthenticator.KEY_OC_BASE_URL);\r
             OwnCloudVersion ocv = new OwnCloudVersion(am.getUserData(mAccount, AccountAuthenticator.KEY_OC_VERSION));\r
@@ -864,6 +864,7 @@ public class FileDetailFragment extends SherlockFragment implements
         \r
         public void run() {\r
             WebdavClient wc = new WebdavClient(mAccount, getSherlockActivity().getApplicationContext());\r
         \r
         public void run() {\r
             WebdavClient wc = new WebdavClient(mAccount, getSherlockActivity().getApplicationContext());\r
+            wc.allowSelfsignedCertificates();\r
             AccountManager am = AccountManager.get(getSherlockActivity());\r
             String baseUrl = am.getUserData(mAccount, AccountAuthenticator.KEY_OC_BASE_URL);\r
             OwnCloudVersion ocv = new OwnCloudVersion(am.getUserData(mAccount, AccountAuthenticator.KEY_OC_VERSION));\r
             AccountManager am = AccountManager.get(getSherlockActivity());\r
             String baseUrl = am.getUserData(mAccount, AccountAuthenticator.KEY_OC_BASE_URL);\r
             OwnCloudVersion ocv = new OwnCloudVersion(am.getUserData(mAccount, AccountAuthenticator.KEY_OC_VERSION));\r