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

List:       koffice-devel
Subject:    Re: Loading plugins from koView subclass
From:       David Faure <faure () kde ! org>
Date:       2005-10-28 11:53:30
Message-ID: 200510281353.30780.faure () kde ! org
[Download RAW message or body]

On Friday 28 October 2005 10:58, Boudewijn Rempt wrote:
> I wanted to load Krita's kxmlgui-based plugins myself so I can check for 
> version numbers. However, I've got two or three problems:
> 
> * Either I use mainWindow()->guiFactory() to add the plugins to my view
Your view has a guifactory too, so this reads strange to me. But I see
that using KoView::factory() is your solution 2 anyway.

> but then the plugins construct the gui first, messing up the menu layout
This sounds like you look for plugins too early then.

> and I get an error saying that krita.so doesn't have an init_krita funciton
!?!?! Where does it look for plugins, to end up finding krita.so !?

> * Or I use the factory() function of the KoView subclass (KisView) to add the 
> plugins, but then I get the crash.
Where does it crash exactly?

> KStdAction::keyBindings( mainWindow()->guiFactory(), 	
> 	SLOT( configureShortcuts() ), actionCollection() );

Hmm I think we should fix KoMainWindow's configure shortcuts action instead.
Can you test this patch?

> 	KTrader::self() -> query(QString::fromLatin1("Krita/ViewPlugin"),

> QString::fromLatin1("(Type == 'Service') 
Heh, that's extra careful. I don't think an application would set Krita/ViewPlugin in \
its servicetypes anyway :)

> if ( plugin ) {
> factory()->addClient(plugin);
What's the crash? factory() is 0?
Did you try without this line?
The KParts docu says "If you call this method in an already constructed GUI..."
but you're doing this from the view constructor, so it hasn't been plugged into
the mainwindow's GUI (and this would be why factory is still 0 at this point).

Try this instead:
   insertChildClient(plugin);

> setInstance(KGenericFactory<KisSeparateChannelsPlugin>::instance());
Excellent. If only all plugins in svn would do that :)

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


["komainwindow.diff" (text/x-diff)]

Index: koMainWindow.cc
===================================================================
--- koMainWindow.cc	(revision 472758)
+++ koMainWindow.cc	(working copy)
@@ -1216,18 +1216,7 @@ void KoMainWindow::slotFilePrintPreview(
 
 void KoMainWindow::slotConfigureKeys()
 {
-    KoView *view = rootView();
-    // We _need_ a view. We use the view's xmlFile() (e.g. kword.rc)
-    Q_ASSERT( view );
-    if ( !view )
-        return;
-
-    KKeyDialog dlg( this );
-    dlg.insert( actionCollection() );
-    dlg.insert( view->actionCollection() );
-    if ( rootDocument() )
-        dlg.insert( rootDocument()->actionCollection() );
-    dlg.configure();
+    guiFactory()->configureShortcuts();
 }
 
 void KoMainWindow::slotConfigureToolbars()


_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


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

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