summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-13 02:26:52 (UTC)
committer zecke <zecke>2002-10-13 02:26:52 (UTC)
commite9e5c2346f12f78b42025c70a50ebb4157dbd7ca (patch) (unidiff)
tree310c3a4bb3fc38646b21941e516f6f9f6b4c7fb9
parentd96ce086c617b5b2efc5081cd10a43257a78f488 (diff)
downloadopie-e9e5c2346f12f78b42025c70a50ebb4157dbd7ca.zip
opie-e9e5c2346f12f78b42025c70a50ebb4157dbd7ca.tar.gz
opie-e9e5c2346f12f78b42025c70a50ebb4157dbd7ca.tar.bz2
Speed Speed Speed...
main.cpp disabled messagehandler.. TableView: do not update View from setCategory if category was not changed and if not first setCategory Inline editing is working again current is working too Fixed sorting MainWindow: Show Event and Edit event does work again Try to avoid calling sorted or allRecords unneeded... 10.000 todos on SQL does feel fast I need to get it down some more... maybe tweaking libsqlite a bit ( some compiler switches and disable asserts ) Before I implement new features I want to get down to 2-3 seconds loading of Data The UI will instantly pop up and then load the stuff within seconds
Diffstat (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
@@ -33,3 +33,3 @@ int main( int argc, char **argv )
33{ 33{
34 qInstallMsgHandler( myMessages ); 34// qInstallMsgHandler( myMessages );
35 QPEApplication a( argc, argv ); 35 QPEApplication a( argc, argv );
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
@@ -422,3 +422,2 @@ void MainWindow::slotNew() {
422 } 422 }
423
424 raiseCurrentView( ); 423 raiseCurrentView( );
@@ -499,2 +498,3 @@ void MainWindow::setCategory( int c) {
499 498
499
500 qWarning("Iterating over cats %d", c ); 500 qWarning("Iterating over cats %d", c );
@@ -515,2 +515,3 @@ void MainWindow::setCategory( int c) {
515 m_catMenu->setItemChecked( c, true ); 515 m_catMenu->setItemChecked( c, true );
516
516 currentView()->setShowCategory( m_curCat ); 517 currentView()->setShowCategory( m_curCat );
@@ -551,3 +552,2 @@ void MainWindow::slotShowDetails() {
551void MainWindow::populateCategories() { 552void MainWindow::populateCategories() {
552 if (m_todoMgr.isLoaded() )
553 m_todoMgr.load(); 553 m_todoMgr.load();
@@ -616,2 +616,3 @@ void MainWindow::slotEdit( int uid ) {
616 currentView()->replaceEvent( todo ); 616 currentView()->replaceEvent( todo );
617 /* a Category might have changed */
617 populateCategories(); 618 populateCategories();
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
@@ -91,2 +91,5 @@ TableView::TableView( MainWindow* window, QWidget* wid )
91 viewport()->update(); 91 viewport()->update();
92 setSortOrder( 0 );
93 setAscending( TRUE );
94 m_first = true;
92} 95}
@@ -111,5 +114,5 @@ QString TableView::type() const {
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}
@@ -125,4 +128,2 @@ void TableView::showOverDue( bool ) {
125void TableView::updateView( ) { 128void TableView::updateView( ) {
126 setSortOrder( 0 );
127 setAscending( true );
128 sort(); 129 sort();
@@ -189,5 +190,10 @@ void TableView::setShowDeadline( bool b) {
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}
@@ -200,3 +206,4 @@ void TableView::slotClicked(int row, int col, int,
200 return; 206 return;
201 int ui=0; // FIXME = uid(row); 207
208 int ui= sorted().uidAt( row );
202 209
@@ -205,8 +212,2 @@ void TableView::slotClicked(int row, int col, int,
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 );
@@ -215,7 +216,10 @@ void TableView::slotClicked(int row, int col, int,
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 }
@@ -264,5 +268,7 @@ QWidget* TableView::widget() {
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}
@@ -359 +365,36 @@ void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool
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
@@ -80,2 +80,8 @@ namespace Todo {
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
@@ -89,2 +95,3 @@ private slots:
89 void slotCurrentChanged(int, int ); 95 void slotCurrentChanged(int, int );
96 void slotPriority();
90 }; 97 };
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
@@ -49,2 +49,3 @@ OTodo TodoManager::event(int uid ) {
49void TodoManager::updateList() { 49void TodoManager::updateList() {
50 qWarning("update list");
50 m_list = m_db->allRecords(); 51 m_list = m_db->allRecords();
@@ -120,2 +121,3 @@ void TodoManager::load() {
120 if (!m_db) { 121 if (!m_db) {
122 qWarning("loading!");
121 m_db = new OTodoAccess(); 123 m_db = new OTodoAccess();
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
@@ -56,3 +56,3 @@ OTodoAccess::List TodoView::list(){
56} 56}
57OTodoAccess::List TodoView::sorted(){ 57OTodoAccess::List TodoView::sorted()const{
58 return m_sort; 58 return m_sort;
@@ -70,2 +70,3 @@ void TodoView::setSortOrder( int order ) {
70void TodoView::setAscending( bool b ) { 70void TodoView::setAscending( bool b ) {
71 qWarning("setAscending %d", b );
71 m_asc = b; 72 m_asc = b;
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
@@ -159,3 +159,3 @@ namespace Todo {
159 OTodoAccess::List list(); 159 OTodoAccess::List list();
160 OTodoAccess::List sorted(); 160 OTodoAccess::List sorted()const;
161 void sort(); 161 void sort();