author | zecke <zecke> | 2002-04-18 20:43:35 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-04-18 20:43:35 (UTC) |
commit | 877e3d4899013687a0a16caefadabf86703bcf27 (patch) (unidiff) | |
tree | b8df1964ea9ea4dc1a1cbb9cab8a2ff84560a11f | |
parent | 56c20411484700350362b5041e3c9db030084caf (diff) | |
download | opie-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?
-rw-r--r-- | core/pim/todo/todotable.cpp | 23 | ||||
-rw-r--r-- | core/pim/todo/todotable.h | 3 |
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 ) | |||
195 | m_off = today.daysTo(ev->date() ); | 195 | m_off = today.daysTo(ev->date() ); |
196 | //qWarning("DueText m_off=%d", m_off ); | ||
196 | setText( QString::number(m_off) + " day(s) " ); | 197 | setText( QString::number(m_off) + " day(s) " ); |
@@ -200,2 +201,3 @@ void DueTextItem::setToDoEvent( const ToDoEvent *ev ) | |||
200 | } | 201 | } |
202 | //qWarning("m_off=%d", m_off ); | ||
201 | } | 203 | } |
@@ -203,2 +205,3 @@ void DueTextItem::paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bo | |||
203 | { | 205 | { |
206 | //qWarning ("paint m_off=%d", m_off ); | ||
204 | QColorGroup cg2(cg); | 207 | QColorGroup cg2(cg); |
@@ -263,2 +266,6 @@ TodoTable::TodoTable( QWidget *parent, const char *name ) | |||
263 | connect( menuTimer, SIGNAL(timeout()), this, SLOT(slotShowMenu()) ); | 266 | connect( menuTimer, SIGNAL(timeout()), this, SLOT(slotShowMenu()) ); |
267 | |||
268 | mDayTimer = new QTimer( this ); | ||
269 | connect( mDayTimer, SIGNAL(timeout()), this, SLOT(slotCheckDay() ) ); | ||
270 | mDay = QDate::currentDate(); | ||
264 | } | 271 | } |
@@ -423,2 +430,3 @@ void TodoTable::load( const QString &fn ) | |||
423 | setSorting(true ); | 430 | setSorting(true ); |
431 | mDayTimer->start( 60 * 1000 ); // gone in 60 seconds? | ||
424 | } | 432 | } |
@@ -783,2 +791,17 @@ void TodoTable::applyJournal() | |||
783 | } | 791 | } |
792 | void TodoTable::slotCheckDay() | ||
793 | { | ||
794 | QDate date = QDate::currentDate(); | ||
795 | if( mDay.daysTo(date )!= 0 ){ | ||
796 | setPaintingEnabled( FALSE ); | ||
797 | for(int i=0; i < numRows(); i++ ){ | ||
798 | ToDoEvent *t = todoList[static_cast<CheckItem*>(item(i, 0))]; | ||
799 | static_cast<DueTextItem*>(item(i, 3) )->setToDoEvent( t ); | ||
800 | |||
801 | } | ||
802 | setPaintingEnabled( TRUE ); | ||
803 | mDay = date; | ||
804 | } | ||
805 | mDayTimer->start( 60 * 1000 ); // 60 seconds | ||
806 | } | ||
784 | // check Action and decide | 807 | // 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: | |||
169 | void rowHeightChanged( int row ); | 169 | void rowHeightChanged( int row ); |
170 | void slotCheckDay(); // check the day | ||
170 | 171 | ||
@@ -178,2 +179,4 @@ private: | |||
178 | QTimer *menuTimer; | 179 | QTimer *menuTimer; |
180 | QDate mDay; | ||
181 | QTimer *mDayTimer; // see if the day changed | ||
179 | bool enablePainting; | 182 | bool enablePainting; |