Documents without files?

Andreas Pakulat apaku at gmx.de
Tue Oct 9 15:51:37 UTC 2007


On 09.10.07 18:02:03, Alexander Dymo wrote:
> On Tuesday 09 October 2007 00:20, Andreas Pakulat wrote:
> > So are documents without actual url's possible with the current
> > API/Platform?
> 
> If what you need is a text document shown in kate part without any url you can 
> use create PartDocument with KUrl() just like UiController::openEmptyDocument 
> does:
>     PartDocument *doc = new PartDocument(KUrl(), Core::self());
>     Sublime::View *view = doc->createView();
>     activeArea()->addView(view);
>     activeSublimeWindow()->activateView(view);

That doesn't work, because PartDocument is part of the Shell and I'm
doing something in a plugin. All I have is the IDocumentController
interface which only allows to open a document with a url and looks up
the right document type to create (i.e. the right factory) using the
mimetype of the document.

Also I think the documentForUrl() will break if I'm using a non-existing
KUrl.

> If you want your own document (say with your own diff widget), create your own 
> subclass of IDocument that returns KUrl() as url. Docs with empty urls 
> shouldn't break the shell (dunno about plugins that might rely on urls).

See above, the problem is opening such a document as there's no API to
do that without a url that creates a proper mimetype. 

Andreas

-- 
Try to relax and enjoy the crisis.
		-- Ashleigh Brilliant




More information about the KDevelop-devel mailing list