|
|
|
@ -2956,30 +2956,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
db.message().updateMessage(draft);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (action == R.id.action_undo || action == R.id.action_redo) {
|
|
|
|
|
if (draft.revision != null && draft.revisions != null) {
|
|
|
|
|
dirty = true;
|
|
|
|
|
|
|
|
|
|
if (action == R.id.action_undo) {
|
|
|
|
|
if (draft.revision > 1)
|
|
|
|
|
draft.revision--;
|
|
|
|
|
} else {
|
|
|
|
|
if (draft.revision < draft.revisions)
|
|
|
|
|
draft.revision++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
body = Helper.readText(draft.getFile(context, draft.revision));
|
|
|
|
|
Helper.writeText(draft.getFile(context), body);
|
|
|
|
|
|
|
|
|
|
db.message().setMessageRevision(draft.id, draft.revision);
|
|
|
|
|
|
|
|
|
|
db.message().setMessageContent(draft.id,
|
|
|
|
|
true,
|
|
|
|
|
draft.plain_only, // unchanged
|
|
|
|
|
HtmlHelper.getPreview(body),
|
|
|
|
|
null);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// Save changed draft
|
|
|
|
|
File file = draft.getFile(context);
|
|
|
|
|
if (!file.exists())
|
|
|
|
|
Helper.writeText(file, body);
|
|
|
|
@ -2991,6 +2968,8 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
draft.revisions = 1;
|
|
|
|
|
else
|
|
|
|
|
draft.revisions++;
|
|
|
|
|
|
|
|
|
|
if (action != R.id.action_undo && action != R.id.action_redo)
|
|
|
|
|
draft.revision = draft.revisions;
|
|
|
|
|
|
|
|
|
|
Helper.writeText(draft.getFile(context), body);
|
|
|
|
@ -3005,6 +2984,30 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
HtmlHelper.getPreview(body),
|
|
|
|
|
null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (action == R.id.action_undo || action == R.id.action_redo) {
|
|
|
|
|
if (draft.revision != null && draft.revisions != null) {
|
|
|
|
|
dirty = true;
|
|
|
|
|
|
|
|
|
|
if (action == R.id.action_undo) {
|
|
|
|
|
if (draft.revision > 1)
|
|
|
|
|
draft.revision--;
|
|
|
|
|
} else {
|
|
|
|
|
if (draft.revision < draft.revisions)
|
|
|
|
|
draft.revision++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
body = Helper.readText(draft.getFile(context, draft.revision));
|
|
|
|
|
Helper.writeText(draft.getFile(context), body);
|
|
|
|
|
|
|
|
|
|
db.message().setMessageRevision(draft.id, draft.revision);
|
|
|
|
|
|
|
|
|
|
db.message().setMessageContent(draft.id,
|
|
|
|
|
true,
|
|
|
|
|
draft.plain_only, // unchanged
|
|
|
|
|
HtmlHelper.getPreview(body),
|
|
|
|
|
null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dirty) {
|
|
|
|
|