Re: Porting KDE3 NetworkManager to 0.9



Em Monday 10 October 2011, Dan Williams escreveu:

> On Sat, 2011-10-08 at 14:15 -0400, Robert Xu wrote:

> > Hi all,

> >

> > Given the fact that I am relatively new at this stuff, forgive me if I

> > am asking very noobish questions...

> >

> > I am trying to figure out how to implement the Register/Unregister

> > functions and the SecretAgent interfaces.

>

> http://projects.gnome.org/NetworkManager/developers/api/09/ref-migrating.ht

> ml

>

> has more information on the architecture changes in 0.9. One big one is

> that the session applets (knetworkmanager, nm-applet, etc) no longer

> store whole connections; they only store secrets. Thus they become

> secret agents instead of full settings storage services. They no longer

> need to advertise a D-Bus service.

 

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.

> > - Where would I implement Register/Unregister? When the program starts

> > up/closes down?

>

> Yes, whenever the thing that's going to respond to secrets requests (ie,

> the secret agent) starts up and shuts down.

 

We added a watcher for NetworkManager service, everytime NM appears on DBus the watcher triggers the agent registration.

> > - (what c++ call do I make to do that? >>;)

>

> Probably the Qt D-Bus bindings, which I think is what the old KDE stuff

> used.

 

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.

 

> > - For SecretAgent interfaces, KNetworkManager has a storage file that

> > handles this stuff. Should this all be depreciated for NM's new

> > handling?

>

> Not necessarily; you'd still need to store secrets somewhere, and the

> storage files are probably as good as any. But you wont' need to store

> whole connections; just secrets. So at a minimum you'll need to store

> the secret itself, the key name of the secret (ie 'psk' or 'password' or

> whatever), and the UUID of the connection the secret is for.

 

In Plasma NM we allows to save secrets in kwallet or in plain text (text files). Kwallet is the default storage. This file implements our storage service: libs/service/secretstorage.cpp.

 

> > - (again, how do you call the functions in c++? relatively new to

> >

> > dbus calling in c++ >>;)

>

> Usually with Qt/KDE you'd use the Qt D-Bus bindings to do anything D-Bus

> related. Unfortunately I don't know much about those, but others on

> this list (like Will Stephenson and Eckhart Woerner) know the Qt/KDE

> side of things.

 

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

 

--

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]