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

List:       kde-devel
Subject:    Re: KDEDModule help
From:       Daniel Nicoletti <dantti12 () gmail ! com>
Date:       2012-06-14 16:19:49
Message-ID: CACo8zOc=q9bKy1qoFFUyJeWS52xXbBZoKVxF=UK2y9AP0cpsxg () mail ! gmail ! com
[Download RAW message or body]

2012/6/14 Luca Ferrari <fluca1978@infinito.it>:
> Hi all,
> I need to keep a consistent state among different kioslave instances,
> so as pointed out in this mailing list, I'm going to do this via KDED.
>  The problem is that I don't have fully understood how this works, so
> I'm going to describe what I have so far and please give me advices.
> I need to keep a list or "Role" objects that can be retrieved and
> added or reduced by one entry at time. So I have a class that inherits
> from KDEDModule that provides methods to do the role-list operations.
> The constructor of my class looks like:
>
> RoleFSKDEDModule::RoleFSKDEDModule ( QObject* parent, const QList<
> QVariant >& parameters )
> : KDEDModule ( parent ), _kdedModuleName( QString::fromLatin1(
> "/modules/rolefskded" ) )
> {
>  Q_UNUSED( parameters )
>
>  // get the DBus connection
>  QDBusConnection currentConnection = QDBusConnection::sessionBus();
>  currentConnection.registerService( QString::fromLatin1("org.kde.kded") );
>  currentConnection.registerObject( _kdedModuleName, this );
> }

Well from what you described what I would do is first not try to register
a service "org.kde.kded", because I don't know if it will allow if kded already
has that registered, and second because if later you decide to move
away from kded you will have to port each client.

Second the object that you are registering could be the "Role" you
describe, having your "org.kde.NetworkRoleManager", which
register a org/kde/NetworkRoleManager with createRole, deleteRole,
that register other objects such as /role1 then a /role2... and so on,
but it all depends on your problem/how do you plan to develop it.
You can keep just one object on the interface and have an array of roles too...

> Then I have an adaptor, that extends QDBusAbstractAdaptor and that
> accepts, as parent in the constructor, and instance of my KDEDModule
> subclass.
> But I don't know how to go further, I mean which methods should I
> place on the adaptor? And what about the factory as in the netwrok:/
> slave? I found the following lines:
>
> K_PLUGIN_FACTORY( NetworkWatcherFactory,
> registerPlugin<Mollet::NetworkWatcher>(); )      \
> K_EXPORT_PLUGIN( NetworkWatcherFactory("networkwatcher") )
>
> which as far as I understand export a module named "networkwatcher"
> which objects, of type NetworkWatcher are created by a factory which
> is auto-generated. Is this correct? Do I need this too?
Yes, you need it otherwise KDED won't load your plugin.

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

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