summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addresseeview.cpp48
-rw-r--r--kaddressbook/kabcore.cpp2
2 files changed, 43 insertions, 7 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp
index 8f104e0..aa96210 100644
--- a/kabc/addresseeview.cpp
+++ b/kabc/addresseeview.cpp
@@ -214,103 +214,139 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
214 .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) 214 .arg( KABC::Address::typeLabel( (*addrIt).type() ) )
215//US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); 215//US .arg( (*addrIt).label().replace( '\n', "<br>" ) );
216 .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); 216 .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ );
217 217
218 } 218 }
219 } 219 }
220 220
221 QString notes; 221 QString notes;
222 if ( !mAddressee.note().isEmpty() ) { 222 if ( !mAddressee.note().isEmpty() ) {
223 notes = QString( 223 notes = QString(
224 "<tr>" 224 "<tr>"
225 "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label 225 "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label
226 "<td align=\"left\">%2</td>" // note 226 "<td align=\"left\">%2</td>" // note
227 "</tr>" ).arg( i18n( "Notes" ) ) 227 "</tr>" ).arg( i18n( "Notes" ) )
228//US .arg( mAddressee.note().replace( '\n', "<br>" ) ); 228//US .arg( mAddressee.note().replace( '\n', "<br>" ) );
229 .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); 229 .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) );
230 //qDebug("AddresseeView::setAddressee has to be verified."); 230 //qDebug("AddresseeView::setAddressee has to be verified.");
231 } 231 }
232 232
233 QString aRole = ""; 233 QString aRole = "";
234 QString aOrga = ""; 234 QString aOrga = "";
235 if ( true /*!mAddressee.role().isEmpty()*/ ) { 235 if ( true /*!mAddressee.role().isEmpty()*/ ) {
236 aRole = "<tr>" 236 aRole = "<tr>"
237 "<td align=\"left\">" + mAddressee.role() + "</td>" 237 "<td align=\"left\">" + mAddressee.role() + "</td>"
238 "</tr>"; 238 "</tr>";
239 } 239 }
240 if ( true /*!mAddressee.organization().isEmpty()*/ ) { 240 if ( true /*!mAddressee.organization().isEmpty()*/ ) {
241 aOrga = "<tr>" 241 aOrga = "<tr>"
242 "<td align=\"left\">" + mAddressee.organization() + "</td>" 242 "<td align=\"left\">" + mAddressee.organization() + "</td>"
243 "</tr>"; 243 "</tr>";
244 } 244 }
245 mText = ""; 245 mText = "";
246 QString picString = ""; 246 QString picString = "";
247 KABC::Picture picture = mAddressee.photo(); 247 KABC::Picture picture = mAddressee.photo();
248 bool picAvailintern = false; 248 bool picAvailintern = false;
249 bool picAvailUrl = false; 249 bool picAvailUrl = false;
250 if (! picture.undefined() ) { 250 if (! picture.undefined() ) {
251 picAvailintern = (picture.isIntern() && !picture.data().isNull()); 251 picAvailintern = (picture.isIntern() && !picture.data().isNull());
252 picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); 252 picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() );
253 } 253 }
254 if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { 254 if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) {
255 picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; 255 picString = "<img src=\"myimage\" width=\"50\" height=\"70\">";
256 if ( picAvailintern ) { 256 if ( picAvailintern ) {
257 QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); 257 QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() );
258 } else { 258 } else {
259 if ( picAvailUrl ) { 259 if ( picAvailUrl ) {
260 QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); 260 QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() ));
261 } else { 261 } else {
262 static bool setDefaultImage = false; 262 if ( !mAddressee.custom( "KADDRESSBOOK", "X-Children" ).isEmpty() ) {
263 if ( !setDefaultImage ) { 263 static bool setDefaultImageChildren = false;
264 qDebug("Setting default pixmap "); 264 if ( !setDefaultImageChildren ) {
265 QMimeSourceFactory::defaultFactory()->setPixmap( "defaultPenguin", KGlobal::iconLoader()->loadIcon( "package_toys", KIcon::Desktop, 128 ) ); 265 QMimeSourceFactory::defaultFactory()->setPixmap( "familyIcon", KGlobal::iconLoader()->loadIcon( "ic_kids", KIcon::Desktop, 128 ) );
266 setDefaultImage = true; 266 setDefaultImageChildren = true;
267 }
268 picString = "<img src=\"familyIcon\" width=\"64\" height=\"64\">";
269
270 } else if ( !mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ).isEmpty() ) {
271 static bool setDefaultImagepouses = false;
272 if ( !setDefaultImagepouses ) {
273 QMimeSourceFactory::defaultFactory()->setPixmap( "SpousesIcon", KGlobal::iconLoader()->loadIcon( "ic_family", KIcon::Desktop, 128 ) );
274 setDefaultImagepouses = true;
275 }
276 picString = "<img src=\"SpousesIcon\" width=\"64\" height=\"64\">";
277 } else {
278 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
279 if ( gen == "male" ) {
280 static bool setDefaultImageMale = false;
281 if ( !setDefaultImageMale ) {
282 QMimeSourceFactory::defaultFactory()->setPixmap( "MaleIcon", KGlobal::iconLoader()->loadIcon( "ic_male", KIcon::Desktop, 128 ) );
283 setDefaultImageMale = true;
284 }
285 picString = "<img src=\"MaleIcon\" width=\"64\" height=\"64\">";
286
287 } else if ( gen == "female" ) {
288 static bool setDefaultImageFemale = false;
289 if ( !setDefaultImageFemale ) {
290 QMimeSourceFactory::defaultFactory()->setPixmap( "FemaleIcon", KGlobal::iconLoader()->loadIcon( "ic_female", KIcon::Desktop, 128 ) );
291 setDefaultImageFemale = true;
292 }
293 picString = "<img src=\"FemaleIcon\" width=\"64\" height=\"64\">";
294
295 } else {
296 static bool setDefaultImage = false;
297 if ( !setDefaultImage ) {
298 qDebug("Setting default pixmap ");
299 QMimeSourceFactory::defaultFactory()->setPixmap( "defaultIcon", KGlobal::iconLoader()->loadIcon( "ic_penguin", KIcon::Desktop, 128 ) );
300 setDefaultImage = true;
301 }
302 picString = "<img src=\"defaultIcon\" width=\"64\" height=\"64\">";
303 }
267 } 304 }
268 picString = "<img src=\"defaultPenguin\" width=\"64\" height=\"64\">";
269 } 305 }
270 } 306 }
271 mText = QString::fromLatin1( 307 mText = QString::fromLatin1(
272 "<html>" 308 "<html>"
273 "<body text=\"%1\" bgcolor=\"%2\">" // text and background color 309 "<body text=\"%1\" bgcolor=\"%2\">" // text and background color
274 "<table>" 310 "<table>"
275 "<tr>" 311 "<tr>"
276 "<td rowspan=\"3\" align=\"right\" valign=\"top\">" 312 "<td rowspan=\"3\" align=\"right\" valign=\"top\">"
277 "%3" 313 "%3"
278 "</td>" 314 "</td>"
279 "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name 315 "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name
280 "</tr>" 316 "</tr>"
281 "%5" // role 317 "%5" // role
282 "%6" // organization 318 "%6" // organization
283 "<td colspan=\"2\">&nbsp;</td>" 319 "<td colspan=\"2\">&nbsp;</td>"
284 "%7" // dynamic part 320 "%7" // dynamic part
285 "%8" // notes 321 "%8" // notes
286 "</table>" 322 "</table>"
287 "</body>" 323 "</body>"
288 "</html>") 324 "</html>")
289//US 325//US
290 .arg( /*KGlobalSettings::textColor().name()*/ "black" ) 326 .arg( /*KGlobalSettings::textColor().name()*/ "black" )
291//US 327//US
292 .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) 328 .arg( /*KGlobalSettings::baseColor().name()*/ "white" )
293 .arg( picString ) 329 .arg( picString )
294 .arg( name ) 330 .arg( name )
295 .arg( aRole ) 331 .arg( aRole )
296 .arg( aOrga ) 332 .arg( aOrga )
297 .arg( dynamicPart ) 333 .arg( dynamicPart )
298 .arg( notes ); 334 .arg( notes );
299 335
300 } else { // no picture! 336 } else { // no picture!
301 337
302mText = "<table width=\"100%\">\n"; 338mText = "<table width=\"100%\">\n";
303 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 339 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
304#ifdef DESKTOP_VERSION 340#ifdef DESKTOP_VERSION
305 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; 341 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>";
306 mText += "<font color=\"#FFFFFF\">" + name +"</font></h1>"; 342 mText += "<font color=\"#FFFFFF\">" + name +"</font></h1>";
307#else 343#else
308 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h3>"; 344 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h3>";
309 mText += "<font color=\"#FFFFFF\"> " + name +"</font></h3>"; 345 mText += "<font color=\"#FFFFFF\"> " + name +"</font></h3>";
310#endif 346#endif
311 347
312 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; 348 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>";
313 349
314 mText += "<table><td colspan=\"2\">&nbsp;</td>"; 350 mText += "<table><td colspan=\"2\">&nbsp;</td>";
315 /* 351 /*
316 mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" 352 mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>"
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index e1a490d..3650b20 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -268,97 +268,97 @@ class KAex2phonePrefs : public QDialog
268 lab->setAlignment (AlignHCenter); 268 lab->setAlignment (AlignHCenter);
269 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 269 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
270 lay->addWidget( ok ); 270 lay->addWidget( ok );
271 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 271 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
272 lay->addWidget( cancel ); 272 lay->addWidget( cancel );
273 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 273 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
274 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 274 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
275 resize( 220, 240 ); 275 resize( 220, 240 );
276 276
277 } 277 }
278 278
279public: 279public:
280 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 280 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
281 QCheckBox* mWriteToSim; 281 QCheckBox* mWriteToSim;
282}; 282};
283 283
284 284
285bool pasteWithNewUid = true; 285bool pasteWithNewUid = true;
286 286
287#ifdef KAB_EMBEDDED 287#ifdef KAB_EMBEDDED
288KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 288KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
289 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 289 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
290 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 290 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
291 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 291 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
292#else //KAB_EMBEDDED 292#else //KAB_EMBEDDED
293KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 293KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
294 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 294 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
295 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 295 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
296 mReadWrite( readWrite ), mModified( false ) 296 mReadWrite( readWrite ), mModified( false )
297#endif //KAB_EMBEDDED 297#endif //KAB_EMBEDDED
298{ 298{
299 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 299 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
300 // syncManager->setBlockSave(false); 300 // syncManager->setBlockSave(false);
301 mIncSearchWidget = 0; 301 mIncSearchWidget = 0;
302 mMiniSplitter = 0; 302 mMiniSplitter = 0;
303 mExtensionBarSplitter = 0; 303 mExtensionBarSplitter = 0;
304 mIsPart = !parent->inherits( "KAddressBookMain" ); 304 mIsPart = !parent->inherits( "KAddressBookMain" );
305 mAddressBook = KABC::StdAddressBook::self(); 305 mAddressBook = KABC::StdAddressBook::self();
306 KABC::StdAddressBook::setAutomaticSave( false ); 306 KABC::StdAddressBook::setAutomaticSave( false );
307 307
308#ifndef KAB_EMBEDDED 308#ifndef KAB_EMBEDDED
309 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 309 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
310#endif //KAB_EMBEDDED 310#endif //KAB_EMBEDDED
311 311
312 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 312 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
313 SLOT( addressBookChanged() ) ); 313 SLOT( addressBookChanged() ) );
314 314
315#if 0 315#if 0
316 // LP moved to addressbook init method 316 // LR moved to addressbook init method
317 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 317 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
318 "X-Department", "KADDRESSBOOK" ); 318 "X-Department", "KADDRESSBOOK" );
319 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 319 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
320 "X-Profession", "KADDRESSBOOK" ); 320 "X-Profession", "KADDRESSBOOK" );
321 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 321 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
322 "X-AssistantsName", "KADDRESSBOOK" ); 322 "X-AssistantsName", "KADDRESSBOOK" );
323 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 323 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
324 "X-ManagersName", "KADDRESSBOOK" ); 324 "X-ManagersName", "KADDRESSBOOK" );
325 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 325 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
326 "X-SpousesName", "KADDRESSBOOK" ); 326 "X-SpousesName", "KADDRESSBOOK" );
327 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 327 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
328 "X-Office", "KADDRESSBOOK" ); 328 "X-Office", "KADDRESSBOOK" );
329 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 329 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
330 "X-IMAddress", "KADDRESSBOOK" ); 330 "X-IMAddress", "KADDRESSBOOK" );
331 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 331 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
332 "X-Anniversary", "KADDRESSBOOK" ); 332 "X-Anniversary", "KADDRESSBOOK" );
333 333
334 //US added this field to become compatible with Opie/qtopia addressbook 334 //US added this field to become compatible with Opie/qtopia addressbook
335 // values can be "female" or "male" or "". An empty field represents undefined. 335 // values can be "female" or "male" or "". An empty field represents undefined.
336 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 336 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
337 "X-Gender", "KADDRESSBOOK" ); 337 "X-Gender", "KADDRESSBOOK" );
338 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 338 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
339 "X-Children", "KADDRESSBOOK" ); 339 "X-Children", "KADDRESSBOOK" );
340 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 340 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
341 "X-FreeBusyUrl", "KADDRESSBOOK" ); 341 "X-FreeBusyUrl", "KADDRESSBOOK" );
342#endif 342#endif
343 initGUI(); 343 initGUI();
344 344
345 mIncSearchWidget->setFocus(); 345 mIncSearchWidget->setFocus();
346 346
347 347
348 connect( mViewManager, SIGNAL( selected( const QString& ) ), 348 connect( mViewManager, SIGNAL( selected( const QString& ) ),
349 SLOT( setContactSelected( const QString& ) ) ); 349 SLOT( setContactSelected( const QString& ) ) );
350 connect( mViewManager, SIGNAL( executed( const QString& ) ), 350 connect( mViewManager, SIGNAL( executed( const QString& ) ),
351 SLOT( executeContact( const QString& ) ) ); 351 SLOT( executeContact( const QString& ) ) );
352 352
353 connect( mViewManager, SIGNAL( deleteRequest( ) ), 353 connect( mViewManager, SIGNAL( deleteRequest( ) ),
354 SLOT( deleteContacts( ) ) ); 354 SLOT( deleteContacts( ) ) );
355 connect( mViewManager, SIGNAL( modified() ), 355 connect( mViewManager, SIGNAL( modified() ),
356 SLOT( setModified() ) ); 356 SLOT( setModified() ) );
357 357
358 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 358 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
359 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 359 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
360 360
361 connect( mXXPortManager, SIGNAL( modified() ), 361 connect( mXXPortManager, SIGNAL( modified() ),
362 SLOT( setModified() ) ); 362 SLOT( setModified() ) );
363 363
364 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 364 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),