changeDocumentUrl close dialog galore
Manuel Breugelmans
mbr.nxi at gmail.com
Wed Jul 30 13:30:11 UTC 2008
Hi,
Seems like you were a bit hasty with the commit ;) This spawns a close box
every time one tries to save a document.
Manuel
On Wednesday 30 July 2008 11:30:43 Hamish Rodda wrote:
> SVN commit 839540 by rodda:
>
> Track url changes in documents, eg. when doing "Save As" in a KTextEditor
> (eg. katepart). Change the title and the url in the document controller,
> so you can open the original file again.
>
> M +5 -0 interfaces/idocument.cpp
> M +1 -0 interfaces/idocument.h
> M +3 -0 interfaces/idocumentcontroller.h
> M +28 -0 shell/documentcontroller.cpp
> M +1 -1 shell/documentcontroller.h
> M +6 -0 shell/partdocument.cpp
> M +1 -0 shell/partdocument.h
> M +7 -1 shell/textdocument.cpp
> M +1 -0 shell/textdocument.h
> M +17 -1 sublime/container.cpp
> M +2 -0 sublime/container.h
> M +6 -0 sublime/document.cpp
> M +4 -0 sublime/document.h
> M +6 -0 sublime/urldocument.cpp
> M +1 -0 sublime/urldocument.h
[...]
>
> + /**Emitted when a document url has changed.*/
> + void documentUrlChanged( KDevelop::IDocument* document );
[...]
> + void changeDocumentUrl(KDevelop::IDocument* document)
> + {
> + QMutableHashIterator<KUrl, IDocument*> it = documents;
> + while (it.hasNext()) {
> + if (it.next().value() == document) {
> + if (documents.contains(document->url())) {
> + // Weird situation (saving as a file that is aready
> open) + IDocument* origDoc = documents[document->url()];
> + if (origDoc->state() & IDocument::Modified) { +
> // given that the file has been saved, close the saved file
> as the other instance will become conflicted on disk +
> document->close();
> + controller->activateDocument( origDoc );
> + break;
> + }
> + // Otherwise close the original document
> + origDoc->close();
> + } else {
> + // Remove the original document
> + it.remove();
> + }
>
> + documents.insert(document->url(), document);
> + break;
> + }
> + }
> + }
> +
More information about the KDevelop-devel
mailing list