1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Added option to specify Reply-to address for an identity. Patch provided by fiouzy (Thanks!).

Fixes issue 1762
This commit is contained in:
cketti 2010-06-20 12:48:22 +00:00
parent e529bed259
commit 7f625b5ef4
6 changed files with 51 additions and 1 deletions

View File

@ -49,6 +49,20 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:hint="@string/edit_identity_email_hint" android:hint="@string/edit_identity_email_hint"
/> />
<TextView
android:text="@string/edit_identity_reply_to_label"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
/>
<EditText
android:id="@+id/reply_to"
android:singleLine="true"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:hint="@string/edit_identity_reply_to_hint"
/>
<!-- <!--
<TextView <TextView
android:text="@string/edit_identity_always_bcc_label" android:text="@string/edit_identity_always_bcc_label"

View File

@ -609,6 +609,8 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="edit_identity_name_hint">(Optional)</string> <string name="edit_identity_name_hint">(Optional)</string>
<string name="edit_identity_email_label">Email address</string> <string name="edit_identity_email_label">Email address</string>
<string name="edit_identity_email_hint">(Required)</string> <string name="edit_identity_email_hint">(Required)</string>
<string name="edit_identity_reply_to_label">Reply-to address</string>
<string name="edit_identity_reply_to_hint">(Optional)</string>
<string name="edit_identity_signature_label">Signature</string> <string name="edit_identity_signature_label">Signature</string>
<string name="edit_identity_signature_hint">(Optional)</string> <string name="edit_identity_signature_hint">(Optional)</string>

View File

@ -1044,6 +1044,7 @@ public class Account implements BaseAccount
boolean signatureUse = prefs.getBoolean(mUuid + ".signatureUse." + ident, true); boolean signatureUse = prefs.getBoolean(mUuid + ".signatureUse." + ident, true);
String signature = prefs.getString(mUuid + ".signature." + ident, null); String signature = prefs.getString(mUuid + ".signature." + ident, null);
String description = prefs.getString(mUuid + ".description." + ident, null); String description = prefs.getString(mUuid + ".description." + ident, null);
final String replyTo = prefs.getString(mUuid + ".replyTo." + ident, null);
if (email != null) if (email != null)
{ {
Identity identity = new Identity(); Identity identity = new Identity();
@ -1052,6 +1053,7 @@ public class Account implements BaseAccount
identity.setSignatureUse(signatureUse); identity.setSignatureUse(signatureUse);
identity.setSignature(signature); identity.setSignature(signature);
identity.setDescription(description); identity.setDescription(description);
identity.setReplyTo(replyTo);
newIdentities.add(identity); newIdentities.add(identity);
gotOne = true; gotOne = true;
} }
@ -1092,6 +1094,7 @@ public class Account implements BaseAccount
editor.remove(mUuid + ".signatureUse." + ident); editor.remove(mUuid + ".signatureUse." + ident);
editor.remove(mUuid + ".signature." + ident); editor.remove(mUuid + ".signature." + ident);
editor.remove(mUuid + ".description." + ident); editor.remove(mUuid + ".description." + ident);
editor.remove(mUuid + ".replyTo." + ident);
gotOne = true; gotOne = true;
} }
ident++; ident++;
@ -1111,6 +1114,7 @@ public class Account implements BaseAccount
editor.putBoolean(mUuid + ".signatureUse." + ident, identity.getSignatureUse()); editor.putBoolean(mUuid + ".signatureUse." + ident, identity.getSignatureUse());
editor.putString(mUuid + ".signature." + ident, identity.getSignature()); editor.putString(mUuid + ".signature." + ident, identity.getSignature());
editor.putString(mUuid + ".description." + ident, identity.getDescription()); editor.putString(mUuid + ".description." + ident, identity.getDescription());
editor.putString(mUuid + ".replyTo." + ident, identity.getReplyTo());
ident++; ident++;
} }
} }

View File

@ -9,6 +9,7 @@ public class Identity implements Serializable
private String mEmail; private String mEmail;
private String mSignature; private String mSignature;
private boolean mSignatureUse; private boolean mSignatureUse;
private String replyTo;
public synchronized String getName() public synchronized String getName()
{ {
@ -60,9 +61,19 @@ public class Identity implements Serializable
mDescription = description; mDescription = description;
} }
public synchronized String getReplyTo()
{
return replyTo;
}
public synchronized void setReplyTo(String replyTo)
{
this.replyTo = replyTo;
}
@Override @Override
public synchronized String toString() public synchronized String toString()
{ {
return "Account.Identity(description=" + mDescription + ", name=" + mName + ", email=" + mEmail + ", signature=" + mSignature; return "Account.Identity(description=" + mDescription + ", name=" + mName + ", email=" + mEmail + ", replyTo=" + replyTo + ", signature=" + mSignature;
} }
} }

View File

@ -30,6 +30,7 @@ public class EditIdentity extends K9Activity
private EditText mEmailView; private EditText mEmailView;
// private EditText mAlwaysBccView; // private EditText mAlwaysBccView;
private EditText mNameView; private EditText mNameView;
private EditText mReplyTo;
@Override @Override
public void onCreate(Bundle savedInstanceState) public void onCreate(Bundle savedInstanceState)
@ -66,6 +67,9 @@ public class EditIdentity extends K9Activity
mEmailView = (EditText)findViewById(R.id.email); mEmailView = (EditText)findViewById(R.id.email);
mEmailView.setText(mIdentity.getEmail()); mEmailView.setText(mIdentity.getEmail());
mReplyTo = (EditText) findViewById(R.id.reply_to);
mReplyTo.setText(mIdentity.getReplyTo());
// mAccountAlwaysBcc = (EditText)findViewById(R.id.bcc); // mAccountAlwaysBcc = (EditText)findViewById(R.id.bcc);
// mAccountAlwaysBcc.setText(mIdentity.getAlwaysBcc()); // mAccountAlwaysBcc.setText(mIdentity.getAlwaysBcc());
@ -115,6 +119,15 @@ public class EditIdentity extends K9Activity
mIdentity.setSignatureUse(mSignatureUse.isChecked()); mIdentity.setSignatureUse(mSignatureUse.isChecked());
mIdentity.setSignature(mSignatureView.getText().toString()); mIdentity.setSignature(mSignatureView.getText().toString());
if (mReplyTo.getText().length() == 0)
{
mIdentity.setReplyTo(null);
}
else
{
mIdentity.setReplyTo(mReplyTo.getText().toString());
}
List<Identity> identities = mAccount.getIdentities(); List<Identity> identities = mAccount.getIdentities();
if (mIdentityIndex == -1) if (mIdentityIndex == -1)
{ {

View File

@ -707,6 +707,12 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
message.setSubject(mSubjectView.getText().toString()); message.setSubject(mSubjectView.getText().toString());
message.setHeader("X-User-Agent", getString(R.string.message_header_mua)); message.setHeader("X-User-Agent", getString(R.string.message_header_mua));
final String replyTo = mIdentity.getReplyTo();
if (replyTo != null)
{
message.setReplyTo(new Address[] { new Address(replyTo) });
}
if (mInReplyTo != null) if (mInReplyTo != null)
{ {
message.setInReplyTo(mInReplyTo); message.setInReplyTo(mInReplyTo);