import eu.alefzero.owncloud.datamodel.FileDataStorageManager;\r
import eu.alefzero.owncloud.datamodel.OCFile;\r
import eu.alefzero.owncloud.files.services.FileDownloader;\r
+import eu.alefzero.owncloud.files.services.FileUploader;\r
import eu.alefzero.owncloud.ui.activity.FileDisplayActivity;\r
import eu.alefzero.owncloud.utils.OwnCloudVersion;\r
import eu.alefzero.webdav.WebdavClient;\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
private class DownloadFinishReceiver extends BroadcastReceiver {\r
@Override\r
public void onReceive(Context context, Intent intent) {\r
- if (mFile != null) {\r
+ String accountName = intent.getStringExtra(FileDownloader.ACCOUNT_NAME);\r
+\r
+ if (accountName.equals(mAccount.name) && mFile != null) {\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
if (!newFilename.equals(mFile.getFileName())) {\r
FileDataStorageManager fdsm = new FileDataStorageManager(mAccount, getActivity().getContentResolver());\r
if (fdsm.getFileById(mFile.getFileId()) != null) {\r
- OCFile newFile = new OCFile(fdsm.getFileById(mFile.getParentId()).getRemotePath() + OCFile.PATH_SEPARATOR + newFilename);\r
+ OCFile newFile = new OCFile(fdsm.getFileById(mFile.getParentId()).getRemotePath() + newFilename);\r
newFile.setCreationTimestamp(mFile.getCreationTimestamp());\r
newFile.setFileId(mFile.getFileId());\r
newFile.setFileLength(mFile.getFileLength());\r
if (mFile.isDown()) {\r
File f = new File(mFile.getStoragePath());\r
Log.e(TAG, f.getAbsolutePath());\r
- f.renameTo(new File(f.getParent()+"/"+newFilename));\r
- Log.e(TAG, f.getAbsolutePath());\r
- newFile.setStoragePath(f.getAbsolutePath());\r
+ f.renameTo(new File(f.getParent() + File.separator + newFilename)); // TODO check if fails\r
+ Log.e(TAG, f.getParent() + File.separator + newFilename);\r
+ newFile.setStoragePath(f.getParent() + File.separator + newFilename);\r
}\r
\r
new Thread(new RenameRunnable(mFile, newFile, mAccount, new Handler())).start();\r