Q: How to use the mAddressBook object in KABCore ?

Kun Xi bookstack at gmail.com
Wed Aug 10 08:28:19 CEST 2005


Hello Tobias,

In the latest commit log, I put the test script for testing:
var ab  = Contacts.AddressBook;
ab.clear();
ab.emitAddressBookChanged();
Contacts.save();

Now, the script works fine.

There are two interesting things:

1)  We need to call emitAddressBookChanged explicitly. It is supposed
to emit this signal
by KABC::AddressBook itself.


2) After ab.emitAddressBookChanged(), the KAddressBook view is
refreshed, no contacts
shown. It is obvious the data has been changed, but the File | Save is
disabled. If we exit the
KAddressBook without calling "Contacts.save();", no prompt to notify
the user whether save
or not, and when I open KAddressBook again, the original contacts
items are still there. All
the modification has been discarded.


Best regards.

Kun Xi


On 8/9/05, Kun Xi <bookstack at gmail.com> wrote:
> Hello Tobias,
> 
> I think I find the problem. Since the KABC::AddressBook is just a
> front end to the address
> service, the change does not take effect until it is synchronized.
> 
> I need to call refreshView and setModified, ,so the view could refresh
> itself. Or I could call
> setModified, and save and re-launch kaddressbook, the change would be committed.
> 
> I would take a try this evening.
> 
> Best regards.
> 
> Kun Xi
> 
> On 8/9/05, Kun Xi <bookstack at gmail.com> wrote:
> > I think so. Since the mAddressBook is "newed" in KABCore's constuctor.
> > I waited until
> > all the kontact items are populated. I would debug this application
> > for more details and
> > keep you informed.
> >
> > Best regards.
> >
> > Kun Xi
> >
> > On 8/9/05, Tobias Koenig <tokoe at kde.org> wrote:
> > > On Tue, Aug 09, 2005 at 09:09:06AM -0800, Kun Xi wrote:
> > > > Hi Tobias,
> > > Hi Kun,
> > >
> > > > Yes, ther are not deleted, at least, if KAdressBook is closed and open again,
> > > > all the items are still there.
> > > Strange... I've really no idea why it shouldn't work. But you are sure
> > > that the addressbook is already loaded before you call clear()?
> > >
> > > Ciao,
> > > Tobias
> > > --
> > > Separate politics from religion and economy!
> > > The Councile of the European Union is an undemocratic and illegal institution!
> > >
> > >
> > >
> > >
> > >
> > > ___________________________________________________________
> > > Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
> > >
> > >
> >
>


More information about the Kde-soc mailing list