This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Create new Akonadi address book

Tags: None
(comma "," separated)
job
Registered Member
Posts
18
Karma
0

Create new Akonadi address book

Tue Aug 18, 2009 7:55 am
I want to have an address book in my application using Akonadi.
Here is what I do:

  • Ask AgentManager for the AgentType with identifier "akonadi_vcard_resource"
  • Create an AgentInstanceCreateJob with this type
  • When this job is finished I set the name of the created instance.

All is well: the instance is created and shows up in akonadiconsole.
The problem I have is that I cannot find an easy way to set the path of the vcard file to use. I know I can call configure() on the created instance to let the user chose the path but I would like to do this without user interaction.
The only way I found to do this is through DBus.

So I have two questions:

  • Are the steps above the correct way of setting up a new address book?
  • Is DBus really the only way to set the path of the vcard file?

Any help is appreciated!
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS

Re: Create new Akonadi address book

Tue Aug 18, 2009 2:48 pm
The common way to create Akonadi resources is to use the Akonadi Control Center Module widget embedded in your application.

Bypassing the user on decision like where and how to store data doesn't sound like a very convincing idea.

What is your use case?

Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
job
Registered Member
Posts
18
Karma
0

Re: Create new Akonadi address book

Wed Aug 19, 2009 6:48 am
On the first run of my application, I want to have it up and running with a minimum amount of user interaction. So I want to set up all needed resources with sensible defaults so my application is immediately usable.
Of course this should all be configurable for users that want so later on but for the first run, I want to set everything to usable default values.
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS

Re: Create new Akonadi address book

Wed Aug 26, 2009 3:37 pm
Akonadi does that already, check kdepimlibs/akonadi/firstrun.cpp

This either migrates a previous KDE resource setup, or creates defaults like KDE' KResource framework would have.

If not it is a bug.

Cheers,
-


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
job
Registered Member
Posts
18
Karma
0

Re: Create new Akonadi address book

Thu Aug 27, 2009 6:35 am
I don't want to use the default resources but create new resources specifically for my application. This means, for instance, that I want to store the address book somewhere in $HOME/.kde/share/apps/$MYAPP.
I still haven't found another way of doing this than through DBus.
job
Registered Member
Posts
18
Karma
0

Re: Create new Akonadi address book

Thu Aug 27, 2009 6:55 am
Ok I just noticed the comments in firstrun_p.h and it seems it's possible the add default agents by installing a file in $KDEDIR/share/akonadi/firstrun describing the agents (including the path, which is what I want).

But the problem is that these agents are only created on the very first run of Akonadi. So for my application this would only work if Akonadi has never run before on the system, which is of course not what I want.

So is there a way to let Akonadi recheck those default agents?

Cheers!
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS

Re: Create new Akonadi address book

Thu Aug 27, 2009 5:37 pm
I am afraid I don't get the use case.

If it is an addressbook, users might want to have it as part of their addressbook setup.
Why force the creation of an additional addressbook instead of just offering the option of creating one if the currently available ones are not satisfactory?

Making the users undo stuff is usually more hassle on both sides. The users put effort into it and you have to provide instructions and support on how to do it.

Instead why not provide a first time assistant that lets the user select an addressbook and offers the choice of creating a new one?

Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
job
Registered Member
Posts
18
Karma
0

Re: Create new Akonadi address book

Sat Aug 29, 2009 11:25 am
What I'm trying to make is a simple administrative application for small music schools (more specifically my fathers guitar school).

The idea is to store the students in an Akonadi vcard resource, the lessons in an Akonadi ical resource,... because this way you can see all information in, for example, Kontact.

Although it should be possible, I don't think it's a good idea to use the standard resources for storing this information. The reason being that most people (at least me and my father) don't like to mix their personal data with data from work. It's also very convenient to use separate resources because I can just (de)select those resource if I (don't) want to see them in Kontact.

This is the reason I want to create new resources the first time the application is started and I would like to do this without user interaction.

I hope this explains my use case a little better. Any comments are of course appreciated!

Cheers!
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS

Re: Create new Akonadi address book

Sat Aug 29, 2009 6:41 pm
I still think that target folders should be selectable, at least as part of an advanced section of a first time assistant.

E.g. people doing backups with rsync tend to prefer vcarddir based setups for contacts since it has each contact in a separate file.

Anyway.
What you can have a look at is the D-Bus interface of the Settings objects our "single file" resources use.
Object path is /Settings.

I think there is even "client" code for initial setup in kdepim/akonadi/migration/kres

Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.


Bookmarks



Who is online

Registered users: Bing [Bot], daret, Google [Bot], sandyvee, Sogou [Bot]