author | zecke <zecke> | 2002-10-07 23:37:48 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-07 23:37:48 (UTC) |
commit | 626183d58f43f010f5cfb055f8582be0227ff59c (patch) (unidiff) | |
tree | ad219a64b642fe63480f04cca7c37de4795c5e84 | |
parent | cdc6cad191b866d481085da1d05806afb5602b2c (diff) | |
download | opie-626183d58f43f010f5cfb055f8582be0227ff59c.zip opie-626183d58f43f010f5cfb055f8582be0227ff59c.tar.gz opie-626183d58f43f010f5cfb055f8582be0227ff59c.tar.bz2 |
We're now using a home made painting of cells
This will theoretically speed up things
Currently it's noticeable slower on SQL
Cause we do up to 80 queries for 10 different
items. As you see a cache could be the answer to these
problems.
The reason for custom drawing is speed and memory consumption.
Take the unlikely case of 10.000 items
We would have 40.000 QTableItem
but would only show 40 of them at a time.
The rest seems to be wasted
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 3 | ||||
-rw-r--r-- | core/pim/todo/tableitems.cpp | 4 | ||||
-rw-r--r-- | core/pim/todo/tableview.cpp | 233 | ||||
-rw-r--r-- | core/pim/todo/tableview.h | 44 | ||||
-rw-r--r-- | core/pim/todo/todoview.h | 2 |
5 files changed, 126 insertions, 160 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 47c0160..7e7d2f7 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -480,9 +480,10 @@ void MainWindow::slotDeleteCompleted() { | |||
480 | 480 | ||
481 | if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all completed tasks?") ) ) | 481 | if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all completed tasks?") ) ) |
482 | return; | 482 | return; |
483 | 483 | ||
484 | m_todoMgr.remove( currentView()->completed() ); | 484 | // FIXME |
485 | //m_todoMgr.remove( currentView()->completed() ); | ||
485 | currentView()->updateView( ); | 486 | currentView()->updateView( ); |
486 | } | 487 | } |
487 | void MainWindow::slotFind() { | 488 | void MainWindow::slotFind() { |
488 | 489 | ||
diff --git a/core/pim/todo/tableitems.cpp b/core/pim/todo/tableitems.cpp index ebfefc8..86fe07d 100644 --- a/core/pim/todo/tableitems.cpp +++ b/core/pim/todo/tableitems.cpp | |||
@@ -47,9 +47,9 @@ void CheckItem::setChecked( bool b ) { | |||
47 | void CheckItem::toggle() { | 47 | void CheckItem::toggle() { |
48 | TableView* view = static_cast<TableView*>( table() ); | 48 | TableView* view = static_cast<TableView*>( table() ); |
49 | OTodo ev = view->find( view->current() ); | 49 | OTodo ev = view->find( view->current() ); |
50 | ev.setCompleted(!isChecked() ); | 50 | ev.setCompleted(!isChecked() ); |
51 | view->updateFromTable( ev ); | 51 | //view->updateFromTable( ev ); |
52 | 52 | ||
53 | OCheckItem::toggle(); | 53 | OCheckItem::toggle(); |
54 | table()->updateCell( row(), col() ); | 54 | table()->updateCell( row(), col() ); |
55 | } | 55 | } |
@@ -93,9 +93,9 @@ void ComboItem::setContentFromEditor( QWidget* w) { | |||
93 | else | 93 | else |
94 | QTableItem::setContentFromEditor( w ); | 94 | QTableItem::setContentFromEditor( w ); |
95 | 95 | ||
96 | ev.setPriority( text().toInt() ); | 96 | ev.setPriority( text().toInt() ); |
97 | view->updateFromTable( ev ); | 97 | //view->updateFromTable( ev ); |
98 | } | 98 | } |
99 | void ComboItem::setText( const QString& s ) { | 99 | void ComboItem::setText( const QString& s ) { |
100 | if ( m_cb ) | 100 | if ( m_cb ) |
101 | m_cb->setCurrentItem( s.toInt()-1 ); | 101 | m_cb->setCurrentItem( s.toInt()-1 ); |
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index eaaf1bc..5594b13 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp | |||
@@ -35,8 +35,13 @@ | |||
35 | #include "tableview.h" | 35 | #include "tableview.h" |
36 | 36 | ||
37 | using namespace Todo; | 37 | using namespace Todo; |
38 | 38 | ||
39 | namespace { | ||
40 | static const int BoxSize = 14; | ||
41 | static const int RowHeight = 20; | ||
42 | } | ||
43 | |||
39 | 44 | ||
40 | TableView::TableView( MainWindow* window, QWidget* wid ) | 45 | TableView::TableView( MainWindow* window, QWidget* wid ) |
41 | : QTable( wid ), TodoView( window ) { | 46 | : QTable( wid ), TodoView( window ) { |
42 | setUpdatesEnabled( false ); | 47 | setUpdatesEnabled( false ); |
@@ -99,38 +104,14 @@ void TableView::slotShowMenu() { | |||
99 | QPopupMenu *menu = todoWindow()->contextMenu( current() ); | 104 | QPopupMenu *menu = todoWindow()->contextMenu( current() ); |
100 | menu->exec(QCursor::pos() ); | 105 | menu->exec(QCursor::pos() ); |
101 | delete menu; | 106 | delete menu; |
102 | } | 107 | } |
103 | OTodo TableView::find(int uid ) { | ||
104 | OTodo ev = TodoView::event( uid ); | ||
105 | return ev; | ||
106 | } | ||
107 | void TableView::updateFromTable( const OTodo& ev, CheckItem* item ) { | ||
108 | TodoView::update( ev.uid(), ev ); | ||
109 | |||
110 | /* update the other columns */ | ||
111 | /* if completed or not we need to update | ||
112 | * the table | ||
113 | * | ||
114 | * We've two cases | ||
115 | * either item or !item | ||
116 | * this makes cases more easy | ||
117 | */ | ||
118 | if ( !item ) { | ||
119 | item = m_cache[ev.uid()]; | ||
120 | } | ||
121 | DueTextItem *due = dueItem( item->row() ); | ||
122 | due->setCompleted( ev.isCompleted() ); | ||
123 | } | ||
124 | QString TableView::type() const { | 108 | QString TableView::type() const { |
125 | return QString::fromLatin1( tr("Table View") ); | 109 | return QString::fromLatin1( tr("Table View") ); |
126 | } | 110 | } |
127 | int TableView::current() { | 111 | int TableView::current() { |
128 | int cur = 0; | 112 | int cur = 0; |
129 | CheckItem* i = checkItem( currentRow() ); | 113 | // FIXME |
130 | if (i ) | ||
131 | cur = i->uid(); | ||
132 | |||
133 | return cur; | 114 | return cur; |
134 | } | 115 | } |
135 | QString TableView::currentRepresentation() { | 116 | QString TableView::currentRepresentation() { |
136 | return text( currentRow(), 2); | 117 | return text( currentRow(), 2); |
@@ -147,98 +128,53 @@ void TableView::updateView( ) { | |||
147 | sort(); | 128 | sort(); |
148 | OTodoAccess::List::Iterator it, end; | 129 | OTodoAccess::List::Iterator it, end; |
149 | it = sorted().begin(); | 130 | it = sorted().begin(); |
150 | end = sorted().end(); | 131 | end = sorted().end(); |
132 | |||
151 | qWarning("setTodos"); | 133 | qWarning("setTodos"); |
152 | QTime time; | 134 | QTime time; |
153 | time.start(); | 135 | time.start(); |
154 | m_enablePaint = false; | 136 | m_enablePaint = false; |
155 | setUpdatesEnabled( false ); | 137 | setUpdatesEnabled( false ); |
156 | viewport()->setUpdatesEnabled( false ); | 138 | viewport()->setUpdatesEnabled( false ); |
157 | clear(); | 139 | |
158 | QString currentCat = todoWindow()->currentCategory(); | ||
159 | bool showCompleted = todoWindow()->showCompleted(); | ||
160 | bool showOverDue = todoWindow()->showOverDue(); | ||
161 | qWarning( "Current Category:" + todoWindow()->currentCategory() ); | ||
162 | int id = todoWindow()->currentCatId(); | ||
163 | QTime t; | 140 | QTime t; |
164 | t.start(); | 141 | t.start(); |
165 | setNumRows( it.count() ); | 142 | setNumRows( it.count() ); |
166 | uint i = 0; | ||
167 | for (; it != end; ++it ) { | ||
168 | OTodo todo = (*it); | ||
169 | /* test if the categories match */ | ||
170 | if ( !currentCat.isEmpty() && | ||
171 | !todo.categories().contains( id ) ) { | ||
172 | continue; | ||
173 | } | ||
174 | /* the item is completed but we shouldn't show it */ | ||
175 | if ( !showCompleted && todo.isCompleted() ) { | ||
176 | qWarning("isCompleted "); | ||
177 | continue; | ||
178 | } | ||
179 | /* the item is not overdue but we should only show overdue */ | ||
180 | if ( showOverDue && !todo.isOverdue() ) { | ||
181 | continue; | ||
182 | } | ||
183 | /* now it's fine to add it */ | ||
184 | insertTodo( todo, i ); | ||
185 | i++; | ||
186 | } | ||
187 | setNumRows( i ); | ||
188 | int elc = time.elapsed(); | 143 | int elc = time.elapsed(); |
189 | qWarning("Adding took %d", elc/1000 ); | 144 | qWarning("Adding took %d", elc/1000 ); |
190 | setUpdatesEnabled( true ); | 145 | setUpdatesEnabled( true ); |
191 | viewport()->setUpdatesEnabled( true ); | 146 | viewport()->setUpdatesEnabled( true ); |
192 | viewport()->update(); | 147 | viewport()->update(); |
148 | |||
193 | m_enablePaint = true; | 149 | m_enablePaint = true; |
194 | int el = time.elapsed(); | 150 | int el = time.elapsed(); |
195 | qWarning("adding took %d", el/1000 ); | 151 | qWarning("adding took %d", el/1000 ); |
196 | } | 152 | } |
197 | void TableView::setTodo( int uid, const OTodo& ev ) { | 153 | void TableView::setTodo( int, const OTodo&) { |
198 | QMap<int, CheckItem*>::Iterator it = m_cache.find( uid ); | 154 | sort(); |
199 | |||
200 | if ( it != m_cache.end() ) { | ||
201 | int row = it.data()->row(); | ||
202 | |||
203 | /* update checked */ | ||
204 | CheckItem* check = checkItem(row ); | ||
205 | if (check) | ||
206 | check->setChecked( ev.isCompleted() ); | ||
207 | |||
208 | /* update the text */ | ||
209 | QString sum = ev.summary(); | ||
210 | setText(row, 2, sum.isEmpty() ? | ||
211 | ev.description().left(40).simplifyWhiteSpace() : | ||
212 | sum ); | ||
213 | |||
214 | /* update priority */ | ||
215 | setText(row, 1, QString::number( ev.priority() ) ); | ||
216 | 155 | ||
217 | /* update DueDate */ | 156 | /* repaint */ |
218 | DueTextItem *due = dueItem( row ); | 157 | QTable::update(); |
219 | due->setToDoEvent( ev ); | ||
220 | } | ||
221 | } | 158 | } |
222 | void TableView::addEvent( const OTodo& ev) { | 159 | void TableView::addEvent( const OTodo&) { |
223 | int row= numRows(); | 160 | sort(); |
224 | setNumRows( row + 1 ); | 161 | |
225 | insertTodo( ev, row ); | 162 | QTable::update(); |
226 | } | 163 | } |
227 | /* | 164 | /* |
228 | * find the event | 165 | * find the event |
229 | * and then replace the complete row | 166 | * and then replace the complete row |
230 | */ | 167 | */ |
231 | void TableView::replaceEvent( const OTodo& ev) { | 168 | void TableView::replaceEvent( const OTodo& ev) { |
232 | setTodo( ev.uid(), ev ); | 169 | addEvent( ev ); |
233 | } | 170 | } |
234 | /* | 171 | /* |
235 | * re aligning table can be slow too | 172 | * re aligning table can be slow too |
236 | * FIXME: look what performs better | 173 | * FIXME: look what performs better |
237 | * either this or the old align table | 174 | * either this or the old align table |
238 | */ | 175 | */ |
239 | void TableView::removeEvent( int ) { | 176 | void TableView::removeEvent( int ) { |
240 | clear(); | ||
241 | updateView(); | 177 | updateView(); |
242 | } | 178 | } |
243 | void TableView::setShowCompleted( bool b) { | 179 | void TableView::setShowCompleted( bool b) { |
244 | qWarning("Show Completed %d" + b ); | 180 | qWarning("Show Completed %d" + b ); |
@@ -255,43 +191,21 @@ void TableView::setShowCategory( const QString& ) { | |||
255 | qWarning("setShowCategory"); | 191 | qWarning("setShowCategory"); |
256 | updateView(); | 192 | updateView(); |
257 | } | 193 | } |
258 | void TableView::clear() { | 194 | void TableView::clear() { |
259 | m_cache.clear(); | 195 | setNumRows(0); |
260 | int rows = numRows(); | ||
261 | for (int r = 0; r < rows; r++ ) { | ||
262 | for (int c = 0; c < numCols(); c++ ) { | ||
263 | if ( cellWidget(r, c) ) | ||
264 | clearCellWidget(r, c ); | ||
265 | clearCell(r, c); | ||
266 | } | ||
267 | } | ||
268 | setNumRows( 0); | ||
269 | } | ||
270 | QArray<int> TableView::completed() { | ||
271 | int row = numRows(); | ||
272 | QArray<int> ids( row ); | ||
273 | |||
274 | int j=0; | ||
275 | for (int i = 0; i < row; i++ ) { | ||
276 | CheckItem* item = checkItem(i ); | ||
277 | if (item->isChecked() ) { | ||
278 | ids[j] = item->uid(); | ||
279 | j++; | ||
280 | } | ||
281 | } | ||
282 | ids.resize( j ); | ||
283 | return ids; | ||
284 | } | 196 | } |
285 | void TableView::slotClicked(int row, int col, int, | 197 | void TableView::slotClicked(int row, int col, int, |
286 | const QPoint& point) { | 198 | const QPoint& point) { |
287 | if ( !cellGeometry(row, col ).contains(point ) ) | 199 | if ( !cellGeometry(row, col ).contains(point ) ) |
288 | return; | 200 | return; |
201 | int ui=0; // FIXME = uid(row); | ||
289 | 202 | ||
290 | 203 | ||
291 | switch( col ) { | 204 | switch( col ) { |
292 | case 0: { | 205 | case 0: { |
293 | CheckItem* item = checkItem( row ); | 206 | // FIXME |
207 | CheckItem* item = 0l; | ||
294 | /* | 208 | /* |
295 | * let's see if we centered clicked | 209 | * let's see if we centered clicked |
296 | */ | 210 | */ |
297 | if ( item ) { | 211 | if ( item ) { |
@@ -312,14 +226,14 @@ void TableView::slotClicked(int row, int col, int, | |||
312 | break; | 226 | break; |
313 | 227 | ||
314 | case 2: { | 228 | case 2: { |
315 | m_menuTimer->stop(); | 229 | m_menuTimer->stop(); |
316 | showTodo( checkItem(row)->uid() ); | 230 | showTodo( ui ); |
317 | break; | 231 | break; |
318 | } | 232 | } |
319 | case 3: { | 233 | case 3: { |
320 | m_menuTimer->stop(); | 234 | m_menuTimer->stop(); |
321 | TodoView::edit( checkItem(row)->uid() ); | 235 | TodoView::edit( ui ); |
322 | break; | 236 | break; |
323 | } | 237 | } |
324 | } | 238 | } |
325 | 239 | ||
@@ -337,26 +251,17 @@ void TableView::slotValueChanged( int, int ) { | |||
337 | } | 251 | } |
338 | void TableView::slotCurrentChanged(int, int ) { | 252 | void TableView::slotCurrentChanged(int, int ) { |
339 | m_menuTimer->stop(); | 253 | m_menuTimer->stop(); |
340 | } | 254 | } |
341 | /* | ||
342 | * hardcode to column 0 | ||
343 | */ | ||
344 | CheckItem* TableView::checkItem( int row ) { | ||
345 | CheckItem *i = static_cast<CheckItem*>( item( row, 0 ) ); | ||
346 | return i; | ||
347 | } | ||
348 | DueTextItem* TableView::dueItem( int row ) { | ||
349 | DueTextItem* i = static_cast<DueTextItem*> ( item(row, 3 ) ); | ||
350 | return i; | ||
351 | } | ||
352 | QWidget* TableView::widget() { | 255 | QWidget* TableView::widget() { |
353 | return this; | 256 | return this; |
354 | } | 257 | } |
355 | /* | 258 | /* |
356 | * We need to overwrite sortColumn | 259 | * We need to overwrite sortColumn |
357 | * because we want to sort whole row | 260 | * because we want to sort whole row |
358 | * based | 261 | * based |
262 | * We event want to set the setOrder | ||
263 | * to a sort() and update() | ||
359 | */ | 264 | */ |
360 | void TableView::sortColumn( int row, bool asc, bool ) { | 265 | void TableView::sortColumn( int row, bool asc, bool ) { |
361 | QTable::sortColumn( row, asc, TRUE ); | 266 | QTable::sortColumn( row, asc, TRUE ); |
362 | 267 | ||
@@ -365,4 +270,90 @@ void TableView::viewportPaintEvent( QPaintEvent* e) { | |||
365 | qWarning("Paint event" ); | 270 | qWarning("Paint event" ); |
366 | if (m_enablePaint ) | 271 | if (m_enablePaint ) |
367 | QTable::viewportPaintEvent( e ); | 272 | QTable::viewportPaintEvent( e ); |
368 | } | 273 | } |
274 | /* | ||
275 | * This segment is copyrighted by TT | ||
276 | * it was taken from their todolist | ||
277 | * application this code is GPL | ||
278 | */ | ||
279 | void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { | ||
280 | const QColorGroup &cg = colorGroup(); | ||
281 | |||
282 | p->save(); | ||
283 | |||
284 | OTodo task = sorted()[row]; | ||
285 | |||
286 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); | ||
287 | |||
288 | QPen op = p->pen(); | ||
289 | p->setPen(cg.mid()); | ||
290 | p->drawLine( 0, cr.height() - 1, cr.width() - 1, cr.height() - 1 ); | ||
291 | p->drawLine( cr.width() - 1, 0, cr.width() - 1, cr.height() - 1 ); | ||
292 | p->setPen(op); | ||
293 | |||
294 | QFont f = p->font(); | ||
295 | QFontMetrics fm(f); | ||
296 | |||
297 | switch(col) { | ||
298 | case 0: | ||
299 | { | ||
300 | // completed field | ||
301 | int marg = ( cr.width() - BoxSize ) / 2; | ||
302 | int x = 0; | ||
303 | int y = ( cr.height() - BoxSize ) / 2; | ||
304 | p->setPen( QPen( cg.text() ) ); | ||
305 | p->drawRect( x + marg, y, BoxSize, BoxSize ); | ||
306 | p->drawRect( x + marg+1, y+1, BoxSize-2, BoxSize-2 ); | ||
307 | p->setPen( darkGreen ); | ||
308 | x += 1; | ||
309 | y += 1; | ||
310 | if ( task.isCompleted() ) { | ||
311 | QPointArray a( 9*2 ); | ||
312 | int i, xx, yy; | ||
313 | xx = x+2+marg; | ||
314 | yy = y+4; | ||
315 | for ( i=0; i<4; i++ ) { | ||
316 | a.setPoint( 2*i, xx, yy ); | ||
317 | a.setPoint( 2*i+1, xx, yy+2 ); | ||
318 | xx++; yy++; | ||
319 | } | ||
320 | yy -= 2; | ||
321 | for ( i=4; i<9; i++ ) { | ||
322 | a.setPoint( 2*i, xx, yy ); | ||
323 | a.setPoint( 2*i+1, xx, yy+2 ); | ||
324 | xx++; yy--; | ||
325 | } | ||
326 | p->drawLineSegments( a ); | ||
327 | } | ||
328 | } | ||
329 | break; | ||
330 | case 1: | ||
331 | // priority field | ||
332 | { | ||
333 | QString text = QString::number(task.priority()); | ||
334 | p->drawText(2,2 + fm.ascent(), text); | ||
335 | } | ||
336 | break; | ||
337 | case 2: | ||
338 | // description field | ||
339 | { | ||
340 | QString text = task.summary().isEmpty() ? | ||
341 | task.description() : | ||
342 | task.summary(); | ||
343 | p->drawText(2,2 + fm.ascent(), text); | ||
344 | } | ||
345 | break; | ||
346 | case 3: | ||
347 | { | ||
348 | QString text; | ||
349 | if (task.hasDueDate()) { | ||
350 | text = "HAS"; | ||
351 | } else { | ||
352 | text = tr("None"); | ||
353 | } | ||
354 | p->drawText(2,2 + fm.ascent(), text); | ||
355 | } | ||
356 | break; | ||
357 | } | ||
358 | p->restore(); | ||
359 | } | ||
diff --git a/core/pim/todo/tableview.h b/core/pim/todo/tableview.h index 1fa21b2..b608204 100644 --- a/core/pim/todo/tableview.h +++ b/core/pim/todo/tableview.h | |||
@@ -45,15 +45,14 @@ namespace Todo { | |||
45 | public: | 45 | public: |
46 | TableView( MainWindow*, QWidget* parent ); | 46 | TableView( MainWindow*, QWidget* parent ); |
47 | ~TableView(); | 47 | ~TableView(); |
48 | 48 | ||
49 | void updateFromTable( const OTodo&, CheckItem* = 0 ); | ||
50 | OTodo find(int uid); | ||
51 | 49 | ||
52 | QString type()const; | 50 | QString type()const; |
53 | int current(); | 51 | int current(); |
54 | QString currentRepresentation(); | 52 | QString currentRepresentation(); |
55 | 53 | ||
54 | void clear(); | ||
56 | void showOverDue( bool ); | 55 | void showOverDue( bool ); |
57 | void updateView(); | 56 | void updateView(); |
58 | void setTodo( int uid, const OTodo& ); | 57 | void setTodo( int uid, const OTodo& ); |
59 | void addEvent( const OTodo& event ); | 58 | void addEvent( const OTodo& event ); |
@@ -62,21 +61,23 @@ namespace Todo { | |||
62 | void setShowCompleted( bool ); | 61 | void setShowCompleted( bool ); |
63 | void setShowDeadline( bool ); | 62 | void setShowDeadline( bool ); |
64 | 63 | ||
65 | void setShowCategory(const QString& =QString::null ); | 64 | void setShowCategory(const QString& =QString::null ); |
66 | void clear(); | ||
67 | void newDay(); | 65 | void newDay(); |
68 | QArray<int> completed(); | ||
69 | QWidget* widget(); | 66 | QWidget* widget(); |
70 | void sortColumn(int, bool, bool ); | 67 | void sortColumn(int, bool, bool ); |
68 | |||
69 | /* | ||
70 | * we do our drawing ourselves | ||
71 | * because we don't want to have | ||
72 | * 40.000 QTableItems for 10.000 | ||
73 | * OTodos where we only show 10 at a time! | ||
74 | */ | ||
75 | void paintCell(QPainter* p, int row, int col, const QRect&, bool ); | ||
71 | private: | 76 | private: |
72 | /* reimplented for internal reasons */ | 77 | /* reimplented for internal reasons */ |
73 | void viewportPaintEvent( QPaintEvent* ); | 78 | void viewportPaintEvent( QPaintEvent* ); |
74 | inline void insertTodo( const OTodo&, int row ); | ||
75 | CheckItem* checkItem( int row ); | ||
76 | DueTextItem* dueItem( int row ); | ||
77 | QTimer *m_menuTimer; | 79 | QTimer *m_menuTimer; |
78 | QMap<int, CheckItem*> m_cache; | ||
79 | bool m_enablePaint:1; | 80 | bool m_enablePaint:1; |
80 | 81 | ||
81 | private slots: | 82 | private slots: |
82 | void slotShowMenu(); | 83 | void slotShowMenu(); |
@@ -86,34 +87,7 @@ private slots: | |||
86 | const QPoint& ); | 87 | const QPoint& ); |
87 | void slotValueChanged(int, int); | 88 | void slotValueChanged(int, int); |
88 | void slotCurrentChanged(int, int ); | 89 | void slotCurrentChanged(int, int ); |
89 | }; | 90 | }; |
90 | inline void TableView::insertTodo( const OTodo& event, int row ) { | ||
91 | |||
92 | |||
93 | QString sortKey = (char) ( (event.isCompleted() ? 'a' : 'A' ) | ||
94 | + event.priority() ) | ||
95 | + Qtopia::buildSortKey( event.description() ); | ||
96 | CheckItem *chk = new CheckItem( this, sortKey, event.uid(), event.categories() ); | ||
97 | chk->setChecked( event.isCompleted() ); | ||
98 | |||
99 | ComboItem *cmb = new ComboItem(this, QTableItem::WhenCurrent ); | ||
100 | cmb->setText( QString::number( event.priority() ) ); | ||
101 | |||
102 | QString sum = event.summary(); | ||
103 | QTableItem* ti = new TodoTextItem( this, sum.isEmpty() ? | ||
104 | event.description().left(40).simplifyWhiteSpace() : | ||
105 | sum ); | ||
106 | ti->setReplaceable( FALSE ); | ||
107 | |||
108 | DueTextItem *due = new DueTextItem(this, event ); | ||
109 | |||
110 | setItem( row, 0, chk ); | ||
111 | setItem( row, 1, cmb ); | ||
112 | setItem( row, 2, ti ); | ||
113 | setItem( row, 3, due ); | ||
114 | |||
115 | m_cache.insert( event.uid(), chk ); | ||
116 | } | ||
117 | }; | 91 | }; |
118 | 92 | ||
119 | #endif | 93 | #endif |
diff --git a/core/pim/todo/todoview.h b/core/pim/todo/todoview.h index 81ace3a..9408ef1 100644 --- a/core/pim/todo/todoview.h +++ b/core/pim/todo/todoview.h | |||
@@ -101,9 +101,9 @@ namespace Todo { | |||
101 | virtual void setShowCompleted( bool ) = 0; | 101 | virtual void setShowCompleted( bool ) = 0; |
102 | virtual void setShowDeadline( bool ) = 0; | 102 | virtual void setShowDeadline( bool ) = 0; |
103 | virtual void setShowCategory( const QString& = QString::null ) = 0; | 103 | virtual void setShowCategory( const QString& = QString::null ) = 0; |
104 | virtual void clear() = 0; | 104 | virtual void clear() = 0; |
105 | virtual QArray<int> completed() = 0; | 105 | /* virtual QArray<int> completed() = 0; */ |
106 | virtual void newDay() = 0; | 106 | virtual void newDay() = 0; |
107 | 107 | ||
108 | virtual void connectShow( QObject*, const char* ) = 0; | 108 | virtual void connectShow( QObject*, const char* ) = 0; |
109 | virtual void connectEdit( QObject*, const char* ) = 0; | 109 | virtual void connectEdit( QObject*, const char* ) = 0; |