-rw-r--r-- | kabc/addresseeview.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp index e85991e..8f104e0 100644 --- a/kabc/addresseeview.cpp +++ b/kabc/addresseeview.cpp | |||
@@ -207,106 +207,112 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) | |||
207 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) | 207 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) |
208 | .arg( formattedAddress ); | 208 | .arg( formattedAddress ); |
209 | } else { | 209 | } else { |
210 | 210 | ||
211 | dynamicPart += QString( | 211 | dynamicPart += QString( |
212 | "<tr><td align=\"right\"><b>%1</b></td>" | 212 | "<tr><td align=\"right\"><b>%1</b></td>" |
213 | "<td align=\"left\">%2</td></tr>" ) | 213 | "<td align=\"left\">%2</td></tr>" ) |
214 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) | 214 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) |
215 | //US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); | 215 | //US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); |
216 | .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); | 216 | .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); |
217 | 217 | ||
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | QString notes; | 221 | QString notes; |
222 | if ( !mAddressee.note().isEmpty() ) { | 222 | if ( !mAddressee.note().isEmpty() ) { |
223 | notes = QString( | 223 | notes = QString( |
224 | "<tr>" | 224 | "<tr>" |
225 | "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label | 225 | "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label |
226 | "<td align=\"left\">%2</td>" // note | 226 | "<td align=\"left\">%2</td>" // note |
227 | "</tr>" ).arg( i18n( "Notes" ) ) | 227 | "</tr>" ).arg( i18n( "Notes" ) ) |
228 | //US .arg( mAddressee.note().replace( '\n', "<br>" ) ); | 228 | //US .arg( mAddressee.note().replace( '\n', "<br>" ) ); |
229 | .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); | 229 | .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); |
230 | //qDebug("AddresseeView::setAddressee has to be verified."); | 230 | //qDebug("AddresseeView::setAddressee has to be verified."); |
231 | } | 231 | } |
232 | 232 | ||
233 | QString aRole = ""; | 233 | QString aRole = ""; |
234 | QString aOrga = ""; | 234 | QString aOrga = ""; |
235 | if ( true /*!mAddressee.role().isEmpty()*/ ) { | 235 | if ( true /*!mAddressee.role().isEmpty()*/ ) { |
236 | aRole = "<tr>" | 236 | aRole = "<tr>" |
237 | "<td align=\"left\">" + mAddressee.role() + "</td>" | 237 | "<td align=\"left\">" + mAddressee.role() + "</td>" |
238 | "</tr>"; | 238 | "</tr>"; |
239 | } | 239 | } |
240 | if ( true /*!mAddressee.organization().isEmpty()*/ ) { | 240 | if ( true /*!mAddressee.organization().isEmpty()*/ ) { |
241 | aOrga = "<tr>" | 241 | aOrga = "<tr>" |
242 | "<td align=\"left\">" + mAddressee.organization() + "</td>" | 242 | "<td align=\"left\">" + mAddressee.organization() + "</td>" |
243 | "</tr>"; | 243 | "</tr>"; |
244 | } | 244 | } |
245 | mText = ""; | 245 | mText = ""; |
246 | QString picString = ""; | 246 | QString picString = ""; |
247 | KABC::Picture picture = mAddressee.photo(); | 247 | KABC::Picture picture = mAddressee.photo(); |
248 | bool picAvailintern = false; | 248 | bool picAvailintern = false; |
249 | bool picAvailUrl = false; | 249 | bool picAvailUrl = false; |
250 | if (! picture.undefined() ) { | 250 | if (! picture.undefined() ) { |
251 | picAvailintern = (picture.isIntern() && !picture.data().isNull()); | 251 | picAvailintern = (picture.isIntern() && !picture.data().isNull()); |
252 | picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); | 252 | picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); |
253 | } | 253 | } |
254 | if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { | 254 | if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { |
255 | picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; | ||
255 | if ( picAvailintern ) { | 256 | if ( picAvailintern ) { |
256 | QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); | 257 | QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); |
257 | } else { | 258 | } else { |
258 | if ( picAvailUrl ) { | 259 | if ( picAvailUrl ) { |
259 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); | 260 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); |
260 | } else { | 261 | } else { |
261 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", KGlobal::iconLoader()->loadIcon( "package_toys", KIcon::Desktop, 128 ) ); | 262 | static bool setDefaultImage = false; |
263 | if ( !setDefaultImage ) { | ||
264 | qDebug("Setting default pixmap "); | ||
265 | QMimeSourceFactory::defaultFactory()->setPixmap( "defaultPenguin", KGlobal::iconLoader()->loadIcon( "package_toys", KIcon::Desktop, 128 ) ); | ||
266 | setDefaultImage = true; | ||
267 | } | ||
268 | picString = "<img src=\"defaultPenguin\" width=\"64\" height=\"64\">"; | ||
262 | } | 269 | } |
263 | } | 270 | } |
264 | picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; | ||
265 | mText = QString::fromLatin1( | 271 | mText = QString::fromLatin1( |
266 | "<html>" | 272 | "<html>" |
267 | "<body text=\"%1\" bgcolor=\"%2\">" // text and background color | 273 | "<body text=\"%1\" bgcolor=\"%2\">" // text and background color |
268 | "<table>" | 274 | "<table>" |
269 | "<tr>" | 275 | "<tr>" |
270 | "<td rowspan=\"3\" align=\"right\" valign=\"top\">" | 276 | "<td rowspan=\"3\" align=\"right\" valign=\"top\">" |
271 | "%3" | 277 | "%3" |
272 | "</td>" | 278 | "</td>" |
273 | "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name | 279 | "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name |
274 | "</tr>" | 280 | "</tr>" |
275 | "%5" // role | 281 | "%5" // role |
276 | "%6" // organization | 282 | "%6" // organization |
277 | "<td colspan=\"2\"> </td>" | 283 | "<td colspan=\"2\"> </td>" |
278 | "%7" // dynamic part | 284 | "%7" // dynamic part |
279 | "%8" // notes | 285 | "%8" // notes |
280 | "</table>" | 286 | "</table>" |
281 | "</body>" | 287 | "</body>" |
282 | "</html>") | 288 | "</html>") |
283 | //US | 289 | //US |
284 | .arg( /*KGlobalSettings::textColor().name()*/ "black" ) | 290 | .arg( /*KGlobalSettings::textColor().name()*/ "black" ) |
285 | //US | 291 | //US |
286 | .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) | 292 | .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) |
287 | .arg( picString ) | 293 | .arg( picString ) |
288 | .arg( name ) | 294 | .arg( name ) |
289 | .arg( aRole ) | 295 | .arg( aRole ) |
290 | .arg( aOrga ) | 296 | .arg( aOrga ) |
291 | .arg( dynamicPart ) | 297 | .arg( dynamicPart ) |
292 | .arg( notes ); | 298 | .arg( notes ); |
293 | 299 | ||
294 | } else { // no picture! | 300 | } else { // no picture! |
295 | 301 | ||
296 | mText = "<table width=\"100%\">\n"; | 302 | mText = "<table width=\"100%\">\n"; |
297 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 303 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
298 | #ifdef DESKTOP_VERSION | 304 | #ifdef DESKTOP_VERSION |
299 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; | 305 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; |
300 | mText += "<font color=\"#FFFFFF\">" + name +"</font></h1>"; | 306 | mText += "<font color=\"#FFFFFF\">" + name +"</font></h1>"; |
301 | #else | 307 | #else |
302 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h3>"; | 308 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h3>"; |
303 | mText += "<font color=\"#FFFFFF\"> " + name +"</font></h3>"; | 309 | mText += "<font color=\"#FFFFFF\"> " + name +"</font></h3>"; |
304 | #endif | 310 | #endif |
305 | 311 | ||
306 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; | 312 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; |
307 | 313 | ||
308 | mText += "<table><td colspan=\"2\"> </td>"; | 314 | mText += "<table><td colspan=\"2\"> </td>"; |
309 | /* | 315 | /* |
310 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" | 316 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" |
311 | "<td align=\"left\"><b>%2</b></td></tr>" ) | 317 | "<td align=\"left\"><b>%2</b></td></tr>" ) |
312 | .arg( i18n(" ") ) | 318 | .arg( i18n(" ") ) |