summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/tableview.cpp7
-rw-r--r--core/pim/todo/todoview.cpp1
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
@@ -97,99 +97,102 @@ TableView::~TableView() {
97} 97}
98void TableView::slotShowMenu() { 98void 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}
103OTodo TableView::find(int uid ) { 103OTodo TableView::find(int uid ) {
104 OTodo ev = TodoView::event( uid ); 104 OTodo ev = TodoView::event( uid );
105 return ev; 105 return ev;
106} 106}
107void TableView::updateFromTable( const OTodo& ev, CheckItem* item ) { 107void 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}
124QString TableView::type() const { 124QString TableView::type() const {
125 return QString::fromLatin1( tr("Table View") ); 125 return QString::fromLatin1( tr("Table View") );
126} 126}
127int TableView::current() { 127int 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}
135QString TableView::currentRepresentation() { 135QString TableView::currentRepresentation() {
136 return text( currentRow(), 2); 136 return text( currentRow(), 2);
137} 137}
138/* show overdue */ 138/* show overdue */
139void TableView::showOverDue( bool ) { 139void TableView::showOverDue( bool ) {
140 clear(); 140 clear();
141 updateView(); 141 updateView();
142} 142}
143 143
144void TableView::updateView( ) { 144void 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}
194void TableView::setTodo( int uid, const OTodo& ev ) { 197void 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 );
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
@@ -14,64 +14,65 @@ TodoView::TodoView( MainWindow* win )
14TodoView::~TodoView() { 14TodoView::~TodoView() {
15 delete hack; 15 delete hack;
16}; 16};
17 17
18void TodoView::connectShow(QObject* obj, 18void 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}
23void TodoView::connectEdit( QObject* obj, 23void 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}
28void TodoView::connectUpdateSmall( QObject* obj, 28void 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}
33void TodoView::connectUpdateBig( QObject* obj, 33void 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}
38void TodoView::connectUpdateView( QObject* obj, 38void 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}
43void TodoView::connectRemove( QObject* obj, 43void 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}
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(){
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} 63}
63void TodoView::sort(int sort) { 64void 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}
66void TodoView::setSortOrder( int order ) { 67void TodoView::setSortOrder( int order ) {
67 m_sortOrder = order; 68 m_sortOrder = order;
68} 69}
69void TodoView::setAscending( bool b ) { 70void TodoView::setAscending( bool b ) {
70 m_asc = b; 71 m_asc = b;
71} 72}
72void TodoView::update(int uid, const SmallTodo& to ) { 73void TodoView::update(int uid, const SmallTodo& to ) {
73 //m_main->slotUpate1( uid, to ); 74 //m_main->slotUpate1( uid, to );
74} 75}
75void TodoView::update(int uid, const OTodo& ev ) { 76void TodoView::update(int uid, const OTodo& ev ) {
76 m_main->updateTodo( ev ); 77 m_main->updateTodo( ev );
77} 78}