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
@@ -63,27 +63,24 @@ TableView::TableView( MainWindow* window, QWidget* wid )
63 viewport()->setUpdatesEnabled( false ); 63 viewport()->setUpdatesEnabled( false );
64 m_enablePaint = false; 64 m_enablePaint = false;
65 setNumRows(0); 65 setNumRows(0);
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& ) ),
87 this, SLOT( slotPressed(int, int, int, const QPoint& ) ) ); 84 this, SLOT( slotPressed(int, int, int, const QPoint& ) ) );
88 connect((QTable*)this, SIGNAL(valueChanged(int, int) ), 85 connect((QTable*)this, SIGNAL(valueChanged(int, int) ),
89 this, SLOT( slotValueChanged(int, int) ) ); 86 this, SLOT( slotValueChanged(int, int) ) );
@@ -109,25 +106,12 @@ TableView::TableView( MainWindow* window, QWidget* wid )
109 for ( unsigned int i = 1; i < 6; i++ ) { 106 for ( unsigned int i = 1; i < 6; i++ ) {
110 namestr = "todo/priority"; 107 namestr = "todo/priority";
111 namestr.append( QString::number( i ) ); 108 namestr.append( QString::number( i ) );
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}
131/* a new day has started 115/* a new day has started
132 * update the day 116 * update the day
133 */ 117 */
@@ -228,12 +212,28 @@ void TableView::setShowCompleted( bool b) {
228void TableView::setShowDeadline( bool b) { 212void TableView::setShowDeadline( bool b) {
229 qWarning("Show DeadLine %d" + b ); 213 qWarning("Show DeadLine %d" + b );
230 if (b) 214 if (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");
237 if ( str != m_oleCat || m_first ) 237 if ( str != m_oleCat || m_first )
238 updateView(); 238 updateView();
239 239
@@ -333,15 +333,17 @@ void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool
333 333
334 // TODO - give user option for grid or bars? 334 // TODO - give user option for grid or bars?
335 335
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
345 //p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); 347 //p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) );
346 //QPen op = p->pen(); 348 //QPen op = p->pen();
347 //p->setPen(cg.mid()); 349 //p->setPen(cg.mid());