summaryrefslogtreecommitdiffabout
path: root/kabc/addresseeview.cpp
Unidiff
Diffstat (limited to 'kabc/addresseeview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addresseeview.cpp47
1 files changed, 26 insertions, 21 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp
index cde19a1..425e67c 100644
--- a/kabc/addresseeview.cpp
+++ b/kabc/addresseeview.cpp
@@ -27,23 +27,28 @@
27#include <kiconloader.h> 27#include <kiconloader.h>
28#include <klocale.h> 28#include <klocale.h>
29//US #include <kstringhandler.h> 29//US #include <kstringhandler.h>
30#include <qscrollview.h> 30#include <q3scrollview.h>
31#include <qregexp.h> 31#include <qregexp.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qvbox.h> 33#include <q3vbox.h>
34#include <qlabel.h> 34#include <qlabel.h>
35#include <qwidget.h> 35#include <qwidget.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qapplication.h> 37#include <qapplication.h>
38#include <qpushbutton.h> 38#include <qpushbutton.h>
39#ifdef DESKTOP_VERSION 39#ifdef DESKTOP_VERSION
40#include <qpaintdevicemetrics.h> 40#include <q3paintdevicemetrics.h>
41#include <qprinter.h> 41#include <qprinter.h>
42#include <qpainter.h> 42#include <qpainter.h>
43#endif 43#endif
44#include <QDesktopWidget>
44 45
45 46
46#include <qstylesheet.h> 47#include <q3stylesheet.h>
48//Added by qt3to4:
49#include <Q3HBoxLayout>
50#include <QPixmap>
51#include <Q3VBoxLayout>
47#include "externalapphandler.h" 52#include "externalapphandler.h"
48#include <kabc/addresseeview.h> 53#include <kabc/addresseeview.h>
49 54
@@ -59,7 +64,7 @@ using namespace KABC;
59bool AddresseeView::sFullDetailsMode = false; 64bool AddresseeView::sFullDetailsMode = false;
60 65
61AddresseeView::AddresseeView( QWidget *parent, const char *name ) 66AddresseeView::AddresseeView( QWidget *parent, const char *name )
62 : QTextBrowser( parent, name ) 67 : Q3TextBrowser( parent, name )
63 68
64 69
65{ 70{
@@ -82,7 +87,7 @@ void AddresseeView::printMe()
82 return; 87 return;
83 QPainter p; 88 QPainter p;
84 p.begin ( &printer ); 89 p.begin ( &printer );
85 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); 90 Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( &printer );
86 float dx, dy; 91 float dx, dy;
87 int wid = (m.width() * 9)/10; 92 int wid = (m.width() * 9)/10;
88 dx = (float) wid/(float)contentsWidth (); 93 dx = (float) wid/(float)contentsWidth ();
@@ -402,7 +407,7 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
402 if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { 407 if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) {
403 picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; 408 picString = "<img src=\"myimage\" width=\"50\" height=\"70\">";
404 if ( picAvailintern ) { 409 if ( picAvailintern ) {
405 QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); 410 Q3MimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() );
406 int wid = picture.data().width(); 411 int wid = picture.data().width();
407 int hei = picture.data().height(); 412 int hei = picture.data().height();
408 if ( wid > 128 || hei > 128 ) { 413 if ( wid > 128 || hei > 128 ) {
@@ -418,7 +423,7 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
418 } else { 423 } else {
419 if ( picAvailUrl ) { 424 if ( picAvailUrl ) {
420 QPixmap picPix( picture.url() ); 425 QPixmap picPix( picture.url() );
421 QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", picPix ); 426 Q3MimeSourceFactory::defaultFactory()->setPixmap( "myimage", picPix );
422 int wid = picPix.width(); 427 int wid = picPix.width();
423 int hei = picPix.height(); 428 int hei = picPix.height();
424 if ( wid > 128 || hei > 128 ) { 429 if ( wid > 128 || hei > 128 ) {
@@ -435,7 +440,7 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
435 if ( !mAddressee.custom( "KADDRESSBOOK", "X-Children" ).isEmpty() ) { 440 if ( !mAddressee.custom( "KADDRESSBOOK", "X-Children" ).isEmpty() ) {
436 static bool setDefaultImageChildren = false; 441 static bool setDefaultImageChildren = false;
437 if ( !setDefaultImageChildren ) { 442 if ( !setDefaultImageChildren ) {
438 QMimeSourceFactory::defaultFactory()->setPixmap( "familyIcon", KGlobal::iconLoader()->loadIcon( "ic_kids", KIcon::Desktop, 128 ) ); 443 Q3MimeSourceFactory::defaultFactory()->setPixmap( "familyIcon", KGlobal::iconLoader()->loadIcon( "ic_kids", KIcon::Desktop, 128 ) );
439 setDefaultImageChildren = true; 444 setDefaultImageChildren = true;
440 } 445 }
441 picString = "<img src=\"familyIcon\" width=\"64\" height=\"64\">"; 446 picString = "<img src=\"familyIcon\" width=\"64\" height=\"64\">";
@@ -443,7 +448,7 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
443 } else if ( !mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ).isEmpty() ) { 448 } else if ( !mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ).isEmpty() ) {
444 static bool setDefaultImagepouses = false; 449 static bool setDefaultImagepouses = false;
445 if ( !setDefaultImagepouses ) { 450 if ( !setDefaultImagepouses ) {
446 QMimeSourceFactory::defaultFactory()->setPixmap( "SpousesIcon", KGlobal::iconLoader()->loadIcon( "ic_family", KIcon::Desktop, 128 ) ); 451 Q3MimeSourceFactory::defaultFactory()->setPixmap( "SpousesIcon", KGlobal::iconLoader()->loadIcon( "ic_family", KIcon::Desktop, 128 ) );
447 setDefaultImagepouses = true; 452 setDefaultImagepouses = true;
448 } 453 }
449 picString = "<img src=\"SpousesIcon\" width=\"64\" height=\"64\">"; 454 picString = "<img src=\"SpousesIcon\" width=\"64\" height=\"64\">";
@@ -452,7 +457,7 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
452 if ( gen == "male" ) { 457 if ( gen == "male" ) {
453 static bool setDefaultImageMale = false; 458 static bool setDefaultImageMale = false;
454 if ( !setDefaultImageMale ) { 459 if ( !setDefaultImageMale ) {
455 QMimeSourceFactory::defaultFactory()->setPixmap( "MaleIcon", KGlobal::iconLoader()->loadIcon( "ic_male", KIcon::Desktop, 128 ) ); 460 Q3MimeSourceFactory::defaultFactory()->setPixmap( "MaleIcon", KGlobal::iconLoader()->loadIcon( "ic_male", KIcon::Desktop, 128 ) );
456 setDefaultImageMale = true; 461 setDefaultImageMale = true;
457 } 462 }
458 picString = "<img src=\"MaleIcon\" width=\"64\" height=\"64\">"; 463 picString = "<img src=\"MaleIcon\" width=\"64\" height=\"64\">";
@@ -460,7 +465,7 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
460 } else if ( gen == "female" ) { 465 } else if ( gen == "female" ) {
461 static bool setDefaultImageFemale = false; 466 static bool setDefaultImageFemale = false;
462 if ( !setDefaultImageFemale ) { 467 if ( !setDefaultImageFemale ) {
463 QMimeSourceFactory::defaultFactory()->setPixmap( "FemaleIcon", KGlobal::iconLoader()->loadIcon( "ic_female", KIcon::Desktop, 128 ) ); 468 Q3MimeSourceFactory::defaultFactory()->setPixmap( "FemaleIcon", KGlobal::iconLoader()->loadIcon( "ic_female", KIcon::Desktop, 128 ) );
464 setDefaultImageFemale = true; 469 setDefaultImageFemale = true;
465 } 470 }
466 picString = "<img src=\"FemaleIcon\" width=\"64\" height=\"64\">"; 471 picString = "<img src=\"FemaleIcon\" width=\"64\" height=\"64\">";
@@ -469,7 +474,7 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
469 static bool setDefaultImage = false; 474 static bool setDefaultImage = false;
470 if ( !setDefaultImage ) { 475 if ( !setDefaultImage ) {
471 //qDebug("Setting default pixmap "); 476 //qDebug("Setting default pixmap ");
472 QMimeSourceFactory::defaultFactory()->setPixmap( "defaultIcon", KGlobal::iconLoader()->loadIcon( "ic_penguin", KIcon::Desktop, 128 ) ); 477 Q3MimeSourceFactory::defaultFactory()->setPixmap( "defaultIcon", KGlobal::iconLoader()->loadIcon( "ic_penguin", KIcon::Desktop, 128 ) );
473 setDefaultImage = true; 478 setDefaultImage = true;
474 } 479 }
475 picString = "<img src=\"defaultIcon\" width=\"64\" height=\"64\">"; 480 picString = "<img src=\"defaultIcon\" width=\"64\" height=\"64\">";
@@ -653,7 +658,7 @@ void AddresseeView::addTag(const QString & tag,const QString & text)
653{ 658{
654 if ( text.isEmpty() ) 659 if ( text.isEmpty() )
655 return; 660 return;
656 int number=text.contains("\n"); 661 int number=text.count("\n");
657 QString str = "<" + tag + ">"; 662 QString str = "<" + tag + ">";
658 QString tmpText=text; 663 QString tmpText=text;
659 QString tmpStr=str; 664 QString tmpStr=str;
@@ -688,24 +693,24 @@ AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bo
688 findButton( User1 )->setText( i18n("Local")); 693 findButton( User1 )->setText( i18n("Local"));
689 QWidget* topframe = new QWidget( this ); 694 QWidget* topframe = new QWidget( this );
690 setMainWidget( topframe ); 695 setMainWidget( topframe );
691 QBoxLayout* bl; 696 Q3BoxLayout* bl;
692 if ( QApplication::desktop()->width() < 640 ) { 697 if ( QApplication::desktop()->width() < 640 ) {
693 bl = new QVBoxLayout( topframe ); 698 bl = new Q3VBoxLayout( topframe );
694 } else { 699 } else {
695 bl = new QHBoxLayout( topframe ); 700 bl = new Q3HBoxLayout( topframe );
696 } 701 }
697 QVBox* subframe = new QVBox( topframe ); 702 Q3VBox* subframe = new Q3VBox( topframe );
698 bl->addWidget(subframe ); 703 bl->addWidget(subframe );
699 QLabel* lab = new QLabel( i18n("Local Addressee"), subframe ); 704 QLabel* lab = new QLabel( i18n("Local Addressee"), subframe );
700 if ( takeloc ) 705 if ( takeloc )
701 lab->setBackgroundColor(Qt::green.light() ); 706 lab->setBackgroundColor(QColor(Qt::green).light() );
702 AddresseeView * av = new AddresseeView( subframe ); 707 AddresseeView * av = new AddresseeView( subframe );
703 av->setAddressee( loc ); 708 av->setAddressee( loc );
704 subframe = new QVBox( topframe ); 709 subframe = new Q3VBox( topframe );
705 bl->addWidget(subframe ); 710 bl->addWidget(subframe );
706 lab = new QLabel( i18n("Remote Addressee"), subframe ); 711 lab = new QLabel( i18n("Remote Addressee"), subframe );
707 if ( !takeloc ) 712 if ( !takeloc )
708 lab->setBackgroundColor(Qt::green.light() ); 713 lab->setBackgroundColor(QColor(Qt::green).light() );
709 av = new AddresseeView( subframe ); 714 av = new AddresseeView( subframe );
710 av->setAddressee( rem ); 715 av->setAddressee( rem );
711 QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote())); 716 QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote()));