[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sup-talk] Problems with undo archive and thread focus
Excerpts from Matthias Guedemann's message of Thu Nov 05 00:27:25 -0800 2009:
> One is, if you hit 'a' in thread view mode, the thread is archived but undo does
> not work. If you go back to index view and hit 'u' the just archived thread does
> not appear, but the one before.
I was annoyed by this too and found that undo is minimally implemented.
I added undo to thread view, at least for the cases that I care about or
were easy. I have to say I was discouraged that this was necessary: the
code to archive a thread should all be in one place, and the undo
record should be created there. There's a lot of code duplication, and
I can't tell if it's because the model and view are too coupled, or
because nobody has bothered to factor it out.
The patch is appended. (This is the first time I've done this with git.)
> The second is, if I respond to a thread and send the mail, I normally want to
> either archive that mail directly or label and archive it. But the thread is put
> to the front and the focus is on the last place of the thread. Therefore I
> sometimes archive the wrong thread (but undo comes in handy)
That's the next most annying thing for me. Hope to get a chance to work
on it.
Andrew
Subject: [PATCH] create undo records in thread view
---
lib/sup/modes/thread-view-mode.rb | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
index 81197c2..2f2d564 100644
--- a/lib/sup/modes/thread-view-mode.rb
+++ b/lib/sup/modes/thread-view-mode.rb
@@ -254,7 +254,8 @@ EOS
end
def edit_labels
- reserved_labels = @thread.labels.select { |l| LabelManager::RESERVED_LABELS.include? l }
+ old_labels = @thread.labels
+ reserved_labels = old_labels.select { |l| LabelManager::RESERVED_LABELS.include? l }
new_labels = BufferManager.ask_for_labels :label, "Labels for thread: ", @thread.labels
return unless new_labels
@@ -262,6 +263,10 @@ EOS
new_labels.each { |l| LabelManager << l }
update
UpdateManager.relay self, :labeled, @thread.first
+ UndoManager.register "labeling thread" do
+ @thread.labels = old_labels
+ UpdateManager.relay self, :labeled, @thread.first
+ end
end
def toggle_starred
@@ -476,6 +481,10 @@ EOS
dispatch op do
@thread.remove_label :inbox
UpdateManager.relay self, :archived, @thread.first
+ UndoManager.register "archiving 1 thread" do
+ @thread.apply_label :inbox
+ UpdateManager.relay self, :unarchived, @thread.first
+ end
end
end
@@ -483,6 +492,10 @@ EOS
dispatch op do
@thread.apply_label :spam
UpdateManager.relay self, :spammed, @thread.first
+ UndoManager.register "marking 1 thread as spam" do
+ @thread.remove_label :spam
+ UpdateManager.relay self, :unspammed, @thread.first
+ end
end
end
@@ -490,6 +503,10 @@ EOS
dispatch op do
@thread.apply_label :deleted
UpdateManager.relay self, :deleted, @thread.first
+ UndoManager.register "deleting 1 thread" do
+ @thread.remove_label :deleted
+ UpdateManager.relay self, :undeleted, @thread.first
+ end
end
end
--
1.5.6.5
--
I've decided to go back to school. Kindergarden.
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk