summaryrefslogtreecommitdiff
authorzecke <zecke>2002-04-18 20:43:35 (UTC)
committer zecke <zecke>2002-04-18 20:43:35 (UTC)
commit877e3d4899013687a0a16caefadabf86703bcf27 (patch) (unidiff)
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
@@ -194,4 +194,5 @@ void DueTextItem::setToDoEvent( const ToDoEvent *ev )
194 QDate today = QDate::currentDate(); 194 QDate today = QDate::currentDate();
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) " );
197 }else{ 198 }else{
@@ -199,7 +200,9 @@ void DueTextItem::setToDoEvent( const ToDoEvent *ev )
199 m_off = 0; 200 m_off = 0;
200 } 201 }
202 //qWarning("m_off=%d", m_off );
201} 203}
202void DueTextItem::paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected ) 204void DueTextItem::paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected )
203{ 205{
206 //qWarning ("paint m_off=%d", m_off );
204 QColorGroup cg2(cg); 207 QColorGroup cg2(cg);
205 QColor text = cg.text(); 208 QColor text = cg.text();
@@ -262,4 +265,8 @@ TodoTable::TodoTable( QWidget *parent, const char *name )
262 menuTimer = new QTimer( this ); 265 menuTimer = new QTimer( this );
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}
265 272
@@ -422,4 +429,5 @@ void TodoTable::load( const QString &fn )
422 setCurrentCell( 0, 2 ); 429 setCurrentCell( 0, 2 );
423 setSorting(true ); 430 setSorting(true );
431 mDayTimer->start( 60 * 1000 ); // gone in 60 seconds?
424} 432}
425void TodoTable::updateVisible() 433void TodoTable::updateVisible()
@@ -782,4 +790,19 @@ void TodoTable::applyJournal()
782 } 790 }
783} 791}
792void 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
785/* 808/*
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
@@ -168,4 +168,5 @@ private slots:
168 void slotShowMenu(); 168 void slotShowMenu();
169 void rowHeightChanged( int row ); 169 void rowHeightChanged( int row );
170 void slotCheckDay(); // check the day
170 171
171private: 172private:
@@ -177,4 +178,6 @@ private:
177 QString showCat; 178 QString showCat;
178 QTimer *menuTimer; 179 QTimer *menuTimer;
180 QDate mDay;
181 QTimer *mDayTimer; // see if the day changed
179 bool enablePainting; 182 bool enablePainting;
180 Categories mCat; 183 Categories mCat;