Behaviour of KoServiceLocator

Adam Pigg adam at piggz.co.uk
Wed Sep 10 22:05:05 BST 2014


Ive tested the patch in relation to BUG: 338737, where the migratemanager
is unable to load the postgresql driver, and this fixed it. (there are
other bugs in the import, but thats not important here!)

On Mon, Sep 8, 2014 at 5:50 PM, Jaroslaw Staniek <staniek at kde.org> wrote:

> Hello,
> I've been trying to figure out why Kexi doesn't find all plugins it
> used to find before switching to KoServiceLocator.
> My findings below.
>
> In KoServiceLocator::init() KService::name() is used as an unique key
> while finding *.desktop files. I.e. the Name field is used.
> But as the script [1] can show you (run it in calligra/), there are
> numerous services in calligra (not just Kexi) with the same Name
> field. [2]
> It's nothing unusual, services typically differ in Comment more than
> Name. And kde-workspace has many duplications too.
>
> Solution I propose is to use both library name and name. (yes, there
> are services sharing the same library name). See:
>
> diff --git a/libs/db/KoServiceLocator.cpp b/libs/db/KoServiceLocator.cpp
> index 09918e1..263335e 100644
> --- a/libs/db/KoServiceLocator.cpp
> +++ b/libs/db/KoServiceLocator.cpp
> @@ -91,8 +91,9 @@ void KoServiceLocator::init()
>          if (servicesDir.exists()) {
>              foreach(const QString &entry,
> servicesDir.entryList(QDir::Files)) {
>                  KService::Ptr service = KService::Ptr(new
> KService(servicesDir.absoluteFilePath(entry)));
> -                if (!services.contains(service->name())) {
> -                    services << service->name();
> +                const QString key(service->library() + '\n' +
> service->name());
> +                if (!services.contains(key)) {
> +                    services << key;
>                      foreach(const QString &t, service->serviceTypes()) {
>                          if (!mimeTypes(service).contains(t)) {
>
> Is it ok for you?
> PS: I use the locator privately in Kexi 2.8 for some stability
> reasons, thus I propose the patch for both calligra/2.8 and master.
>
> [1] http://paste.kde.org/ptsnsnbs2/j0kqks/raw
>
> [2]
> ./filters/flow/visio/import/calligra_filter_vsdx2odg.desktop:Name=Flow
> Visio Import Filter
>
> ./filters/flow/wpg/import/flow_wpg_thumbnail.desktop:Name=WordPerfect/DrawPerfect
> Images
> ./filters/karbon/eps/calligra_filter_eps2svgai.desktop:Name=Karbon EPS
> Import Filter
> ./filters/karbon/eps/karbon_ps_import.desktop:Name=Karbon EPS Import Filter
>
> ./filters/karbon/wpg/karbon_wpg_thumbnail.desktop:Name=WordPerfect/DrawPerfect
> Images
> ./filters/words/works/import/calligra_filter_wps2odt.desktop:Name=Flow
> Visio Import Filter
> ./flow/stencils/Sybase/collection.desktop:Name=Sybase
> ./karbon/plugins/flattenpath/karbonflattenpath.desktop:Name=Karbon
> Flatten Path plugin
> ./karbon/plugins/flattenpath/karbonflattenpathplugin.desktop:Name=Karbon
> Flatten Path plugin
> ./karbon/plugins/refinepath/karbonrefinepath.desktop:Name=Karbon
> Refine Path plugin
> ./karbon/plugins/refinepath/karbonrefinepathplugin.desktop:Name=Karbon
> Refine Path plugin
> ./karbon/plugins/roundcorners/karbonroundcorners.desktop:Name=Karbon
> Round Corners plugin
> ./karbon/plugins/roundcorners/karbonroundcornersplugin.desktop:Name=Karbon
> Round Corners plugin
> ./karbon/plugins/whirlpinch/karbonwhirlpinch.desktop:Name=Karbon Whirl
> Pinch plugin
> ./karbon/plugins/whirlpinch/karbonwhirlpinchplugin.desktop:Name=Karbon
> Whirl Pinch plugin
> ./kexi/kexidb/drivers/mysql/kexidb_mysqldriver.desktop:Name=MySQL
> ./kexi/kexidb/drivers/pqxx/kexidb_pqxxsqldriver.desktop:Name=PostgreSQL
> ./kexi/kexidb/drivers/sybase/kexidb_sybasedriver.desktop:Name=Sybase
> ./kexi/kexidb/drivers/xbase/kexidb_xbasedriver.desktop:Name=xBase
> ./kexi/migration/mysql/keximigrate_mysql.desktop:Name=MySQL
> ./kexi/migration/pqxx/keximigrate_pqxx.desktop:Name=PostgreSQL
> ./kexi/migration/sybase/keximigrate_sybase.desktop:Name=Sybase
> ./kexi/migration/xbase/keximigrate_xbase.desktop:Name=xBase
> ./krita/plugins/paintops/gridbrush/kritagridpaintop.desktop:Name=Grid
> ./krita/plugins/tools/tool_grid/kritatoolgrid.desktop:Name=Grid
> ./plan/planpart.desktop:Name=Calligra Project Management Component
> ./plan/plugins/scripting/krossmoduleplan.desktop:Name=Scripting plugin
> ./plan/workpackage/planworkpart.desktop:Name=Calligra Project
> Management Component
> ./sheets/plugins/scripting/krossmodulesheets.desktop:Name=Scripting plugin
> ./sheets/shape/calligra_shape_spreadsheet-deferred.desktop:Name=Spreadsheet
> Shape
> ./sheets/shape/calligra_shape_spreadsheet.desktop:Name=Spreadsheet Shape
> ./words/plugins/scripting/krossmodulewords.desktop:Name=Scripting plugin
>
> --
> regards / pozdrawiam, Jaroslaw Staniek
>  Kexi & Calligra & KDE | http://calligra.org/kexi | http://kde.org
>  Qt for Tizen | http://qt-project.org/wiki/Tizen
>  Qt Certified Specialist | http://www.linkedin.com/in/jstaniek
> _______________________________________________
> calligra-devel mailing list
> calligra-devel at kde.org
> https://mail.kde.org/mailman/listinfo/calligra-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20140910/81e25cb0/attachment.htm>


More information about the calligra-devel mailing list