summaryrefslogtreecommitdiff
path: root/core
Unidiff
Diffstat (limited to 'core') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/todo/main.cpp2
-rw-r--r--core/pim/todo/mainwindow.cpp5
-rw-r--r--core/pim/todo/tableview.cpp83
-rw-r--r--core/pim/todo/tableview.h7
-rw-r--r--core/pim/todo/todomanager.cpp2
-rw-r--r--core/pim/todo/todoview.cpp3
-rw-r--r--core/pim/todo/todoview.h2
7 files changed, 78 insertions, 26 deletions
diff --git a/core/pim/todo/main.cpp b/core/pim/todo/main.cpp
index 58ed45c..aeae794 100644
--- a/core/pim/todo/main.cpp
+++ b/core/pim/todo/main.cpp
@@ -22,25 +22,25 @@
22 22
23 23
24#include <qdatetime.h> 24#include <qdatetime.h>
25 25
26#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27 27
28void myMessages( QtMsgType, const char* ) { 28void myMessages( QtMsgType, const char* ) {
29 29
30} 30}
31 31
32int main( int argc, char **argv ) 32int main( int argc, char **argv )
33{ 33{
34 qInstallMsgHandler( myMessages ); 34// qInstallMsgHandler( myMessages );
35 QPEApplication a( argc, argv ); 35 QPEApplication a( argc, argv );
36 36
37 QTime time; 37 QTime time;
38 time.start(); 38 time.start();
39 Todo::MainWindow mw; 39 Todo::MainWindow mw;
40 int t = time.elapsed(); 40 int t = time.elapsed();
41 qWarning("QTime %d", t/1000 ); 41 qWarning("QTime %d", t/1000 );
42 mw.setCaption("Opie Todolist"); 42 mw.setCaption("Opie Todolist");
43 QObject::connect( &a, SIGNAL( flush() ), &mw, SLOT( slotFlush() ) ); 43 QObject::connect( &a, SIGNAL( flush() ), &mw, SLOT( slotFlush() ) );
44 QObject::connect( &a, SIGNAL( reload() ), &mw, SLOT( slotReload() ) ); 44 QObject::connect( &a, SIGNAL( reload() ), &mw, SLOT( slotReload() ) );
45 45
46 a.showMainWidget(&mw); 46 a.showMainWidget(&mw);
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index 48954ce..c9c43d4 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -411,25 +411,24 @@ void MainWindow::slotNew() {
411 this ); 411 this );
412 412
413 if ( currentEditor()->accepted() ) { 413 if ( currentEditor()->accepted() ) {
414 //todo.assignUid(); 414 //todo.assignUid();
415 currentView()->addEvent( todo ); 415 currentView()->addEvent( todo );
416 m_todoMgr.add( todo ); 416 m_todoMgr.add( todo );
417 417
418 // I'm afraid we must call this every time now, otherwise 418 // I'm afraid we must call this every time now, otherwise
419 // spend expensive time comparing all these strings... 419 // spend expensive time comparing all these strings...
420 // but only call if we changed something -zecke 420 // but only call if we changed something -zecke
421 populateCategories(); 421 populateCategories();
422 } 422 }
423
424 raiseCurrentView( ); 423 raiseCurrentView( );
425} 424}
426void MainWindow::slotDuplicate() { 425void MainWindow::slotDuplicate() {
427 if(m_syncing) { 426 if(m_syncing) {
428 QMessageBox::warning(this, tr("Todo"), 427 QMessageBox::warning(this, tr("Todo"),
429 tr("Can not edit data, currently syncing")); 428 tr("Can not edit data, currently syncing"));
430 return; 429 return;
431 } 430 }
432 OTodo ev = m_todoMgr.event( currentView()->current() ); 431 OTodo ev = m_todoMgr.event( currentView()->current() );
433 /* let's generate a new uid */ 432 /* let's generate a new uid */
434 ev.setUid(-1); 433 ev.setUid(-1);
435 m_todoMgr.add( ev ); 434 m_todoMgr.add( ev );
@@ -488,40 +487,42 @@ void MainWindow::slotDeleteCompleted() {
488void MainWindow::slotFind() { 487void MainWindow::slotFind() {
489 488
490} 489}
491void MainWindow::slotEdit() { 490void MainWindow::slotEdit() {
492 slotEdit( currentView()->current() ); 491 slotEdit( currentView()->current() );
493} 492}
494/* 493/*
495 * set the category 494 * set the category
496 */ 495 */
497void MainWindow::setCategory( int c) { 496void MainWindow::setCategory( int c) {
498 if ( c <= 0 ) return; 497 if ( c <= 0 ) return;
499 498
499
500 qWarning("Iterating over cats %d", c ); 500 qWarning("Iterating over cats %d", c );
501 for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) 501 for ( unsigned int i = 1; i < m_catMenu->count(); i++ )
502 m_catMenu->setItemChecked(i, c == (int)i ); 502 m_catMenu->setItemChecked(i, c == (int)i );
503 503
504 if (c == 1 ) { 504 if (c == 1 ) {
505 m_curCat = QString::null; 505 m_curCat = QString::null;
506 setCaption( tr("Todo") + " - " + tr("All Categories" ) ); 506 setCaption( tr("Todo") + " - " + tr("All Categories" ) );
507 507
508 }else if ( c == (int)m_catMenu->count() - 1 ) { 508 }else if ( c == (int)m_catMenu->count() - 1 ) {
509 m_curCat = tr("Unfiled"); 509 m_curCat = tr("Unfiled");
510 setCaption( tr("Todo") + " - " + tr("Unfiled") ); 510 setCaption( tr("Todo") + " - " + tr("Unfiled") );
511 }else { 511 }else {
512 m_curCat = m_todoMgr.categories()[c-2]; 512 m_curCat = m_todoMgr.categories()[c-2];
513 setCaption( tr("Todo") + " - " + m_curCat ); 513 setCaption( tr("Todo") + " - " + m_curCat );
514 } 514 }
515 m_catMenu->setItemChecked( c, true ); 515 m_catMenu->setItemChecked( c, true );
516
516 currentView()->setShowCategory( m_curCat ); 517 currentView()->setShowCategory( m_curCat );
517 raiseCurrentView(); 518 raiseCurrentView();
518} 519}
519void MainWindow::slotShowDeadLine( bool dead) { 520void MainWindow::slotShowDeadLine( bool dead) {
520 m_deadline = dead; 521 m_deadline = dead;
521 currentView()->setShowDeadline( dead ); 522 currentView()->setShowDeadline( dead );
522} 523}
523void MainWindow::slotShowCompleted( bool show) { 524void MainWindow::slotShowCompleted( bool show) {
524 m_completed = show; 525 m_completed = show;
525 currentView()->setShowCompleted( m_completed ); 526 currentView()->setShowCompleted( m_completed );
526} 527}
527bool MainWindow::showOverDue()const { 528bool MainWindow::showOverDue()const {
@@ -540,25 +541,24 @@ void MainWindow::beamDone( Ir* ) {
540void MainWindow::slotFlush() { 541void MainWindow::slotFlush() {
541 m_syncing = FALSE; 542 m_syncing = FALSE;
542 m_todoMgr.save(); 543 m_todoMgr.save();
543} 544}
544void MainWindow::slotShowDetails() { 545void MainWindow::slotShowDetails() {
545 slotShow( currentView()->current() ); 546 slotShow( currentView()->current() );
546} 547}
547/* 548/*
548 * populate the Categories 549 * populate the Categories
549 * Menu 550 * Menu
550 */ 551 */
551void MainWindow::populateCategories() { 552void MainWindow::populateCategories() {
552 if (m_todoMgr.isLoaded() )
553 m_todoMgr.load(); 553 m_todoMgr.load();
554 554
555 m_catMenu->clear(); 555 m_catMenu->clear();
556 int id, rememberId; 556 int id, rememberId;
557 id = 1; 557 id = 1;
558 rememberId = 1; 558 rememberId = 1;
559 559
560 m_catMenu->insertItem( tr( "All Categories" ), id++ ); 560 m_catMenu->insertItem( tr( "All Categories" ), id++ );
561 m_catMenu->insertSeparator(); 561 m_catMenu->insertSeparator();
562 QStringList categories = m_todoMgr.categories(); 562 QStringList categories = m_todoMgr.categories();
563 categories.append( tr( "Unfiled" ) ); 563 categories.append( tr( "Unfiled" ) );
564 for ( QStringList::Iterator it = categories.begin(); 564 for ( QStringList::Iterator it = categories.begin();
@@ -605,24 +605,25 @@ void MainWindow::slotEdit( int uid ) {
605 return; 605 return;
606 } 606 }
607 607
608 OTodo todo = m_todoMgr.event( uid ); 608 OTodo todo = m_todoMgr.event( uid );
609 609
610 todo = currentEditor()->edit(this, todo ); 610 todo = currentEditor()->edit(this, todo );
611 611
612 /* if completed */ 612 /* if completed */
613 if ( currentEditor()->accepted() ) { 613 if ( currentEditor()->accepted() ) {
614 qWarning("Replacing now" ); 614 qWarning("Replacing now" );
615 m_todoMgr.update( todo.uid(), todo ); 615 m_todoMgr.update( todo.uid(), todo );
616 currentView()->replaceEvent( todo ); 616 currentView()->replaceEvent( todo );
617 /* a Category might have changed */
617 populateCategories(); 618 populateCategories();
618 } 619 }
619 620
620 raiseCurrentView(); 621 raiseCurrentView();
621} 622}
622/* 623/*
623void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { 624void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) {
624 m_todoMgr.update( uid, ev ); 625 m_todoMgr.update( uid, ev );
625} 626}
626*/ 627*/
627void MainWindow::updateTodo( const OTodo& ev) { 628void MainWindow::updateTodo( const OTodo& ev) {
628 m_todoMgr.update( ev.uid() , ev ); 629 m_todoMgr.update( ev.uid() , ev );
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp
index 5594b13..5d82eb2 100644
--- a/core/pim/todo/tableview.cpp
+++ b/core/pim/todo/tableview.cpp
@@ -80,60 +80,61 @@ TableView::TableView( MainWindow* window, QWidget* wid )
80 this, SLOT( slotValueChanged(int, int) ) ); 80 this, SLOT( slotValueChanged(int, int) ) );
81 connect((QTable*)this, SIGNAL(currentChanged(int, int) ), 81 connect((QTable*)this, SIGNAL(currentChanged(int, int) ),
82 this, SLOT( slotCurrentChanged(int, int) ) ); 82 this, SLOT( slotCurrentChanged(int, int) ) );
83 83
84 m_menuTimer = new QTimer( this ); 84 m_menuTimer = new QTimer( this );
85 connect( m_menuTimer, SIGNAL(timeout()), 85 connect( m_menuTimer, SIGNAL(timeout()),
86 this, SLOT(slotShowMenu()) ); 86 this, SLOT(slotShowMenu()) );
87 87
88 m_enablePaint = true; 88 m_enablePaint = true;
89 setUpdatesEnabled( true ); 89 setUpdatesEnabled( true );
90 viewport()->setUpdatesEnabled( true ); 90 viewport()->setUpdatesEnabled( true );
91 viewport()->update(); 91 viewport()->update();
92 setSortOrder( 0 );
93 setAscending( TRUE );
94 m_first = true;
92} 95}
93/* a new day has started 96/* a new day has started
94 * update the day 97 * update the day
95 */ 98 */
96void TableView::newDay() { 99void TableView::newDay() {
97 clear(); 100 clear();
98 updateView(); 101 updateView();
99} 102}
100TableView::~TableView() { 103TableView::~TableView() {
101 104
102} 105}
103void TableView::slotShowMenu() { 106void TableView::slotShowMenu() {
104 QPopupMenu *menu = todoWindow()->contextMenu( current() ); 107 QPopupMenu *menu = todoWindow()->contextMenu( current() );
105 menu->exec(QCursor::pos() ); 108 menu->exec(QCursor::pos() );
106 delete menu; 109 delete menu;
107} 110}
108QString TableView::type() const { 111QString TableView::type() const {
109 return QString::fromLatin1( tr("Table View") ); 112 return QString::fromLatin1( tr("Table View") );
110} 113}
111int TableView::current() { 114int TableView::current() {
112 int cur = 0; 115 int uid = sorted().uidAt(currentRow() );
113 // FIXME 116 qWarning("uid %d", uid );
114 return cur; 117 return uid;
115} 118}
116QString TableView::currentRepresentation() { 119QString TableView::currentRepresentation() {
117 return text( currentRow(), 2); 120 return text( currentRow(), 2);
118} 121}
119/* show overdue */ 122/* show overdue */
120void TableView::showOverDue( bool ) { 123void TableView::showOverDue( bool ) {
121 clear(); 124 clear();
122 updateView(); 125 updateView();
123} 126}
124 127
125void TableView::updateView( ) { 128void TableView::updateView( ) {
126 setSortOrder( 0 );
127 setAscending( true );
128 sort(); 129 sort();
129 OTodoAccess::List::Iterator it, end; 130 OTodoAccess::List::Iterator it, end;
130 it = sorted().begin(); 131 it = sorted().begin();
131 end = sorted().end(); 132 end = sorted().end();
132 133
133 qWarning("setTodos"); 134 qWarning("setTodos");
134 QTime time; 135 QTime time;
135 time.start(); 136 time.start();
136 m_enablePaint = false; 137 m_enablePaint = false;
137 setUpdatesEnabled( false ); 138 setUpdatesEnabled( false );
138 viewport()->setUpdatesEnabled( false ); 139 viewport()->setUpdatesEnabled( false );
139 140
@@ -178,55 +179,58 @@ void TableView::removeEvent( int ) {
178} 179}
179void TableView::setShowCompleted( bool b) { 180void TableView::setShowCompleted( bool b) {
180 qWarning("Show Completed %d" + b ); 181 qWarning("Show Completed %d" + b );
181 updateView(); 182 updateView();
182} 183}
183void TableView::setShowDeadline( bool b) { 184void TableView::setShowDeadline( bool b) {
184 qWarning("Show DeadLine %d" + b ); 185 qWarning("Show DeadLine %d" + b );
185 if (b) 186 if (b)
186 showColumn(3 ); 187 showColumn(3 );
187 else 188 else
188 hideColumn(3 ); 189 hideColumn(3 );
189} 190}
190void TableView::setShowCategory( const QString& ) { 191void TableView::setShowCategory( const QString& str) {
191 qWarning("setShowCategory"); 192 qWarning("setShowCategory");
193 if ( str != m_oleCat || m_first )
192 updateView(); 194 updateView();
195
196 m_oleCat = str;
197 m_first = false;
198
193} 199}
194void TableView::clear() { 200void TableView::clear() {
195 setNumRows(0); 201 setNumRows(0);
196} 202}
197void TableView::slotClicked(int row, int col, int, 203void TableView::slotClicked(int row, int col, int,
198 const QPoint& point) { 204 const QPoint& point) {
199 if ( !cellGeometry(row, col ).contains(point ) ) 205 if ( !cellGeometry(row, col ).contains(point ) )
200 return; 206 return;
201 int ui=0; // FIXME = uid(row); 207
208 int ui= sorted().uidAt( row );
202 209
203 210
204 switch( col ) { 211 switch( col ) {
205 case 0: { 212 case 0: {
206 // FIXME
207 CheckItem* item = 0l;
208 /*
209 * let's see if we centered clicked
210 */
211 if ( item ) {
212 int x = point.x() -columnPos( col ); 213 int x = point.x() -columnPos( col );
213 int y = point.y() -rowPos( row ); 214 int y = point.y() -rowPos( row );
214 int w = columnWidth( col ); 215 int w = columnWidth( col );
215 int h = rowHeight( row ); 216 int h = rowHeight( row );
216 if ( x >= ( w - OCheckItem::BoxSize ) / 2 && 217 if ( x >= ( w - BoxSize ) / 2 &&
217 x <= ( w - OCheckItem::BoxSize ) / 2 + OCheckItem::BoxSize && 218 x <= ( w - BoxSize ) / 2 + BoxSize &&
218 y >= ( h - OCheckItem::BoxSize ) / 2 && 219 y >= ( h - BoxSize ) / 2 &&
219 y <= ( h - OCheckItem::BoxSize ) / 2 + OCheckItem::BoxSize ) 220 y <= ( h - BoxSize ) / 2 + BoxSize ) {
220 item->toggle(); 221 OTodo todo = sorted()[row];
222 todo.setCompleted( !todo.isCompleted() );
223 TodoView::update( todo.uid(), todo );
224 updateView();
221 } 225 }
222 } 226 }
223 break; 227 break;
224 228
225 case 1: 229 case 1:
226 break; 230 break;
227 231
228 case 2: { 232 case 2: {
229 m_menuTimer->stop(); 233 m_menuTimer->stop();
230 showTodo( ui ); 234 showTodo( ui );
231 break; 235 break;
232 } 236 }
@@ -253,27 +257,29 @@ void TableView::slotCurrentChanged(int, int ) {
253 m_menuTimer->stop(); 257 m_menuTimer->stop();
254} 258}
255QWidget* TableView::widget() { 259QWidget* TableView::widget() {
256 return this; 260 return this;
257} 261}
258/* 262/*
259 * We need to overwrite sortColumn 263 * We need to overwrite sortColumn
260 * because we want to sort whole row 264 * because we want to sort whole row
261 * based 265 * based
262 * We event want to set the setOrder 266 * We event want to set the setOrder
263 * to a sort() and update() 267 * to a sort() and update()
264 */ 268 */
265void TableView::sortColumn( int row, bool asc, bool ) { 269void TableView::sortColumn( int col, bool asc, bool ) {
266 QTable::sortColumn( row, asc, TRUE ); 270 qWarning("bool %d", asc );
267 271 setSortOrder( col );
272 setAscending( asc );
273 updateView();
268} 274}
269void TableView::viewportPaintEvent( QPaintEvent* e) { 275void TableView::viewportPaintEvent( QPaintEvent* e) {
270 qWarning("Paint event" ); 276 qWarning("Paint event" );
271 if (m_enablePaint ) 277 if (m_enablePaint )
272 QTable::viewportPaintEvent( e ); 278 QTable::viewportPaintEvent( e );
273} 279}
274/* 280/*
275 * This segment is copyrighted by TT 281 * This segment is copyrighted by TT
276 * it was taken from their todolist 282 * it was taken from their todolist
277 * application this code is GPL 283 * application this code is GPL
278 */ 284 */
279void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { 285void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) {
@@ -348,12 +354,47 @@ void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool
348 QString text; 354 QString text;
349 if (task.hasDueDate()) { 355 if (task.hasDueDate()) {
350 text = "HAS"; 356 text = "HAS";
351 } else { 357 } else {
352 text = tr("None"); 358 text = tr("None");
353 } 359 }
354 p->drawText(2,2 + fm.ascent(), text); 360 p->drawText(2,2 + fm.ascent(), text);
355 } 361 }
356 break; 362 break;
357 } 363 }
358 p->restore(); 364 p->restore();
359} 365}
366QWidget* TableView::createEditor(int row, int col, bool )const {
367 switch( col ) {
368 case 1: {
369 /* the priority stuff */
370 QComboBox* combo = new QComboBox( viewport() );
371 combo->insertItem( "1" );
372 combo->insertItem( "2" );
373 combo->insertItem( "3" );
374 combo->insertItem( "4" );
375 combo->insertItem( "5" );
376 combo->setCurrentItem( sorted()[row].priority()-1 );
377 return combo;
378 }
379 case 0:
380 default:
381 return 0l;
382 }
383}
384void TableView::setCellContentFromEditor(int row, int col ) {
385 if ( col == 1 ) {
386 QWidget* wid = cellWidget(row, 1 );
387 if ( wid->inherits("QComboBox") ) {
388 int pri = ((QComboBox*)wid)->currentItem() + 1;
389 OTodo todo = sorted()[row];
390 if ( todo.priority() != pri ) {
391 todo.setPriority( pri );
392 TodoView::update( todo.uid(), todo );
393 updateView();
394 }
395 }
396 }
397}
398void TableView::slotPriority() {
399 setCellContentFromEditor( currentRow(), currentColumn() );
400}
diff --git a/core/pim/todo/tableview.h b/core/pim/todo/tableview.h
index b608204..bf41aea 100644
--- a/core/pim/todo/tableview.h
+++ b/core/pim/todo/tableview.h
@@ -69,25 +69,32 @@ namespace Todo {
69 /* 69 /*
70 * we do our drawing ourselves 70 * we do our drawing ourselves
71 * because we don't want to have 71 * because we don't want to have
72 * 40.000 QTableItems for 10.000 72 * 40.000 QTableItems for 10.000
73 * OTodos where we only show 10 at a time! 73 * OTodos where we only show 10 at a time!
74 */ 74 */
75 void paintCell(QPainter* p, int row, int col, const QRect&, bool ); 75 void paintCell(QPainter* p, int row, int col, const QRect&, bool );
76 private: 76 private:
77 /* reimplented for internal reasons */ 77 /* reimplented for internal reasons */
78 void viewportPaintEvent( QPaintEvent* ); 78 void viewportPaintEvent( QPaintEvent* );
79 QTimer *m_menuTimer; 79 QTimer *m_menuTimer;
80 bool m_enablePaint:1; 80 bool m_enablePaint:1;
81 QString m_oleCat;
82 bool m_first : 1;
83
84 protected:
85 QWidget* createEditor(int row, int col, bool initFromCell )const;
86 void setCellContentFromEditor( int row, int col );
81 87
82private slots: 88private slots:
83 void slotShowMenu(); 89 void slotShowMenu();
84 void slotClicked(int, int, int, 90 void slotClicked(int, int, int,
85 const QPoint& ); 91 const QPoint& );
86 void slotPressed(int, int, int, 92 void slotPressed(int, int, int,
87 const QPoint& ); 93 const QPoint& );
88 void slotValueChanged(int, int); 94 void slotValueChanged(int, int);
89 void slotCurrentChanged(int, int ); 95 void slotCurrentChanged(int, int );
96 void slotPriority();
90 }; 97 };
91}; 98};
92 99
93#endif 100#endif
diff --git a/core/pim/todo/todomanager.cpp b/core/pim/todo/todomanager.cpp
index ebf9e8a..1f81539 100644
--- a/core/pim/todo/todomanager.cpp
+++ b/core/pim/todo/todomanager.cpp
@@ -38,24 +38,25 @@ TodoManager::TodoManager( QObject *obj )
38 QTime time; 38 QTime time;
39 time.start(); 39 time.start();
40 int el = time.elapsed(); 40 int el = time.elapsed();
41 qWarning("QTimer for loading %d", el/1000 ); 41 qWarning("QTimer for loading %d", el/1000 );
42} 42}
43TodoManager::~TodoManager() { 43TodoManager::~TodoManager() {
44 delete m_db; 44 delete m_db;
45} 45}
46OTodo TodoManager::event(int uid ) { 46OTodo TodoManager::event(int uid ) {
47 return m_db->find( uid ); 47 return m_db->find( uid );
48} 48}
49void TodoManager::updateList() { 49void TodoManager::updateList() {
50 qWarning("update list");
50 m_list = m_db->allRecords(); 51 m_list = m_db->allRecords();
51} 52}
52OTodoAccess::List TodoManager::list() const{ 53OTodoAccess::List TodoManager::list() const{
53 return m_list; 54 return m_list;
54} 55}
55OTodoAccess::List TodoManager::sorted( bool asc, int so, int f, int cat ) { 56OTodoAccess::List TodoManager::sorted( bool asc, int so, int f, int cat ) {
56 return m_db->sorted( asc, so, f, cat ); 57 return m_db->sorted( asc, so, f, cat );
57} 58}
58OTodoAccess::List::Iterator TodoManager::overDue() { 59OTodoAccess::List::Iterator TodoManager::overDue() {
59 int filter = 2 | 1; 60 int filter = 2 | 1;
60 m_list = m_db->sorted(m_asc, m_sortOrder, filter, m_ca ); 61 m_list = m_db->sorted(m_asc, m_sortOrder, filter, m_ca );
61 m_it = m_list.begin(); 62 m_it = m_list.begin();
@@ -109,16 +110,17 @@ QStringList TodoManager::categories() {
109int TodoManager::catId( const QString& cats ) { 110int TodoManager::catId( const QString& cats ) {
110 return m_cat.id( "Todo List", cats ); 111 return m_cat.id( "Todo List", cats );
111} 112}
112void TodoManager::remove( const QArray<int>& ids) { 113void TodoManager::remove( const QArray<int>& ids) {
113 for (uint i=0; i < ids.size(); i++ ) 114 for (uint i=0; i < ids.size(); i++ )
114 remove( ids[i] ); 115 remove( ids[i] );
115} 116}
116bool TodoManager::isLoaded()const { 117bool TodoManager::isLoaded()const {
117 return (m_db == 0 ); 118 return (m_db == 0 );
118} 119}
119void TodoManager::load() { 120void TodoManager::load() {
120 if (!m_db) { 121 if (!m_db) {
122 qWarning("loading!");
121 m_db = new OTodoAccess(); 123 m_db = new OTodoAccess();
122 m_db->load(); 124 m_db->load();
123 } 125 }
124} 126}
diff --git a/core/pim/todo/todoview.cpp b/core/pim/todo/todoview.cpp
index 06eaaa9..639fa66 100644
--- a/core/pim/todo/todoview.cpp
+++ b/core/pim/todo/todoview.cpp
@@ -45,34 +45,35 @@ void TodoView::connectRemove( QObject* obj,
45 QObject::connect( hack, SIGNAL(remove(int) ), 45 QObject::connect( hack, SIGNAL(remove(int) ),
46 obj, slot ); 46 obj, slot );
47} 47}
48MainWindow* TodoView::todoWindow() { 48MainWindow* TodoView::todoWindow() {
49 return m_main; 49 return m_main;
50} 50}
51 51
52OTodo TodoView::event(int uid ) { return m_main->event( uid ); } 52OTodo TodoView::event(int uid ) { return m_main->event( uid ); }
53OTodoAccess::List TodoView::list(){ 53OTodoAccess::List TodoView::list(){
54 todoWindow()->updateList(); 54 todoWindow()->updateList();
55 return todoWindow()->list(); 55 return todoWindow()->list();
56} 56}
57OTodoAccess::List TodoView::sorted(){ 57OTodoAccess::List TodoView::sorted()const{
58 return m_sort; 58 return m_sort;
59} 59}
60void TodoView::sort() { 60void 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 qWarning("m_sort.count() = %d", m_sort.count() );
63} 63}
64void TodoView::sort(int sort) { 64void TodoView::sort(int sort) {
65 m_sort = todoWindow()->sorted(m_asc, m_sortOrder, sort ); 65 m_sort = todoWindow()->sorted(m_asc, m_sortOrder, sort );
66} 66}
67void TodoView::setSortOrder( int order ) { 67void TodoView::setSortOrder( int order ) {
68 m_sortOrder = order; 68 m_sortOrder = order;
69} 69}
70void TodoView::setAscending( bool b ) { 70void TodoView::setAscending( bool b ) {
71 qWarning("setAscending %d", b );
71 m_asc = b; 72 m_asc = b;
72} 73}
73void TodoView::update(int uid, const SmallTodo& to ) { 74void TodoView::update(int uid, const SmallTodo& to ) {
74 //m_main->slotUpate1( uid, to ); 75 //m_main->slotUpate1( uid, to );
75} 76}
76void TodoView::update(int uid, const OTodo& ev ) { 77void TodoView::update(int uid, const OTodo& ev ) {
77 m_main->updateTodo( ev ); 78 m_main->updateTodo( ev );
78} 79}
diff --git a/core/pim/todo/todoview.h b/core/pim/todo/todoview.h
index 9408ef1..e5c77f9 100644
--- a/core/pim/todo/todoview.h
+++ b/core/pim/todo/todoview.h
@@ -148,25 +148,25 @@ namespace Todo {
148 void connectUpdateSmall( QObject* obj, 148 void connectUpdateSmall( QObject* obj,
149 const char* slot ); 149 const char* slot );
150 void connectUpdateBig( QObject* obj, 150 void connectUpdateBig( QObject* obj,
151 const char* slot ) ; 151 const char* slot ) ;
152 void connectUpdateView( QObject* obj, 152 void connectUpdateView( QObject* obj,
153 const char* slot ); 153 const char* slot );
154 void connectRemove( QObject* obj, 154 void connectRemove( QObject* obj,
155 const char* slot ); 155 const char* slot );
156 protected: 156 protected:
157 MainWindow* todoWindow(); 157 MainWindow* todoWindow();
158 OTodo event(int uid ); 158 OTodo event(int uid );
159 OTodoAccess::List list(); 159 OTodoAccess::List list();
160 OTodoAccess::List sorted(); 160 OTodoAccess::List sorted()const;
161 void sort(); 161 void sort();
162 void sort(int sort ); 162 void sort(int sort );
163 void setSortOrder( int order ); 163 void setSortOrder( int order );
164 void setAscending( bool ); 164 void setAscending( bool );
165 165
166 /* 166 /*
167 These things needs to be implemented 167 These things needs to be implemented
168 in a implementation 168 in a implementation
169 signals: 169 signals:
170 */ 170 */
171 protected: 171 protected:
172 void showTodo( int uid ) { hack->emitShow(uid); } 172 void showTodo( int uid ) { hack->emitShow(uid); }