diff options
Diffstat (limited to 'src/main/java/de')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 11e81bfc6..c218a940e 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -630,6 +630,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa MenuItem sendAgain = menu.findItem(R.id.send_again); MenuItem copyUrl = menu.findItem(R.id.copy_url); MenuItem cancelTransmission = menu.findItem(R.id.cancel_transmission); + MenuItem downloadFile = menu.findItem(R.id.download_file); MenuItem deleteFile = menu.findItem(R.id.delete_file); MenuItem showErrorMessage = menu.findItem(R.id.show_error_message); if (!treatAsFile @@ -667,6 +668,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; @@ -708,6 +713,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; @@ -832,6 +840,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) { |