[PATCH] New feature: closed tabs trash bin as in Opera
David Faure
faure at kde.org
Sat Feb 24 23:58:58 GMT 2007
On Wednesday 21 February 2007, Eduardo Robles Elvira wrote:
> Okay this is what happens: when Konqueror is in KHTML mode, m_lock is always
> off and it's not possible to execute "normal" undo actions. Read "normal"
> as "current", like "File renamed" or "Moved file". And I understand that the
> purpose of m_lock is precisely to block those when we're in a not editable
> mode, like when the active view is showing a webpage.
No, locking is used to disable the undo action while an undo job is already in progress.
Undo is disabled while khtml is loaded because of the code in KonqMainWindow::slotUndoAvailable
(it asks the part whether is "supportsUndo").
> But now there's a new kind of actions in the undo list: one that
> doesn't "edit" the content managed by the views. It's the "Closed tab"
> action, which is of a different kind. It's an action that should be able to
> be undone (or however it's said :P) in any kind of view.
Yes.
> So in this case, I treat the "closed tab" action as a normal one when the
> current view is editable, but in the non-editable views (like KHTML) we still
> want to be able to reopen all previously closed tabs, so undoAvailable()
> returns true if there's any closed tab, and it only allows to undo one kind
> of actions of the undo stack: "closed tabs".
I think this needs to be revised.
> As suggested by ereslibre, I didn't limit the number of stored tabs because
> they don't take much memory, I only limited the number of them that are shown
> in the drop down menu. So if you close 11 tabs, all of them will be stored in
> m_closedTabsList, but only the last 10 of them will be shown in the "Recently
> closed tabs" menu. That's why I use a list of pointers instead of an array or
> a lis of values: I need to dynamically create and remove eah item with
> new/delete. And also I belive of this there shouldn't be any dangling
> pointer.
>
> It's true is that we could put everything in the undo list so we don't have
> two lists, that's an idea I didn't take into account, and it will take less
> space in memory, the only problem will be that
> slotClosedTabsListAboutToShow() will then call a function in the undomanager
> that would run through all undoActions and retrieve a list of
> ClosedTabItems
Ah, I hadn't realized all that.
I see now that you implemented that already (sorry that I didn't have time to reply
earlier)... I'll have a look at your new patch on Monday, but I would have probably
said ok to having the info in both places since indeed it's not only about undo but also
about the list in konq.... Ah well, both approaches are okay I think.
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kfm-devel
mailing list