summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp23
-rw-r--r--core/pim/todo/mainwindow.h9
-rw-r--r--core/pim/todo/todoentryimpl.cpp8
-rw-r--r--core/pim/todo/todotable.cpp68
-rw-r--r--core/pim/todo/todotable.h22
5 files changed, 120 insertions, 10 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index f3afa5f..33f13aa 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -2,2 +2,4 @@
** Copyright (C) 2000 Trolltech AS. All rights reserved.
+ Copyright (C) 2002 zecke
+ Copyright (C) 2002 Stefan Eilers
**
@@ -109,2 +111,7 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
table->setShowCompleted( complete );
+
+ /* added 20.01.2k2 by se */
+ bool showdeadline = config.readBoolEntry("ShowDeadLine", true);
+ table->setShowDeadline (showdeadline);
+
QString category = config.readEntry( "Category", QString::null );
@@ -176,2 +183,5 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
+ /* added 20.01.2k2 by se */
+ showdeadlineAction = new QAction( QString::null, tr( "Show Deadline" ), 0, this, 0, TRUE );
+
catMenu->setCheckable( true );
@@ -197,2 +207,3 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
connect( completedAction, SIGNAL( toggled(bool) ), this, SLOT( showCompleted(bool) ) );
+ connect( showdeadlineAction, SIGNAL( toggled(bool) ), this, SLOT( showDeadline(bool) ) );
connect( catMenu, SIGNAL(activated(int)), this, SLOT(setCategory(int)) );
@@ -353,2 +364,4 @@ void TodoWindow::populateCategories()
completedAction->setOn( table->showCompleted() );
+ showdeadlineAction->addTo( catMenu );
+ showdeadlineAction->setOn( table->showDeadline() );
@@ -404,2 +417,4 @@ void TodoWindow::closeEvent( QCloseEvent *e )
config.writeEntry( "Category", table->showCategory() );
+ /* added 20.01.2k2 by se */
+ config.writeEntry( "ShowDeadLine", table->showDeadline());
} else {
@@ -475 +490,9 @@ void TodoWindow::beamDone( Ir *ir )
}
+
+/* added 20.01.2k2 by se */
+void TodoWindow::showDeadline( bool s )
+{
+ table->setPaintingEnabled( false );
+ table->setShowDeadline( s );
+ table->setPaintingEnabled( true );
+}
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h
index 856dcb4..a81c27c 100644
--- a/core/pim/todo/mainwindow.h
+++ b/core/pim/todo/mainwindow.h
@@ -49,2 +49,6 @@ protected slots:
void showCompleted( bool );
+
+ /* added 20.01.2k2 by se */
+ void showDeadline( bool );
+
void currentEntryChanged( int r, int c );
@@ -66,4 +70,5 @@ private:
*deleteAction,
- *findAction,
- * completedAction;
+ *findAction,
+ * completedAction,
+ *showdeadlineAction ;
QPopupMenu *contextMenu, *catMenu;
diff --git a/core/pim/todo/todoentryimpl.cpp b/core/pim/todo/todoentryimpl.cpp
index 1dc1d44..f938d61 100644
--- a/core/pim/todo/todoentryimpl.cpp
+++ b/core/pim/todo/todoentryimpl.cpp
@@ -50,3 +50,3 @@ NewTaskDialog::NewTaskDialog( const ToDoEvent& task, QWidget *parent,
qWarning("setting category" );
- todo.setCategory( task.category() );
+ todo.setCategories( task.allCategories() );
if ( todo.hasDate() )
@@ -130,6 +130,6 @@ ToDoEvent NewTaskDialog::todoEntry()
QArray<int> arr = comboCategory->currentCategories();
- int id = arr[0];
- qWarning("id 0: %d",id );
- todo.setCategory( Qtopia::Record::idsToString( arr ) );
+ QStringList list;
+ list = QStringList::split(";", Qtopia::Record::idsToString( arr )) ;
qWarning("saving category");
+ todo.setCategories( list );
}
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) );
diff --git a/core/pim/todo/todotable.h b/core/pim/todo/todotable.h
index 2746ce7..288ff90 100644
--- a/core/pim/todo/todotable.h
+++ b/core/pim/todo/todotable.h
@@ -100,2 +100,6 @@ public:
+ /* added 20.01.2k2 by se */
+ void setShowDeadline (bool sd) {showDeadl = sd; updateVisible();}
+ bool showDeadline() const { return showDeadl;}
+
void setShowCategory( const QString &c ) { showCat = c; updateVisible(); }
@@ -161,2 +165,5 @@ private:
int currFindRow;
+
+ /* added 20.01.2k2 by se */
+ bool showDeadl;
};
@@ -176,2 +183,16 @@ inline void TodoTable::insertIntoTable( ToDoEvent *todo, int row )
+ /* added 20.01.2k2 by se */
+ QTableItem *dl = NULL;
+ if (todo->hasDate()){
+ QDate *today = new QDate (QDate::currentDate());
+ if (today){
+ dl = new TodoTextItem (this, tr ("%1").
+ arg(today->daysTo(todo->date())));
+ delete (today);
+ }
+ }else{
+ dl = new TodoTextItem (this,"n.d.");
+ }
+ setItem( row, 3, dl);
+
setItem( row, 0, chk );
@@ -180,2 +201,3 @@ inline void TodoTable::insertIntoTable( ToDoEvent *todo, int row )
+
todoList.insert( chk, todo );