author | eilers <eilers> | 2003-03-06 08:15:23 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-03-06 08:15:23 (UTC) |
commit | de5ee3b655897d8d6b8b78fee3cb2b63f9a9bf8a (patch) (unidiff) | |
tree | a1be481f2d4281f7221f538f95bfe996ff5e2dfc | |
parent | caecd32d28df2c0de6982bf84c599c5b25880661 (diff) | |
download | opie-de5ee3b655897d8d6b8b78fee3cb2b63f9a9bf8a.zip opie-de5ee3b655897d8d6b8b78fee3cb2b63f9a9bf8a.tar.gz opie-de5ee3b655897d8d6b8b78fee3cb2b63f9a9bf8a.tar.bz2 |
New table appearance by Dan Williams ! It looks like todolist, now ! Thanks
a lot !
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 36 | ||||
-rw-r--r-- | core/pim/addressbook/abtable.h | 1 |
2 files changed, 35 insertions, 2 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index 55b1ba1..a829dc2 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp | |||
@@ -565,81 +565,113 @@ void AbTable::updateVisible() | |||
565 | visible = 0; | 565 | visible = 0; |
566 | 566 | ||
567 | setPaintingEnabled( FALSE ); | 567 | setPaintingEnabled( FALSE ); |
568 | 568 | ||
569 | realignTable(); | 569 | realignTable(); |
570 | 570 | ||
571 | totalRows = numRows(); | 571 | totalRows = numRows(); |
572 | for ( row = 0; row < totalRows; row++ ) { | 572 | for ( row = 0; row < totalRows; row++ ) { |
573 | if ( rowHeight(row) == 0 ) { | 573 | if ( rowHeight(row) == 0 ) { |
574 | showRow( row ); | 574 | showRow( row ); |
575 | adjustRow( row ); | 575 | adjustRow( row ); |
576 | if ( isSelected( row,0 ) || isSelected( row,1 ) ) | 576 | if ( isSelected( row,0 ) || isSelected( row,1 ) ) |
577 | selectedRow = row; | 577 | selectedRow = row; |
578 | } | 578 | } |
579 | visible++; | 579 | visible++; |
580 | } | 580 | } |
581 | 581 | ||
582 | if ( selectedRow ) | 582 | if ( selectedRow ) |
583 | setCurrentCell( selectedRow, 0 ); | 583 | setCurrentCell( selectedRow, 0 ); |
584 | 584 | ||
585 | if ( !visible ) | 585 | if ( !visible ) |
586 | setCurrentCell( -1, 0 ); | 586 | setCurrentCell( -1, 0 ); |
587 | 587 | ||
588 | setPaintingEnabled( TRUE ); | 588 | setPaintingEnabled( TRUE ); |
589 | |||
590 | |||
591 | } | 589 | } |
592 | 590 | ||
593 | 591 | ||
594 | void AbTable::setPaintingEnabled( bool e ) | 592 | void AbTable::setPaintingEnabled( bool e ) |
595 | { | 593 | { |
596 | //qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); | 594 | //qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); |
597 | 595 | ||
598 | if ( e ) { | 596 | if ( e ) { |
599 | if ( countNested > 0 ) | 597 | if ( countNested > 0 ) |
600 | --countNested; | 598 | --countNested; |
601 | if ( ! countNested ){ | 599 | if ( ! countNested ){ |
602 | setUpdatesEnabled( true ); | 600 | setUpdatesEnabled( true ); |
603 | enablePainting = true; | 601 | enablePainting = true; |
604 | rowHeightChanged( 0 ); | 602 | rowHeightChanged( 0 ); |
605 | viewport()->update(); | 603 | viewport()->update(); |
606 | } | 604 | } |
607 | } else { | 605 | } else { |
608 | ++countNested; | 606 | ++countNested; |
609 | enablePainting = false; | 607 | enablePainting = false; |
610 | setUpdatesEnabled( false ); | 608 | setUpdatesEnabled( false ); |
611 | } | 609 | } |
612 | //qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); | 610 | //qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); |
613 | } | 611 | } |
614 | 612 | ||
615 | void AbTable::viewportPaintEvent( QPaintEvent* e ) { | 613 | void AbTable::viewportPaintEvent( QPaintEvent* e ) { |
616 | //qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting); | 614 | //qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting); |
617 | if ( enablePainting ) | 615 | if ( enablePainting ) |
618 | QTable::viewportPaintEvent( e ); | 616 | QTable::viewportPaintEvent( e ); |
619 | } | 617 | } |
620 | 618 | ||
619 | void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { | ||
620 | const QColorGroup &cg = colorGroup(); | ||
621 | |||
622 | p->save(); | ||
623 | |||
624 | // Paint alternating background bars | ||
625 | if ( (row % 2 ) == 0 ) { | ||
626 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); | ||
627 | p->setPen( QPen( cg.text() ) ); | ||
628 | } | ||
629 | else { | ||
630 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); | ||
631 | p->setPen( QPen( cg.buttonText() ) ); | ||
632 | } | ||
621 | 633 | ||
634 | QFont f = p->font(); | ||
635 | QFontMetrics fm(f); | ||
636 | |||
637 | int marg = 2; | ||
638 | int x = 0; | ||
639 | int y = ( cr.height() - 14 ) / 2; | ||
640 | |||
641 | QPixmap pic = pixmap( row, col ); | ||
642 | if ( !pic.isNull() ) | ||
643 | { | ||
644 | p->drawPixmap( x + marg, y, pixmap( row, col ) ); | ||
645 | p->drawText( x + marg + pixmap( row, col ).width() + 4,2 + fm.ascent(), text( row, col ) ); | ||
646 | } | ||
647 | else | ||
648 | { | ||
649 | p->drawText( x + marg,2 + fm.ascent(), text( row, col ) ); | ||
650 | } | ||
651 | |||
652 | p->restore(); | ||
653 | } | ||
622 | 654 | ||
623 | void AbTable::rowHeightChanged( int row ) | 655 | void AbTable::rowHeightChanged( int row ) |
624 | { | 656 | { |
625 | if ( enablePainting ) | 657 | if ( enablePainting ) |
626 | QTable::rowHeightChanged( row ); | 658 | QTable::rowHeightChanged( row ); |
627 | } | 659 | } |
628 | ContactItem AbTable::findContactContact( const OContact &entry, int /* row */ ) | 660 | ContactItem AbTable::findContactContact( const OContact &entry, int /* row */ ) |
629 | { | 661 | { |
630 | 662 | ||
631 | ContactItem item; | 663 | ContactItem item; |
632 | 664 | ||
633 | item.value = ""; | 665 | item.value = ""; |
634 | 666 | ||
635 | for ( QValueList<int>::ConstIterator it = intFields.begin(); | 667 | for ( QValueList<int>::ConstIterator it = intFields.begin(); |
636 | it != intFields.end(); ++it ) { | 668 | it != intFields.end(); ++it ) { |
637 | switch ( *it ) { | 669 | switch ( *it ) { |
638 | default: | 670 | default: |
639 | break; | 671 | break; |
640 | case Qtopia::Title: | 672 | case Qtopia::Title: |
641 | item.value = entry.title(); | 673 | item.value = entry.title(); |
642 | break; | 674 | break; |
643 | case Qtopia::Suffix: | 675 | case Qtopia::Suffix: |
644 | item.value = entry.suffix(); | 676 | item.value = entry.suffix(); |
645 | break; | 677 | break; |
diff --git a/core/pim/addressbook/abtable.h b/core/pim/addressbook/abtable.h index 092e86f..4e6b294 100644 --- a/core/pim/addressbook/abtable.h +++ b/core/pim/addressbook/abtable.h | |||
@@ -75,48 +75,49 @@ class AbTable : public QTable | |||
75 | public: | 75 | public: |
76 | AbTable( const QValueList<int> ordered, QWidget *parent, const char *name=0 ); | 76 | AbTable( const QValueList<int> ordered, QWidget *parent, const char *name=0 ); |
77 | ~AbTable(); | 77 | ~AbTable(); |
78 | 78 | ||
79 | // Set the contacts shown in the table | 79 | // Set the contacts shown in the table |
80 | void setContacts( const OContactAccess::List& viewList ); | 80 | void setContacts( const OContactAccess::List& viewList ); |
81 | // Selects a contact of a specific UID | 81 | // Selects a contact of a specific UID |
82 | bool selectContact( int UID ); | 82 | bool selectContact( int UID ); |
83 | 83 | ||
84 | // Get the current selected entry | 84 | // Get the current selected entry |
85 | OContact currentEntry(); | 85 | OContact currentEntry(); |
86 | 86 | ||
87 | // Get the UID of the current selected Entry | 87 | // Get the UID of the current selected Entry |
88 | int currentEntry_UID(); | 88 | int currentEntry_UID(); |
89 | 89 | ||
90 | QString findContactName( const OContact &entry ); | 90 | QString findContactName( const OContact &entry ); |
91 | 91 | ||
92 | void init(); | 92 | void init(); |
93 | void clear(); | 93 | void clear(); |
94 | void refresh(); | 94 | void refresh(); |
95 | 95 | ||
96 | void show(); | 96 | void show(); |
97 | void setPaintingEnabled( bool e ); | 97 | void setPaintingEnabled( bool e ); |
98 | void viewportPaintEvent( QPaintEvent* e); | 98 | void viewportPaintEvent( QPaintEvent* e); |
99 | void paintCell(QPainter* p, int row, int col, const QRect&, bool ); | ||
99 | 100 | ||
100 | // addresspicker mode (What's that ? se) | 101 | // addresspicker mode (What's that ? se) |
101 | void setChoiceNames( const QStringList& list); | 102 | void setChoiceNames( const QStringList& list); |
102 | QStringList choiceNames() const; | 103 | QStringList choiceNames() const; |
103 | void setChoiceSelection( const QValueList<int>& list ); | 104 | void setChoiceSelection( const QValueList<int>& list ); |
104 | QStringList choiceSelection(int index) const; | 105 | QStringList choiceSelection(int index) const; |
105 | 106 | ||
106 | signals: | 107 | signals: |
107 | void signalSwitch(); | 108 | void signalSwitch(); |
108 | void signalEditor(); | 109 | void signalEditor(); |
109 | void signalKeyDown(); | 110 | void signalKeyDown(); |
110 | void signalKeyUp(); | 111 | void signalKeyUp(); |
111 | 112 | ||
112 | protected: | 113 | protected: |
113 | virtual void keyPressEvent( QKeyEvent *e ); | 114 | virtual void keyPressEvent( QKeyEvent *e ); |
114 | 115 | ||
115 | // int rowHeight( int ) const; | 116 | // int rowHeight( int ) const; |
116 | // int rowPos( int row ) const; | 117 | // int rowPos( int row ) const; |
117 | // virtual int rowAt( int pos ) const; | 118 | // virtual int rowAt( int pos ) const; |
118 | 119 | ||
119 | 120 | ||
120 | protected slots: | 121 | protected slots: |
121 | void moveTo( char ); | 122 | void moveTo( char ); |
122 | virtual void columnClicked( int col ); | 123 | virtual void columnClicked( int col ); |