]> granicus.if.org Git - neomutt/commitdiff
feature: quasi-delete
authorKarel Zak <kzak@redhat.com>
Sat, 30 Jan 2016 16:27:19 +0000 (16:27 +0000)
committerRichard Russon <rich@flatcap.org>
Thu, 18 Aug 2016 15:15:31 +0000 (16:15 +0100)
Mark emails that should be hidden, but not deleted

OPS
curs_main.c
functions.h
mutt.h
mx.c

diff --git a/OPS b/OPS
index 02cea8e1e86293ead331873f2fe9b60783dc5acc..8ccc1880857ab401bda34d029e10d71bb29dbfba 100644 (file)
--- a/OPS
+++ b/OPS
@@ -127,6 +127,7 @@ OP_MAIN_READ_SUBTHREAD "mark the current subthread as read"
 OP_MAIN_SET_FLAG "set a status flag on a message"
 OP_MAIN_SYNC_FOLDER "save changes to mailbox"
 OP_MAIN_TAG_PATTERN "tag messages matching a pattern"
+OP_MAIN_QUASI_DELETE "delete from mutt, don't touch on disk"
 OP_MAIN_UNDELETE_PATTERN "undelete messages matching a pattern"
 OP_MAIN_UNTAG_PATTERN "untag messages matching a pattern"
 OP_MIDDLE_PAGE "move to the middle of the page"
index 8e0f52ad837eadbee37601851c2626956f4e9e01..4041a630aa9271f0b858da1907331f9530a0bca5 100644 (file)
@@ -1165,6 +1165,20 @@ int mutt_index_menu (void)
          menu->redraw = REDRAW_FULL;
        break;
 
+      case OP_MAIN_QUASI_DELETE:
+       if (tag) {
+         for (j = 0; j < Context->vcount; j++) {
+           if (Context->hdrs[Context->v2r[j]]->tagged) {
+             Context->hdrs[Context->v2r[j]]->quasi_deleted = TRUE;
+             Context->changed = TRUE;
+           }
+         }
+       } else {
+         CURHDR->quasi_deleted = TRUE;
+         Context->changed = 1;
+       }
+       break;
+
 #ifdef USE_SIDEBAR
       case OP_SIDEBAR_OPEN:
 #endif
index abc06ca0da943c40a69545a52a46dc4770b1f6d7..47b1b94a80c4911d361c8194abee9d1e25e10165 100644 (file)
@@ -168,6 +168,7 @@ const struct binding_t OpMain[] = { /* map: index */
   { "mail-key",                        OP_MAIL_KEY,                    "\033k" },
   { "decrypt-copy",            OP_DECRYPT_COPY,                NULL },
   { "decrypt-save",            OP_DECRYPT_SAVE,                NULL },
+  { "quasi-delete",            OP_MAIN_QUASI_DELETE,           NULL },
 
 #ifdef USE_SIDEBAR
   { "sidebar-next",            OP_SIDEBAR_NEXT,                NULL },
@@ -283,6 +284,7 @@ const struct binding_t OpPager[] = { /* map: pager */
   { "decrypt-save",            OP_DECRYPT_SAVE,                NULL },
 
   { "what-key",                OP_WHAT_KEY,            NULL },
+  { "quasi-delete",    OP_MAIN_QUASI_DELETE,           NULL },
 
 #ifdef USE_SIDEBAR
   { "sidebar-next",            OP_SIDEBAR_NEXT,                NULL },
diff --git a/mutt.h b/mutt.h
index 2cf55b102640049fc25711e381550be4677208ad..f4d044137df2921ec46f173c262459bc326fc6e5 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -731,6 +731,7 @@ typedef struct header
   unsigned int tagged : 1;
   unsigned int deleted : 1;
   unsigned int purge : 1;               /* skip trash folder when deleting */
+  unsigned int quasi_deleted : 1;      /* deleted from mutt, but not modified on disk */
   unsigned int changed : 1;
   unsigned int attach_del : 1;                 /* has an attachment marked for deletion */
   unsigned int old : 1;
diff --git a/mx.c b/mx.c
index fbe82e4ca38d0cae230569603110a2b323fbd36a..b2604a8ab2d352fcd008f3b3889f0de28f960b39 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -1033,9 +1033,10 @@ void mx_update_tables(CONTEXT *ctx, int committing)
 #define this_body ctx->hdrs[j]->content
   for (i = 0, j = 0; i < ctx->msgcount; i++)
   {
-    if ((committing && (!ctx->hdrs[i]->deleted || 
+    if (!ctx->hdrs[i]->quasi_deleted &&
+       ((committing && (!ctx->hdrs[i]->deleted ||
                        (ctx->magic == MUTT_MAILDIR && option (OPTMAILDIRTRASH)))) ||
-       (!committing && ctx->hdrs[i]->active))
+       (!committing && ctx->hdrs[i]->active)))
     {
       if (i != j)
       {