1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-17 21:32:26 -05:00

Added option setting/preference to specify the signature location. This fixed issue 74

This commit is contained in:
Bao-Long Nguyen-Trong 2009-05-17 06:02:02 +00:00
parent 42194562c1
commit d222a48a18
5 changed files with 63 additions and 22 deletions

View File

@ -55,6 +55,28 @@
android:id="@+id/account_signature" android:id="@+id/account_signature"
android:singleLine="false" android:singleLine="false"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent" /> android:layout_width="fill_parent" />
<TextView
android:text="@string/account_settings_signature__location_label"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary" />
<RadioGroup
android:id="@+id/account_signature_location"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="vertical" >
<RadioButton
android:id="@+id/account_signature_location_before_quoted_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/account_settings_signature__location_before_quoted_text" />
<RadioButton
android:id="@+id/account_signature_location_after_quoted_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/account_settings_signature__location_after_quoted_text" />
</RadioGroup>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View File

@ -459,4 +459,8 @@ Welcome to K-9 Mail setup. K-9 is an open source email client for Android based
<string name="message_list_help_key">Del (or D) - Delete\u000AR - <string name="message_list_help_key">Del (or D) - Delete\u000AR -
Reply\u000AA - Reply All\u000AC - Compose\u000AF - Forward\u000aM - Move\u000AY - Copy\u000AG - Flag\u000AO - Sort type\u000AI - Sort order\u000AQ Reply\u000AA - Reply All\u000AC - Compose\u000AF - Forward\u000aM - Move\u000AY - Copy\u000AG - Flag\u000AO - Sort type\u000AI - Sort order\u000AQ
- Return to Accounts</string> - Return to Accounts</string>
<string name="account_settings_signature__location_label">Signature before/after quote</string>
<string name="account_settings_signature__location_before_quoted_text">Before</string>
<string name="account_settings_signature__location_after_quoted_text">After</string>
</resources> </resources>

View File

@ -56,7 +56,8 @@ public class Account implements Serializable {
String mRingtoneUri; String mRingtoneUri;
boolean mNotifySync; boolean mNotifySync;
HideButtons mHideMessageViewButtons; HideButtons mHideMessageViewButtons;
boolean mIsSignatureBeforeQuotedText;
public enum FolderMode { public enum FolderMode {
ALL, FIRST_CLASS, FIRST_AND_SECOND_CLASS, NOT_SECOND_CLASS; ALL, FIRST_CLASS, FIRST_AND_SECOND_CLASS, NOT_SECOND_CLASS;
} }
@ -90,6 +91,7 @@ public class Account implements Serializable {
mFolderTargetMode = FolderMode.NOT_SECOND_CLASS; mFolderTargetMode = FolderMode.NOT_SECOND_CLASS;
mHideMessageViewButtons = HideButtons.NEVER; mHideMessageViewButtons = HideButtons.NEVER;
mRingtoneUri = "content://settings/system/notification_sound"; mRingtoneUri = "content://settings/system/notification_sound";
mIsSignatureBeforeQuotedText = false;
} }
Account(Preferences preferences, String uuid) { Account(Preferences preferences, String uuid) {
@ -199,6 +201,7 @@ public class Account implements Serializable {
mFolderTargetMode = FolderMode.NOT_SECOND_CLASS; mFolderTargetMode = FolderMode.NOT_SECOND_CLASS;
} }
mIsSignatureBeforeQuotedText = preferences.getPreferences().getBoolean(mUuid + ".signatureBeforeQuotedText", false);
} }
public String getUuid() { public String getUuid() {
@ -317,6 +320,7 @@ public class Account implements Serializable {
editor.remove(mUuid + ".folderSyncMode"); editor.remove(mUuid + ".folderSyncMode");
editor.remove(mUuid + ".folderTargetMode"); editor.remove(mUuid + ".folderTargetMode");
editor.remove(mUuid + ".hideButtonsEnum"); editor.remove(mUuid + ".hideButtonsEnum");
editor.remove(mUuid + ".signatureBeforeQuotedText");
editor.commit(); editor.commit();
} }
@ -380,6 +384,7 @@ public class Account implements Serializable {
editor.putString(mUuid + ".folderDisplayMode", mFolderDisplayMode.name()); editor.putString(mUuid + ".folderDisplayMode", mFolderDisplayMode.name());
editor.putString(mUuid + ".folderSyncMode", mFolderSyncMode.name()); editor.putString(mUuid + ".folderSyncMode", mFolderSyncMode.name());
editor.putString(mUuid + ".folderTargetMode", mFolderTargetMode.name()); editor.putString(mUuid + ".folderTargetMode", mFolderTargetMode.name());
editor.putBoolean(mUuid + ".signatureBeforeQuotedText", this.mIsSignatureBeforeQuotedText);
editor.commit(); editor.commit();
} }
@ -612,4 +617,12 @@ public class Account implements Serializable {
mFolderTargetMode = folderTargetMode; mFolderTargetMode = folderTargetMode;
} }
public boolean isSignatureBeforeQuotedText() {
return mIsSignatureBeforeQuotedText;
}
public void setSignatureBeforeQuotedText(boolean mIsSignatureBeforeQuotedText) {
this.mIsSignatureBeforeQuotedText = mIsSignatureBeforeQuotedText;
}
} }

View File

@ -481,9 +481,11 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
} }
if (!ACTION_EDIT_DRAFT.equals(action)) { if (!ACTION_EDIT_DRAFT.equals(action)) {
String signature = getSignature(); if (mAccount.isSignatureBeforeQuotedText()) {
if (signature!=null) { String signature = getSignature();
mMessageContentView.setText(signature); if (signature!=null) {
mMessageContentView.setText(signature);
}
} }
addAddress(mBccView, new Address(mAccount.getAlwaysBcc(), "")); addAddress(mBccView, new Address(mAccount.getAlwaysBcc(), ""));
} }
@ -636,16 +638,13 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
} }
} }
/* if (!mAccount.isSignatureBeforeQuotedText()
* Place holder for when we implement the signature location preference / setting && !ACTION_EDIT_DRAFT.equals(action)) {
*
if (!ACTION_EDIT_DRAFT.equals(action)) {
String signature = getSignature(); String signature = getSignature();
if (signature!=null) { if (signature!=null) {
text += signature; text += signature;
} }
} }//if isSignatureBeforeQuotedText DRAFT
*/
TextBody body = new TextBody(text); TextBody body = new TextBody(text);

View File

@ -2,22 +2,16 @@ package com.android.email.activity.setup;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.util.Log;
import android.os.Bundle; import android.os.Bundle;
import android.text.Editable; import android.util.Log;
import android.text.TextWatcher;
import android.view.View;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.widget.AdapterView;
import android.widget.EditText; import android.widget.EditText;
import android.widget.TextView;
import android.widget.RadioButton;
import com.android.email.Account; import com.android.email.Account;
import com.android.email.Email;
import com.android.email.Preferences; import com.android.email.Preferences;
import com.android.email.R; import com.android.email.R;
import com.android.email.Email;
import com.android.email.Utility;
public class AccountSetupComposition extends Activity { public class AccountSetupComposition extends Activity {
@ -29,6 +23,8 @@ public class AccountSetupComposition extends Activity {
private EditText mAccountEmail; private EditText mAccountEmail;
private EditText mAccountAlwaysBcc; private EditText mAccountAlwaysBcc;
private EditText mAccountName; private EditText mAccountName;
private RadioButton mAccountSignatureBeforeLocation;
private RadioButton mAccountSignatureAfterLocation;
public static void actionEditCompositionSettings(Activity context, Account account) { public static void actionEditCompositionSettings(Activity context, Account account) {
@ -66,7 +62,12 @@ public class AccountSetupComposition extends Activity {
mAccountSignature = (EditText)findViewById(R.id.account_signature); mAccountSignature = (EditText)findViewById(R.id.account_signature);
mAccountSignature.setText(mAccount.getSignature()); mAccountSignature.setText(mAccount.getSignature());
mAccountSignatureBeforeLocation = (RadioButton)findViewById(R.id.account_signature_location_before_quoted_text);
mAccountSignatureAfterLocation = (RadioButton)findViewById(R.id.account_signature_location_after_quoted_text);
boolean isSignatureBeforeQuotedText = mAccount.isSignatureBeforeQuotedText();
mAccountSignatureBeforeLocation.setChecked(isSignatureBeforeQuotedText);
mAccountSignatureAfterLocation.setChecked(!isSignatureBeforeQuotedText);
} }
@Override @Override
@ -79,7 +80,9 @@ public class AccountSetupComposition extends Activity {
mAccount.setEmail(mAccountEmail.getText().toString()); mAccount.setEmail(mAccountEmail.getText().toString());
mAccount.setAlwaysBcc(mAccountAlwaysBcc.getText().toString()); mAccount.setAlwaysBcc(mAccountAlwaysBcc.getText().toString());
mAccount.setName(mAccountName.getText().toString()); mAccount.setName(mAccountName.getText().toString());
mAccount.setSignature(mAccountSignature.getText().toString()); mAccount.setSignature(mAccountSignature.getText().toString());
boolean isSignatureBeforeQuotedText = mAccountSignatureBeforeLocation.isChecked();
mAccount.setSignatureBeforeQuotedText(isSignatureBeforeQuotedText);
mAccount.save(Preferences.getPreferences(this)); mAccount.save(Preferences.getPreferences(this));
} }