summaryrefslogtreecommitdiffabout
path: root/kabc/addresseeview.cpp
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kabc/addresseeview.cpp
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-p1.zip
kdepimpi-p1.tar.gz
kdepimpi-p1.tar.bz2
initial public commit of qt4 portp1
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
@@ -1,117 +1,122 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 3
4 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 4 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22#include <kabc/address.h> 22#include <kabc/address.h>
23#include <kabc/addressee.h> 23#include <kabc/addressee.h>
24#include <kabc/phonenumber.h> 24#include <kabc/phonenumber.h>
25#include <kglobal.h> 25#include <kglobal.h>
26//US#include <kglobalsettings.h> 26//US#include <kglobalsettings.h>
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
50 55
51//US #ifndef DESKTOP_VERSION 56//US #ifndef DESKTOP_VERSION
52//US #include <qtopia/qcopenvelope_qws.h> 57//US #include <qtopia/qcopenvelope_qws.h>
53//US #include <qpe/qpeapplication.h> 58//US #include <qpe/qpeapplication.h>
54//US #endif 59//US #endif
55 60
56//US static int kphoneInstalled = 0; 61//US static int kphoneInstalled = 0;
57 62
58using namespace KABC; 63using 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{
66//US setWrapPolicy( QTextEdit::AtWordBoundary ); 71//US setWrapPolicy( QTextEdit::AtWordBoundary );
67 setLinkUnderline( false ); 72 setLinkUnderline( false );
68 // setVScrollBarMode( QScrollView::AlwaysOff ); 73 // setVScrollBarMode( QScrollView::AlwaysOff );
69 //setHScrollBarMode( QScrollView::AlwaysOff ); 74 //setHScrollBarMode( QScrollView::AlwaysOff );
70 75
71//US QStyleSheet *sheet = styleSheet(); 76//US QStyleSheet *sheet = styleSheet();
72//US QStyleSheetItem *link = sheet->item( "a" ); 77//US QStyleSheetItem *link = sheet->item( "a" );
73//US link->setColor( KGlobalSettings::linkColor() ); 78//US link->setColor( KGlobalSettings::linkColor() );
74 79
75 80
76} 81}
77void AddresseeView::printMe() 82void AddresseeView::printMe()
78{ 83{
79#ifdef DESKTOP_VERSION 84#ifdef DESKTOP_VERSION
80 QPrinter printer; 85 QPrinter printer;
81 if (!printer.setup() ) 86 if (!printer.setup() )
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 ();
89 dy = (float)(m.height()) / (float)contentsHeight (); 94 dy = (float)(m.height()) / (float)contentsHeight ();
90 float scale; 95 float scale;
91 // scale to fit the width or height of the paper 96 // scale to fit the width or height of the paper
92 if ( dx < dy ) 97 if ( dx < dy )
93 scale = dx; 98 scale = dx;
94 else 99 else
95 scale = dy; 100 scale = dy;
96 p.translate( m.width()/10,0 ); 101 p.translate( m.width()/10,0 );
97 p.scale( scale, scale ); 102 p.scale( scale, scale );
98 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); 103 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
99 p.end(); 104 p.end();
100#endif 105#endif
101} 106}
102void AddresseeView::setSource(const QString& n) 107void AddresseeView::setSource(const QString& n)
103{ 108{
104 //qDebug("********AddresseeView::setSource %s", n.latin1()); 109 //qDebug("********AddresseeView::setSource %s", n.latin1());
105 110
106 if ( n == "allDetails" ) { 111 if ( n == "allDetails" ) {
107 sFullDetailsMode = true; 112 sFullDetailsMode = true;
108 setAddressee( mCurrentContact ); 113 setAddressee( mCurrentContact );
109 } else if ( n == "notAllDetails" ) { 114 } else if ( n == "notAllDetails" ) {
110 sFullDetailsMode = false; 115 sFullDetailsMode = false;
111 setAddressee( mCurrentContact ); 116 setAddressee( mCurrentContact );
112 } else if ( n.left( 6 ) == "mailto" ) 117 } else if ( n.left( 6 ) == "mailto" )
113 ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); 118 ExternalAppHandler::instance()->mailToOneContact( n.mid(7) );
114 else if ( n.left( 7 ) == "phoneto" ) 119 else if ( n.left( 7 ) == "phoneto" )
115 ExternalAppHandler::instance()->callByPhone( n.mid(8) ); 120 ExternalAppHandler::instance()->callByPhone( n.mid(8) );
116 else if ( n.left( 5 ) == "faxto" ) 121 else if ( n.left( 5 ) == "faxto" )
117 ExternalAppHandler::instance()->callByFax( n.mid(6) ); 122 ExternalAppHandler::instance()->callByFax( n.mid(6) );
@@ -373,132 +378,132 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
373 "<td align=\"left\"><a href=\"allDetails\">%4</a></td></tr>" ) 378 "<td align=\"left\"><a href=\"allDetails\">%4</a></td></tr>" )
374 .arg( i18n("Details") ) 379 .arg( i18n("Details") )
375 .arg( i18n("Show!") ); 380 .arg( i18n("Show!") );
376 381
377 382
378 } 383 }
379 384
380 QString aRole = ""; 385 QString aRole = "";
381 QString aOrga = ""; 386 QString aOrga = "";
382 if ( true /*!mAddressee.role().isEmpty()*/ ) { 387 if ( true /*!mAddressee.role().isEmpty()*/ ) {
383 aRole = "<tr>" 388 aRole = "<tr>"
384 "<td align=\"left\">" + mAddressee.role() + "</td>" 389 "<td align=\"left\">" + mAddressee.role() + "</td>"
385 "</tr>"; 390 "</tr>";
386 } 391 }
387 if ( true /*!mAddressee.organization().isEmpty()*/ ) { 392 if ( true /*!mAddressee.organization().isEmpty()*/ ) {
388 aOrga = "<tr>" 393 aOrga = "<tr>"
389 "<td align=\"left\">" + mAddressee.organization() + "</td>" 394 "<td align=\"left\">" + mAddressee.organization() + "</td>"
390 "</tr>"; 395 "</tr>";
391 } 396 }
392 mText = ""; 397 mText = "";
393 QString picString = ""; 398 QString picString = "";
394 KABC::Picture picture = mAddressee.photo(); 399 KABC::Picture picture = mAddressee.photo();
395 if (picture.undefined() ) picture = mAddressee.logo(); 400 if (picture.undefined() ) picture = mAddressee.logo();
396 bool picAvailintern = false; 401 bool picAvailintern = false;
397 bool picAvailUrl = false; 402 bool picAvailUrl = false;
398 if (! picture.undefined() ) { 403 if (! picture.undefined() ) {
399 picAvailintern = (picture.isIntern() && !picture.data().isNull()); 404 picAvailintern = (picture.isIntern() && !picture.data().isNull());
400 picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); 405 picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() );
401 } 406 }
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 ) {
409 if ( wid > hei ) { 414 if ( wid > hei ) {
410 hei = (hei*128)/wid; 415 hei = (hei*128)/wid;
411 wid = 128; 416 wid = 128;
412 } else { 417 } else {
413 wid = (wid*128)/hei; 418 wid = (wid*128)/hei;
414 hei = 128; 419 hei = 128;
415 } 420 }
416 } 421 }
417 picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei); 422 picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei);
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 ) {
425 if ( wid > hei ) { 430 if ( wid > hei ) {
426 hei = (hei*128)/wid; 431 hei = (hei*128)/wid;
427 wid = 128; 432 wid = 128;
428 } else { 433 } else {
429 wid = (wid*128)/hei; 434 wid = (wid*128)/hei;
430 hei = 128; 435 hei = 128;
431 } 436 }
432 } 437 }
433 picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei); 438 picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei);
434 } else { 439 } else {
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\">";
442 447
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\">";
450 } else { 455 } else {
451 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); 456 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
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\">";
459 464
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\">";
467 472
468 } else { 473 } else {
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\">";
476 } 481 }
477 } 482 }
478 } 483 }
479 } 484 }
480 mText = QString::fromLatin1( 485 mText = QString::fromLatin1(
481 "<html>" 486 "<html>"
482 "<body text=\"%1\" bgcolor=\"%2\">" // text and background color 487 "<body text=\"%1\" bgcolor=\"%2\">" // text and background color
483 "<table>" 488 "<table>"
484 "<tr>" 489 "<tr>"
485 "<td rowspan=\"3\" align=\"right\" valign=\"top\">" 490 "<td rowspan=\"3\" align=\"right\" valign=\"top\">"
486 "%3" 491 "%3"
487 "</td>" 492 "</td>"
488 "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name 493 "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name
489 "</tr>" 494 "</tr>"
490 "%5" // role 495 "%5" // role
491 "%6" // organization 496 "%6" // organization
492 "<td colspan=\"2\">&nbsp;</td>" 497 "<td colspan=\"2\">&nbsp;</td>"
493 "%7" // dynamic part 498 "%7" // dynamic part
494 "%8" // notes 499 "%8" // notes
495 "</table>" 500 "</table>"
496 "</body>" 501 "</body>"
497 "</html>") 502 "</html>")
498//US 503//US
499 .arg( /*KGlobalSettings::textColor().name()*/ "black" ) 504 .arg( /*KGlobalSettings::textColor().name()*/ "black" )
500//US 505//US
501 .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) 506 .arg( /*KGlobalSettings::baseColor().name()*/ "white" )
502 .arg( picString ) 507 .arg( picString )
503 .arg( name ) 508 .arg( name )
504 .arg( aRole ) 509 .arg( aRole )
@@ -624,116 +629,116 @@ QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones_unsorted
624 629
625 if ( !extension.isEmpty() ) { 630 if ( !extension.isEmpty() ) {
626 dynamicPart += QString( 631 dynamicPart += QString(
627 "<tr><td align=\"right\"><b>%1</b></td>" 632 "<tr><td align=\"right\"><b>%1</b></td>"
628 "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) 633 "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" )
629 .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) 634 .arg( KABC::PhoneNumber::typeLabel( phonetype ) )
630 .arg( extension ) 635 .arg( extension )
631 .arg( (*phoneIt).number() ) 636 .arg( (*phoneIt).number() )
632 .arg( (*phoneIt).number() ) 637 .arg( (*phoneIt).number() )
633 .arg( sms ); 638 .arg( sms );
634 639
635 } else { 640 } else {
636 dynamicPart += QString( 641 dynamicPart += QString(
637 "<tr><td align=\"right\"><b>%1</b></td>" 642 "<tr><td align=\"right\"><b>%1</b></td>"
638 "<td align=\"left\">%2 %3</td></tr>" ) 643 "<td align=\"left\">%2 %3</td></tr>" )
639 .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) 644 .arg( KABC::PhoneNumber::typeLabel( phonetype ) )
640 .arg( (*phoneIt).number() ) 645 .arg( (*phoneIt).number() )
641 .arg( sms ); 646 .arg( sms );
642 } 647 }
643 } 648 }
644 return dynamicPart; 649 return dynamicPart;
645} 650}
646/* 651/*
647KABC::Addressee AddresseeView::addressee() const 652KABC::Addressee AddresseeView::addressee() const
648{ 653{
649 return mAddressee; 654 return mAddressee;
650} 655}
651*/ 656*/
652void AddresseeView::addTag(const QString & tag,const QString & text) 657void 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;
660 if(number !=-1) 665 if(number !=-1)
661 { 666 {
662 if (number > 0) { 667 if (number > 0) {
663 int pos=0; 668 int pos=0;
664 QString tmp; 669 QString tmp;
665 for(int i=0;i<=number;i++) { 670 for(int i=0;i<=number;i++) {
666 pos=tmpText.find("\n"); 671 pos=tmpText.find("\n");
667 tmp=tmpText.left(pos); 672 tmp=tmpText.left(pos);
668 tmpText=tmpText.right(tmpText.length()-pos-1); 673 tmpText=tmpText.right(tmpText.length()-pos-1);
669 tmpStr+=tmp+"<br>"; 674 tmpStr+=tmp+"<br>";
670 } 675 }
671 } 676 }
672 else tmpStr += tmpText; 677 else tmpStr += tmpText;
673 tmpStr+="</" + tag + ">"; 678 tmpStr+="</" + tag + ">";
674 mText.append(tmpStr); 679 mText.append(tmpStr);
675 } 680 }
676 else 681 else
677 { 682 {
678 str += text + "</" + tag + ">"; 683 str += text + "</" + tag + ">";
679 mText.append(str); 684 mText.append(str);
680 } 685 }
681} 686}
682 687
683AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name, 688AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name,
684 true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false) 689 true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false)
685{ 690{
686 findButton( Close )->setText( i18n("Cancel Sync")); 691 findButton( Close )->setText( i18n("Cancel Sync"));
687 findButton( Ok )->setText( i18n("Remote")); 692 findButton( Ok )->setText( i18n("Remote"));
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()));
712 QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local())); 717 QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local()));
713#ifndef DESKTOP_VERSION 718#ifndef DESKTOP_VERSION
714 showMaximized(); 719 showMaximized();
715#else 720#else
716 resize ( 640, 400 ); 721 resize ( 640, 400 );
717#endif 722#endif
718} 723}
719 724
720int AddresseeChooser::executeD( bool local ) 725int AddresseeChooser::executeD( bool local )
721{ 726{
722 mSyncResult = 3; 727 mSyncResult = 3;
723 if ( local ) 728 if ( local )
724 findButton( User1 )->setFocus(); 729 findButton( User1 )->setFocus();
725 else 730 else
726 findButton( Ok )->setFocus(); 731 findButton( Ok )->setFocus();
727 exec(); 732 exec();
728 return mSyncResult; 733 return mSyncResult;
729} 734}
730void AddresseeChooser::slot_remote() 735void AddresseeChooser::slot_remote()
731{ 736{
732 mSyncResult = 2; 737 mSyncResult = 2;
733 accept(); 738 accept();
734} 739}
735void AddresseeChooser::slot_local() 740void AddresseeChooser::slot_local()
736{ 741{
737 mSyncResult = 1; 742 mSyncResult = 1;
738 accept(); 743 accept();
739} 744}