added dialog for otr file transfer

This commit is contained in:
Daniel Gultsch 2014-05-09 21:20:34 +02:00
parent f0eb80eb5c
commit ef0bc6714a
3 changed files with 30 additions and 3 deletions

View File

@ -4,13 +4,13 @@
android:id="@+id/action_add" android:id="@+id/action_add"
android:orderInCategory="10" android:orderInCategory="10"
android:icon="@drawable/ic_action_add" android:icon="@drawable/ic_action_add"
android:showAsAction="always" android:showAsAction="ifRoom"
android:title="@string/action_add" /> android:title="@string/action_add" />
<item <item
android:id="@+id/action_security" android:id="@+id/action_security"
android:orderInCategory="20" android:orderInCategory="20"
android:showAsAction="always" android:showAsAction="ifRoom"
android:icon="@drawable/ic_action_unsecure" android:icon="@drawable/ic_action_unsecure"
android:title="@string/action_secure" /> android:title="@string/action_secure" />

View File

@ -89,4 +89,7 @@
<string name="encrypted_message_received"><i>Encrypted message received. Touch to view and decrypt.</i></string> <string name="encrypted_message_received"><i>Encrypted message received. Touch to view and decrypt.</i></string>
<string name="encrypted_image_received"><i>Encrypted image received. Touch to view and decrypt.</i></string> <string name="encrypted_image_received"><i>Encrypted image received. Touch to view and decrypt.</i></string>
<string name="image_file"><i>Image received. Touch to view</i></string> <string name="image_file"><i>Image received. Touch to view</i></string>
<string name="otr_file_transfer">OTR encryption not available</string>
<string name="otr_file_transfer_msg">Unfortunaly OTR encryption is not available for file transfer. You can choose either openPGP or no encryption.</string>
<string name="use_pgp_encryption">Use openPGP encryption</string>
</resources> </resources>

View File

@ -2,7 +2,6 @@ package eu.siacs.conversations.ui;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.math.BigInteger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.List; import java.util.List;
@ -390,6 +389,31 @@ public class ConversationActivity extends XmppActivity {
} }
} else if (getSelectedConversation().getNextEncryption() == Message.ENCRYPTION_NONE) { } else if (getSelectedConversation().getNextEncryption() == Message.ENCRYPTION_NONE) {
attachFileDialog(); attachFileDialog();
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getString(R.string.otr_file_transfer));
builder.setMessage(getString(R.string.otr_file_transfer_msg));
builder.setNegativeButton(getString(R.string.cancel), null);
if (conversation.getContact().getPgpKeyId()==0) {
builder.setPositiveButton(getString(R.string.send_unencrypted), new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
conversation.setNextEncryption(Message.ENCRYPTION_NONE);
attachFile();
}
});
} else {
builder.setPositiveButton(getString(R.string.use_pgp_encryption), new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
conversation.setNextEncryption(Message.ENCRYPTION_PGP);
attachFile();
}
});
}
builder.create().show();
} }
} }