summaryrefslogtreecommitdiff
path: root/core/pim/todo/tableview.cpp
Unidiff
Diffstat (limited to 'core/pim/todo/tableview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/tableview.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp
index 0b1c579..b7458d8 100644
--- a/core/pim/todo/tableview.cpp
+++ b/core/pim/todo/tableview.cpp
@@ -186,39 +186,39 @@ int TableView::prev() {
186} 186}
187QString TableView::currentRepresentation() { 187QString TableView::currentRepresentation() {
188 OPimTodo to = sorted()[currentRow()]; 188 OPimTodo to = sorted()[currentRow()];
189 return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; 189 return to.summary().isEmpty() ? to.description().left(20) : to.summary() ;
190} 190}
191/* show overdue */ 191/* show overdue */
192void TableView::showOverDue( bool ) { 192void TableView::showOverDue( bool ) {
193 clear(); 193 clear();
194 updateView(); 194 updateView();
195} 195}
196 196
197void TableView::updateView( ) { 197void TableView::updateView( ) {
198 Opie::Core::owarn << "update view" << oendl; 198 owarn << "update view" << oendl;
199 m_row = false; 199 m_row = false;
200 static int id; 200 static int id;
201 id = startTimer(4000 ); 201 id = startTimer(4000 );
202 /* FIXME we want one page to be read! 202 /* FIXME we want one page to be read!
203 * 203 *
204 * Calculate that screensize 204 * Calculate that screensize
205 */ 205 */
206 todoWindow()->setReadAhead( 4 ); 206 todoWindow()->setReadAhead( 4 );
207 sort(); 207 sort();
208 OPimTodoAccess::List::Iterator it, end; 208 OPimTodoAccess::List::Iterator it, end;
209 it = sorted().begin(); 209 it = sorted().begin();
210 end = sorted().end(); 210 end = sorted().end();
211 211
212 Opie::Core::owarn << "setTodos" << oendl; 212 owarn << "setTodos" << oendl;
213 QTime time; 213 QTime time;
214 time.start(); 214 time.start();
215 m_enablePaint = false; 215 m_enablePaint = false;
216 setUpdatesEnabled( false ); 216 setUpdatesEnabled( false );
217 viewport()->setUpdatesEnabled( false ); 217 viewport()->setUpdatesEnabled( false );
218 218
219 setNumRows( it.count() ); 219 setNumRows( it.count() );
220 if ( it.count() == 0 ) 220 if ( it.count() == 0 )
221 killTimer(id); 221 killTimer(id);
222 222
223// int elc = time.elapsed(); 223// int elc = time.elapsed();
224 setUpdatesEnabled( true ); 224 setUpdatesEnabled( true );
@@ -246,52 +246,52 @@ void TableView::addEvent( const OPimTodo&) {
246void TableView::replaceEvent( const OPimTodo& ev) { 246void TableView::replaceEvent( const OPimTodo& ev) {
247 addEvent( ev ); 247 addEvent( ev );
248} 248}
249/* 249/*
250 * re aligning table can be slow too 250 * re aligning table can be slow too
251 * FIXME: look what performs better 251 * FIXME: look what performs better
252 * either this or the old align table 252 * either this or the old align table
253 */ 253 */
254void TableView::removeEvent( int ) { 254void TableView::removeEvent( int ) {
255 updateView(); 255 updateView();
256} 256}
257void TableView::setShowCompleted( bool b) { 257void TableView::setShowCompleted( bool b) {
258 Opie::Core::owarn << "Show Completed " << b << oendl; 258 owarn << "Show Completed " << b << oendl;
259 updateView(); 259 updateView();
260} 260}
261void TableView::setShowDeadline( bool b ) { 261void TableView::setShowDeadline( bool b ) {
262 Opie::Core::owarn << "Show Deadline " << b << oendl; 262 owarn << "Show Deadline " << b << oendl;
263 if ( b ) 263 if ( b )
264 showColumn( 3 ); 264 showColumn( 3 );
265 else 265 else
266 hideColumn( 3 ); 266 hideColumn( 3 );
267 267
268 // Try to intelligently size columns 268 // Try to intelligently size columns
269 // TODO - would use width() below, but doesn't have valid value at time of c'tor 269 // TODO - would use width() below, but doesn't have valid value at time of c'tor
270 int col2width = 238; 270 int col2width = 238;
271 int width = m_pic_completed.width(); 271 int width = m_pic_completed.width();
272 setColumnWidth( 0, width ); 272 setColumnWidth( 0, width );
273 col2width -= width; 273 col2width -= width;
274 width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8; 274 width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8;
275 setColumnWidth( 1, width ); 275 setColumnWidth( 1, width );
276 col2width -= width; 276 col2width -= width;
277 if ( b ) { 277 if ( b ) {
278 width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8; 278 width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8;
279 setColumnWidth( 3, width ); 279 setColumnWidth( 3, width );
280 col2width -= width; 280 col2width -= width;
281 } 281 }
282 setColumnWidth( 2, col2width ); 282 setColumnWidth( 2, col2width );
283} 283}
284void TableView::setShowCategory( const QString& str) { 284void TableView::setShowCategory( const QString& str) {
285 Opie::Core::owarn << "setShowCategory" << oendl; 285 owarn << "setShowCategory" << oendl;
286 if ( str != m_oleCat || m_first ) 286 if ( str != m_oleCat || m_first )
287 updateView(); 287 updateView();
288 288
289 m_oleCat = str; 289 m_oleCat = str;
290 m_first = false; 290 m_first = false;
291 291
292} 292}
293void TableView::clear() { 293void TableView::clear() {
294 setNumRows(0); 294 setNumRows(0);
295} 295}
296void TableView::slotClicked(int row, int col, int, 296void TableView::slotClicked(int row, int col, int,
297 const QPoint& point) { 297 const QPoint& point) {
@@ -338,49 +338,49 @@ void TableView::slotClicked(int row, int col, int,
338 case 3: { 338 case 3: {
339 m_menuTimer->stop(); 339 m_menuTimer->stop();
340 TodoView::edit( ui ); 340 TodoView::edit( ui );
341 break; 341 break;
342 } 342 }
343 } 343 }
344 344
345 345
346} 346}
347void TableView::slotPressed(int row, int col, int, 347void TableView::slotPressed(int row, int col, int,
348 const QPoint& point) { 348 const QPoint& point) {
349 349
350 Opie::Core::owarn << "pressed row " << row << " col " << col << " x:" << point.x() 350 owarn << "pressed row " << row << " col " << col << " x:" << point.x()
351 << "+y:" << point.y() << oendl; 351 << "+y:" << point.y() << oendl;
352 m_prevP = point; 352 m_prevP = point;
353 /* TextColumn column */ 353 /* TextColumn column */
354 if ( col == 2 && cellGeometry( row, col ).contains( point ) ) 354 if ( col == 2 && cellGeometry( row, col ).contains( point ) )
355 m_menuTimer->start( 750, TRUE ); 355 m_menuTimer->start( 750, TRUE );
356} 356}
357void TableView::slotValueChanged( int, int ) { 357void TableView::slotValueChanged( int, int ) {
358 Opie::Core::owarn << "Value Changed" << oendl; 358 owarn << "Value Changed" << oendl;
359} 359}
360void TableView::slotCurrentChanged(int, int ) { 360void TableView::slotCurrentChanged(int, int ) {
361 m_menuTimer->stop(); 361 m_menuTimer->stop();
362} 362}
363QWidget* TableView::widget() { 363QWidget* TableView::widget() {
364 return this; 364 return this;
365} 365}
366/* 366/*
367 * We need to overwrite sortColumn 367 * We need to overwrite sortColumn
368 * because we want to sort whole row 368 * because we want to sort whole row
369 * based 369 * based
370 * We event want to set the setOrder 370 * We event want to set the setOrder
371 * to a sort() and update() 371 * to a sort() and update()
372 */ 372 */
373void TableView::sortColumn( int col, bool asc, bool ) { 373void TableView::sortColumn( int col, bool asc, bool ) {
374 Opie::Core::owarn << "bool " << asc << oendl; 374 owarn << "bool " << asc << oendl;
375 setSortOrder( col ); 375 setSortOrder( col );
376 setAscending( asc ); 376 setAscending( asc );
377 updateView(); 377 updateView();
378} 378}
379void TableView::viewportPaintEvent( QPaintEvent* e) { 379void TableView::viewportPaintEvent( QPaintEvent* e) {
380 if (m_enablePaint ) 380 if (m_enablePaint )
381 QTable::viewportPaintEvent( e ); 381 QTable::viewportPaintEvent( e );
382} 382}
383/* 383/*
384 * This segment is copyrighted by TT 384 * This segment is copyrighted by TT
385 * it was taken from their todolist 385 * it was taken from their todolist
386 * application this code is GPL 386 * application this code is GPL
@@ -485,25 +485,25 @@ QWidget* TableView::createEditor(int row, int col, bool )const {
485 /* summary */ 485 /* summary */
486 case 2:{ 486 case 2:{
487 QLineEdit* edit = new QLineEdit( viewport() ); 487 QLineEdit* edit = new QLineEdit( viewport() );
488 edit->setText( sorted()[row].summary() ); 488 edit->setText( sorted()[row].summary() );
489 return edit; 489 return edit;
490 } 490 }
491 case 0: 491 case 0:
492 default: 492 default:
493 return 0l; 493 return 0l;
494 } 494 }
495} 495}
496void TableView::setCellContentFromEditor(int row, int col ) { 496void TableView::setCellContentFromEditor(int row, int col ) {
497 Opie::Core::owarn << "set cell content from editor" << oendl; 497 owarn << "set cell content from editor" << oendl;
498 if ( col == 1 ) { 498 if ( col == 1 ) {
499 QWidget* wid = cellWidget(row, 1 ); 499 QWidget* wid = cellWidget(row, 1 );
500 if ( wid->inherits("QComboBox") ) { 500 if ( wid->inherits("QComboBox") ) {
501 int pri = ((QComboBox*)wid)->currentItem() + 1; 501 int pri = ((QComboBox*)wid)->currentItem() + 1;
502 OPimTodo todo = sorted()[row]; 502 OPimTodo todo = sorted()[row];
503 if ( todo.priority() != pri ) { 503 if ( todo.priority() != pri ) {
504 todo.setPriority( pri ); 504 todo.setPriority( pri );
505 TodoView::update( todo.uid(), todo ); 505 TodoView::update( todo.uid(), todo );
506 updateView(); 506 updateView();
507 } 507 }
508 } 508 }
509 }else if ( col == 2) { 509 }else if ( col == 2) {
@@ -569,25 +569,25 @@ void TableView::timerEvent( QTimerEvent* ) {
569 * BUG: When clicking on the Due column and it's scrollable 569 * BUG: When clicking on the Due column and it's scrollable
570 * the todo is marked as completed... 570 * the todo is marked as completed...
571 * REASON: QTable is doing auto scrolling which leads to a move 571 * REASON: QTable is doing auto scrolling which leads to a move
572 * in the x coordinate and this way it's able to pass the 572 * in the x coordinate and this way it's able to pass the
573 * m_completeStrokeWidth criteria 573 * m_completeStrokeWidth criteria
574 * WORKAROUND: strike through needs to strike through the same 574 * WORKAROUND: strike through needs to strike through the same
575 * row and two columns! 575 * row and two columns!
576 */ 576 */
577void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { 577void TableView::contentsMouseReleaseEvent( QMouseEvent* e) {
578 int row = rowAt(m_prevP.y()); 578 int row = rowAt(m_prevP.y());
579 int colOld = columnAt(m_prevP.x() ); 579 int colOld = columnAt(m_prevP.x() );
580 int colNew = columnAt(e->x() ); 580 int colNew = columnAt(e->x() );
581 Opie::Core::owarn << "colNew: " << colNew << " colOld: " << colOld << oendl; 581 owarn << "colNew: " << colNew << " colOld: " << colOld << oendl;
582 if ( row == rowAt( e->y() ) && row != -1 && 582 if ( row == rowAt( e->y() ) && row != -1 &&
583 colOld != colNew ) { 583 colOld != colNew ) {
584 TodoView::complete( sorted()[row] ); 584 TodoView::complete( sorted()[row] );
585 return; 585 return;
586 } 586 }
587 QTable::contentsMouseReleaseEvent( e ); 587 QTable::contentsMouseReleaseEvent( e );
588} 588}
589void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { 589void TableView::contentsMouseMoveEvent( QMouseEvent* e ) {
590 m_menuTimer->stop(); 590 m_menuTimer->stop();
591 QTable::contentsMouseMoveEvent( e ); 591 QTable::contentsMouseMoveEvent( e );
592} 592}
593void TableView::keyPressEvent( QKeyEvent* event) { 593void TableView::keyPressEvent( QKeyEvent* event) {