[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice
Subject:    Re: New document problems
From:       David Faure <faure () kde ! org>
Date:       2005-06-27 10:20:16
Message-ID: 200506271220.16955.faure () kde ! org
[Download RAW message or body]

On Monday 27 June 2005 12:06, Boudewijn Rempt wrote:
> I'm trying to implement paste as new image in Krita, and so I need to find a 
> way to create a new document, set some data in it, and then create a new view 
> with that document (which may not have been saved, even). I've tried wrapping 
> my mind around the things that happen when KoAppliatication::slotFileNew is 
> called, but short of duplicating a lot of that code, I cannot see a way 
> out... Is there actually a way of creating a document, creating a view and 
> settting the document to that view?

This is a new requirement for kofficecore indeed, but I'm sure we can put together
a method to do this. Do you want the new document to be in a new KoMainWindow ?
AFAICS all you need is

        KoDocument* newdoc = myMainWindow->createDoc(); // or duplicate the 3 lines there
        KoMainWindow *win = new KoMainWindow( newdoc->instance() );
        win->show();
        win->setRootDocument( newdoc );

(The view stuff happens in setRootDocument automatically, you only need to care
about document and mainwindow).

-- 
David Faure, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).

____________________________________
koffice mailing list
koffice@kde.org
To unsubscribe please visit:
https://mail.kde.org/mailman/listinfo/koffice
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic