summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/tableview.cpp50
1 files changed, 26 insertions, 24 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
@@ -68,3 +68,3 @@ TableView::TableView( MainWindow* window, QWidget* wid )
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" ) );
@@ -72,2 +72,4 @@ TableView::TableView( MainWindow* window, QWidget* wid )
72 72
73 setShowDeadline( todoWindow()->showDeadline() );
74
73 setSorting( TRUE ); 75 setSorting( TRUE );
@@ -78,7 +80,2 @@ TableView::TableView( MainWindow* window, QWidget* wid )
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& ) ),
@@ -114,15 +111,2 @@ TableView::TableView( MainWindow* window, QWidget* wid )
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 */
@@ -227,8 +211,24 @@ void TableView::setShowCompleted( bool b) {
227} 211}
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}
@@ -338,2 +338,3 @@ void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool
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 }
@@ -341,2 +342,3 @@ void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool
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 }