Bug 60659 - Always using at least one of the addresses from kaddressbook
Summary: Always using at least one of the addresses from kaddressbook
Status: RESOLVED FIXED
Alias: None
Product: kpilot
Classification: Unmaintained
Component: Contacts Conduit (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: Reinhold Kainhofer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-02 23:11 UTC by Eric Seynaeve
Modified: 2003-07-31 01:36 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seynaeve 2003-07-02 23:11:10 UTC
Version:            (using KDE KDE 3.1.1)
Installed from:    SuSE RPMs
OS:          Linux

At the moment (KPilot version 4.3.9), one has to choose whether to use either the home or business address from KAddressbook for syncing with the palm. If an entry only has a home address but the conduit is selected to use the business address, no address will appear on the palm.

Why not the switch between these two types of addresses optional: if only one address is known in KAddressbook, take that one (irrespective of the settings in the conduit). If there is both a business address and a home address, take the one selected by the user. This would avoid a lot of confusing regarding 'disappearing' addresses. I know, it has taken me quite a while to figure this thing out :-O
Comment 1 Reinhold Kainhofer 2003-07-03 09:17:08 UTC
Subject: Re: Always using at least one of the addresses from kaddressbook

Unfortunately, it is not that simple. Image you have a record with only a home 
address, and kpilot is configured to use the business address. You do a sync, 
and with your suggestion, that address will be synced to the handheld. 
Now you add a business address in kaddressbook, and edit the address on the 
handheld. When you do a sync, kpilot sees that the adress on the handheld was 
changed, and it sees that there is a business address, which is supposed to 
be synced. How is kpilot supposed to merge these two into one address?
Clearly, you don't want to loose your changes to the address on the handheld, 
but you also don't want to loose the business address.

There is a similar problem with phone numbers and emails: On the handheld 
there are only 5 fields for email and phones, while kaddressbook can have an 
arbitrary number of those. That's really giving me a headache.

Reinhold
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/A9hvTqjEwhXvPN0RAuZVAJ4uud69uqw4sg2TcO9EdM9CMMUTeQCguq91
fOxWrjGt/Rqy+QetNvMtOlI=
=0opC
-----END PGP SIGNATURE-----

Comment 2 Reinhold Kainhofer 2003-07-31 01:36:20 UTC
Subject: kdepim/kpilot/conduits/abbrowserconduit

CVS commit by kainhofe: 

The conduit now uses a different algorithm to find the type of address on the PC to sync with.
First, if there is a preferred address (no matter if home, work or whatever), this one is synced to the handheld. If no preferred address exists, either home or work (depending on the setting in the conduit config dialog) is used for the sync. If that doesn't exist, either, the other one (work/home) is tried. If that also doesn't exist, and the address is copied to the PC, its type is set to preferred+the setting from the config dialog. 
This fixes both bugs #50560 (conduit should sync with preferred address) as well as bug #60659 (conduit should use the existing address from the PC, even if the type is not the one chosen in the config dialog). 

CCMAIL: 50560-done@bugs.kde.org, 60659-done@bugs.kde.org


  M +14 -2     abbrowser-conduit.cc   1.80
  M +2 -2      kaddressbookConduit.ui   1.18


--- kdepim/kpilot/conduits/abbrowserconduit/abbrowser-conduit.cc  #1.79:1.80
@@ -547,7 +547,19 @@ void AbbrowserConduit::setFax(Addressee 
 
 
+/** First search for a preferred  address. If we don't have one, search
+ *  for home or work as specified in the config dialog. If we don't have
+ *  such one, either, search for the other type. If we still have no luck,
+ *  return an address with preferred + home/work flag (from config dlg). */
 KABC::Address AbbrowserConduit::getAddress(const Addressee & abEntry)
 {
-        return abEntry.address((fPilotStreetHome) ?(KABC::Address::Home) :(KABC::Address::Work));
+        int type=(fPilotStreetHome)?(KABC::Address::Home):(KABC::Address::Work);
+        KABC::Address ad(abEntry.address(KABC::Address::Pref));
+        if (!ad.isEmpty()) return ad;
+        ad=abEntry.address(type);
+        if (!ad.isEmpty()) return ad;
+        ad=abEntry.address((fPilotStreetHome) ?(KABC::Address::Work):(KABC::Address::Home));
+        if (!ad.isEmpty()) return ad;
+
+        return abEntry.address(type | KABC::Address::Pref);
 }
 

--- kdepim/kpilot/conduits/abbrowserconduit/kaddressbookConduit.ui  #1.17:1.18
@@ -343,10 +343,10 @@
                         <item>
                             <property name="text">
-                                <string>Home Address</string>
+                                <string>Preferred, then Home Address</string>
                             </property>
                         </item>
                         <item>
                             <property name="text">
-                                <string>Business Address</string>
+                                <string>Preferred, then Business Address</string>
                             </property>
                         </item>