-rw-r--r-- | core/pim/todo/todotable.cpp | 68 |
1 files changed, 64 insertions, 4 deletions
diff --git a/core/pim/todo/todotable.cpp b/core/pim/todo/todotable.cpp index 2bb95a2..3cd0c0e 100644 --- a/core/pim/todo/todotable.cpp +++ b/core/pim/todo/todotable.cpp @@ -19,3 +19,4 @@ **********************************************************************/ - +/* Show Deadline was added by Stefan Eilers (se, eilers.stefan@epost.de) + */ #include "todotable.h" @@ -40,2 +41,4 @@ +#include <stdio.h> + @@ -166,3 +169,3 @@ TodoTable::TodoTable( QWidget *parent, const char *name ) // #else - : QTable( 0, 3, parent, name ), + : QTable( 0, 4, parent, name ), // #endif @@ -171,3 +174,4 @@ TodoTable::TodoTable( QWidget *parent, const char *name ) mCat( 0 ), - currFindRow( -2 ) + currFindRow( -2 ), + showDeadl( true) { @@ -179,2 +183,3 @@ TodoTable::TodoTable( QWidget *parent, const char *name ) setColumnWidth( 1, 35 ); + setLeftMargin( 0 ); @@ -184,2 +189,13 @@ TodoTable::TodoTable( QWidget *parent, const char *name ) horizontalHeader()->setLabel( 2, tr( "Description" ) ); + + setColumnStretchable( 3, FALSE ); + setColumnWidth( 3, 20 ); + horizontalHeader()->setLabel( 3, tr( "Deadline" ) ); + + if (showDeadl){ + showColumn (3); + }else{ + hideColumn (3); + } + connect( this, SIGNAL( clicked( int, int, int, const QPoint & ) ), @@ -236,2 +252,7 @@ void TodoTable::slotClicked( int row, int col, int, const QPoint &pos ) break; + case 3: /* added 20.01.2k2 by se */ + // may as well edit it... + menuTimer->stop(); + emit signalEdit(); + break; } @@ -267,2 +288,4 @@ ToDoEvent TodoTable::currentEntry() const { + printf ("in currentEntry\n"); + QTableItem *i = item( currentRow(), 0 ); @@ -356,2 +379,11 @@ void TodoTable::updateVisible() + /* added 20.01.2k2 by se */ + if (showDeadl){ + showColumn (3); + adjustColumn(3); + }else{ + hideColumn (3); + adjustColumn(2); + } + int visible = 0; @@ -457,3 +489,3 @@ void TodoTable::slotCheckPriority(int row, int col ) -void TodoTable::updateJournal( const ToDoEvent &todo, journal_action action, int row ) +void TodoTable::updateJournal( const ToDoEvent &/*todo*/, journal_action action, int row ) { @@ -510,2 +542,16 @@ void TodoTable::journalFreeReplaceEntry( const ToDoEvent &todo, int row ) item( row, 2 )->setText( strTodo ); + + /* added 20.01.2k2 by se */ + if (showDeadl){ + if (todo.hasDate()){ + QDate *today = new QDate (QDate::currentDate()); + if (today){ + item (row, 3)->setText (tr ("%1").arg(today->daysTo(todo.date()))); + delete (today); + } + }else{ + item (row, 3)->setText ("n.d."); + } + } + *(*it) = todo; @@ -520,2 +566,16 @@ void TodoTable::journalFreeReplaceEntry( const ToDoEvent &todo, int row ) item( row, 2 )->setText( strTodo ); + + /* added 20.01.2k2 by se */ + if (showDeadl){ + if (todo.hasDate()){ + QDate *today = new QDate (QDate::currentDate()); + if (today){ + item (row, 3)->setText (tr ("%1").arg(today->daysTo(todo.date()))); + delete (today); + } + }else{ + item (row, 3)->setText ("n.d."); + } + } + todoList.insert( static_cast<CheckItem*>(item(row,0)), new ToDoEvent(todo) ); |