[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-11 15:03:28
Message-ID: 20040211150327.GB4894 () ghostdog
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


On Wed, Feb 11, 2004 at 06:04:29AM -0800, enine wrote:
> On Wednesday 11 February 2004 11:49 am, Tobias Koenig wrote:
Hi Eugene,

> Ok, I applied your patch and it imports the anniversaries fine,
> however I do get duplicates.
Hmm, right...

> My thought was to create an array the length of the # of address book records.
> Then each time through the loop look for the found anniversary in that array
> and if its not found add it, if it is found then its a duplicate and discard it.
> When finished then import everything from the array.
How do you decide if the anniversary is already included?
When the one contact contains the name of you wife and the other your
name, how shall the plugin know that you belong together and the
anniversary should be merged to one?

> So my question is why did you patch the resourcekabc instead of in the birthdays
> plugin
Hmm, because the resourcekabc is the birthday plugin? ;)

> and where would be the appripritae location to check for duplicates?
See the attached patch, it checks if the summary is the same and doesn't
apply the anniversary twice then...

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	11 Feb 2004 15:01:25 -0000
@@ -189,6 +189,20 @@ bool ResourceKABC::load()
       if (name.isEmpty()) name = (*it).realName();
       summary = i18n("%1's anniversary").arg( name );
 
+      // check for duplicates
+      bool duplicated = false;
+      Event::List events = mCalendar.events( anniversary );
+      Event::List::ConstIterator evIt;
+      for ( evIt = events.begin(); evIt != events.end(); ++evIt ) {
+        if ( (*evIt)->summary() == summary ) {
+          duplicated = true;
+          break;
+        }
+      }
+
+      if ( duplicated )
+        continue;
+
       Event *ev = new Event();
 
       ev->setDtStart(anniversary);

["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