-rw-r--r-- | core/pim/todo/todotable.h | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/core/pim/todo/todotable.h b/core/pim/todo/todotable.h index 288ff90..32df514 100644 --- a/core/pim/todo/todotable.h +++ b/core/pim/todo/todotable.h | |||
@@ -77,6 +77,19 @@ public: | |||
77 | QString key () const { return Qtopia::buildSortKey( text() ); } | 77 | QString key () const { return Qtopia::buildSortKey( text() ); } |
78 | }; | 78 | }; |
79 | 79 | ||
80 | class DueTextItem : public QTableItem | ||
81 | { | ||
82 | public: | ||
83 | DueTextItem( QTable *t, ToDoEvent *ev ); | ||
84 | QString key() const; | ||
85 | void setToDoEvent( const ToDoEvent *ev ); | ||
86 | void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected ); | ||
87 | private: | ||
88 | int m_off; | ||
89 | bool m_hasDate:1; | ||
90 | bool m_completed:1; | ||
91 | |||
92 | }; | ||
80 | 93 | ||
81 | 94 | ||
82 | enum journal_action { ACTION_ADD, ACTION_REMOVE, ACTION_REPLACE }; | 95 | enum journal_action { ACTION_ADD, ACTION_REMOVE, ACTION_REPLACE }; |
@@ -98,7 +111,6 @@ public: | |||
98 | void setShowCompleted( bool sc ) { showComp = sc; updateVisible(); } | 111 | void setShowCompleted( bool sc ) { showComp = sc; updateVisible(); } |
99 | bool showCompleted() const { return showComp; } | 112 | bool showCompleted() const { return showComp; } |
100 | 113 | ||
101 | /* added 20.01.2k2 by se */ | ||
102 | void setShowDeadline (bool sd) {showDeadl = sd; updateVisible();} | 114 | void setShowDeadline (bool sd) {showDeadl = sd; updateVisible();} |
103 | bool showDeadline() const { return showDeadl;} | 115 | bool showDeadline() const { return showDeadl;} |
104 | 116 | ||
@@ -163,9 +175,7 @@ private: | |||
163 | bool enablePainting; | 175 | bool enablePainting; |
164 | Categories mCat; | 176 | Categories mCat; |
165 | int currFindRow; | 177 | int currFindRow; |
166 | 178 | bool showDeadl:1; | |
167 | /* added 20.01.2k2 by se */ | ||
168 | bool showDeadl; | ||
169 | }; | 179 | }; |
170 | 180 | ||
171 | 181 | ||
@@ -181,19 +191,8 @@ inline void TodoTable::insertIntoTable( ToDoEvent *todo, int row ) | |||
181 | QTableItem *ti = new TodoTextItem( this, todo->description().left(40).simplifyWhiteSpace() ); | 191 | QTableItem *ti = new TodoTextItem( this, todo->description().left(40).simplifyWhiteSpace() ); |
182 | ti->setReplaceable( false ); | 192 | ti->setReplaceable( false ); |
183 | 193 | ||
184 | /* added 20.01.2k2 by se */ | 194 | DueTextItem *due = new DueTextItem(this, todo ); |
185 | QTableItem *dl = NULL; | 195 | setItem( row, 3, due); |
186 | if (todo->hasDate()){ | ||
187 | QDate *today = new QDate (QDate::currentDate()); | ||
188 | if (today){ | ||
189 | dl = new TodoTextItem (this, tr ("%1"). | ||
190 | arg(today->daysTo(todo->date()))); | ||
191 | delete (today); | ||
192 | } | ||
193 | }else{ | ||
194 | dl = new TodoTextItem (this,"n.d."); | ||
195 | } | ||
196 | setItem( row, 3, dl); | ||
197 | 196 | ||
198 | setItem( row, 0, chk ); | 197 | setItem( row, 0, chk ); |
199 | setItem( row, 1, cmb ); | 198 | setItem( row, 1, cmb ); |
@@ -207,7 +206,8 @@ inline void TodoTable::realignTable( int row ) | |||
207 | { | 206 | { |
208 | QTableItem *ti1, | 207 | QTableItem *ti1, |
209 | *ti2, | 208 | *ti2, |
210 | *ti3; | 209 | *ti3, |
210 | *ti4; | ||
211 | int totalRows = numRows(); | 211 | int totalRows = numRows(); |
212 | for ( int curr = row; curr < totalRows - 1; curr++ ) { | 212 | for ( int curr = row; curr < totalRows - 1; curr++ ) { |
213 | // this is bad, we must take the item out and then | 213 | // this is bad, we must take the item out and then |
@@ -217,12 +217,15 @@ inline void TodoTable::realignTable( int row ) | |||
217 | ti1 = item( curr + 1, 0 ); | 217 | ti1 = item( curr + 1, 0 ); |
218 | ti2 = item( curr + 1, 1 ); | 218 | ti2 = item( curr + 1, 1 ); |
219 | ti3 = item( curr + 1, 2 ); | 219 | ti3 = item( curr + 1, 2 ); |
220 | ti4 = item( curr + 1, 3 ); | ||
220 | takeItem( ti1 ); | 221 | takeItem( ti1 ); |
221 | takeItem( ti2 ); | 222 | takeItem( ti2 ); |
222 | takeItem( ti3 ); | 223 | takeItem( ti3 ); |
224 | takeItem( ti4 ); | ||
223 | setItem( curr, 0, ti1 ); | 225 | setItem( curr, 0, ti1 ); |
224 | setItem( curr, 1, ti2 ); | 226 | setItem( curr, 1, ti2 ); |
225 | setItem( curr, 2, ti3 ); | 227 | setItem( curr, 2, ti3 ); |
228 | setItem( curr, 3, ti4 ); | ||
226 | } | 229 | } |
227 | setNumRows( totalRows - 1 ); | 230 | setNumRows( totalRows - 1 ); |
228 | } | 231 | } |