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

List:       kde-pim
Subject:    Re: [Kde-pim] Configurable resource
From:       Cornelius Schumacher <schumacher () kde ! org>
Date:       2002-06-03 13:06:13
[Download RAW message or body]

On Sunday 02 June 2002 10:58, Tobias Koenig wrote:
> On Sat, Jun 01, 2002 at 11:38:46PM +0200, Cornelius Schumacher wrote:
> > On Saturday 01 June 2002 23:06, Tobias Koenig wrote:
> > > I commited the newest version of libkabc to cvs a few minutes
> > > ago. It supports multiple resources now, which are configureable
> > > with a kcontrol modul (Personalization->AddressBook
> > > Configuration).
> > >
> > > StdAddressBook does no longer provide the method fileName(). Is
> > > there a programm that use this function?
> >
> > Yes, at least kabcfrontend. This also breaks binary compatibility.
> > Please don't remove existing methods.
>
> Ok, I'll add them again, but this function doesn't return any usefull
> value atm. Should it return the name (not filename) of the writeable
> resource?

What's not useful about the file name of the standard addressbook? Ok, 
with multiple resources it becomes less useful than before.

> > > Furthermore StdAddressBook::identifier() returns
> > > KApplication::randomString(10).
> >
> > That's wrong. A random string can't be used to identify an
> > addressbook as it changes from call to call. This function is e.g.
> > used to associate distribution lists with the corresponding
> > addressbook.
>
> What should be returned instead? A filename is wrong, because when
> using a sql backend there is no filename. The name of the writeable
> resource also lacks, since this resource could be changed in the
> meantime.

For a file based addressbook the filename seems to be ok. For a sql 
backend you could use the name of the server plus the name of the 
database. The identifier function should probably be moved to the 
resources and the addressbook identifier function could then return a 
concatenation of identifiers of its resources.

> > What happens, when the addressbook is switched from one resource to
> > the other? Is the addressbook data automatically converted?
>
> No, since you can't switch between them, during executing e.g.
> kaddressbook.

That means changing resources becomes effective with restart of apps 
using the addressbooks. There should probably be a warning dialog in 
the control module to inform the user about this behaviour. Or is there 
already such a dialog?

> In the ctor of StdAddressBook the resources are loaded. The first
> resource, that is added by addResource() is the 'writeable' resource.
> So all new entries will append to this resource. All following
> resources are readonly. There entries will be added to AddressBook,
> but when syncing the addressbook, there will be no changes to the
> readonly resources.

That sound reasonable. Does KAddressBook already support read-only 
entries?

> For converting between the different backends we could provide a
> standalone program, that execute the following code
>
>
> 	AddressBook ab;
> 	Resource *oldFormat = new ResourceXXX(&ab,...);
> 	Resource *newFormat = new ResourceYYY(&ab,...);
> 	ab.addResource(oldFormat);
> 	ab.load();
> 	ab.addResource(newFormat);
> 	AddressBook::Iterator it;
> 	for (it = ab.begin(); it != ab.end(); ++it)
> 		(*it).setResource(0); // mark all entries as new
>
> 	ab.save( ab.requestSaveTicket(newFormat) );

Yes, but conversion of data from different backends should be done 
transparently in the background. If the user switches backends the 
addressbook data should appear in exactly the same way in KAddressBook 
as before.

-- 
Cornelius Schumacher <schumacher@kde.org>
_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread] 

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