Re: Porting KDE3 NetworkManager to 0.9



Em Monday 10 October 2011, Robert Xu escreveu:

> On Mon, Oct 10, 2011 at 20:02, Lamarque V. Souza <lamarque kde org> wrote:

> > You can also look at how we implemented it in Plasma NM (KDE 4.x):

> > git clone git://anongit.kde.org/networkmanagement (branch nm09)

> > This is our agent backends/NetworkManager/nmdbussecretagent.cpp.

>

> Oh, thanks for this. I was looking for how KDE4 did it in hopes that I

> could maybe backport some stuff.

>

> > We added a watcher for NetworkManager service, everytime NM appears on

> > DBus the watcher triggers the agent registration.

>

> So, basically, it just idles in the panel waiting for NM?

 

Yes. The agent's constructor sets up the watcher and afterwards calls the slot reponsable for registering the agent. If NM is running the registration succeeds and that is it. If NM is not running the registration fails, but whenever NM appears on the system bus the slot is called again and it registers the agent. This scheme also works when NM restarts. If you call the registration slot only on knetworkmanager start the agent will stop working when NM restarts.

> > In Qt 4.x you create a QDBusInterface to NM's agent manager service and

> > just call ->connection().registerObject(NM_DBUS_PATH_SECRET_AGENT,

> > d->agent, QDBusConnection::ExportAllSlots). d->agent is the pointer to

> > our dbus adaptor object, which is a child of our agent and connects the

> > agent to the system bus.

>

> *notes*

>

> > Well, I have never programmed with qt3's dbus bindings :-/ I cannot help

> > with this part.

>

> That's fine, I think I have a much better idea now.

> Thanks so much!

 

You are welcome.

 

--

Lamarque V. Souza

KDE's Network Management maintainer

http://planetkde.org/pt-br



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]