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