summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/converter/opie/opieconverter.cpp13
-rw-r--r--kaddressbook/kabcore.cpp3
2 files changed, 12 insertions, 4 deletions
diff --git a/kabc/converter/opie/opieconverter.cpp b/kabc/converter/opie/opieconverter.cpp
index 0b6a55e..46e14dd 100644
--- a/kabc/converter/opie/opieconverter.cpp
+++ b/kabc/converter/opie/opieconverter.cpp
@@ -179,49 +179,52 @@ bool OpieConverter::opieToAddressee( const OContact &contact, Addressee &addr )
179 PhoneNumber businessmobile; 179 PhoneNumber businessmobile;
180 businessmobile.setType( PhoneNumber::Work | PhoneNumber::Cell ); 180 businessmobile.setType( PhoneNumber::Work | PhoneNumber::Cell );
181 businessmobile.setNumber( contact.businessMobile() ); 181 businessmobile.setNumber( contact.businessMobile() );
182 addr.insertPhoneNumber( businessmobile ); 182 addr.insertPhoneNumber( businessmobile );
183 } 183 }
184 184
185 if (!contact.businessPager().isEmpty()) 185 if (!contact.businessPager().isEmpty())
186 { 186 {
187 PhoneNumber businesspager; 187 PhoneNumber businesspager;
188 businesspager.setType( PhoneNumber::Work | PhoneNumber::Pager ); 188 businesspager.setType( PhoneNumber::Work | PhoneNumber::Pager );
189 businesspager.setNumber( contact.businessPager() ); 189 businesspager.setNumber( contact.businessPager() );
190 addr.insertPhoneNumber( businesspager ); 190 addr.insertPhoneNumber( businesspager );
191 } 191 }
192 192
193 addr.setRole( contact.jobTitle() ); //? 193 addr.setRole( contact.jobTitle() ); //?
194 addr.setOrganization( contact.company() ); 194 addr.setOrganization( contact.company() );
195 addr.insertCustom( "KADDRESSBOOK", "X-Profession", contact.profession() ); 195 addr.insertCustom( "KADDRESSBOOK", "X-Profession", contact.profession() );
196 addr.insertCustom( "KADDRESSBOOK", "X-AssistantsName", contact.assistant() ); 196 addr.insertCustom( "KADDRESSBOOK", "X-AssistantsName", contact.assistant() );
197 addr.insertCustom( "KADDRESSBOOK", "X-Department", contact.department() ); 197 addr.insertCustom( "KADDRESSBOOK", "X-Department", contact.department() );
198 addr.insertCustom( "KADDRESSBOOK", "X-ManagersName", contact.manager() ); 198 addr.insertCustom( "KADDRESSBOOK", "X-ManagersName", contact.manager() );
199 addr.insertCustom( "KADDRESSBOOK", "X-Office", contact.office() ); 199 addr.insertCustom( "KADDRESSBOOK", "X-Office", contact.office() );
200 200
201 //personal 201 //personal
202 addr.insertCustom( "KADDRESSBOOK", "X-SpousesName", contact.spouse() ); 202 addr.insertCustom( "KADDRESSBOOK", "X-SpousesName", contact.spouse() );
203 addr.insertCustom( "KADDRESSBOOK", "X-Gender", contact.gender() ); 203 if (contact.gender() == 1)
204 addr.insertCustom( "KADDRESSBOOK", "X-Gender", "female" );
205 else if (contact.gender() == 2)
206 addr.insertCustom( "KADDRESSBOOK", "X-Gender", "male" );
204 207
205 if (contact.anniversary().isValid()) { 208 if (contact.anniversary().isValid()) {
206 QString dt = KGlobal::locale()->formatDate(contact.anniversary(), true, KLocale::ISODate); 209 QString dt = KGlobal::locale()->formatDate(contact.anniversary(), true, KLocale::ISODate);
207//US 210//US
208 qDebug("OpieConverter::opieToAddressee found:%s", dt.latin1()); 211 qDebug("OpieConverter::opieToAddressee found:%s", dt.latin1());
209 addr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); 212 addr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
210 } 213 }
211 214
212 addr.insertCustom( "KADDRESSBOOK", "X-Children", contact.children() ); 215 addr.insertCustom( "KADDRESSBOOK", "X-Children", contact.children() );
213 if (contact.birthday().isValid()) 216 if (contact.birthday().isValid())
214 addr.setBirthday( contact.birthday() ); 217 addr.setBirthday( contact.birthday() );
215 218
216 addr.setNickName( contact.nickname() ); 219 addr.setNickName( contact.nickname() );
217 220
218 // others 221 // others
219 //US I put opies BusinessWebPage into Ka/Pi's notes block, because no other native field is available. 222 //US I put opies BusinessWebPage into Ka/Pi's notes block, because no other native field is available.
220 QString notes = contact.notes(); 223 QString notes = contact.notes();
221 notes += "\nBusinessWebPage: " + contact.businessWebpage() + "\n"; 224 notes += "\nBusinessWebPage: " + contact.businessWebpage() + "\n";
222 225
223 addr.setNote( contact.notes() ); 226 addr.setNote( contact.notes() );
224 227
225 228
226 229
227//US QString groups() const { return find( Qtopia::Groups ); } 230//US QString groups() const { return find( Qtopia::Groups ); }
@@ -298,50 +301,54 @@ bool OpieConverter::addresseeToOpie( const Addressee &addr, OContact &contact )
298 301
299 PhoneNumber businessfax = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ); 302 PhoneNumber businessfax = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax );
300 if (!businessfax.number().isEmpty()) 303 if (!businessfax.number().isEmpty())
301 contact.setBusinessFax(businessfax.number()); 304 contact.setBusinessFax(businessfax.number());
302 305
303 PhoneNumber businessmobile = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Cell ); 306 PhoneNumber businessmobile = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Cell );
304 if (!businessmobile.number().isEmpty()) 307 if (!businessmobile.number().isEmpty())
305 contact.setBusinessMobile(businessmobile.number()); 308 contact.setBusinessMobile(businessmobile.number());
306 309
307 PhoneNumber businesspager = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Pager ); 310 PhoneNumber businesspager = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Pager );
308 if (!businesspager.number().isEmpty()) 311 if (!businesspager.number().isEmpty())
309 contact.setBusinessPager(businesspager.number()); 312 contact.setBusinessPager(businesspager.number());
310 313
311 contact.setJobTitle(addr.role()); 314 contact.setJobTitle(addr.role());
312 contact.setCompany(addr.organization()); 315 contact.setCompany(addr.organization());
313 316
314 contact.setProfession(addr.custom( "KADDRESSBOOK", "X-Profession" )); 317 contact.setProfession(addr.custom( "KADDRESSBOOK", "X-Profession" ));
315 contact.setAssistant(addr.custom( "KADDRESSBOOK", "X-AssistantsName" )); 318 contact.setAssistant(addr.custom( "KADDRESSBOOK", "X-AssistantsName" ));
316 contact.setDepartment(addr.custom( "KADDRESSBOOK", "X-Department" )); 319 contact.setDepartment(addr.custom( "KADDRESSBOOK", "X-Department" ));
317 contact.setManager(addr.custom( "KADDRESSBOOK", "X-ManagersName" )); 320 contact.setManager(addr.custom( "KADDRESSBOOK", "X-ManagersName" ));
318 contact.setOffice(addr.custom( "KADDRESSBOOK", "X-Office" )); 321 contact.setOffice(addr.custom( "KADDRESSBOOK", "X-Office" ));
319 322
320 //personal 323 //personal
321 contact.setSpouse(addr.custom( "KADDRESSBOOK", "X-Spouse" )); 324 contact.setSpouse(addr.custom( "KADDRESSBOOK", "X-Spouse" ));
322 contact.setGender(addr.custom( "KADDRESSBOOK", "X-Gender" )); 325 QString gend = addr.custom( "KADDRESSBOOK", "X-Gender" );
323 326 if (gend == "female")
327 contact.setGender("1");
328 else if (gend == "male")
329 contact.setGender("2");
330
324 QDate dt = KGlobal::locale()->readDate( 331 QDate dt = KGlobal::locale()->readDate(
325 addr.custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); // = Qt::ISODate 332 addr.custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); // = Qt::ISODate
326 contact.setAnniversary( dt ); 333 contact.setAnniversary( dt );
327 334
328 contact.setChildren(addr.custom( "KADDRESSBOOK", "X-Children" )); 335 contact.setChildren(addr.custom( "KADDRESSBOOK", "X-Children" ));
329 336
330 contact.setBirthday(addr.birthday().date()); 337 contact.setBirthday(addr.birthday().date());
331 contact.setNickname(addr.nickName()); 338 contact.setNickname(addr.nickName());
332 339
333 // other 340 // other
334 contact.setNotes(addr.note()); 341 contact.setNotes(addr.note());
335 342
336//US QString groups() const { return find( Qtopia::Groups ); } 343//US QString groups() const { return find( Qtopia::Groups ); }
337//US QStringList groupList() const; 344//US QStringList groupList() const;
338 345
339 QStringList cats = addr.categories(); 346 QStringList cats = addr.categories();
340 347
341 QArray<int> iar; 348 QArray<int> iar;
342 if ( !cats.isEmpty() ) { 349 if ( !cats.isEmpty() ) {
343 QArray<int> iar = catDB->ids("contact", cats); 350 QArray<int> iar = catDB->ids("contact", cats);
344 contact.setCategories(iar); 351 contact.setCategories(iar);
345 } 352 }
346 353
347 return true; 354 return true;
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 1a34e4d..8daca33 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -142,49 +142,50 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
142#ifndef KAB_EMBEDDED 142#ifndef KAB_EMBEDDED
143 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 143 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
144#endif //KAB_EMBEDDED 144#endif //KAB_EMBEDDED
145 145
146 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 146 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
147 SLOT( addressBookChanged() ) ); 147 SLOT( addressBookChanged() ) );
148 148
149 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 149 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
150 "X-Department", "KADDRESSBOOK" ); 150 "X-Department", "KADDRESSBOOK" );
151 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 151 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
152 "X-Profession", "KADDRESSBOOK" ); 152 "X-Profession", "KADDRESSBOOK" );
153 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 153 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
154 "X-AssistantsName", "KADDRESSBOOK" ); 154 "X-AssistantsName", "KADDRESSBOOK" );
155 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 155 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
156 "X-ManagersName", "KADDRESSBOOK" ); 156 "X-ManagersName", "KADDRESSBOOK" );
157 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 157 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
158 "X-SpousesName", "KADDRESSBOOK" ); 158 "X-SpousesName", "KADDRESSBOOK" );
159 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 159 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
160 "X-Office", "KADDRESSBOOK" ); 160 "X-Office", "KADDRESSBOOK" );
161 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 161 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
162 "X-IMAddress", "KADDRESSBOOK" ); 162 "X-IMAddress", "KADDRESSBOOK" );
163 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 163 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
164 "X-Anniversary", "KADDRESSBOOK" ); 164 "X-Anniversary", "KADDRESSBOOK" );
165 165
166//US added this field to become compatible with Opie addressbook 166 //US added this field to become compatible with Opie/qtopia addressbook
167 // values can be "female" or "male" or "". An empty field represents undefined.
167 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 168 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
168 "X-Gender", "KADDRESSBOOK" ); 169 "X-Gender", "KADDRESSBOOK" );
169 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 170 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
170 "X-Children", "KADDRESSBOOK" ); 171 "X-Children", "KADDRESSBOOK" );
171 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 172 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
172 "X-FreeBusyUrl", "KADDRESSBOOK" ); 173 "X-FreeBusyUrl", "KADDRESSBOOK" );
173 174
174 initGUI(); 175 initGUI();
175 176
176 mIncSearchWidget->setFocus(); 177 mIncSearchWidget->setFocus();
177 178
178 179
179 connect( mViewManager, SIGNAL( selected( const QString& ) ), 180 connect( mViewManager, SIGNAL( selected( const QString& ) ),
180 SLOT( setContactSelected( const QString& ) ) ); 181 SLOT( setContactSelected( const QString& ) ) );
181 connect( mViewManager, SIGNAL( executed( const QString& ) ), 182 connect( mViewManager, SIGNAL( executed( const QString& ) ),
182 SLOT( editContact( const QString& ) ) ); 183 SLOT( editContact( const QString& ) ) );
183 connect( mViewManager, SIGNAL( deleteRequest( ) ), 184 connect( mViewManager, SIGNAL( deleteRequest( ) ),
184 SLOT( deleteContacts( ) ) ); 185 SLOT( deleteContacts( ) ) );
185 connect( mViewManager, SIGNAL( modified() ), 186 connect( mViewManager, SIGNAL( modified() ),
186 SLOT( setModified() ) ); 187 SLOT( setModified() ) );
187 188
188 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 189 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
189 190
190 connect( mXXPortManager, SIGNAL( modified() ), 191 connect( mXXPortManager, SIGNAL( modified() ),