[PATCH] ReadWritePart::queryClose()

David Faure david at mandrakesoft.com
Sun Dec 1 22:55:02 GMT 2002

Hash: SHA1

On Sunday 01 December 2002 23:00, John Firebaugh wrote:
> The attached patch factors out portions of ReadWritePart::closeURL() into a 
> separate function that is appropriate to call from KMainWindow::queryClose(). 
> This is a prerequisite for fixing http://bugs.kde.org/show_bug.cgi?id=49270 
> properly. It should be functionally equivalent to the existing behavior 
> except that setModified( false ) is not called if the user elects not to save 
> changes, which can't easily happen after the refactoring, and seems wrong to 
> me anyway. (What if the close is somehow canceled after that? Shouldn't the 
> document still be marked modified?) The patch also adds additional 
> documentation for KMainWindow::queryClose(), noting a potential 'gotcha'. The 
> new method is marked @since 3.2 but I will backport and change that to 3.1.1 
> if people think it necessary.

Looks fine to me - except that AFAICS the tempfile won't be deleted when 
queryClose() calls saveAs() (and is being called by KMainWindow::queryClose()).
m_bClosing=true is only set in closeURL, not in queryClose(), so saveAs won't
remove the tempfile.
I would suggest moving m_bClosing=true before the saveAs() call, as it was
before - after all queryClose() is about closing in all cases, right?

Also....... isn't it going to be a problem if closeURL() is called after
queryClose()? The document is still marked as modified (if the user said no),
so the user will get asked once again about saving?
You seem to assume that closeURL() won't be called, but I'm a bit surprised
by this... the destructor calls it!

- -- 
David FAURE, david at mandrakesoft.com, faure at kde.org
Contributing to: http://www.konqueror.org/, http://www.koffice.org/
Get the latest KOffice - http://download.kde.org/stable/koffice-1.2/
Version: GnuPG v1.0.7 (GNU/Linux)


More information about the kde-core-devel mailing list