X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/2a04c6ae5da009baa78c243606297b5a039925c2..a032bdeebc51a6e81d1bd5c558944f96fc55eacb:/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java diff --git a/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java b/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java index 6a34c6d0..ad6f6047 100644 --- a/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java +++ b/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java @@ -79,6 +79,7 @@ import eu.alefzero.owncloud.authenticator.AccountAuthenticator; import eu.alefzero.owncloud.datamodel.FileDataStorageManager; import eu.alefzero.owncloud.datamodel.OCFile; import eu.alefzero.owncloud.files.services.FileDownloader; +import eu.alefzero.owncloud.files.services.FileUploader; import eu.alefzero.owncloud.ui.activity.FileDisplayActivity; import eu.alefzero.owncloud.utils.OwnCloudVersion; import eu.alefzero.webdav.WebdavClient; @@ -217,7 +218,6 @@ public class FileDetailFragment extends SherlockFragment implements i.putExtra(FileDownloader.EXTRA_FILE_SIZE, mFile.getFileLength()); // update ui - Toast.makeText(getActivity(), "Downloading", Toast.LENGTH_LONG).show(); setButtonsForDownloading(); getActivity().startService(i); @@ -240,7 +240,7 @@ public class FileDetailFragment extends SherlockFragment implements break; } case R.id.fdRemoveBtn: { - ConfirmationDialogFragment confDialog = ConfirmationDialogFragment.newInstance("to remove " + mFile.getFileName()); + ConfirmationDialogFragment confDialog = ConfirmationDialogFragment.newInstance(R.string.confirmation_remove_alert, new String[]{mFile.getFileName()}); confDialog.setOnConfirmationListener(this); confDialog.show(getFragmentManager(), FTAG_CONFIRMATION); break; @@ -361,7 +361,7 @@ public class FileDetailFragment extends SherlockFragment implements cb.setChecked(mFile.keepInSync()); // configure UI for depending upon local state of the file - if (mFile.isDownloading()) { + if (FileDownloader.isDownloading(mAccount, mFile.getRemotePath())) { setButtonsForDownloading(); } else if (mFile.isDown()) { @@ -553,7 +553,9 @@ public class FileDetailFragment extends SherlockFragment implements private class DownloadFinishReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - if (mFile != null) { + String accountName = intent.getStringExtra(FileDownloader.ACCOUNT_NAME); + + if (!isEmpty() && accountName.equals(mAccount.name)) { boolean downloadWasFine = intent.getBooleanExtra(FileDownloader.EXTRA_DOWNLOAD_RESULT, false); String downloadedRemotePath = intent.getStringExtra(FileDownloader.EXTRA_REMOTE_PATH); if (mFile.getRemotePath().equals(downloadedRemotePath)) { @@ -688,7 +690,7 @@ public class FileDetailFragment extends SherlockFragment implements if (!newFilename.equals(mFile.getFileName())) { FileDataStorageManager fdsm = new FileDataStorageManager(mAccount, getActivity().getContentResolver()); if (fdsm.getFileById(mFile.getFileId()) != null) { - OCFile newFile = new OCFile(fdsm.getFileById(mFile.getParentId()).getRemotePath() + OCFile.PATH_SEPARATOR + newFilename); + OCFile newFile = new OCFile(fdsm.getFileById(mFile.getParentId()).getRemotePath() + newFilename); newFile.setCreationTimestamp(mFile.getCreationTimestamp()); newFile.setFileId(mFile.getFileId()); newFile.setFileLength(mFile.getFileLength()); @@ -700,9 +702,9 @@ public class FileDetailFragment extends SherlockFragment implements if (mFile.isDown()) { File f = new File(mFile.getStoragePath()); Log.e(TAG, f.getAbsolutePath()); - f.renameTo(new File(f.getParent()+"/"+newFilename)); - Log.e(TAG, f.getAbsolutePath()); - newFile.setStoragePath(f.getAbsolutePath()); + f.renameTo(new File(f.getParent() + File.separator + newFilename)); // TODO check if fails + Log.e(TAG, f.getParent() + File.separator + newFilename); + newFile.setStoragePath(f.getParent() + File.separator + newFilename); } new Thread(new RenameRunnable(mFile, newFile, mAccount, new Handler())).start(); @@ -731,6 +733,7 @@ public class FileDetailFragment extends SherlockFragment implements public void run() { WebdavClient wc = new WebdavClient(mAccount, getSherlockActivity().getApplicationContext()); + wc.allowSelfsignedCertificates(); AccountManager am = AccountManager.get(getSherlockActivity()); String baseUrl = am.getUserData(mAccount, AccountAuthenticator.KEY_OC_BASE_URL); OwnCloudVersion ocv = new OwnCloudVersion(am.getUserData(mAccount, AccountAuthenticator.KEY_OC_VERSION)); @@ -861,6 +864,7 @@ public class FileDetailFragment extends SherlockFragment implements public void run() { WebdavClient wc = new WebdavClient(mAccount, getSherlockActivity().getApplicationContext()); + wc.allowSelfsignedCertificates(); AccountManager am = AccountManager.get(getSherlockActivity()); String baseUrl = am.getUserData(mAccount, AccountAuthenticator.KEY_OC_BASE_URL); OwnCloudVersion ocv = new OwnCloudVersion(am.getUserData(mAccount, AccountAuthenticator.KEY_OC_VERSION));