-rw-r--r-- | core/pim/todo/tableview.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index 8cd2e7e..097af39 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp | |||
@@ -81,25 +81,25 @@ TableView::TableView( MainWindow* window, QWidget* wid ) | |||
81 | this, SLOT(slotShowMenu()) ); | 81 | this, SLOT(slotShowMenu()) ); |
82 | 82 | ||
83 | m_enablePaint = true; | 83 | m_enablePaint = true; |
84 | setUpdatesEnabled( true ); | 84 | setUpdatesEnabled( true ); |
85 | viewport()->setUpdatesEnabled( true ); | 85 | viewport()->setUpdatesEnabled( true ); |
86 | viewport()->update(); | 86 | viewport()->update(); |
87 | } | 87 | } |
88 | /* a new day has started | 88 | /* a new day has started |
89 | * update the day | 89 | * update the day |
90 | */ | 90 | */ |
91 | void TableView::newDay() { | 91 | void TableView::newDay() { |
92 | clear(); | 92 | clear(); |
93 | setTodos( begin(),end() ); | 93 | updateView(); |
94 | } | 94 | } |
95 | TableView::~TableView() { | 95 | TableView::~TableView() { |
96 | 96 | ||
97 | } | 97 | } |
98 | void TableView::slotShowMenu() { | 98 | void TableView::slotShowMenu() { |
99 | QPopupMenu *menu = todoWindow()->contextMenu( current() ); | 99 | QPopupMenu *menu = todoWindow()->contextMenu( current() ); |
100 | menu->exec(QCursor::pos() ); | 100 | menu->exec(QCursor::pos() ); |
101 | delete menu; | 101 | delete menu; |
102 | } | 102 | } |
103 | OTodo TableView::find(int uid ) { | 103 | OTodo TableView::find(int uid ) { |
104 | OTodo ev = TodoView::event( uid ); | 104 | OTodo ev = TodoView::event( uid ); |
105 | return ev; | 105 | return ev; |
@@ -129,29 +129,31 @@ int TableView::current() { | |||
129 | CheckItem* i = checkItem( currentRow() ); | 129 | CheckItem* i = checkItem( currentRow() ); |
130 | if (i ) | 130 | if (i ) |
131 | cur = i->uid(); | 131 | cur = i->uid(); |
132 | 132 | ||
133 | return cur; | 133 | return cur; |
134 | } | 134 | } |
135 | QString TableView::currentRepresentation() { | 135 | QString TableView::currentRepresentation() { |
136 | return text( currentRow(), 2); | 136 | return text( currentRow(), 2); |
137 | } | 137 | } |
138 | /* show overdue */ | 138 | /* show overdue */ |
139 | void TableView::showOverDue( bool ) { | 139 | void TableView::showOverDue( bool ) { |
140 | clear(); | 140 | clear(); |
141 | setTodos( begin(), end() ); | 141 | updateView(); |
142 | } | 142 | } |
143 | 143 | ||
144 | void TableView::setTodos( OTodoAccess::List::Iterator it, | 144 | void TableView::updateView( ) { |
145 | OTodoAccess::List::Iterator end ) { | 145 | OTodoAccess::List::Iterator it, end; |
146 | it = list().begin(); | ||
147 | end = list().end(); | ||
146 | qWarning("setTodos"); | 148 | qWarning("setTodos"); |
147 | QTime time; | 149 | QTime time; |
148 | time.start(); | 150 | time.start(); |
149 | m_enablePaint = false; | 151 | m_enablePaint = false; |
150 | setUpdatesEnabled( false ); | 152 | setUpdatesEnabled( false ); |
151 | viewport()->setUpdatesEnabled( false ); | 153 | viewport()->setUpdatesEnabled( false ); |
152 | clear(); | 154 | clear(); |
153 | QString currentCat = todoWindow()->currentCategory(); | 155 | QString currentCat = todoWindow()->currentCategory(); |
154 | bool showCompleted = todoWindow()->showCompleted(); | 156 | bool showCompleted = todoWindow()->showCompleted(); |
155 | bool showOverDue = todoWindow()->showOverDue(); | 157 | bool showOverDue = todoWindow()->showOverDue(); |
156 | qWarning( "Current Category:" + todoWindow()->currentCategory() ); | 158 | qWarning( "Current Category:" + todoWindow()->currentCategory() ); |
157 | int id = todoWindow()->currentCatId(); | 159 | int id = todoWindow()->currentCatId(); |
@@ -224,40 +226,40 @@ void TableView::addEvent( const OTodo& ev) { | |||
224 | * and then replace the complete row | 226 | * and then replace the complete row |
225 | */ | 227 | */ |
226 | void TableView::replaceEvent( const OTodo& ev) { | 228 | void TableView::replaceEvent( const OTodo& ev) { |
227 | setTodo( ev.uid(), ev ); | 229 | setTodo( ev.uid(), ev ); |
228 | } | 230 | } |
229 | /* | 231 | /* |
230 | * re aligning table can be slow too | 232 | * re aligning table can be slow too |
231 | * FIXME: look what performs better | 233 | * FIXME: look what performs better |
232 | * either this or the old align table | 234 | * either this or the old align table |
233 | */ | 235 | */ |
234 | void TableView::removeEvent( int ) { | 236 | void TableView::removeEvent( int ) { |
235 | clear(); | 237 | clear(); |
236 | setTodos( begin(), end() ); | 238 | updateView(); |
237 | } | 239 | } |
238 | void TableView::setShowCompleted( bool b) { | 240 | void TableView::setShowCompleted( bool b) { |
239 | qWarning("Show Completed %d" + b ); | 241 | qWarning("Show Completed %d" + b ); |
240 | setTodos( begin(), end() ); | 242 | updateView(); |
241 | } | 243 | } |
242 | void TableView::setShowDeadline( bool b) { | 244 | void TableView::setShowDeadline( bool b) { |
243 | qWarning("Show DeadLine %d" + b ); | 245 | qWarning("Show DeadLine %d" + b ); |
244 | if (b) | 246 | if (b) |
245 | showColumn(3 ); | 247 | showColumn(3 ); |
246 | else | 248 | else |
247 | hideColumn(3 ); | 249 | hideColumn(3 ); |
248 | } | 250 | } |
249 | void TableView::setShowCategory( const QString& ) { | 251 | void TableView::setShowCategory( const QString& ) { |
250 | qWarning("setShowCategory"); | 252 | qWarning("setShowCategory"); |
251 | setTodos( begin(), end() ); | 253 | updateView(); |
252 | } | 254 | } |
253 | void TableView::clear() { | 255 | void TableView::clear() { |
254 | m_cache.clear(); | 256 | m_cache.clear(); |
255 | int rows = numRows(); | 257 | int rows = numRows(); |
256 | for (int r = 0; r < rows; r++ ) { | 258 | for (int r = 0; r < rows; r++ ) { |
257 | for (int c = 0; c < numCols(); c++ ) { | 259 | for (int c = 0; c < numCols(); c++ ) { |
258 | if ( cellWidget(r, c) ) | 260 | if ( cellWidget(r, c) ) |
259 | clearCellWidget(r, c ); | 261 | clearCellWidget(r, c ); |
260 | clearCell(r, c); | 262 | clearCell(r, c); |
261 | } | 263 | } |
262 | } | 264 | } |
263 | setNumRows( 0); | 265 | setNumRows( 0); |