summaryrefslogtreecommitdiff
authorzecke <zecke>2002-04-18 20:43:35 (UTC)
committer zecke <zecke>2002-04-18 20:43:35 (UTC)
commit877e3d4899013687a0a16caefadabf86703bcf27 (patch) (side-by-side diff)
treeb8df1964ea9ea4dc1a1cbb9cab8a2ff84560a11f
parent56c20411484700350362b5041e3c9db030084caf (diff)
downloadopie-877e3d4899013687a0a16caefadabf86703bcf27.zip
opie-877e3d4899013687a0a16caefadabf86703bcf27.tar.gz
opie-877e3d4899013687a0a16caefadabf86703bcf27.tar.bz2
on day change the deadline gets changed
I use QDate and a Timer for that. Does anyone know a better way?
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/todotable.cpp23
-rw-r--r--core/pim/todo/todotable.h3
2 files changed, 26 insertions, 0 deletions
diff --git a/core/pim/todo/todotable.cpp b/core/pim/todo/todotable.cpp
index 96cd860..d0bc61c 100644
--- a/core/pim/todo/todotable.cpp
+++ b/core/pim/todo/todotable.cpp
@@ -195,2 +195,3 @@ void DueTextItem::setToDoEvent( const ToDoEvent *ev )
m_off = today.daysTo(ev->date() );
+ //qWarning("DueText m_off=%d", m_off );
setText( QString::number(m_off) + " day(s) " );
@@ -200,2 +201,3 @@ void DueTextItem::setToDoEvent( const ToDoEvent *ev )
}
+ //qWarning("m_off=%d", m_off );
}
@@ -203,2 +205,3 @@ void DueTextItem::paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bo
{
+ //qWarning ("paint m_off=%d", m_off );
QColorGroup cg2(cg);
@@ -263,2 +266,6 @@ TodoTable::TodoTable( QWidget *parent, const char *name )
connect( menuTimer, SIGNAL(timeout()), this, SLOT(slotShowMenu()) );
+
+ mDayTimer = new QTimer( this );
+ connect( mDayTimer, SIGNAL(timeout()), this, SLOT(slotCheckDay() ) );
+ mDay = QDate::currentDate();
}
@@ -423,2 +430,3 @@ void TodoTable::load( const QString &fn )
setSorting(true );
+ mDayTimer->start( 60 * 1000 ); // gone in 60 seconds?
}
@@ -783,2 +791,17 @@ void TodoTable::applyJournal()
}
+void TodoTable::slotCheckDay()
+{
+ QDate date = QDate::currentDate();
+ if( mDay.daysTo(date )!= 0 ){
+ setPaintingEnabled( FALSE );
+ for(int i=0; i < numRows(); i++ ){
+ ToDoEvent *t = todoList[static_cast<CheckItem*>(item(i, 0))];
+ static_cast<DueTextItem*>(item(i, 3) )->setToDoEvent( t );
+
+ }
+ setPaintingEnabled( TRUE );
+ mDay = date;
+ }
+ mDayTimer->start( 60 * 1000 ); // 60 seconds
+}
// check Action and decide
diff --git a/core/pim/todo/todotable.h b/core/pim/todo/todotable.h
index 6e371e8..458e07a 100644
--- a/core/pim/todo/todotable.h
+++ b/core/pim/todo/todotable.h
@@ -169,2 +169,3 @@ private slots:
void rowHeightChanged( int row );
+ void slotCheckDay(); // check the day
@@ -178,2 +179,4 @@ private:
QTimer *menuTimer;
+ QDate mDay;
+ QTimer *mDayTimer; // see if the day changed
bool enablePainting;