-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 @@ -18,5 +18,6 @@ ** **********************************************************************/ - +/* Show Deadline was added by Stefan Eilers (se, eilers.stefan@epost.de) + */ #include "todotable.h" @@ -39,4 +40,6 @@ #include <stdlib.h> +#include <stdio.h> + @@ -165,10 +168,11 @@ TodoTable::TodoTable( QWidget *parent, const char *name ) // : QTable( 0, 3, parent, name, TRUE ), // #else - : QTable( 0, 3, parent, name ), + : QTable( 0, 4, parent, name ), // #endif showComp( true ), enablePainting( true ), mCat( 0 ), - currFindRow( -2 ) + currFindRow( -2 ), + showDeadl( true) { mCat.load( categoryFileName() ); @@ -178,4 +182,5 @@ TodoTable::TodoTable( QWidget *parent, const char *name ) setColumnWidth( 0, 20 ); setColumnWidth( 1, 35 ); + setLeftMargin( 0 ); verticalHeader()->hide(); @@ -183,4 +188,15 @@ TodoTable::TodoTable( QWidget *parent, const char *name ) horizontalHeader()->setLabel( 1, tr( "Prior." ) ); 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 & ) ), this, SLOT( slotClicked( int, int, int, const QPoint & ) ) ); @@ -235,4 +251,9 @@ void TodoTable::slotClicked( int row, int col, int, const QPoint &pos ) // emit signalEdit(); break; + case 3: /* added 20.01.2k2 by se */ + // may as well edit it... + menuTimer->stop(); + emit signalEdit(); + break; } } @@ -266,4 +287,6 @@ void TodoTable::internalAddEntries( QList<ToDoEvent> &list ) ToDoEvent TodoTable::currentEntry() const { + printf ("in currentEntry\n"); + QTableItem *i = item( currentRow(), 0 ); if ( !i || rowHeight( currentRow() ) <= 0 ) @@ -355,4 +378,13 @@ void TodoTable::updateVisible() // qDebug("--> updateVisible!"); + /* added 20.01.2k2 by se */ + if (showDeadl){ + showColumn (3); + adjustColumn(3); + }else{ + hideColumn (3); + adjustColumn(2); + } + int visible = 0; int id = mCat.id( "Todo List", showCat ); @@ -456,5 +488,5 @@ 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 ) { QFile f( journalFileName() ); @@ -509,4 +541,18 @@ void TodoTable::journalFreeReplaceEntry( const ToDoEvent &todo, int row ) static_cast<ComboItem*>(item(row, 1))->setText( QString::number(todo.priority()) ); 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; } @@ -519,4 +565,18 @@ void TodoTable::journalFreeReplaceEntry( const ToDoEvent &todo, int row ) static_cast<ComboItem*>(item(row, 1))->setText( QString::number(todo.priority()) ); 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) ); } |