re-add redownload context menu entry for deleted files. fixes #2453

This commit is contained in:
Daniel Gultsch 2017-04-20 11:52:54 +02:00
parent ae85a9e87b
commit 9cc37a7bdb
2 changed files with 16 additions and 0 deletions

View File

@ -608,6 +608,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
MenuItem shareWith = menu.findItem(R.id.share_with);
MenuItem sendAgain = menu.findItem(R.id.send_again);
MenuItem copyUrl = menu.findItem(R.id.copy_url);
MenuItem downloadFile = menu.findItem(R.id.download_file);
MenuItem cancelTransmission = menu.findItem(R.id.cancel_transmission);
MenuItem deleteFile = menu.findItem(R.id.delete_file);
MenuItem showErrorMessage = menu.findItem(R.id.show_error_message);
@ -637,6 +638,10 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|| (t != null && t instanceof HttpDownloadConnection)) {
copyUrl.setVisible(true);
}
if ((m.isFileOrImage() && t instanceof TransferablePlaceholder && m.hasFileOnRemoteHost())) {
downloadFile.setVisible(true);
downloadFile.setTitle(activity.getString(R.string.download_x_file,UIHelper.getFileDescriptionString(activity, m)));
}
boolean waitingOfferedSending = m.getStatus() == Message.STATUS_WAITING
|| m.getStatus() == Message.STATUS_UNSEND
|| m.getStatus() == Message.STATUS_OFFERED;
@ -677,6 +682,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
case R.id.copy_url:
copyUrl(selectedMessage);
return true;
case R.id.download_file:
downloadFile(selectedMessage);
return true;
case R.id.cancel_transmission:
cancelTransmission(selectedMessage);
return true;
@ -798,6 +806,10 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
}
}
private void downloadFile(Message message) {
activity.xmppConnectionService.getHttpConnectionManager().createNewDownloadConnection(message,true);
}
private void cancelTransmission(Message message) {
Transferable transferable = message.getTransferable();
if (transferable != null) {

View File

@ -33,6 +33,10 @@
android:id="@+id/send_again"
android:title="@string/send_again"
android:visible="false"/>
<item
android:id="@+id/download_file"
android:title="@string/download_x_file"
android:visible="false"/>
<item
android:id="@+id/cancel_transmission"
android:title="@string/cancel_transmission"