summaryrefslogtreecommitdiff
authordrw <drw>2002-12-22 15:54:54 (UTC)
committer drw <drw>2002-12-22 15:54:54 (UTC)
commit043abeb16589fa2aaa0881d2781bb46fa99007b6 (patch) (unidiff)
tree9a36c9bf485dd72d021b57a3de56b2f27f2e7f96
parent255d01d91f79b27765a03e100a6704fb43e1a9c1 (diff)
downloadopie-043abeb16589fa2aaa0881d2781bb46fa99007b6.zip
opie-043abeb16589fa2aaa0881d2781bb46fa99007b6.tar.gz
opie-043abeb16589fa2aaa0881d2781bb46fa99007b6.tar.bz2
Main todo view text color and column width fixes.
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/todo/tableview.cpp40
1 files changed, 21 insertions, 19 deletions
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp
index faf4611..d229f52 100644
--- a/core/pim/todo/tableview.cpp
+++ b/core/pim/todo/tableview.cpp
@@ -66,21 +66,18 @@ TableView::TableView( MainWindow* window, QWidget* wid )
66 setNumCols(4); 66 setNumCols(4);
67 67
68 horizontalHeader()->setLabel( 0, tr("C.") ); 68 horizontalHeader()->setLabel( 0, tr("C.") );
69 horizontalHeader()->setLabel( 1, tr("Prior.") ); 69 horizontalHeader()->setLabel( 1, tr("Priority") );
70 horizontalHeader()->setLabel( 2, tr("Description" ) ); 70 horizontalHeader()->setLabel( 2, tr("Description" ) );
71 horizontalHeader()->setLabel( 3, tr("Deadline") ); 71 horizontalHeader()->setLabel( 3, tr("Deadline") );
72 72
73 setShowDeadline( todoWindow()->showDeadline() );
74
73 setSorting( TRUE ); 75 setSorting( TRUE );
74 setSelectionMode( NoSelection ); 76 setSelectionMode( NoSelection );
75 77
76 setLeftMargin( 0 ); 78 setLeftMargin( 0 );
77 verticalHeader()->hide(); 79 verticalHeader()->hide();
78 80
79 if ( todoWindow()->showDeadline() )
80 showColumn( 3 );
81 else
82 hideColumn( 3 );
83
84 connect((QTable*)this, SIGNAL( clicked( int, int, int, const QPoint& ) ), 81 connect((QTable*)this, SIGNAL( clicked( int, int, int, const QPoint& ) ),
85 this, SLOT( slotClicked(int, int, int, const QPoint& ) ) ); 82 this, SLOT( slotClicked(int, int, int, const QPoint& ) ) );
86 connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ), 83 connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ),
@@ -112,19 +109,6 @@ TableView::TableView( MainWindow* window, QWidget* wid )
112 m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr ); 109 m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr );
113 } 110 }
114 111
115 // Try to intelligently size columns
116 int col2width = 240;
117 int width = m_pic_completed.width();
118 setColumnWidth( 0, width );
119 col2width -= width;
120 width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width()+8;
121 setColumnWidth( 1, width );
122 col2width -= width;
123 width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width()+8;
124 setColumnWidth( 3, width );
125 col2width -= width;
126 setColumnWidth( 2, col2width - 2 );
127
128 /* now let's init the config */ 112 /* now let's init the config */
129 initConfig(); 113 initConfig();
130} 114}
@@ -231,6 +215,22 @@ void TableView::setShowDeadline( bool b) {
231 showColumn(3 ); 215 showColumn(3 );
232 else 216 else
233 hideColumn(3 ); 217 hideColumn(3 );
218
219 // Try to intelligently size columns
220 // TODO - would use width() below, but doesn't have valid value at time of c'tor
221 int col2width = 238;
222 int width = m_pic_completed.width();
223 setColumnWidth( 0, width );
224 col2width -= width;
225 width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8;
226 setColumnWidth( 1, width );
227 col2width -= width;
228 if ( b ) {
229 width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8;
230 setColumnWidth( 3, width );
231 col2width -= width;
232 }
233 setColumnWidth( 2, col2width );
234} 234}
235void TableView::setShowCategory( const QString& str) { 235void TableView::setShowCategory( const QString& str) {
236 qWarning("setShowCategory"); 236 qWarning("setShowCategory");
@@ -336,9 +336,11 @@ void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool
336 // Paint alternating background bars 336 // Paint alternating background bars
337 if ( (row % 2 ) == 0 ) { 337 if ( (row % 2 ) == 0 ) {
338 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); 338 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) );
339 p->setPen( QPen( cg.text() ) );
339 } 340 }
340 else { 341 else {
341 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); 342 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) );
343 p->setPen( QPen( cg.buttonText() ) );
342 } 344 }
343 345
344 // Paint grid 346 // Paint grid