|
@ -296,6 +296,7 @@ public class FragmentCompose extends FragmentEx { |
|
|
EntityIdentity identity = (EntityIdentity) spFrom.getSelectedItem(); |
|
|
EntityIdentity identity = (EntityIdentity) spFrom.getSelectedItem(); |
|
|
|
|
|
|
|
|
Bundle args = new Bundle(); |
|
|
Bundle args = new Bundle(); |
|
|
|
|
|
args.putString("action", action); |
|
|
args.putLong("id", id); |
|
|
args.putLong("id", id); |
|
|
args.putLong("iid", identity == null ? -1 : identity.id); |
|
|
args.putLong("iid", identity == null ? -1 : identity.id); |
|
|
args.putString("thread", FragmentCompose.this.thread); |
|
|
args.putString("thread", FragmentCompose.this.thread); |
|
@ -305,7 +306,6 @@ public class FragmentCompose extends FragmentEx { |
|
|
args.putString("bcc", etBcc.getText().toString()); |
|
|
args.putString("bcc", etBcc.getText().toString()); |
|
|
args.putString("subject", etSubject.getText().toString()); |
|
|
args.putString("subject", etSubject.getText().toString()); |
|
|
args.putString("body", etBody.getText().toString()); |
|
|
args.putString("body", etBody.getText().toString()); |
|
|
args.putString("action", action); |
|
|
|
|
|
|
|
|
|
|
|
LoaderManager.getInstance(this) |
|
|
LoaderManager.getInstance(this) |
|
|
.restartLoader(ActivityCompose.LOADER_COMPOSE_PUT, args, putLoaderCallbacks).forceLoad(); |
|
|
.restartLoader(ActivityCompose.LOADER_COMPOSE_PUT, args, putLoaderCallbacks).forceLoad(); |
|
@ -502,8 +502,8 @@ public class FragmentCompose extends FragmentEx { |
|
|
@Override |
|
|
@Override |
|
|
public Throwable loadInBackground() { |
|
|
public Throwable loadInBackground() { |
|
|
try { |
|
|
try { |
|
|
long id = args.getLong("id"); |
|
|
|
|
|
String action = args.getString("action"); |
|
|
String action = args.getString("action"); |
|
|
|
|
|
long id = args.getLong("id"); |
|
|
Log.i(Helper.TAG, "Put load id=" + id + " action=" + action); |
|
|
Log.i(Helper.TAG, "Put load id=" + id + " action=" + action); |
|
|
|
|
|
|
|
|
DB db = DB.getInstance(getContext()); |
|
|
DB db = DB.getInstance(getContext()); |
|
@ -560,21 +560,7 @@ public class FragmentCompose extends FragmentEx { |
|
|
try { |
|
|
try { |
|
|
db.beginTransaction(); |
|
|
db.beginTransaction(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("save".equals(action)) { |
|
|
|
|
|
// Delete previous draft |
|
|
|
|
|
draft.ui_hide = true; |
|
|
|
|
|
db.message().updateMessage(draft); |
|
|
|
|
|
EntityOperation.queue(db, draft, EntityOperation.DELETE); |
|
|
|
|
|
|
|
|
|
|
|
// Create new draft |
|
|
|
|
|
draft.id = null; |
|
|
|
|
|
draft.uid = null; |
|
|
|
|
|
draft.ui_hide = false; |
|
|
|
|
|
draft.id = db.message().insertMessage(draft); |
|
|
|
|
|
EntityOperation.queue(db, draft, EntityOperation.ADD); |
|
|
|
|
|
|
|
|
|
|
|
} else if ("trash".equals(action)) { |
|
|
|
|
|
|
|
|
if ("trash".equals(action)) { |
|
|
EntityFolder trash = db.folder().getFolderByType(ident.account, EntityFolder.TRASH); |
|
|
EntityFolder trash = db.folder().getFolderByType(ident.account, EntityFolder.TRASH); |
|
|
|
|
|
|
|
|
boolean move = (draft.uid != null); |
|
|
boolean move = (draft.uid != null); |
|
@ -588,6 +574,19 @@ public class FragmentCompose extends FragmentEx { |
|
|
if (!move) |
|
|
if (!move) |
|
|
EntityOperation.queue(db, draft, EntityOperation.ADD); |
|
|
EntityOperation.queue(db, draft, EntityOperation.ADD); |
|
|
|
|
|
|
|
|
|
|
|
} else if ("save".equals(action)) { |
|
|
|
|
|
// Delete previous draft |
|
|
|
|
|
draft.ui_hide = true; |
|
|
|
|
|
db.message().updateMessage(draft); |
|
|
|
|
|
EntityOperation.queue(db, draft, EntityOperation.DELETE); |
|
|
|
|
|
|
|
|
|
|
|
// Create new draft |
|
|
|
|
|
draft.id = null; |
|
|
|
|
|
draft.uid = null; |
|
|
|
|
|
draft.ui_hide = false; |
|
|
|
|
|
draft.id = db.message().insertMessage(draft); |
|
|
|
|
|
EntityOperation.queue(db, draft, EntityOperation.ADD); |
|
|
|
|
|
|
|
|
} else if ("send".equals(action)) { |
|
|
} else if ("send".equals(action)) { |
|
|
if (draft.to == null && draft.cc == null && draft.bcc == null) |
|
|
if (draft.to == null && draft.cc == null && draft.bcc == null) |
|
|
throw new IllegalArgumentException(getContext().getString(R.string.title_to_missing)); |
|
|
throw new IllegalArgumentException(getContext().getString(R.string.title_to_missing)); |
|
|