Behaviour of KoServiceLocator

Jaroslaw Staniek staniek at kde.org
Mon Sep 15 07:29:33 BST 2014


On 10 September 2014 23:05, Adam Pigg <adam at piggz.co.uk> wrote:
> Ive tested the patch in relation to BUG: 338737, where the migratemanager is
> unable to load the postgresql driver, and this fixed it.

Thanks,
You probably mean https://bugs.kde.org/show_bug.cgi?id=338735 ...
Since it's urgent fix for a regression it has been comited to
calligra/2.8 on Sep 11 and to master yesterday.
Please let me know about any difficulties (especially waiting for OK
from @boud as the author of KoServiceLocator).

> (there are other
> bugs in the import, but thats not important here!)

I've got some fixes, including: https://bugs.kde.org/show_bug.cgi?id=336556.
They're coming to 2.8.6 assuming your review powers are available ;)
Cheers.

> 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
>
>
>
> _______________________________________________
> calligra-devel mailing list
> calligra-devel at kde.org
> https://mail.kde.org/mailman/listinfo/calligra-devel
>



-- 
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



More information about the calligra-devel mailing list