summaryrefslogtreecommitdiffabout
path: root/kabc/addresseeview.cpp
Unidiff
Diffstat (limited to 'kabc/addresseeview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addresseeview.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp
index 487e8a5..2dda968 100644
--- a/kabc/addresseeview.cpp
+++ b/kabc/addresseeview.cpp
@@ -367,101 +367,98 @@ mText = "<table width=\"100%\">\n";
367 367
368 // at last display it... 368 // at last display it...
369 setText( mText ); 369 setText( mText );
370 370
371} 371}
372 372
373KABC::Addressee AddresseeView::addressee() const 373KABC::Addressee AddresseeView::addressee() const
374{ 374{
375 return mAddressee; 375 return mAddressee;
376} 376}
377void AddresseeView::addTag(const QString & tag,const QString & text) 377void AddresseeView::addTag(const QString & tag,const QString & text)
378{ 378{
379 if ( text.isEmpty() ) 379 if ( text.isEmpty() )
380 return; 380 return;
381 int number=text.contains("\n"); 381 int number=text.contains("\n");
382 QString str = "<" + tag + ">"; 382 QString str = "<" + tag + ">";
383 QString tmpText=text; 383 QString tmpText=text;
384 QString tmpStr=str; 384 QString tmpStr=str;
385 if(number !=-1) 385 if(number !=-1)
386 { 386 {
387 if (number > 0) { 387 if (number > 0) {
388 int pos=0; 388 int pos=0;
389 QString tmp; 389 QString tmp;
390 for(int i=0;i<=number;i++) { 390 for(int i=0;i<=number;i++) {
391 pos=tmpText.find("\n"); 391 pos=tmpText.find("\n");
392 tmp=tmpText.left(pos); 392 tmp=tmpText.left(pos);
393 tmpText=tmpText.right(tmpText.length()-pos-1); 393 tmpText=tmpText.right(tmpText.length()-pos-1);
394 tmpStr+=tmp+"<br>"; 394 tmpStr+=tmp+"<br>";
395 } 395 }
396 } 396 }
397 else tmpStr += tmpText; 397 else tmpStr += tmpText;
398 tmpStr+="</" + tag + ">"; 398 tmpStr+="</" + tag + ">";
399 mText.append(tmpStr); 399 mText.append(tmpStr);
400 } 400 }
401 else 401 else
402 { 402 {
403 str += text + "</" + tag + ">"; 403 str += text + "</" + tag + ">";
404 mText.append(str); 404 mText.append(str);
405 } 405 }
406} 406}
407 407
408AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name, 408AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name,
409 true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false) 409 true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false)
410{ 410{
411 findButton( Close )->setText( i18n("Cancel Sync")); 411 findButton( Close )->setText( i18n("Cancel Sync"));
412 findButton( Ok )->setText( i18n("Remote")); 412 findButton( Ok )->setText( i18n("Remote"));
413 findButton( User1 )->setText( i18n("Local")); 413 findButton( User1 )->setText( i18n("Local"));
414 QWidget* topframe = new QWidget( this ); 414 QWidget* topframe = new QWidget( this );
415 //QVBox* topframe = new QVBox( this );
416 setMainWidget( topframe ); 415 setMainWidget( topframe );
417 QBoxLayout* bl; 416 QBoxLayout* bl;
418 if ( QApplication::desktop()->width() < 640 ) { 417 if ( QApplication::desktop()->width() < 640 ) {
419 bl = new QVBoxLayout( topframe ); 418 bl = new QVBoxLayout( topframe );
420
421 } else { 419 } else {
422 bl = new QHBoxLayout( topframe ); 420 bl = new QHBoxLayout( topframe );
423
424 } 421 }
425 QVBox* subframe = new QVBox( topframe ); 422 QVBox* subframe = new QVBox( topframe );
426 bl->addWidget(subframe ); 423 bl->addWidget(subframe );
427 QLabel* lab = new QLabel( i18n("Local Addressee"), subframe ); 424 QLabel* lab = new QLabel( i18n("Local Addressee"), subframe );
425 if ( takeloc )
426 lab->setBackgroundColor(Qt::green.light() );
428 AddresseeView * av = new AddresseeView( subframe ); 427 AddresseeView * av = new AddresseeView( subframe );
429 av->setAddressee( loc ); 428 av->setAddressee( loc );
430 subframe = new QVBox( topframe ); 429 subframe = new QVBox( topframe );
431 bl->addWidget(subframe ); 430 bl->addWidget(subframe );
432 lab = new QLabel( i18n("Remote Addressee"), subframe ); 431 lab = new QLabel( i18n("Remote Addressee"), subframe );
432 if ( !takeloc )
433 lab->setBackgroundColor(Qt::green.light() );
433 av = new AddresseeView( subframe ); 434 av = new AddresseeView( subframe );
434 av->setAddressee( rem ); 435 av->setAddressee( rem );
435 436 QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote()));
436 QObject::connect(findButton( Ok ),SIGNAL(clicked()), 437 QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local()));
437 SLOT(slot_remote()));
438 QObject::connect(this,SIGNAL(user1Clicked()),
439 SLOT(slot_local()));
440#ifndef DESKTOP_VERSION 438#ifndef DESKTOP_VERSION
441 showMaximized(); 439 showMaximized();
442#else 440#else
443 resize ( 640, 400 ); 441 resize ( 640, 400 );
444#endif 442#endif
445} 443}
446 444
447int AddresseeChooser::executeD( bool local ) 445int AddresseeChooser::executeD( bool local )
448{ 446{
449 mSyncResult = 3; 447 mSyncResult = 3;
450 if ( local ) 448 if ( local )
451 findButton( User1 )->setFocus(); 449 findButton( User1 )->setFocus();
452 else 450 else
453 findButton( Ok )->setFocus(); 451 findButton( Ok )->setFocus();
454 exec(); 452 exec();
455 qDebug("returning %d ",mSyncResult );
456 return mSyncResult; 453 return mSyncResult;
457} 454}
458void AddresseeChooser::slot_remote() 455void AddresseeChooser::slot_remote()
459{ 456{
460 mSyncResult = 2; 457 mSyncResult = 2;
461 accept(); 458 accept();
462} 459}
463void AddresseeChooser::slot_local() 460void AddresseeChooser::slot_local()
464{ 461{
465 mSyncResult = 1; 462 mSyncResult = 1;
466 accept(); 463 accept();
467} 464}