summaryrefslogtreecommitdiffabout
path: root/libkdepim/addresseeview.cpp
Unidiff
Diffstat (limited to 'libkdepim/addresseeview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/addresseeview.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/libkdepim/addresseeview.cpp b/libkdepim/addresseeview.cpp
index 5c69010..b4717d7 100644
--- a/libkdepim/addresseeview.cpp
+++ b/libkdepim/addresseeview.cpp
@@ -1,395 +1,401 @@
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 <qscrollview.h>
31#include <qregexp.h> 31#include <qregexp.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qapplication.h> 33#include <qapplication.h>
34 34
35 35
36#include "externalapphandler.h" 36#include "externalapphandler.h"
37#include "addresseeview.h" 37#include "addresseeview.h"
38 38
39 39
40//US #ifndef DESKTOP_VERSION 40//US #ifndef DESKTOP_VERSION
41//US #include <qtopia/qcopenvelope_qws.h> 41//US #include <qtopia/qcopenvelope_qws.h>
42//US #include <qpe/qpeapplication.h> 42//US #include <qpe/qpeapplication.h>
43//US #endif 43//US #endif
44 44
45//US static int kphoneInstalled = 0; 45//US static int kphoneInstalled = 0;
46 46
47using namespace KPIM; 47using namespace KPIM;
48 48
49AddresseeView::AddresseeView( QWidget *parent, const char *name ) 49AddresseeView::AddresseeView( QWidget *parent, const char *name )
50//US : KTextBrowser( parent, name ) 50//US : KTextBrowser( parent, name )
51 : QTextBrowser( parent, name ) 51 : QTextBrowser( parent, name )
52 52
53 53
54{ 54{
55//US setWrapPolicy( QTextEdit::AtWordBoundary ); 55//US setWrapPolicy( QTextEdit::AtWordBoundary );
56 setLinkUnderline( false ); 56 setLinkUnderline( false );
57 // setVScrollBarMode( QScrollView::AlwaysOff ); 57 // setVScrollBarMode( QScrollView::AlwaysOff );
58 //setHScrollBarMode( QScrollView::AlwaysOff ); 58 //setHScrollBarMode( QScrollView::AlwaysOff );
59 59
60//US QStyleSheet *sheet = styleSheet(); 60//US QStyleSheet *sheet = styleSheet();
61//US QStyleSheetItem *link = sheet->item( "a" ); 61//US QStyleSheetItem *link = sheet->item( "a" );
62//US link->setColor( KGlobalSettings::linkColor() ); 62//US link->setColor( KGlobalSettings::linkColor() );
63 63
64} 64}
65 65
66void AddresseeView::setSource(const QString& n) 66void AddresseeView::setSource(const QString& n)
67{ 67{
68 //qDebug("********AddresseeView::setSource %s", n.latin1()); 68 //qDebug("********AddresseeView::setSource %s", n.latin1());
69 69
70 if ( n.left( 6 ) == "mailto" ) 70 if ( n.left( 6 ) == "mailto" )
71 ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); 71 ExternalAppHandler::instance()->mailToOneContact( n.mid(7) );
72 else if ( n.left( 7 ) == "phoneto" ) 72 else if ( n.left( 7 ) == "phoneto" )
73 ExternalAppHandler::instance()->callByPhone( n.mid(8) ); 73 ExternalAppHandler::instance()->callByPhone( n.mid(8) );
74 else if ( n.left( 5 ) == "faxto" ) 74 else if ( n.left( 5 ) == "faxto" )
75 ExternalAppHandler::instance()->callByFax( n.mid(6) ); 75 ExternalAppHandler::instance()->callByFax( n.mid(6) );
76 else if ( n.left( 5 ) == "smsto" ) 76 else if ( n.left( 5 ) == "smsto" )
77 ExternalAppHandler::instance()->callBySMS( n.mid(6) ); 77 ExternalAppHandler::instance()->callBySMS( n.mid(6) );
78 else if ( n.left( 7 ) == "pagerto" ) 78 else if ( n.left( 7 ) == "pagerto" )
79 ExternalAppHandler::instance()->callByPager( n.mid(8) ); 79 ExternalAppHandler::instance()->callByPager( n.mid(8) );
80 else if ( n.left( 5 ) == "sipto" )
81 ExternalAppHandler::instance()->callBySIP( n.mid(6) );
80 82
81} 83}
82void AddresseeView::setAddressee( const KABC::Addressee& addr ) 84void AddresseeView::setAddressee( const KABC::Addressee& addr )
83{ 85{
84 ExternalAppHandler* eah = ExternalAppHandler::instance(); 86 ExternalAppHandler* eah = ExternalAppHandler::instance();
85 bool kemailAvail = eah->isEmailAppAvailable(); 87 bool kemailAvail = eah->isEmailAppAvailable();
86 bool kphoneAvail = eah->isPhoneAppAvailable(); 88 bool kphoneAvail = eah->isPhoneAppAvailable();
87 bool kfaxAvail = eah->isFaxAppAvailable(); 89 bool kfaxAvail = eah->isFaxAppAvailable();
88 bool ksmsAvail = eah->isSMSAppAvailable(); 90 bool ksmsAvail = eah->isSMSAppAvailable();
89 bool kpagerAvail = eah->isPagerAppAvailable(); 91 bool kpagerAvail = eah->isPagerAppAvailable();
92 bool ksipAvail = eah->isSIPAppAvailable();
90 93
91 94
92 mAddressee = addr; 95 mAddressee = addr;
93 // clear view 96 // clear view
94 setText( QString::null ); 97 setText( QString::null );
95 98
96 if ( mAddressee.isEmpty() ) 99 if ( mAddressee.isEmpty() )
97 return; 100 return;
98 101
99 QString name = ( mAddressee.assembledName().isEmpty() ? 102 QString name = ( mAddressee.assembledName().isEmpty() ?
100 mAddressee.formattedName() : mAddressee.assembledName() ); 103 mAddressee.formattedName() : mAddressee.assembledName() );
101 104
102 QString dynamicPart; 105 QString dynamicPart;
103 106
104 QStringList emails = mAddressee.emails(); 107 QStringList emails = mAddressee.emails();
105 QStringList::ConstIterator emailIt; 108 QStringList::ConstIterator emailIt;
106 QString type = i18n( "Email" ); 109 QString type = i18n( "Email" );
107 emailIt = emails.begin(); 110 emailIt = emails.begin();
108 if ( emailIt != emails.end() ) { 111 if ( emailIt != emails.end() ) {
109 if ( kemailAvail ) { 112 if ( kemailAvail ) {
110 dynamicPart += QString( 113 dynamicPart += QString(
111 "<tr><td align=\"right\"><b>%1</b></td>" 114 "<tr><td align=\"right\"><b>%1</b></td>"
112 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) 115 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" )
113 .arg( type ) 116 .arg( type )
114 .arg( name ) 117 .arg( name )
115 .arg( *emailIt ) 118 .arg( *emailIt )
116 .arg( *emailIt ); 119 .arg( *emailIt );
117 ++emailIt; 120 ++emailIt;
118 } else { 121 } else {
119 dynamicPart += QString( 122 dynamicPart += QString(
120 "<tr><td align=\"right\"><b>%1</b></td>" 123 "<tr><td align=\"right\"><b>%1</b></td>"
121 "<td align=\"left\">%2</td></tr>" ) 124 "<td align=\"left\">%2</td></tr>" )
122 .arg( type ) 125 .arg( type )
123 .arg( *emailIt ); 126 .arg( *emailIt );
124 ++emailIt; 127 ++emailIt;
125 } 128 }
126 } 129 }
127 if ( mAddressee.birthday().date().isValid() ) { 130 if ( mAddressee.birthday().date().isValid() ) {
128 dynamicPart += QString( 131 dynamicPart += QString(
129 "<tr><td align=\"right\"><b>%1</b></td>" 132 "<tr><td align=\"right\"><b>%1</b></td>"
130 "<td align=\"left\">%2</td></tr>" ) 133 "<td align=\"left\">%2</td></tr>" )
131 .arg( i18n ("Birthday") ) 134 .arg( i18n ("Birthday") )
132 .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) ); 135 .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) );
133 } 136 }
134 KABC::PhoneNumber::List phones = mAddressee.phoneNumbers(); 137 KABC::PhoneNumber::List phones = mAddressee.phoneNumbers();
135 KABC::PhoneNumber::List::ConstIterator phoneIt; 138 KABC::PhoneNumber::List::ConstIterator phoneIt;
136 QString extension; 139 QString extension;
137 int phonetype; 140 int phonetype;
138 QString sms; 141 QString sms;
139 for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { 142 for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) {
140 phonetype = (*phoneIt).type(); 143 phonetype = (*phoneIt).type();
141 if (ksmsAvail && 144 if (ksmsAvail &&
142 ( 145 (
143 ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || 146 ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) ||
144 ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) 147 ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell)
145 ) 148 )
146 ) 149 )
147 { 150 {
148 sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) 151 sms = QString("<a href=\"smsto:%1 \">(sms)</a>" )
149 .arg( (*phoneIt).number() ); 152 .arg( (*phoneIt).number() );
150 153
151 } 154 }
152 else 155 else
153 sms = ""; 156 sms = "";
154 157
155 extension = QString::null; 158 extension = QString::null;
156 if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { 159 if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) {
157 if (kfaxAvail) extension = "faxto:"; 160 if (kfaxAvail) extension = "faxto:";
158 } 161 }
159 else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { 162 else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) {
160 if (kpagerAvail) extension = "pagerto:"; 163 if (kpagerAvail) extension = "pagerto:";
161 } 164 }
165 else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) {
166 if (ksipAvail) extension = "sipto:";
167 }
162 else if (kphoneAvail) { 168 else if (kphoneAvail) {
163 extension = "phoneto:"; 169 extension = "phoneto:";
164 } 170 }
165 else 171 else
166 extension = QString::null; 172 extension = QString::null;
167 173
168 if ( !extension.isEmpty() ) { 174 if ( !extension.isEmpty() ) {
169 dynamicPart += QString( 175 dynamicPart += QString(
170 "<tr><td align=\"right\"><b>%1</b></td>" 176 "<tr><td align=\"right\"><b>%1</b></td>"
171 "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) 177 "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" )
172 .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) 178 .arg( KABC::PhoneNumber::typeLabel( phonetype ) )
173 .arg( extension ) 179 .arg( extension )
174 .arg( (*phoneIt).number() ) 180 .arg( (*phoneIt).number() )
175 .arg( (*phoneIt).number() ) 181 .arg( (*phoneIt).number() )
176 .arg( sms ); 182 .arg( sms );
177 183
178 } else { 184 } else {
179 dynamicPart += QString( 185 dynamicPart += QString(
180 "<tr><td align=\"right\"><b>%1</b></td>" 186 "<tr><td align=\"right\"><b>%1</b></td>"
181 "<td align=\"left\">%2 %3</td></tr>" ) 187 "<td align=\"left\">%2 %3</td></tr>" )
182 .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) 188 .arg( KABC::PhoneNumber::typeLabel( phonetype ) )
183 .arg( (*phoneIt).number() ) 189 .arg( (*phoneIt).number() )
184 .arg( sms ); 190 .arg( sms );
185 } 191 }
186 } 192 }
187 193
188 194
189 for ( ; emailIt != emails.end(); ++emailIt ) { 195 for ( ; emailIt != emails.end(); ++emailIt ) {
190 if ( kemailAvail ) { 196 if ( kemailAvail ) {
191 dynamicPart += QString( 197 dynamicPart += QString(
192 "<tr><td align=\"right\"><b>%1</b></td>" 198 "<tr><td align=\"right\"><b>%1</b></td>"
193 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) 199 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" )
194 .arg( type ) 200 .arg( type )
195 .arg( name ) 201 .arg( name )
196 .arg( *emailIt ) 202 .arg( *emailIt )
197 .arg( *emailIt ); 203 .arg( *emailIt );
198 } else { 204 } else {
199 dynamicPart += QString( 205 dynamicPart += QString(
200 "<tr><td align=\"right\"><b>%1</b></td>" 206 "<tr><td align=\"right\"><b>%1</b></td>"
201 "<td align=\"left\">%2</td></tr>" ) 207 "<td align=\"left\">%2</td></tr>" )
202 .arg( type ) 208 .arg( type )
203 .arg( *emailIt ); 209 .arg( *emailIt );
204 } 210 }
205 } 211 }
206 212
207 if ( !mAddressee.url().url().isEmpty() ) { 213 if ( !mAddressee.url().url().isEmpty() ) {
208 dynamicPart += QString( 214 dynamicPart += QString(
209 "<tr><td align=\"right\"><b>%1</b></td>" 215 "<tr><td align=\"right\"><b>%1</b></td>"
210 "<td align=\"left\">%2</td></tr>" ) 216 "<td align=\"left\">%2</td></tr>" )
211 .arg( i18n( "Homepage" ) ) 217 .arg( i18n( "Homepage" ) )
212//US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) ); 218//US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) );
213 .arg( mAddressee.url().url() ); 219 .arg( mAddressee.url().url() );
214 //qDebug("AddresseeView::setAddressee has to be verified."); 220 //qDebug("AddresseeView::setAddressee has to be verified.");
215 } 221 }
216 222
217 KABC::Address::List addresses = mAddressee.addresses(); 223 KABC::Address::List addresses = mAddressee.addresses();
218 KABC::Address::List::ConstIterator addrIt; 224 KABC::Address::List::ConstIterator addrIt;
219 for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { 225 for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) {
220 if ( true /*(*addrIt).label().isEmpty()*/ ) { 226 if ( true /*(*addrIt).label().isEmpty()*/ ) {
221 QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace(); 227 QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace();
222//US formattedAddress = formattedAddress.replace( '\n', "<br>" ); 228//US formattedAddress = formattedAddress.replace( '\n', "<br>" );
223 //qDebug("adresss %s ",formattedAddress.latin1() ); 229 //qDebug("adresss %s ",formattedAddress.latin1() );
224 formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" ); 230 formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" );
225 //qDebug("AddresseeView::setAddressee has to be verified."); 231 //qDebug("AddresseeView::setAddressee has to be verified.");
226 232
227 dynamicPart += QString( 233 dynamicPart += QString(
228 "<tr><td align=\"right\"><b>%1</b></td>" 234 "<tr><td align=\"right\"><b>%1</b></td>"
229 "<td align=\"left\">%2</td></tr>" ) 235 "<td align=\"left\">%2</td></tr>" )
230 .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) 236 .arg( KABC::Address::typeLabel( (*addrIt).type() ) )
231 .arg( formattedAddress ); 237 .arg( formattedAddress );
232 } else { 238 } else {
233 239
234 dynamicPart += QString( 240 dynamicPart += QString(
235 "<tr><td align=\"right\"><b>%1</b></td>" 241 "<tr><td align=\"right\"><b>%1</b></td>"
236 "<td align=\"left\">%2</td></tr>" ) 242 "<td align=\"left\">%2</td></tr>" )
237 .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) 243 .arg( KABC::Address::typeLabel( (*addrIt).type() ) )
238//US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); 244//US .arg( (*addrIt).label().replace( '\n', "<br>" ) );
239 .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); 245 .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ );
240 246
241 } 247 }
242 } 248 }
243 249
244 QString notes; 250 QString notes;
245 if ( !mAddressee.note().isEmpty() ) { 251 if ( !mAddressee.note().isEmpty() ) {
246 notes = QString( 252 notes = QString(
247 "<tr>" 253 "<tr>"
248 "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label 254 "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label
249 "<td align=\"left\">%2</td>" // note 255 "<td align=\"left\">%2</td>" // note
250 "</tr>" ).arg( i18n( "Notes" ) ) 256 "</tr>" ).arg( i18n( "Notes" ) )
251//US .arg( mAddressee.note().replace( '\n', "<br>" ) ); 257//US .arg( mAddressee.note().replace( '\n', "<br>" ) );
252 .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); 258 .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) );
253 //qDebug("AddresseeView::setAddressee has to be verified."); 259 //qDebug("AddresseeView::setAddressee has to be verified.");
254 } 260 }
255 261
256 QString aRole = ""; 262 QString aRole = "";
257 QString aOrga = ""; 263 QString aOrga = "";
258 if ( true /*!mAddressee.role().isEmpty()*/ ) { 264 if ( true /*!mAddressee.role().isEmpty()*/ ) {
259 aRole = "<tr>" 265 aRole = "<tr>"
260 "<td align=\"left\">" + mAddressee.role() + "</td>" 266 "<td align=\"left\">" + mAddressee.role() + "</td>"
261 "</tr>"; 267 "</tr>";
262 } 268 }
263 if ( true /*!mAddressee.organization().isEmpty()*/ ) { 269 if ( true /*!mAddressee.organization().isEmpty()*/ ) {
264 aOrga = "<tr>" 270 aOrga = "<tr>"
265 "<td align=\"left\">" + mAddressee.organization() + "</td>" ; 271 "<td align=\"left\">" + mAddressee.organization() + "</td>" ;
266 "</tr>"; 272 "</tr>";
267 } 273 }
268 mText = ""; 274 mText = "";
269 QString picString = ""; 275 QString picString = "";
270 KABC::Picture picture = mAddressee.photo(); 276 KABC::Picture picture = mAddressee.photo();
271 bool picAvailintern = false; 277 bool picAvailintern = false;
272 bool picAvailUrl = false; 278 bool picAvailUrl = false;
273 if (! picture.undefined() ) { 279 if (! picture.undefined() ) {
274 picAvailintern = (picture.isIntern() && !picture.data().isNull()); 280 picAvailintern = (picture.isIntern() && !picture.data().isNull());
275 picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); 281 picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() );
276 } 282 }
277 if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { 283 if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) {
278 if ( picAvailintern ) { 284 if ( picAvailintern ) {
279 QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); 285 QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() );
280 } else { 286 } else {
281 if ( picAvailUrl ) { 287 if ( picAvailUrl ) {
282 QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); 288 QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() ));
283 } else { 289 } else {
284 QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", KGlobal::iconLoader()->loadIcon( "package_toys", KIcon::Desktop, 128 ) ); 290 QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", KGlobal::iconLoader()->loadIcon( "package_toys", KIcon::Desktop, 128 ) );
285 } 291 }
286 } 292 }
287 picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; 293 picString = "<img src=\"myimage\" width=\"50\" height=\"70\">";
288 mText = QString::fromLatin1( 294 mText = QString::fromLatin1(
289 "<html>" 295 "<html>"
290 "<body text=\"%1\" bgcolor=\"%2\">" // text and background color 296 "<body text=\"%1\" bgcolor=\"%2\">" // text and background color
291 "<table>" 297 "<table>"
292 "<tr>" 298 "<tr>"
293 "<td rowspan=\"3\" align=\"right\" valign=\"top\">" 299 "<td rowspan=\"3\" align=\"right\" valign=\"top\">"
294 "%3" 300 "%3"
295 "</td>" 301 "</td>"
296 "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name 302 "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name
297 "</tr>" 303 "</tr>"
298 "%5" // role 304 "%5" // role
299 "%6" // organization 305 "%6" // organization
300 "<td colspan=\"2\">&nbsp;</td>" 306 "<td colspan=\"2\">&nbsp;</td>"
301 "%7" // dynamic part 307 "%7" // dynamic part
302 "%8" // notes 308 "%8" // notes
303 "</table>" 309 "</table>"
304 "</body>" 310 "</body>"
305 "</html>") 311 "</html>")
306//US 312//US
307 .arg( /*KGlobalSettings::textColor().name()*/ "black" ) 313 .arg( /*KGlobalSettings::textColor().name()*/ "black" )
308//US 314//US
309 .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) 315 .arg( /*KGlobalSettings::baseColor().name()*/ "white" )
310 .arg( picString ) 316 .arg( picString )
311 .arg( name ) 317 .arg( name )
312 .arg( aRole ) 318 .arg( aRole )
313 .arg( aOrga ) 319 .arg( aOrga )
314 .arg( dynamicPart ) 320 .arg( dynamicPart )
315 .arg( notes ); 321 .arg( notes );
316 322
317 } else { // no picture! 323 } else { // no picture!
318 324
319mText = "<table width=\"100%\">\n"; 325mText = "<table width=\"100%\">\n";
320 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 326 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
321#ifdef DESKTOP_VERSION 327#ifdef DESKTOP_VERSION
322 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; 328 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>";
323#else 329#else
324 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h2>"; 330 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h2>";
325#endif 331#endif
326 332
327#ifdef DESKTOP_VERSION 333#ifdef DESKTOP_VERSION
328 mText += "<font color=\"#FFFFFF\"> <em>" + name+"</em></font></h1>"; 334 mText += "<font color=\"#FFFFFF\"> <em>" + name+"</em></font></h1>";
329#else 335#else
330 mText += "<font color=\"#FFFFFF\"> <em>" + name +"</em></font></h2>"; 336 mText += "<font color=\"#FFFFFF\"> <em>" + name +"</em></font></h2>";
331#endif 337#endif
332 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; 338 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>";
333 339
334 mText += "<table><td colspan=\"2\">&nbsp;</td>"; 340 mText += "<table><td colspan=\"2\">&nbsp;</td>";
335 /* 341 /*
336 mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" 342 mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>"
337 "<td align=\"left\"><b>%2</b></td></tr>" ) 343 "<td align=\"left\"><b>%2</b></td></tr>" )
338 .arg( i18n(" ") ) 344 .arg( i18n(" ") )
339 .arg( name ); 345 .arg( name );
340 */ 346 */
341 if ( ! mAddressee.role().isEmpty() ) 347 if ( ! mAddressee.role().isEmpty() )
342 mText += QString("<tr><td align=\"right\"><b>%1</b></td>" 348 mText += QString("<tr><td align=\"right\"><b>%1</b></td>"
343 "<td align=\"left\">%2</td></tr>" ) 349 "<td align=\"left\">%2</td></tr>" )
344 .arg( i18n(" ") ) 350 .arg( i18n(" ") )
345 .arg( mAddressee.role()); 351 .arg( mAddressee.role());
346 if ( ! mAddressee.organization().isEmpty() ) 352 if ( ! mAddressee.organization().isEmpty() )
347 mText += QString("<tr><td align=\"right\"><b>%1</b></td>" 353 mText += QString("<tr><td align=\"right\"><b>%1</b></td>"
348 "<td align=\"left\">%2</td></tr>" ) 354 "<td align=\"left\">%2</td></tr>" )
349 .arg( i18n(" ") ) 355 .arg( i18n(" ") )
350 .arg( mAddressee.organization()); 356 .arg( mAddressee.organization());
351 mText += dynamicPart; 357 mText += dynamicPart;
352 mText += notes; 358 mText += notes;
353 mText += "</table>"; 359 mText += "</table>";
354 360
355 } 361 }
356 362
357 // at last display it... 363 // at last display it...
358 setText( mText ); 364 setText( mText );
359 365
360} 366}
361 367
362KABC::Addressee AddresseeView::addressee() const 368KABC::Addressee AddresseeView::addressee() const
363{ 369{
364 return mAddressee; 370 return mAddressee;
365} 371}
366void AddresseeView::addTag(const QString & tag,const QString & text) 372void AddresseeView::addTag(const QString & tag,const QString & text)
367{ 373{
368 if ( text.isEmpty() ) 374 if ( text.isEmpty() )
369 return; 375 return;
370 int number=text.contains("\n"); 376 int number=text.contains("\n");
371 QString str = "<" + tag + ">"; 377 QString str = "<" + tag + ">";
372 QString tmpText=text; 378 QString tmpText=text;
373 QString tmpStr=str; 379 QString tmpStr=str;
374 if(number !=-1) 380 if(number !=-1)
375 { 381 {
376 if (number > 0) { 382 if (number > 0) {
377 int pos=0; 383 int pos=0;
378 QString tmp; 384 QString tmp;
379 for(int i=0;i<=number;i++) { 385 for(int i=0;i<=number;i++) {
380 pos=tmpText.find("\n"); 386 pos=tmpText.find("\n");
381 tmp=tmpText.left(pos); 387 tmp=tmpText.left(pos);
382 tmpText=tmpText.right(tmpText.length()-pos-1); 388 tmpText=tmpText.right(tmpText.length()-pos-1);
383 tmpStr+=tmp+"<br>"; 389 tmpStr+=tmp+"<br>";
384 } 390 }
385 } 391 }
386 else tmpStr += tmpText; 392 else tmpStr += tmpText;
387 tmpStr+="</" + tag + ">"; 393 tmpStr+="</" + tag + ">";
388 mText.append(tmpStr); 394 mText.append(tmpStr);
389 } 395 }
390 else 396 else
391 { 397 {
392 str += text + "</" + tag + ">"; 398 str += text + "</" + tag + ">";
393 mText.append(str); 399 mText.append(str);
394 } 400 }
395} 401}