[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-pim
Subject: Re: [Kde-pim] Korganizer Anniversary import?
From: Tobias Koenig <tokoe () kde ! org>
Date: 2004-02-12 0:21:41
Message-ID: 20040212002141.GD729 () ghostdog
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
[Attachment #4 (multipart/mixed)]
On Wed, Feb 11, 2004 at 06:13:25PM +0000, Eugene Nine wrote:
Hi Eugene,
> Ahh, back home in Kmail much better.
;)
> My plan was to check the spouse field in each record of the address file. In
> my record I have my wife's name as a spouse and in my wife's record I have my
> name listed as a spouse. I figured I would check either against the rest of
> the address book for spouse listings and eliminate them that way. I think to
> a user filling in the spouse field would be more intuitive than remembering
> to leave one anniversary field blank and if one anniversary field is left
> blank it won't get a duplicate anyway.
That's indeed a good idea... what do you think about the attached patch?
:)
> I wanted to see if anyone thinks it would be worth it for file a wish for
> kaddressbook to use a kmail type lookup for the spouse, manager and assistant
> fields. Basically make the labels for those fields buttons which bring up
> address selection just like the ... button in kmail and also make the
> autocomplete work the same way when typing a name in the field. This way (to
> use my wife as an example) I won't get a duplicate if I type Shirley
> Grey-Nine in the spouse field but her vcard record has her as Shirley A.
> Grey-Nine.
Very good idea, I've added it to my TODO list.
> > > So my question is why did you patch the resourcekabc instead of in the
> > > birthdays plugin
> >
> > Hmm, because the resourcekabc is the birthday plugin? ;)
> >
> I thought the birthday plugin code was in birthday.cpp
> under /korganizer/plugins/birthdays :)
This plugin is obsolete because the birthdays are imported once and
won't get updated when you change the contacts. With the resource they
get updated whenever you change a contact in kaddressbook.
Ciao,
Tobias
--
Separate politics from religion and economy!
["anniversary.patch" (text/plain)]
Index: resourcekabc.cpp
===================================================================
RCS file: /home/kde/kdepim/libkcal/resourcekabc.cpp,v
retrieving revision 1.12
diff -p -u -b -r1.12 resourcekabc.cpp
--- resourcekabc.cpp 11 Feb 2004 11:46:04 -0000 1.12
+++ resourcekabc.cpp 12 Feb 2004 00:19:02 -0000
@@ -135,6 +135,9 @@ bool ResourceKABC::load()
// import from kabc
QString summary;
+ KABC::Addressee::List anniversaries;
+ KABC::Addressee::List::Iterator addrIt;
+
KABC::AddressBook::Iterator it;
for ( it = mAddressbook->begin(); it != mAddressbook->end(); ++it ) {
@@ -182,11 +185,36 @@ bool ResourceKABC::load()
}
QDateTime anniversary = QDate::fromString( (*it).custom( "KADDRESSBOOK", \
"X-Anniversary" ), Qt::ISODate );
- if ( anniversary.isValid() ) {
+ if ( !anniversary.isValid() )
+ continue;
+
+ QString name = (*it).custom( "KADDRESSBOOK", "X-SpousesName" );
+ if ( name.isEmpty() )
+ anniversaries.append( *it );
+ else {
+ bool found = false;
+ for ( addrIt = anniversaries.begin(); addrIt != anniversaries.end(); ++addrIt \
) { + if ( name == (*addrIt).realName() ) {
+ found = true;
+ break;
+ }
+ }
+
+ if ( !found )
+ anniversaries.append( *it );
+ }
+ }
+
+ for ( addrIt = anniversaries.begin(); addrIt != anniversaries.end(); ++addrIt ) {
+ QDateTime anniversary = QDate::fromString( (*addrIt).custom( "KADDRESSBOOK", \
"X-Anniversary" ), Qt::ISODate );
kdDebug() << "found a anniversary " << anniversary.toString() << endl;
- QString name = (*it).nickName();
- if (name.isEmpty()) name = (*it).realName();
+ QString name = (*addrIt).nickName();
+ QString spouseName = (*addrIt).custom( "KADDRESSBOOK", "X-SpousesName" );
+ if ( name.isEmpty() )
+ name = (*addrIt).realName();
+ if ( !spouseName.isEmpty() )
+ name += " & " + spouseName;
summary = i18n("%1's anniversary").arg( name );
Event *ev = new Event();
@@ -223,7 +251,6 @@ bool ResourceKABC::load()
mCalendar.addEvent(ev);
kdDebug() << "imported " << anniversary.toString() << endl;
}
- }
emit resourceChanged( this );
["signature.asc" (application/pgp-signature)]
_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
https://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