author | eilers <eilers> | 2002-11-19 08:09:25 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-11-19 08:09:25 (UTC) |
commit | 30b3c39b9fc3d6e4da21c7f7406d66b7ebf02d1a (patch) (unidiff) | |
tree | d917a8d887b0a23605002692b958891cffa08c20 | |
parent | 8500e91c7d1faca6ad301244534b13885d5799a8 (diff) | |
download | opie-30b3c39b9fc3d6e4da21c7f7406d66b7ebf02d1a.zip opie-30b3c39b9fc3d6e4da21c7f7406d66b7ebf02d1a.tar.gz opie-30b3c39b9fc3d6e4da21c7f7406d66b7ebf02d1a.tar.bz2 |
Minor bugfix
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index b8127e9..e333b17 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp | |||
@@ -437,276 +437,278 @@ void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) | |||
437 | // } | 437 | // } |
438 | 438 | ||
439 | // int AbTable::rowPos( int row ) const | 439 | // int AbTable::rowPos( int row ) const |
440 | // { | 440 | // { |
441 | // return 18*row; | 441 | // return 18*row; |
442 | // } | 442 | // } |
443 | 443 | ||
444 | // int AbTable::rowAt( int pos ) const | 444 | // int AbTable::rowAt( int pos ) const |
445 | // { | 445 | // { |
446 | // return QMIN( pos/18, numRows()-1 ); | 446 | // return QMIN( pos/18, numRows()-1 ); |
447 | // } | 447 | // } |
448 | 448 | ||
449 | 449 | ||
450 | 450 | ||
451 | void AbTable::fitColumns() | 451 | void AbTable::fitColumns() |
452 | { | 452 | { |
453 | qWarning( "void AbTable::fitColumns()" ); | 453 | qWarning( "void AbTable::fitColumns()" ); |
454 | int contentsWidth = visibleWidth() / 2; // :SX Why too low | 454 | int contentsWidth = visibleWidth() / 2; // :SX Why too low |
455 | // Fix to better value | 455 | // Fix to better value |
456 | // contentsWidth = 130; | 456 | // contentsWidth = 130; |
457 | 457 | ||
458 | if ( columnVisible == false ){ | 458 | if ( columnVisible == false ){ |
459 | showColumn(0); | 459 | showColumn(0); |
460 | columnVisible = true; | 460 | columnVisible = true; |
461 | } | 461 | } |
462 | 462 | ||
463 | qWarning("Width: %d", contentsWidth); | 463 | qWarning("Width: %d", contentsWidth); |
464 | 464 | ||
465 | setColumnWidth( 0, contentsWidth ); | 465 | setColumnWidth( 0, contentsWidth ); |
466 | adjustColumn(1); | 466 | adjustColumn(1); |
467 | if ( columnWidth(1) < contentsWidth ) | 467 | if ( columnWidth(1) < contentsWidth ) |
468 | setColumnWidth( 1, contentsWidth ); | 468 | setColumnWidth( 1, contentsWidth ); |
469 | } | 469 | } |
470 | 470 | ||
471 | void AbTable::show() | 471 | void AbTable::show() |
472 | { | 472 | { |
473 | qWarning( "void AbTable::show()" ); | 473 | qWarning( "void AbTable::show()" ); |
474 | realignTable(); | 474 | realignTable(); |
475 | QTable::show(); | 475 | QTable::show(); |
476 | } | 476 | } |
477 | 477 | ||
478 | void AbTable::setChoiceNames( const QStringList& list) | 478 | void AbTable::setChoiceNames( const QStringList& list) |
479 | { | 479 | { |
480 | choicenames = list; | 480 | choicenames = list; |
481 | if ( choicenames.isEmpty() ) { | 481 | if ( choicenames.isEmpty() ) { |
482 | // hide pick column | 482 | // hide pick column |
483 | setNumCols( 2 ); | 483 | setNumCols( 2 ); |
484 | } else { | 484 | } else { |
485 | // show pick column | 485 | // show pick column |
486 | setNumCols( 3 ); | 486 | setNumCols( 3 ); |
487 | setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 ); | 487 | setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 ); |
488 | horizontalHeader()->setLabel( 2, tr( "Pick" )); | 488 | horizontalHeader()->setLabel( 2, tr( "Pick" )); |
489 | } | 489 | } |
490 | fitColumns(); | 490 | fitColumns(); |
491 | } | 491 | } |
492 | 492 | ||
493 | void AbTable::itemClicked(int,int col) | 493 | void AbTable::itemClicked(int,int col) |
494 | { | 494 | { |
495 | qWarning( "AbTable::itemClicked(int, col:%d)", col); | 495 | qWarning( "AbTable::itemClicked(int, col:%d)", col); |
496 | if ( col == 2 ) { | 496 | if ( col == 2 ) { |
497 | return; | 497 | return; |
498 | } else { | 498 | } else { |
499 | qWarning ("Emitting signalSwitch()"); | 499 | qWarning ("Emitting signalSwitch()"); |
500 | emit signalSwitch(); | 500 | emit signalSwitch(); |
501 | } | 501 | } |
502 | } | 502 | } |
503 | 503 | ||
504 | QStringList AbTable::choiceNames() const | 504 | QStringList AbTable::choiceNames() const |
505 | { | 505 | { |
506 | return choicenames; | 506 | return choicenames; |
507 | } | 507 | } |
508 | 508 | ||
509 | void AbTable::setChoiceSelection( const QValueList<int>& list ) | 509 | void AbTable::setChoiceSelection( const QValueList<int>& list ) |
510 | { | 510 | { |
511 | intFields = list; | 511 | intFields = list; |
512 | } | 512 | } |
513 | 513 | ||
514 | QStringList AbTable::choiceSelection(int /*index*/) const | 514 | QStringList AbTable::choiceSelection(int /*index*/) const |
515 | { | 515 | { |
516 | QStringList r; | 516 | QStringList r; |
517 | /* ###### | 517 | /* ###### |
518 | 518 | ||
519 | QString selname = choicenames.at(index); | 519 | QString selname = choicenames.at(index); |
520 | for (each row) { | 520 | for (each row) { |
521 | OContact *c = contactForRow(row); | 521 | OContact *c = contactForRow(row); |
522 | if ( text(row,2) == selname ) { | 522 | if ( text(row,2) == selname ) { |
523 | r.append(c->email); | 523 | r.append(c->email); |
524 | } | 524 | } |
525 | } | 525 | } |
526 | 526 | ||
527 | */ | 527 | */ |
528 | return r; | 528 | return r; |
529 | } | 529 | } |
530 | 530 | ||
531 | 531 | ||
532 | 532 | ||
533 | 533 | ||
534 | void AbTable::updateVisible() | 534 | void AbTable::updateVisible() |
535 | { | 535 | { |
536 | int visible, | 536 | int visible, |
537 | totalRows, | 537 | totalRows, |
538 | row, | 538 | row, |
539 | selectedRow = 0; | 539 | selectedRow = 0; |
540 | 540 | ||
541 | visible = 0; | 541 | visible = 0; |
542 | 542 | ||
543 | realignTable(); | 543 | realignTable(); |
544 | 544 | ||
545 | setPaintingEnabled( FALSE ); | 545 | setPaintingEnabled( FALSE ); |
546 | 546 | ||
547 | totalRows = numRows(); | 547 | totalRows = numRows(); |
548 | for ( row = 0; row < totalRows; row++ ) { | 548 | for ( row = 0; row < totalRows; row++ ) { |
549 | if ( rowHeight(row) == 0 ) { | 549 | if ( rowHeight(row) == 0 ) { |
550 | showRow( row ); | 550 | showRow( row ); |
551 | adjustRow( row ); | 551 | adjustRow( row ); |
552 | if ( isSelected( row,0 ) || isSelected( row,1 ) ) | 552 | if ( isSelected( row,0 ) || isSelected( row,1 ) ) |
553 | selectedRow = row; | 553 | selectedRow = row; |
554 | } | 554 | } |
555 | visible++; | 555 | visible++; |
556 | } | 556 | } |
557 | 557 | ||
558 | if ( selectedRow ) | 558 | if ( selectedRow ) |
559 | setCurrentCell( selectedRow, 0 ); | 559 | setCurrentCell( selectedRow, 0 ); |
560 | 560 | ||
561 | if ( !visible ) | 561 | if ( !visible ) |
562 | setCurrentCell( -1, 0 ); | 562 | setCurrentCell( -1, 0 ); |
563 | 563 | ||
564 | setPaintingEnabled( TRUE ); | 564 | setPaintingEnabled( TRUE ); |
565 | 565 | ||
566 | 566 | ||
567 | } | 567 | } |
568 | 568 | ||
569 | 569 | ||
570 | void AbTable::setPaintingEnabled( bool e ) | 570 | void AbTable::setPaintingEnabled( bool e ) |
571 | { | 571 | { |
572 | if ( e != enablePainting ) { | 572 | if ( e != enablePainting ) { |
573 | if ( !enablePainting ) { | 573 | if ( !enablePainting ) { |
574 | enablePainting = true; | 574 | enablePainting = true; |
575 | rowHeightChanged( 0 ); | 575 | rowHeightChanged( 0 ); |
576 | viewport()->update(); | 576 | viewport()->update(); |
577 | } else { | 577 | } else { |
578 | enablePainting = false; | 578 | enablePainting = false; |
579 | } | 579 | } |
580 | } | 580 | } |
581 | } | 581 | } |
582 | 582 | ||
583 | void AbTable::rowHeightChanged( int row ) | 583 | void AbTable::rowHeightChanged( int row ) |
584 | { | 584 | { |
585 | if ( enablePainting ) | 585 | if ( enablePainting ) |
586 | QTable::rowHeightChanged( row ); | 586 | QTable::rowHeightChanged( row ); |
587 | } | 587 | } |
588 | QString AbTable::findContactContact( const OContact &entry, int /* row */ ) | 588 | QString AbTable::findContactContact( const OContact &entry, int /* row */ ) |
589 | { | 589 | { |
590 | QString value; | 590 | QString value; |
591 | value = ""; | 591 | value = ""; |
592 | for ( QValueList<int>::ConstIterator it = intFields.begin(); | 592 | for ( QValueList<int>::ConstIterator it = intFields.begin(); |
593 | it != intFields.end(); ++it ) { | 593 | it != intFields.end(); ++it ) { |
594 | switch ( *it ) { | 594 | switch ( *it ) { |
595 | default: | 595 | default: |
596 | break; | 596 | break; |
597 | case Qtopia::Title: | 597 | case Qtopia::Title: |
598 | value = entry.title(); | 598 | value = entry.title(); |
599 | break; | 599 | break; |
600 | case Qtopia::Suffix: | 600 | case Qtopia::Suffix: |
601 | value = entry.suffix(); | 601 | value = entry.suffix(); |
602 | break; | 602 | break; |
603 | case Qtopia::FileAs: | 603 | case Qtopia::FileAs: |
604 | value = entry.fileAs(); | 604 | value = entry.fileAs(); |
605 | break; | 605 | break; |
606 | case Qtopia::DefaultEmail: | 606 | case Qtopia::DefaultEmail: |
607 | value = entry.defaultEmail(); | 607 | value = entry.defaultEmail(); |
608 | case Qtopia::Emails: | 608 | case Qtopia::Emails: |
609 | value = entry.emails(); | 609 | value = entry.emails(); |
610 | break; | 610 | break; |
611 | case Qtopia::HomeStreet: | 611 | case Qtopia::HomeStreet: |
612 | value = entry.homeStreet(); | 612 | value = entry.homeStreet(); |
613 | break; | 613 | break; |
614 | case Qtopia::HomeCity: | 614 | case Qtopia::HomeCity: |
615 | value = entry.homeCity(); | 615 | value = entry.homeCity(); |
616 | break; | 616 | break; |
617 | case Qtopia::HomeState: | 617 | case Qtopia::HomeState: |
618 | value = entry.homeState(); | 618 | value = entry.homeState(); |
619 | break; | 619 | break; |
620 | case Qtopia::HomeZip: | 620 | case Qtopia::HomeZip: |
621 | value = entry.homeZip(); | 621 | value = entry.homeZip(); |
622 | break; | 622 | break; |
623 | case Qtopia::HomeCountry: | 623 | case Qtopia::HomeCountry: |
624 | value = entry.homeCountry(); | 624 | value = entry.homeCountry(); |
625 | break; | 625 | break; |
626 | case Qtopia::HomePhone: | 626 | case Qtopia::HomePhone: |
627 | value = entry.homePhone(); | 627 | value = entry.homePhone(); |
628 | break; | 628 | break; |
629 | case Qtopia::HomeFax: | 629 | case Qtopia::HomeFax: |
630 | value = entry.homeFax(); | 630 | value = entry.homeFax(); |
631 | break; | 631 | break; |
632 | case Qtopia::HomeMobile: | 632 | case Qtopia::HomeMobile: |
633 | value = entry.homeMobile(); | 633 | value = entry.homeMobile(); |
634 | break; | 634 | break; |
635 | case Qtopia::HomeWebPage: | 635 | case Qtopia::HomeWebPage: |
636 | value = entry.homeWebpage(); | 636 | value = entry.homeWebpage(); |
637 | break; | 637 | break; |
638 | case Qtopia::Company: | 638 | case Qtopia::Company: |
639 | value = entry.company(); | 639 | value = entry.company(); |
640 | break; | 640 | break; |
641 | case Qtopia::BusinessCity: | 641 | case Qtopia::BusinessCity: |
642 | value = entry.businessCity(); | 642 | value = entry.businessCity(); |
643 | break; | 643 | break; |
644 | case Qtopia::BusinessStreet: | 644 | case Qtopia::BusinessStreet: |
645 | value = entry.businessStreet(); | 645 | value = entry.businessStreet(); |
646 | break; | 646 | break; |
647 | case Qtopia::BusinessZip: | 647 | case Qtopia::BusinessZip: |
648 | value = entry.businessZip(); | 648 | value = entry.businessZip(); |
649 | break; | 649 | break; |
650 | case Qtopia::BusinessCountry: | 650 | case Qtopia::BusinessCountry: |
651 | value = entry.businessCountry(); | 651 | value = entry.businessCountry(); |
652 | break; | 652 | break; |
653 | case Qtopia::BusinessWebPage: | 653 | case Qtopia::BusinessWebPage: |
654 | value = entry.businessWebpage(); | 654 | value = entry.businessWebpage(); |
655 | break; | 655 | break; |
656 | case Qtopia::JobTitle: | 656 | case Qtopia::JobTitle: |
657 | value = entry.jobTitle(); | 657 | value = entry.jobTitle(); |
658 | break; | 658 | break; |
659 | case Qtopia::Department: | 659 | case Qtopia::Department: |
660 | value = entry.department(); | 660 | value = entry.department(); |
661 | break; | 661 | break; |
662 | case Qtopia::Office: | 662 | case Qtopia::Office: |
663 | value = entry.office(); | 663 | value = entry.office(); |
664 | break; | 664 | break; |
665 | case Qtopia::BusinessPhone: | 665 | case Qtopia::BusinessPhone: |
666 | value = entry.businessPhone(); | 666 | value = entry.businessPhone(); |
667 | break; | 667 | break; |
668 | case Qtopia::BusinessFax: | 668 | case Qtopia::BusinessFax: |
669 | value = entry.businessFax(); | 669 | value = entry.businessFax(); |
670 | break; | 670 | break; |
671 | case Qtopia::BusinessMobile: | 671 | case Qtopia::BusinessMobile: |
672 | value = entry.businessMobile(); | 672 | value = entry.businessMobile(); |
673 | break; | 673 | break; |
674 | case Qtopia::BusinessPager: | 674 | case Qtopia::BusinessPager: |
675 | value = entry.businessPager(); | 675 | value = entry.businessPager(); |
676 | break; | 676 | break; |
677 | case Qtopia::Profession: | 677 | case Qtopia::Profession: |
678 | value = entry.profession(); | 678 | value = entry.profession(); |
679 | break; | 679 | break; |
680 | case Qtopia::Assistant: | 680 | case Qtopia::Assistant: |
681 | value = entry.assistant(); | 681 | value = entry.assistant(); |
682 | break; | 682 | break; |
683 | case Qtopia::Manager: | 683 | case Qtopia::Manager: |
684 | value = entry.manager(); | 684 | value = entry.manager(); |
685 | break; | 685 | break; |
686 | case Qtopia::Spouse: | 686 | case Qtopia::Spouse: |
687 | value = entry.spouse(); | 687 | value = entry.spouse(); |
688 | break; | 688 | break; |
689 | case Qtopia::Gender: | 689 | case Qtopia::Gender: |
690 | value = entry.gender(); | 690 | value = entry.gender(); |
691 | break; | 691 | break; |
692 | case Qtopia::Birthday: | 692 | case Qtopia::Birthday: |
693 | value = TimeString::numberDateString( entry.birthday() ); | 693 | if ( ! entry.birthday().isNull() ) |
694 | value = TimeString::numberDateString( entry.birthday() ); | ||
694 | break; | 695 | break; |
695 | case Qtopia::Anniversary: | 696 | case Qtopia::Anniversary: |
696 | value = TimeString::numberDateString( entry.anniversary() ); | 697 | if ( ! entry.anniversary().isNull() ) |
698 | value = TimeString::numberDateString( entry.anniversary() ); | ||
697 | break; | 699 | break; |
698 | case Qtopia::Nickname: | 700 | case Qtopia::Nickname: |
699 | value = entry.nickname(); | 701 | value = entry.nickname(); |
700 | break; | 702 | break; |
701 | case Qtopia::Children: | 703 | case Qtopia::Children: |
702 | value = entry.children(); | 704 | value = entry.children(); |
703 | break; | 705 | break; |
704 | case Qtopia::Notes: | 706 | case Qtopia::Notes: |
705 | value = entry.notes(); | 707 | value = entry.notes(); |
706 | break; | 708 | break; |
707 | } | 709 | } |
708 | if ( !value.isEmpty() ) | 710 | if ( !value.isEmpty() ) |
709 | break; | 711 | break; |
710 | } | 712 | } |
711 | return value; | 713 | return value; |
712 | } | 714 | } |