diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
index b464d2318..1cd5507b5 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
@@ -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) {
diff --git a/src/main/res/menu/message_context.xml b/src/main/res/menu/message_context.xml
index 3ba14e084..283d3f2fc 100644
--- a/src/main/res/menu/message_context.xml
+++ b/src/main/res/menu/message_context.xml
@@ -33,6 +33,10 @@
android:id="@+id/send_again"
android:title="@string/send_again"
android:visible="false"/>
+