summaryrefslogtreecommitdiffabout
path: root/kabc/addresseeview.cpp
Unidiff
Diffstat (limited to 'kabc/addresseeview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addresseeview.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp
index 2691d9a..f3cfb23 100644
--- a/kabc/addresseeview.cpp
+++ b/kabc/addresseeview.cpp
@@ -173,227 +173,231 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
173 "<td align=\"left\">%2</td></tr>" ) 173 "<td align=\"left\">%2</td></tr>" )
174 .arg( i18n ("Birthday") ) 174 .arg( i18n ("Birthday") )
175 .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) ); 175 .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) );
176 } 176 }
177 dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(), false ); 177 dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(), false );
178 178
179 for ( ; emailIt != emails.end(); ++emailIt ) { 179 for ( ; emailIt != emails.end(); ++emailIt ) {
180 if ( kemailAvail ) { 180 if ( kemailAvail ) {
181 dynamicPart += QString( 181 dynamicPart += QString(
182 "<tr><td align=\"right\"><b>%1</b></td>" 182 "<tr><td align=\"right\"><b>%1</b></td>"
183 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) 183 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" )
184 .arg( type ) 184 .arg( type )
185 .arg( name ) 185 .arg( name )
186 .arg( *emailIt ) 186 .arg( *emailIt )
187 .arg( *emailIt ); 187 .arg( *emailIt );
188 } else { 188 } else {
189 dynamicPart += QString( 189 dynamicPart += QString(
190 "<tr><td align=\"right\"><b>%1</b></td>" 190 "<tr><td align=\"right\"><b>%1</b></td>"
191 "<td align=\"left\">%2</td></tr>" ) 191 "<td align=\"left\">%2</td></tr>" )
192 .arg( type ) 192 .arg( type )
193 .arg( *emailIt ); 193 .arg( *emailIt );
194 } 194 }
195 } 195 }
196 196
197 197
198 198
199 KABC::Address::List addresses = mAddressee.addresses(); 199 KABC::Address::List addresses = mAddressee.addresses();
200 KABC::Address::List::ConstIterator addrIt; 200 KABC::Address::List::ConstIterator addrIt;
201 for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { 201 for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) {
202 if ( true /*(*addrIt).label().isEmpty()*/ ) { 202 if ( true /*(*addrIt).label().isEmpty()*/ ) {
203 QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace(); 203 QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace();
204//US formattedAddress = formattedAddress.replace( '\n', "<br>" ); 204//US formattedAddress = formattedAddress.replace( '\n', "<br>" );
205 //qDebug("adresss %s ",formattedAddress.latin1() ); 205 //qDebug("adresss %s ",formattedAddress.latin1() );
206 formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" ); 206 formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" );
207 //qDebug("AddresseeView::setAddressee has to be verified."); 207 //qDebug("AddresseeView::setAddressee has to be verified.");
208 208
209 dynamicPart += QString( 209 dynamicPart += QString(
210 "<tr><td align=\"right\"><b>%1</b></td>" 210 "<tr><td align=\"right\"><b>%1</b></td>"
211 "<td align=\"left\">%2</td></tr>" ) 211 "<td align=\"left\">%2</td></tr>" )
212 .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) 212 .arg( KABC::Address::typeLabel( (*addrIt).type() ) )
213 .arg( formattedAddress ); 213 .arg( formattedAddress );
214 } else { 214 } else {
215 215
216 dynamicPart += QString( 216 dynamicPart += QString(
217 "<tr><td align=\"right\"><b>%1</b></td>" 217 "<tr><td align=\"right\"><b>%1</b></td>"
218 "<td align=\"left\">%2</td></tr>" ) 218 "<td align=\"left\">%2</td></tr>" )
219 .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) 219 .arg( KABC::Address::typeLabel( (*addrIt).type() ) )
220//US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); 220//US .arg( (*addrIt).label().replace( '\n', "<br>" ) );
221 .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); 221 .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ );
222 222
223 } 223 }
224 } 224 }
225 225
226 226
227 QString notes; 227 QString notes;
228 if ( sFullDetailsMode ) { 228 if ( sFullDetailsMode ) {
229 notes = QString( 229 notes = QString(
230 "<tr><td align=\"right\"><b>%1</b></td>" 230 "<tr><td align=\"right\"><b>%1</b></td>"
231 "<td align=\"left\"><a href=\"notAllDetails\">%4</a></td></tr>" ) 231 "<td align=\"left\"><a href=\"notAllDetails\">%4</a></td></tr>" )
232 .arg( i18n("Details") ) 232 .arg( i18n("Details") )
233 .arg( i18n("Hide!") ); 233 .arg( i18n("Hide!") );
234 234
235 QString tempX = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); 235 QString tempX = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
236 if ( !tempX.isEmpty() ) { 236 if ( !tempX.isEmpty() ) {
237 notes += QString( 237 if ( tempX == "male" || tempX == "female" ) {
238 "<tr><td align=\"right\"><b>%1</b></td>" 238 notes += QString(
239 "<td align=\"left\">%2</td></tr>" ) 239 "<tr><td align=\"right\"><b>%1</b></td>"
240 .arg( i18n( "" ) ) 240 "<td align=\"left\">%2</td></tr>" )
241 .arg( i18n(tempX) ); 241 .arg( i18n( "" ) )
242 .arg( i18n(tempX) );
243 }
242 } 244 }
243 245
244 246
245 tempX = mAddressee.secrecy().asString(); 247 tempX = mAddressee.secrecy().asString();
246 248
247 notes += QString( 249 notes += QString(
248 "<tr><td align=\"right\"><b>%1</b></td>" 250 "<tr><td align=\"right\"><b>%1</b></td>"
249 "<td align=\"left\">%2</td></tr>" ) 251 "<td align=\"left\">%2</td></tr>" )
250 .arg( "" ) 252 .arg( "" )
251 .arg( tempX ); 253 .arg( tempX );
252 254
253 255
254 tempX = mAddressee.categories().join(" - "); 256 tempX = mAddressee.categories().join(" - ");
255 if ( !tempX.isEmpty() ) { 257 if ( !tempX.isEmpty() ) {
256 notes += QString( 258 notes += QString(
257 "<tr><td align=\"right\"><b>%1</b></td>" 259 "<tr><td align=\"right\"><b>%1</b></td>"
258 "<td align=\"left\">%2</td></tr>" ) 260 "<td align=\"left\">%2</td></tr>" )
259 .arg( i18n( "Category" ) ) 261 .arg( i18n( "Category" ) )
260 .arg( tempX ); 262 .arg( tempX );
261 } 263 }
262 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Profession" ); 264 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Profession" );
263 if ( !tempX.isEmpty() ) { 265 if ( !tempX.isEmpty() ) {
264 notes += QString( 266 notes += QString(
265 "<tr><td align=\"right\"><b>%1</b></td>" 267 "<tr><td align=\"right\"><b>%1</b></td>"
266 "<td align=\"left\">%2</td></tr>" ) 268 "<td align=\"left\">%2</td></tr>" )
267 .arg( i18n( "Profession" ) ) 269 .arg( i18n( "Profession" ) )
268 .arg( tempX ); 270 .arg( tempX );
269 } 271 }
270 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Office" ); 272 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Office" );
271 if ( !tempX.isEmpty() ) { 273 if ( !tempX.isEmpty() ) {
272 notes += QString( 274 notes += QString(
273 "<tr><td align=\"right\"><b>%1</b></td>" 275 "<tr><td align=\"right\"><b>%1</b></td>"
274 "<td align=\"left\">%2</td></tr>" ) 276 "<td align=\"left\">%2</td></tr>" )
275 .arg( i18n( "Office" ) ) 277 .arg( i18n( "Office" ) )
276 .arg( tempX ); 278 .arg( tempX );
277 } 279 }
278 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Department" ); 280 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Department" );
279 if ( !tempX.isEmpty() ) { 281 if ( !tempX.isEmpty() ) {
280 notes += QString( 282 notes += QString(
281 "<tr><td align=\"right\"><b>%1</b></td>" 283 "<tr><td align=\"right\"><b>%1</b></td>"
282 "<td align=\"left\">%2</td></tr>" ) 284 "<td align=\"left\">%2</td></tr>" )
283 .arg( i18n( "Department" ) ) 285 .arg( i18n( "Department" ) )
284 .arg( tempX ); 286 .arg( tempX );
285 } 287 }
286 288
287 tempX = mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ); 289 tempX = mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" );
288 if ( !tempX.isEmpty() ) { 290 if ( !tempX.isEmpty() ) {
289 notes += QString( 291 notes += QString(
290 "<tr><td align=\"right\"><b>%1</b></td>" 292 "<tr><td align=\"right\"><b>%1</b></td>"
291 "<td align=\"left\">%2</td></tr>" ) 293 "<td align=\"left\">%2</td></tr>" )
292 .arg( i18n( "Manager" ) ) 294 .arg( i18n( "Manager" ) )
293 .arg( tempX ); 295 .arg( tempX );
294 } 296 }
295 tempX = mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ); 297 tempX = mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" );
296 if ( !tempX.isEmpty() ) { 298 if ( !tempX.isEmpty() ) {
297 notes += QString( 299 notes += QString(
298 "<tr><td align=\"right\"><b>%1</b></td>" 300 "<tr><td align=\"right\"><b>%1</b></td>"
299 "<td align=\"left\">%2</td></tr>" ) 301 "<td align=\"left\">%2</td></tr>" )
300 .arg( i18n( "Assistant" ) ) 302 .arg( i18n( "Assistant" ) )
301 .arg( tempX ); 303 .arg( tempX );
302 } 304 }
303 if ( !mAddressee.url().url().isEmpty() ) { 305 if ( !mAddressee.url().url().isEmpty() ) {
304 notes += QString( 306 notes += QString(
305 "<tr><td align=\"right\"><b>%1</b></td>" 307 "<tr><td align=\"right\"><b>%1</b></td>"
306 "<td align=\"left\">%2</td></tr>" ) 308 "<td align=\"left\">%2</td></tr>" )
307 .arg( i18n( "Homepage" ) ) 309 .arg( i18n( "Homepage" ) )
308 .arg( mAddressee.url().url() ); 310 .arg( mAddressee.url().url() );
309 } 311 }
310 tempX = mAddressee.nickName(); 312 tempX = mAddressee.nickName();
311 if ( !tempX.isEmpty() ) { 313 if ( !tempX.isEmpty() ) {
312 notes += QString( 314 notes += QString(
313 "<tr><td align=\"right\"><b>%1</b></td>" 315 "<tr><td align=\"right\"><b>%1</b></td>"
314 "<td align=\"left\">%2</td></tr>" ) 316 "<td align=\"left\">%2</td></tr>" )
315 .arg( i18n( "Nickname" ) ) 317 .arg( i18n( "Nickname" ) )
316 .arg( tempX ); 318 .arg( tempX );
317 } 319 }
318 tempX = mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ); 320 tempX = mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" );
319 if ( !tempX.isEmpty() ) { 321 if ( !tempX.isEmpty() ) {
320 notes += QString( 322 notes += QString(
321 "<tr><td align=\"right\"><b>%1</b></td>" 323 "<tr><td align=\"right\"><b>%1</b></td>"
322 "<td align=\"left\">%2</td></tr>" ) 324 "<td align=\"left\">%2</td></tr>" )
323 .arg( i18n( "Messanger" ) ) 325 .arg( i18n( "Messanger" ) )
324 .arg( tempX ); 326 .arg( tempX );
325 } 327 }
326 328
327 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Anniversary" ); 329 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Anniversary" );
328 if ( !tempX.isEmpty() ) { 330 if ( !tempX.isEmpty() ) {
329 QDate dt = KGlobal::locale()->readDate( tempX, "%Y-%m-%d"); 331 QDate dt = KGlobal::locale()->readDate( tempX, "%Y-%m-%d");
330 tempX = KGlobal::locale()->formatDate(dt, true); 332 if ( dt.isValid () ) {
331 notes += QString( 333 tempX = KGlobal::locale()->formatDate(dt, true);
332 "<tr><td align=\"right\"><b>%1</b></td>" 334 notes += QString(
333 "<td align=\"left\">%2</td></tr>" ) 335 "<tr><td align=\"right\"><b>%1</b></td>"
334 .arg( i18n( "Anniversary" ) ) 336 "<td align=\"left\">%2</td></tr>" )
335 .arg( tempX ); 337 .arg( i18n( "Anniversary" ) )
338 .arg( tempX );
339 }
336 } 340 }
337 tempX = mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ); 341 tempX = mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" );
338 if ( !tempX.isEmpty() ) { 342 if ( !tempX.isEmpty() ) {
339 notes += QString( 343 notes += QString(
340 "<tr><td align=\"right\"><b>%1</b></td>" 344 "<tr><td align=\"right\"><b>%1</b></td>"
341 "<td align=\"left\">%2</td></tr>" ) 345 "<td align=\"left\">%2</td></tr>" )
342 .arg( i18n( "Spouse" ) ) 346 .arg( i18n( "Spouse" ) )
343 .arg( tempX ); 347 .arg( tempX );
344 } 348 }
345 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Children" ); 349 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Children" );
346 if ( !tempX.isEmpty() ) { 350 if ( !tempX.isEmpty() ) {
347 notes += QString( 351 notes += QString(
348 "<tr><td align=\"right\"><b>%1</b></td>" 352 "<tr><td align=\"right\"><b>%1</b></td>"
349 "<td align=\"left\">%2</td></tr>" ) 353 "<td align=\"left\">%2</td></tr>" )
350 .arg( i18n( "Children" ) ) 354 .arg( i18n( "Children" ) )
351 .arg( tempX ); 355 .arg( tempX );
352 } 356 }
353 357
354 if ( !mAddressee.note().isEmpty() ) { 358 if ( !mAddressee.note().isEmpty() ) {
355 notes += QString( 359 notes += QString(
356 "<tr>" 360 "<tr>"
357 "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label 361 "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label
358 "<td align=\"left\">%2</td>" // note 362 "<td align=\"left\">%2</td>" // note
359 "</tr>" ).arg( i18n( "Notes" ) ) 363 "</tr>" ).arg( i18n( "Notes" ) )
360 //US .arg( mAddressee.note().replace( '\n', "<br>" ) ); 364 //US .arg( mAddressee.note().replace( '\n', "<br>" ) );
361 .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); 365 .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) );
362 //qDebug("AddresseeView::setAddressee has to be verified."); 366 //qDebug("AddresseeView::setAddressee has to be verified.");
363 } 367 }
364 } else { 368 } else {
365 notes = QString( 369 notes = QString(
366 "<tr><td align=\"right\"><b>%1</b></td>" 370 "<tr><td align=\"right\"><b>%1</b></td>"
367 "<td align=\"left\"><a href=\"allDetails\">%4</a></td></tr>" ) 371 "<td align=\"left\"><a href=\"allDetails\">%4</a></td></tr>" )
368 .arg( i18n("Details") ) 372 .arg( i18n("Details") )
369 .arg( i18n("Show!") ); 373 .arg( i18n("Show!") );
370 374
371 375
372 } 376 }
373 377
374 QString aRole = ""; 378 QString aRole = "";
375 QString aOrga = ""; 379 QString aOrga = "";
376 if ( true /*!mAddressee.role().isEmpty()*/ ) { 380 if ( true /*!mAddressee.role().isEmpty()*/ ) {
377 aRole = "<tr>" 381 aRole = "<tr>"
378 "<td align=\"left\">" + mAddressee.role() + "</td>" 382 "<td align=\"left\">" + mAddressee.role() + "</td>"
379 "</tr>"; 383 "</tr>";
380 } 384 }
381 if ( true /*!mAddressee.organization().isEmpty()*/ ) { 385 if ( true /*!mAddressee.organization().isEmpty()*/ ) {
382 aOrga = "<tr>" 386 aOrga = "<tr>"
383 "<td align=\"left\">" + mAddressee.organization() + "</td>" 387 "<td align=\"left\">" + mAddressee.organization() + "</td>"
384 "</tr>"; 388 "</tr>";
385 } 389 }
386 mText = ""; 390 mText = "";
387 QString picString = ""; 391 QString picString = "";
388 KABC::Picture picture = mAddressee.photo(); 392 KABC::Picture picture = mAddressee.photo();
389 bool picAvailintern = false; 393 bool picAvailintern = false;
390 bool picAvailUrl = false; 394 bool picAvailUrl = false;
391 if (! picture.undefined() ) { 395 if (! picture.undefined() ) {
392 picAvailintern = (picture.isIntern() && !picture.data().isNull()); 396 picAvailintern = (picture.isIntern() && !picture.data().isNull());
393 picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); 397 picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() );
394 } 398 }
395 if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { 399 if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) {
396 picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; 400 picString = "<img src=\"myimage\" width=\"50\" height=\"70\">";
397 if ( picAvailintern ) { 401 if ( picAvailintern ) {
398 QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); 402 QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() );
399 } else { 403 } else {