KLibFactory preview of planned changes

Holger Freyther freyther at kde.org
Sat Oct 28 01:45:07 BST 2006


my quest for KLibFactory and KLibLoader involves two things. The  
first one is brining the KDE Plugin System closer to the one of Qt  
and the second item is introducing a new concept for loading some  
plugins. Imagine you want to write a KPart in KDEs preferred  
scripting language. As of KDE3 you were forced to write some sort of  
glue code in C++, but not only once. You were forced to write this  
glue code for every plugin you wrote. There was one brave guy who  
actually did that. So for KDE4 I plan to introduce 'Chain Loading'  
where the plugins can specify which chains to use. So the .desktop  
file of the plugin specify the chain and the chain initliazes the VM  
and then loads the plugin.

But before I start implementing this in kservice I looked at the  
current usecases of KLib* by taking a look at kdelibs and kdebase.

Tonight I will talk about the three arguments of the KLibFactory  
create method:
	The className and parent are used most of the time. The className is  
used inside the KGenericFactory but most non KPart plugins not using  
KGenericFactory do not use it.

	The QStringList argument is mostly unused. Really most plugins do  
not use the QStringList at all, most classes actually loading plugins  
do not use QStringList at all. The ones that use QStringList to pass  
arbitary options have all different semantics:

         1. kdeprint uses it to pass printer device and one option to  
the plugin. The order of the list does matter
         2. the two Konq Views (List and Icon) use it to specify the  
ViewMode. This uses QStringList::first()
         3. KParts specify key=value pairs for  the QStringList. As  
the comment says this is used to pass embedded options, e.g. from a  
HTML page, to the KPart. This is used by KJavaAppletViewer to get the  
width, height and other options. Which requires every KPart to  
implement their own splitter/scanner/parser.

My conclusion and what this patch implements. I conclude that the  
QStringList argument is mainly unused and can be removed. And what  
about the users of the QStringList? Well, we have this argument there  
since the early and pre Qt2 days. Late in the Qt2 series QProperties  
were introduced and with Qt4.2 you can even create the properties  
dynamically. So I believe this is a good replacement for the  
QStringList argument.

This patch removes the QStringList from the various APIs and kdelibs,  
kdepimlibs and kdebase compile and sort of run. What is missing is  
converting all the plugins to not have a QStringList argument as  
well, and to make use of QProperty as a replacement for the  
QStringList argument in Konqueror and kdeprint.

So what I would like to know is if I have your blessing to continue  
removing the QStringList argument or do you have any other comments?

love and peace

PS:  I'm monkey enough to convert all of KDE...
PPS: The diffstat:

apps/konsole/konsole/konsole_part.cpp                           |    3
apps/konsole/konsole/konsole_part.h                             |    3
interfaces/kmediaplayer/kfileaudiopreview/kfileaudiopreview.cpp |    4
kate/app/katepluginmanager.cpp                                  |    2
kate/interfaces/plugin.cpp                                      |    5
kate/interfaces/plugin.h                                        |    3
kate/part/katefactory.cpp                                       |    3
kdecore/kgenericfactory.h                                       |    
59 +++-------
kdecore/kgenericfactory.tcc                                     |    
57 +++++----
kdecore/klibloader.cpp                                          |    4
kdecore/klibloader.h                                            |    
19 ---
kdecore/kservice/kservice.h                                     |   10 -
kdecore/kservice/kservicetypetrader.h                           |    5
kdecore/tests/klibloadertest.cpp                                |    8 -
kdeprint/lpdunix/kmlpdunixfactory.cpp                           |    2
kdeprint/management/kmmainview.cpp                              |    6 -
kdeprint/tools/escputil/escpwidget.cpp                          |    7 -
khtml/java/kjavaappletviewer.cpp                                |    9 +
khtml/java/kjavaappletviewer.h                                  |    4
khtml/khtml_factory.cpp                                         |    2
khtml/khtml_factory.h                                           |    2
khtml/khtml_part.cpp                                            |    3
khtml/khtmlimage.cpp                                            |    2
khtml/khtmlimage.h                                              |    2
konqueror/about/konq_aboutpage.cc                               |    2
konqueror/about/konq_aboutpage.h                                |    2
konqueror/iconview/konq_iconview.cc                             |    8 -
konqueror/konq_factory.cc                                       |    9 -
konqueror/listview/konq_listview.cc                             |    7 +
konqueror/listview/konq_listview.h                              |    2
konqueror/sidebar/konqsidebar.cpp                               |    6 -
konqueror/sidebar/konqsidebar.h                                 |    2
kparts/componentfactory.h                                       |    
22 +--
kparts/factory.cpp                                              |   10 -
kparts/factory.h                                                |    7 -
kparts/genericfactory.h                                         |    
12 --
kresources/resource.h                                           |    3
kutils/kcmoduleloader.cpp                                       |    
15 +-
kutils/kcmoduleloader.h                                         |    6 -
kutils/kcmoduleproxy.cpp                                        |    
15 --
kutils/kcmoduleproxy.h                                          |    
15 --
libkonq/konq_sound.cc                                           |    4
runtime/kioslave/man/kmanpart.cpp                               |    2
runtime/kioslave/man/kmanpart.h                                 |    3
solid/solid/managerbase.cpp                                     |    3
sonnet/spelling/loader.cpp                                      |    1
46 files changed, 166 insertions(+), 214 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: klibloader-remove-stringlist-kdebase-r0.patch.gz
Type: application/x-gzip
Size: 2141 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20061028/75aed1fd/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: klibloader-remove-stringlist-kdelibs-r0.patch.gz
Type: application/x-gzip
Size: 8531 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20061028/75aed1fd/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: klibloader-remove-stringlist-kdepimlibs-r0.patch
Type: application/octet-stream
Size: 494 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20061028/75aed1fd/attachment.obj>

More information about the kde-core-devel mailing list