summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/abtable.cpp
Unidiff
Diffstat (limited to 'core/pim/addressbook/abtable.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abtable.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index 4705c78..70330c7 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -390,194 +390,194 @@ void AbTable::moveTo( char c )
390 while ( r > 0 ) { 390 while ( r > 0 ) {
391 abi = static_cast<AbTableItem*>( item(r, 0) ); 391 abi = static_cast<AbTableItem*>( item(r, 0) );
392 QChar first = abi->key()[0]; 392 QChar first = abi->key()[0];
393 //### is there a bug in QChar to char comparison??? 393 //### is there a bug in QChar to char comparison???
394 if ( first.row() || first.cell() >= c ) 394 if ( first.row() || first.cell() >= c )
395 break; 395 break;
396 r--; 396 r--;
397 } 397 }
398 } 398 }
399 setCurrentCell( r, currentColumn() ); 399 setCurrentCell( r, currentColumn() );
400 400
401#endif 401#endif
402} 402}
403 403
404#if 0 404#if 0
405// Useless.. Nobody uses it .. (se) 405// Useless.. Nobody uses it .. (se)
406QString AbTable::findContactName( const OContact &entry ) 406QString AbTable::findContactName( const OContact &entry )
407{ 407{
408 // We use the fileAs, then company, defaultEmail 408 // We use the fileAs, then company, defaultEmail
409 QString str; 409 QString str;
410 str = entry.fileAs(); 410 str = entry.fileAs();
411 if ( str.isEmpty() ) { 411 if ( str.isEmpty() ) {
412 str = entry.company(); 412 str = entry.company();
413 if ( str.isEmpty() ) { 413 if ( str.isEmpty() ) {
414 str = entry.defaultEmail(); 414 str = entry.defaultEmail();
415 } 415 }
416 } 416 }
417 return str; 417 return str;
418} 418}
419#endif 419#endif
420 420
421 421
422void AbTable::resizeRows() { 422void AbTable::resizeRows() {
423 /* 423 /*
424 if (numRows()) { 424 if (numRows()) {
425 for (int i = 0; i < numRows(); i++) { 425 for (int i = 0; i < numRows(); i++) {
426 setRowHeight( i, size ); 426 setRowHeight( i, size );
427 } 427 }
428 } 428 }
429 updateVisible(); 429 updateVisible();
430 */ 430 */
431} 431}
432 432
433 433
434void AbTable::realignTable() 434void AbTable::realignTable()
435{ 435{
436 //qWarning( "void AbTable::realignTable()" ); 436 //qWarning( "void AbTable::realignTable()" );
437 437
438 setPaintingEnabled( FALSE ); 438 setPaintingEnabled( FALSE );
439 439
440 resizeRows(); 440 resizeRows();
441 fitColumns(); 441 fitColumns();
442 442
443 setPaintingEnabled( TRUE ); 443 setPaintingEnabled( TRUE );
444 444
445} 445}
446 446
447 447
448 448
449 449
450#if QT_VERSION <= 230 450#if QT_VERSION <= 230
451#ifndef SINGLE_APP 451#ifndef SINGLE_APP
452void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) 452void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch )
453{ 453{
454 // Region of the rect we should draw 454 // Region of the rect we should draw
455 QRegion reg( QRect( cx, cy, cw, ch ) ); 455 QRegion reg( QRect( cx, cy, cw, ch ) );
456 // Subtract the table from it 456 // Subtract the table from it
457 reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) ); 457 reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) );
458 // And draw the rectangles (transformed as needed) 458 // And draw the rectangles (transformed as needed)
459 QArray<QRect> r = reg.rects(); 459 QArray<QRect> r = reg.rects();
460 for (unsigned int i=0; i<r.count(); i++) 460 for (unsigned int i=0; i<r.count(); i++)
461 p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) ); 461 p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) );
462} 462}
463#endif 463#endif
464#endif 464#endif
465 465
466 466
467// int AbTable::rowHeight( int ) const 467// int AbTable::rowHeight( int ) const
468// { 468// {
469// return 18; 469// return 18;
470// } 470// }
471 471
472// int AbTable::rowPos( int row ) const 472// int AbTable::rowPos( int row ) const
473// { 473// {
474// return 18*row; 474// return 18*row;
475// } 475// }
476 476
477// int AbTable::rowAt( int pos ) const 477// int AbTable::rowAt( int pos ) const
478// { 478// {
479// return QMIN( pos/18, numRows()-1 ); 479// return QMIN( pos/18, numRows()-1 );
480// } 480// }
481 481
482 482
483 483
484void AbTable::fitColumns() 484void AbTable::fitColumns()
485{ 485{
486 //qWarning( "void AbTable::fitColumns()" ); 486 qWarning( "void AbTable::fitColumns()" );
487 int contentsWidth = visibleWidth() / 2; // :SX Why too low 487 int contentsWidth = visibleWidth() / 2;
488 // Fix to better value 488 // Fix to better value
489 // contentsWidth = 130; 489 // contentsWidth = 130;
490 490
491 setPaintingEnabled( FALSE ); 491 setPaintingEnabled( FALSE );
492 492
493 if ( columnVisible == false ){ 493 if ( columnVisible == false ){
494 showColumn(0); 494 showColumn(0);
495 columnVisible = true; 495 columnVisible = true;
496 } 496 }
497 497
498 //qWarning("Width: %d", contentsWidth); 498 //qWarning("Width: %d", contentsWidth);
499 499
500 setColumnWidth( 0, contentsWidth ); 500 setColumnWidth( 0, contentsWidth );
501 adjustColumn(1); 501 adjustColumn(1);
502 if ( columnWidth(1) < contentsWidth ) 502 if ( columnWidth(1) < contentsWidth )
503 setColumnWidth( 1, contentsWidth ); 503 setColumnWidth( 1, contentsWidth );
504 504
505 setPaintingEnabled( TRUE ); 505 setPaintingEnabled( TRUE );
506} 506}
507 507
508void AbTable::show() 508void AbTable::show()
509{ 509{
510 //qWarning( "void AbTable::show()" ); 510 //qWarning( "void AbTable::show()" );
511 realignTable(); 511 realignTable();
512 QTable::show(); 512 QTable::show();
513} 513}
514 514
515#if 0 515#if 0
516void AbTable::setChoiceNames( const QStringList& list) 516void AbTable::setChoiceNames( const QStringList& list)
517{ 517{
518 choicenames = list; 518 choicenames = list;
519 if ( choicenames.isEmpty() ) { 519 if ( choicenames.isEmpty() ) {
520 // hide pick column 520 // hide pick column
521 setNumCols( 2 ); 521 setNumCols( 2 );
522 } else { 522 } else {
523 // show pick column 523 // show pick column
524 setNumCols( 3 ); 524 setNumCols( 3 );
525 setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 ); 525 setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 );
526 horizontalHeader()->setLabel( 2, tr( "Pick" )); 526 horizontalHeader()->setLabel( 2, tr( "Pick" ));
527 } 527 }
528 fitColumns(); 528 fitColumns();
529} 529}
530#endif 530#endif
531 531
532void AbTable::itemClicked(int,int col) 532void AbTable::itemClicked(int,int col)
533{ 533{
534 //qWarning( "AbTable::itemClicked(int, col:%d)", col); 534 //qWarning( "AbTable::itemClicked(int, col:%d)", col);
535 if ( col == 2 ) { 535 if ( col == 2 ) {
536 return; 536 return;
537 } else { 537 } else {
538 // qWarning ("Emitting signalSwitch()"); 538 // qWarning ("Emitting signalSwitch()");
539 emit signalSwitch(); 539 emit signalSwitch();
540 } 540 }
541} 541}
542 542
543#if 0 543#if 0
544QStringList AbTable::choiceNames() const 544QStringList AbTable::choiceNames() const
545{ 545{
546 return choicenames; 546 return choicenames;
547} 547}
548 548
549#endif 549#endif
550void AbTable::setChoiceSelection( const QValueList<int>& list ) 550void AbTable::setChoiceSelection( const QValueList<int>& list )
551{ 551{
552 intFields = list; 552 intFields = list;
553} 553}
554 554
555QStringList AbTable::choiceSelection(int /*index*/) const 555QStringList AbTable::choiceSelection(int /*index*/) const
556{ 556{
557 QStringList r; 557 QStringList r;
558 /* ###### 558 /* ######
559 559
560 QString selname = choicenames.at(index); 560 QString selname = choicenames.at(index);
561 for (each row) { 561 for (each row) {
562 OContact *c = contactForRow(row); 562 OContact *c = contactForRow(row);
563 if ( text(row,2) == selname ) { 563 if ( text(row,2) == selname ) {
564 r.append(c->email); 564 r.append(c->email);
565 } 565 }
566 } 566 }
567 567
568 */ 568 */
569 return r; 569 return r;
570} 570}
571 571
572 572
573void AbTable::updateVisible() 573void AbTable::updateVisible()
574{ 574{
575 //qWarning("void AbTable::updateVisible()"); 575 //qWarning("void AbTable::updateVisible()");
576 576
577 int visible, 577 int visible,
578 totalRows, 578 totalRows,
579 row, 579 row,
580 selectedRow = 0; 580 selectedRow = 0;
581 581
582 visible = 0; 582 visible = 0;
583 583