author | zecke <zecke> | 2002-10-07 14:59:17 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-07 14:59:17 (UTC) |
commit | 645b377506fb32f4519e70d43c020084943debae (patch) (unidiff) | |
tree | 95398d3a8aeb0342e08732c203eda5098beb92cb | |
parent | a7b03f9c31f515747663f07b6665744369e57ba8 (diff) | |
download | opie-645b377506fb32f4519e70d43c020084943debae.zip opie-645b377506fb32f4519e70d43c020084943debae.tar.gz opie-645b377506fb32f4519e70d43c020084943debae.tar.bz2 |
Switch to sorted stuff for TableView as default
Stefan it's safe
-rw-r--r-- | core/pim/todo/tableview.cpp | 7 | ||||
-rw-r--r-- | core/pim/todo/todoview.cpp | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index 097af39..eaaf1bc 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp | |||
@@ -1,339 +1,342 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 <> | 3 | .=l. Copyright (c) 2002 <> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This program is free software; you can | 5 | _;:, .> :=|. This program is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This program is distributed in the hope that | 12 | .i_,=:_. -<s. This program is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <qtimer.h> | 29 | #include <qtimer.h> |
30 | #include <qpoint.h> | 30 | #include <qpoint.h> |
31 | #include <qpopupmenu.h> | 31 | #include <qpopupmenu.h> |
32 | 32 | ||
33 | #include "mainwindow.h" | 33 | #include "mainwindow.h" |
34 | //#include "tableitems.h" | 34 | //#include "tableitems.h" |
35 | #include "tableview.h" | 35 | #include "tableview.h" |
36 | 36 | ||
37 | using namespace Todo; | 37 | using namespace Todo; |
38 | 38 | ||
39 | 39 | ||
40 | TableView::TableView( MainWindow* window, QWidget* wid ) | 40 | TableView::TableView( MainWindow* window, QWidget* wid ) |
41 | : QTable( wid ), TodoView( window ) { | 41 | : QTable( wid ), TodoView( window ) { |
42 | setUpdatesEnabled( false ); | 42 | setUpdatesEnabled( false ); |
43 | viewport()->setUpdatesEnabled( false ); | 43 | viewport()->setUpdatesEnabled( false ); |
44 | m_enablePaint = false; | 44 | m_enablePaint = false; |
45 | setNumRows(0); | 45 | setNumRows(0); |
46 | setNumCols(4); | 46 | setNumCols(4); |
47 | 47 | ||
48 | setSorting( TRUE ); | 48 | setSorting( TRUE ); |
49 | setSelectionMode( NoSelection ); | 49 | setSelectionMode( NoSelection ); |
50 | setColumnStretchable( 2, TRUE ); | 50 | setColumnStretchable( 2, TRUE ); |
51 | setColumnWidth(0, 20 ); | 51 | setColumnWidth(0, 20 ); |
52 | setColumnWidth(1, 35 ); | 52 | setColumnWidth(1, 35 ); |
53 | 53 | ||
54 | setLeftMargin( 0 ); | 54 | setLeftMargin( 0 ); |
55 | verticalHeader()->hide(); | 55 | verticalHeader()->hide(); |
56 | 56 | ||
57 | horizontalHeader()->setLabel(0, tr("C.") ); | 57 | horizontalHeader()->setLabel(0, tr("C.") ); |
58 | horizontalHeader()->setLabel(1, tr("Prior.") ); | 58 | horizontalHeader()->setLabel(1, tr("Prior.") ); |
59 | horizontalHeader()->setLabel(2, tr("Description" ) ); | 59 | horizontalHeader()->setLabel(2, tr("Description" ) ); |
60 | 60 | ||
61 | setColumnStretchable(3, FALSE ); | 61 | setColumnStretchable(3, FALSE ); |
62 | setColumnWidth(3, 20 ); | 62 | setColumnWidth(3, 20 ); |
63 | horizontalHeader()->setLabel(3, tr("Deadline") ); | 63 | horizontalHeader()->setLabel(3, tr("Deadline") ); |
64 | 64 | ||
65 | if ( todoWindow()->showDeadline() ) | 65 | if ( todoWindow()->showDeadline() ) |
66 | showColumn( 3); | 66 | showColumn( 3); |
67 | else | 67 | else |
68 | hideColumn(3 ); | 68 | hideColumn(3 ); |
69 | 69 | ||
70 | connect((QTable*)this, SIGNAL( clicked( int, int, int, const QPoint& ) ), | 70 | connect((QTable*)this, SIGNAL( clicked( int, int, int, const QPoint& ) ), |
71 | this, SLOT( slotClicked(int, int, int, const QPoint& ) ) ); | 71 | this, SLOT( slotClicked(int, int, int, const QPoint& ) ) ); |
72 | connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ), | 72 | connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ), |
73 | this, SLOT( slotPressed(int, int, int, const QPoint& ) ) ); | 73 | this, SLOT( slotPressed(int, int, int, const QPoint& ) ) ); |
74 | connect((QTable*)this, SIGNAL(valueChanged(int, int) ), | 74 | connect((QTable*)this, SIGNAL(valueChanged(int, int) ), |
75 | this, SLOT( slotValueChanged(int, int) ) ); | 75 | this, SLOT( slotValueChanged(int, int) ) ); |
76 | connect((QTable*)this, SIGNAL(currentChanged(int, int) ), | 76 | connect((QTable*)this, SIGNAL(currentChanged(int, int) ), |
77 | this, SLOT( slotCurrentChanged(int, int) ) ); | 77 | this, SLOT( slotCurrentChanged(int, int) ) ); |
78 | 78 | ||
79 | m_menuTimer = new QTimer( this ); | 79 | m_menuTimer = new QTimer( this ); |
80 | connect( m_menuTimer, SIGNAL(timeout()), | 80 | connect( m_menuTimer, SIGNAL(timeout()), |
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 | updateView(); | 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; |
106 | } | 106 | } |
107 | void TableView::updateFromTable( const OTodo& ev, CheckItem* item ) { | 107 | void TableView::updateFromTable( const OTodo& ev, CheckItem* item ) { |
108 | TodoView::update( ev.uid(), ev ); | 108 | TodoView::update( ev.uid(), ev ); |
109 | 109 | ||
110 | /* update the other columns */ | 110 | /* update the other columns */ |
111 | /* if completed or not we need to update | 111 | /* if completed or not we need to update |
112 | * the table | 112 | * the table |
113 | * | 113 | * |
114 | * We've two cases | 114 | * We've two cases |
115 | * either item or !item | 115 | * either item or !item |
116 | * this makes cases more easy | 116 | * this makes cases more easy |
117 | */ | 117 | */ |
118 | if ( !item ) { | 118 | if ( !item ) { |
119 | item = m_cache[ev.uid()]; | 119 | item = m_cache[ev.uid()]; |
120 | } | 120 | } |
121 | DueTextItem *due = dueItem( item->row() ); | 121 | DueTextItem *due = dueItem( item->row() ); |
122 | due->setCompleted( ev.isCompleted() ); | 122 | due->setCompleted( ev.isCompleted() ); |
123 | } | 123 | } |
124 | QString TableView::type() const { | 124 | QString TableView::type() const { |
125 | return QString::fromLatin1( tr("Table View") ); | 125 | return QString::fromLatin1( tr("Table View") ); |
126 | } | 126 | } |
127 | int TableView::current() { | 127 | int TableView::current() { |
128 | int cur = 0; | 128 | int cur = 0; |
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 | updateView(); | 141 | updateView(); |
142 | } | 142 | } |
143 | 143 | ||
144 | void TableView::updateView( ) { | 144 | void TableView::updateView( ) { |
145 | setSortOrder( 0 ); | ||
146 | setAscending( true ); | ||
147 | sort(); | ||
145 | OTodoAccess::List::Iterator it, end; | 148 | OTodoAccess::List::Iterator it, end; |
146 | it = list().begin(); | 149 | it = sorted().begin(); |
147 | end = list().end(); | 150 | end = sorted().end(); |
148 | qWarning("setTodos"); | 151 | qWarning("setTodos"); |
149 | QTime time; | 152 | QTime time; |
150 | time.start(); | 153 | time.start(); |
151 | m_enablePaint = false; | 154 | m_enablePaint = false; |
152 | setUpdatesEnabled( false ); | 155 | setUpdatesEnabled( false ); |
153 | viewport()->setUpdatesEnabled( false ); | 156 | viewport()->setUpdatesEnabled( false ); |
154 | clear(); | 157 | clear(); |
155 | QString currentCat = todoWindow()->currentCategory(); | 158 | QString currentCat = todoWindow()->currentCategory(); |
156 | bool showCompleted = todoWindow()->showCompleted(); | 159 | bool showCompleted = todoWindow()->showCompleted(); |
157 | bool showOverDue = todoWindow()->showOverDue(); | 160 | bool showOverDue = todoWindow()->showOverDue(); |
158 | qWarning( "Current Category:" + todoWindow()->currentCategory() ); | 161 | qWarning( "Current Category:" + todoWindow()->currentCategory() ); |
159 | int id = todoWindow()->currentCatId(); | 162 | int id = todoWindow()->currentCatId(); |
160 | QTime t; | 163 | QTime t; |
161 | t.start(); | 164 | t.start(); |
162 | setNumRows( it.count() ); | 165 | setNumRows( it.count() ); |
163 | uint i = 0; | 166 | uint i = 0; |
164 | for (; it != end; ++it ) { | 167 | for (; it != end; ++it ) { |
165 | OTodo todo = (*it); | 168 | OTodo todo = (*it); |
166 | /* test if the categories match */ | 169 | /* test if the categories match */ |
167 | if ( !currentCat.isEmpty() && | 170 | if ( !currentCat.isEmpty() && |
168 | !todo.categories().contains( id ) ) { | 171 | !todo.categories().contains( id ) ) { |
169 | continue; | 172 | continue; |
170 | } | 173 | } |
171 | /* the item is completed but we shouldn't show it */ | 174 | /* the item is completed but we shouldn't show it */ |
172 | if ( !showCompleted && todo.isCompleted() ) { | 175 | if ( !showCompleted && todo.isCompleted() ) { |
173 | qWarning("isCompleted "); | 176 | qWarning("isCompleted "); |
174 | continue; | 177 | continue; |
175 | } | 178 | } |
176 | /* the item is not overdue but we should only show overdue */ | 179 | /* the item is not overdue but we should only show overdue */ |
177 | if ( showOverDue && !todo.isOverdue() ) { | 180 | if ( showOverDue && !todo.isOverdue() ) { |
178 | continue; | 181 | continue; |
179 | } | 182 | } |
180 | /* now it's fine to add it */ | 183 | /* now it's fine to add it */ |
181 | insertTodo( todo, i ); | 184 | insertTodo( todo, i ); |
182 | i++; | 185 | i++; |
183 | } | 186 | } |
184 | setNumRows( i ); | 187 | setNumRows( i ); |
185 | int elc = time.elapsed(); | 188 | int elc = time.elapsed(); |
186 | qWarning("Adding took %d", elc/1000 ); | 189 | qWarning("Adding took %d", elc/1000 ); |
187 | setUpdatesEnabled( true ); | 190 | setUpdatesEnabled( true ); |
188 | viewport()->setUpdatesEnabled( true ); | 191 | viewport()->setUpdatesEnabled( true ); |
189 | viewport()->update(); | 192 | viewport()->update(); |
190 | m_enablePaint = true; | 193 | m_enablePaint = true; |
191 | int el = time.elapsed(); | 194 | int el = time.elapsed(); |
192 | qWarning("adding took %d", el/1000 ); | 195 | qWarning("adding took %d", el/1000 ); |
193 | } | 196 | } |
194 | void TableView::setTodo( int uid, const OTodo& ev ) { | 197 | void TableView::setTodo( int uid, const OTodo& ev ) { |
195 | QMap<int, CheckItem*>::Iterator it = m_cache.find( uid ); | 198 | QMap<int, CheckItem*>::Iterator it = m_cache.find( uid ); |
196 | 199 | ||
197 | if ( it != m_cache.end() ) { | 200 | if ( it != m_cache.end() ) { |
198 | int row = it.data()->row(); | 201 | int row = it.data()->row(); |
199 | 202 | ||
200 | /* update checked */ | 203 | /* update checked */ |
201 | CheckItem* check = checkItem(row ); | 204 | CheckItem* check = checkItem(row ); |
202 | if (check) | 205 | if (check) |
203 | check->setChecked( ev.isCompleted() ); | 206 | check->setChecked( ev.isCompleted() ); |
204 | 207 | ||
205 | /* update the text */ | 208 | /* update the text */ |
206 | QString sum = ev.summary(); | 209 | QString sum = ev.summary(); |
207 | setText(row, 2, sum.isEmpty() ? | 210 | setText(row, 2, sum.isEmpty() ? |
208 | ev.description().left(40).simplifyWhiteSpace() : | 211 | ev.description().left(40).simplifyWhiteSpace() : |
209 | sum ); | 212 | sum ); |
210 | 213 | ||
211 | /* update priority */ | 214 | /* update priority */ |
212 | setText(row, 1, QString::number( ev.priority() ) ); | 215 | setText(row, 1, QString::number( ev.priority() ) ); |
213 | 216 | ||
214 | /* update DueDate */ | 217 | /* update DueDate */ |
215 | DueTextItem *due = dueItem( row ); | 218 | DueTextItem *due = dueItem( row ); |
216 | due->setToDoEvent( ev ); | 219 | due->setToDoEvent( ev ); |
217 | } | 220 | } |
218 | } | 221 | } |
219 | void TableView::addEvent( const OTodo& ev) { | 222 | void TableView::addEvent( const OTodo& ev) { |
220 | int row= numRows(); | 223 | int row= numRows(); |
221 | setNumRows( row + 1 ); | 224 | setNumRows( row + 1 ); |
222 | insertTodo( ev, row ); | 225 | insertTodo( ev, row ); |
223 | } | 226 | } |
224 | /* | 227 | /* |
225 | * find the event | 228 | * find the event |
226 | * and then replace the complete row | 229 | * and then replace the complete row |
227 | */ | 230 | */ |
228 | void TableView::replaceEvent( const OTodo& ev) { | 231 | void TableView::replaceEvent( const OTodo& ev) { |
229 | setTodo( ev.uid(), ev ); | 232 | setTodo( ev.uid(), ev ); |
230 | } | 233 | } |
231 | /* | 234 | /* |
232 | * re aligning table can be slow too | 235 | * re aligning table can be slow too |
233 | * FIXME: look what performs better | 236 | * FIXME: look what performs better |
234 | * either this or the old align table | 237 | * either this or the old align table |
235 | */ | 238 | */ |
236 | void TableView::removeEvent( int ) { | 239 | void TableView::removeEvent( int ) { |
237 | clear(); | 240 | clear(); |
238 | updateView(); | 241 | updateView(); |
239 | } | 242 | } |
240 | void TableView::setShowCompleted( bool b) { | 243 | void TableView::setShowCompleted( bool b) { |
241 | qWarning("Show Completed %d" + b ); | 244 | qWarning("Show Completed %d" + b ); |
242 | updateView(); | 245 | updateView(); |
243 | } | 246 | } |
244 | void TableView::setShowDeadline( bool b) { | 247 | void TableView::setShowDeadline( bool b) { |
245 | qWarning("Show DeadLine %d" + b ); | 248 | qWarning("Show DeadLine %d" + b ); |
246 | if (b) | 249 | if (b) |
247 | showColumn(3 ); | 250 | showColumn(3 ); |
248 | else | 251 | else |
249 | hideColumn(3 ); | 252 | hideColumn(3 ); |
250 | } | 253 | } |
251 | void TableView::setShowCategory( const QString& ) { | 254 | void TableView::setShowCategory( const QString& ) { |
252 | qWarning("setShowCategory"); | 255 | qWarning("setShowCategory"); |
253 | updateView(); | 256 | updateView(); |
254 | } | 257 | } |
255 | void TableView::clear() { | 258 | void TableView::clear() { |
256 | m_cache.clear(); | 259 | m_cache.clear(); |
257 | int rows = numRows(); | 260 | int rows = numRows(); |
258 | for (int r = 0; r < rows; r++ ) { | 261 | for (int r = 0; r < rows; r++ ) { |
259 | for (int c = 0; c < numCols(); c++ ) { | 262 | for (int c = 0; c < numCols(); c++ ) { |
260 | if ( cellWidget(r, c) ) | 263 | if ( cellWidget(r, c) ) |
261 | clearCellWidget(r, c ); | 264 | clearCellWidget(r, c ); |
262 | clearCell(r, c); | 265 | clearCell(r, c); |
263 | } | 266 | } |
264 | } | 267 | } |
265 | setNumRows( 0); | 268 | setNumRows( 0); |
266 | } | 269 | } |
267 | QArray<int> TableView::completed() { | 270 | QArray<int> TableView::completed() { |
268 | int row = numRows(); | 271 | int row = numRows(); |
269 | QArray<int> ids( row ); | 272 | QArray<int> ids( row ); |
270 | 273 | ||
271 | int j=0; | 274 | int j=0; |
272 | for (int i = 0; i < row; i++ ) { | 275 | for (int i = 0; i < row; i++ ) { |
273 | CheckItem* item = checkItem(i ); | 276 | CheckItem* item = checkItem(i ); |
274 | if (item->isChecked() ) { | 277 | if (item->isChecked() ) { |
275 | ids[j] = item->uid(); | 278 | ids[j] = item->uid(); |
276 | j++; | 279 | j++; |
277 | } | 280 | } |
278 | } | 281 | } |
279 | ids.resize( j ); | 282 | ids.resize( j ); |
280 | return ids; | 283 | return ids; |
281 | } | 284 | } |
282 | void TableView::slotClicked(int row, int col, int, | 285 | void TableView::slotClicked(int row, int col, int, |
283 | const QPoint& point) { | 286 | const QPoint& point) { |
284 | if ( !cellGeometry(row, col ).contains(point ) ) | 287 | if ( !cellGeometry(row, col ).contains(point ) ) |
285 | return; | 288 | return; |
286 | 289 | ||
287 | 290 | ||
288 | switch( col ) { | 291 | switch( col ) { |
289 | case 0: { | 292 | case 0: { |
290 | CheckItem* item = checkItem( row ); | 293 | CheckItem* item = checkItem( row ); |
291 | /* | 294 | /* |
292 | * let's see if we centered clicked | 295 | * let's see if we centered clicked |
293 | */ | 296 | */ |
294 | if ( item ) { | 297 | if ( item ) { |
295 | int x = point.x() -columnPos( col ); | 298 | int x = point.x() -columnPos( col ); |
296 | int y = point.y() -rowPos( row ); | 299 | int y = point.y() -rowPos( row ); |
297 | int w = columnWidth( col ); | 300 | int w = columnWidth( col ); |
298 | int h = rowHeight( row ); | 301 | int h = rowHeight( row ); |
299 | if ( x >= ( w - OCheckItem::BoxSize ) / 2 && | 302 | if ( x >= ( w - OCheckItem::BoxSize ) / 2 && |
300 | x <= ( w - OCheckItem::BoxSize ) / 2 + OCheckItem::BoxSize && | 303 | x <= ( w - OCheckItem::BoxSize ) / 2 + OCheckItem::BoxSize && |
301 | y >= ( h - OCheckItem::BoxSize ) / 2 && | 304 | y >= ( h - OCheckItem::BoxSize ) / 2 && |
302 | y <= ( h - OCheckItem::BoxSize ) / 2 + OCheckItem::BoxSize ) | 305 | y <= ( h - OCheckItem::BoxSize ) / 2 + OCheckItem::BoxSize ) |
303 | item->toggle(); | 306 | item->toggle(); |
304 | } | 307 | } |
305 | } | 308 | } |
306 | break; | 309 | break; |
307 | 310 | ||
308 | case 1: | 311 | case 1: |
309 | break; | 312 | break; |
310 | 313 | ||
311 | case 2: { | 314 | case 2: { |
312 | m_menuTimer->stop(); | 315 | m_menuTimer->stop(); |
313 | showTodo( checkItem(row)->uid() ); | 316 | showTodo( checkItem(row)->uid() ); |
314 | break; | 317 | break; |
315 | } | 318 | } |
316 | case 3: { | 319 | case 3: { |
317 | m_menuTimer->stop(); | 320 | m_menuTimer->stop(); |
318 | TodoView::edit( checkItem(row)->uid() ); | 321 | TodoView::edit( checkItem(row)->uid() ); |
319 | break; | 322 | break; |
320 | } | 323 | } |
321 | } | 324 | } |
322 | 325 | ||
323 | 326 | ||
324 | } | 327 | } |
325 | void TableView::slotPressed(int row, int col, int, | 328 | void TableView::slotPressed(int row, int col, int, |
326 | const QPoint& point) { | 329 | const QPoint& point) { |
327 | 330 | ||
328 | /* TextColumn column */ | 331 | /* TextColumn column */ |
329 | if ( col == 2 && cellGeometry( row, col ).contains( point ) ) | 332 | if ( col == 2 && cellGeometry( row, col ).contains( point ) ) |
330 | m_menuTimer->start( 750, TRUE ); | 333 | m_menuTimer->start( 750, TRUE ); |
331 | } | 334 | } |
332 | void TableView::slotValueChanged( int, int ) { | 335 | void TableView::slotValueChanged( int, int ) { |
333 | qWarning("Value Changed"); | 336 | qWarning("Value Changed"); |
334 | } | 337 | } |
335 | void TableView::slotCurrentChanged(int, int ) { | 338 | void TableView::slotCurrentChanged(int, int ) { |
336 | m_menuTimer->stop(); | 339 | m_menuTimer->stop(); |
337 | } | 340 | } |
338 | /* | 341 | /* |
339 | * hardcode to column 0 | 342 | * hardcode to column 0 |
diff --git a/core/pim/todo/todoview.cpp b/core/pim/todo/todoview.cpp index b77baed..06eaaa9 100644 --- a/core/pim/todo/todoview.cpp +++ b/core/pim/todo/todoview.cpp | |||
@@ -1,77 +1,78 @@ | |||
1 | #include "mainwindow.h" | 1 | #include "mainwindow.h" |
2 | 2 | ||
3 | #include "todoview.h" | 3 | #include "todoview.h" |
4 | 4 | ||
5 | using namespace Todo; | 5 | using namespace Todo; |
6 | 6 | ||
7 | TodoView::TodoView( MainWindow* win ) | 7 | TodoView::TodoView( MainWindow* win ) |
8 | : m_main( win ) | 8 | : m_main( win ) |
9 | { | 9 | { |
10 | hack = new InternQtHack; | 10 | hack = new InternQtHack; |
11 | m_asc = false; | 11 | m_asc = false; |
12 | m_sortOrder = -1; | 12 | m_sortOrder = -1; |
13 | } | 13 | } |
14 | TodoView::~TodoView() { | 14 | TodoView::~TodoView() { |
15 | delete hack; | 15 | delete hack; |
16 | }; | 16 | }; |
17 | 17 | ||
18 | void TodoView::connectShow(QObject* obj, | 18 | void TodoView::connectShow(QObject* obj, |
19 | const char* slot ) { | 19 | const char* slot ) { |
20 | QObject::connect( hack, SIGNAL(showTodo(int) ), | 20 | QObject::connect( hack, SIGNAL(showTodo(int) ), |
21 | obj, slot ); | 21 | obj, slot ); |
22 | } | 22 | } |
23 | void TodoView::connectEdit( QObject* obj, | 23 | void TodoView::connectEdit( QObject* obj, |
24 | const char* slot ) { | 24 | const char* slot ) { |
25 | QObject::connect( hack, SIGNAL(edit(int) ), | 25 | QObject::connect( hack, SIGNAL(edit(int) ), |
26 | obj, slot ); | 26 | obj, slot ); |
27 | } | 27 | } |
28 | void TodoView::connectUpdateSmall( QObject* obj, | 28 | void TodoView::connectUpdateSmall( QObject* obj, |
29 | const char* slot ) { | 29 | const char* slot ) { |
30 | QObject::connect( hack, SIGNAL(update(int, const Todo::SmallTodo& ) ), | 30 | QObject::connect( hack, SIGNAL(update(int, const Todo::SmallTodo& ) ), |
31 | obj, slot ); | 31 | obj, slot ); |
32 | } | 32 | } |
33 | void TodoView::connectUpdateBig( QObject* obj, | 33 | void TodoView::connectUpdateBig( QObject* obj, |
34 | const char* slot ) { | 34 | const char* slot ) { |
35 | QObject::connect( hack, SIGNAL(update(int, const OTodo& ) ), | 35 | QObject::connect( hack, SIGNAL(update(int, const OTodo& ) ), |
36 | obj, slot ); | 36 | obj, slot ); |
37 | } | 37 | } |
38 | void TodoView::connectUpdateView( QObject* obj, | 38 | void TodoView::connectUpdateView( QObject* obj, |
39 | const char* slot ) { | 39 | const char* slot ) { |
40 | QObject::connect( hack, SIGNAL(update(QWidget*) ), | 40 | QObject::connect( hack, SIGNAL(update(QWidget*) ), |
41 | obj, slot ); | 41 | obj, slot ); |
42 | } | 42 | } |
43 | void TodoView::connectRemove( QObject* obj, | 43 | void TodoView::connectRemove( QObject* obj, |
44 | const char* slot ) { | 44 | const char* slot ) { |
45 | QObject::connect( hack, SIGNAL(remove(int) ), | 45 | QObject::connect( hack, SIGNAL(remove(int) ), |
46 | obj, slot ); | 46 | obj, slot ); |
47 | } | 47 | } |
48 | MainWindow* TodoView::todoWindow() { | 48 | MainWindow* TodoView::todoWindow() { |
49 | return m_main; | 49 | return m_main; |
50 | } | 50 | } |
51 | 51 | ||
52 | OTodo TodoView::event(int uid ) { return m_main->event( uid ); } | 52 | OTodo TodoView::event(int uid ) { return m_main->event( uid ); } |
53 | OTodoAccess::List TodoView::list(){ | 53 | OTodoAccess::List TodoView::list(){ |
54 | todoWindow()->updateList(); | 54 | todoWindow()->updateList(); |
55 | return todoWindow()->list(); | 55 | return todoWindow()->list(); |
56 | } | 56 | } |
57 | OTodoAccess::List TodoView::sorted(){ | 57 | OTodoAccess::List TodoView::sorted(){ |
58 | return m_sort; | 58 | return m_sort; |
59 | } | 59 | } |
60 | void TodoView::sort() { | 60 | void TodoView::sort() { |
61 | m_sort = todoWindow()->sorted(m_asc,m_sortOrder ); | 61 | m_sort = todoWindow()->sorted(m_asc,m_sortOrder ); |
62 | qWarning("m_sort.count() = %d", m_sort.count() ); | ||
62 | } | 63 | } |
63 | void TodoView::sort(int sort) { | 64 | void TodoView::sort(int sort) { |
64 | m_sort = todoWindow()->sorted(m_asc, m_sortOrder, sort ); | 65 | m_sort = todoWindow()->sorted(m_asc, m_sortOrder, sort ); |
65 | } | 66 | } |
66 | void TodoView::setSortOrder( int order ) { | 67 | void TodoView::setSortOrder( int order ) { |
67 | m_sortOrder = order; | 68 | m_sortOrder = order; |
68 | } | 69 | } |
69 | void TodoView::setAscending( bool b ) { | 70 | void TodoView::setAscending( bool b ) { |
70 | m_asc = b; | 71 | m_asc = b; |
71 | } | 72 | } |
72 | void TodoView::update(int uid, const SmallTodo& to ) { | 73 | void TodoView::update(int uid, const SmallTodo& to ) { |
73 | //m_main->slotUpate1( uid, to ); | 74 | //m_main->slotUpate1( uid, to ); |
74 | } | 75 | } |
75 | void TodoView::update(int uid, const OTodo& ev ) { | 76 | void TodoView::update(int uid, const OTodo& ev ) { |
76 | m_main->updateTodo( ev ); | 77 | m_main->updateTodo( ev ); |
77 | } | 78 | } |