summaryrefslogtreecommitdiff
path: root/core/pim/todo/mainwindow.cpp
authorzecke <zecke>2002-10-13 02:26:52 (UTC)
committer zecke <zecke>2002-10-13 02:26:52 (UTC)
commite9e5c2346f12f78b42025c70a50ebb4157dbd7ca (patch) (side-by-side diff)
tree310c3a4bb3fc38646b21941e516f6f9f6b4c7fb9 /core/pim/todo/mainwindow.cpp
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 (limited to 'core/pim/todo/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp7
1 files changed, 4 insertions, 3 deletions
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
@@ -407,33 +407,32 @@ void MainWindow::slotNew() {
}
OTodo todo = currentEditor()->newTodo( currentCatId(),
this );
if ( currentEditor()->accepted() ) {
//todo.assignUid();
currentView()->addEvent( todo );
m_todoMgr.add( todo );
// I'm afraid we must call this every time now, otherwise
// spend expensive time comparing all these strings...
// but only call if we changed something -zecke
populateCategories();
}
-
raiseCurrentView( );
}
void MainWindow::slotDuplicate() {
if(m_syncing) {
QMessageBox::warning(this, tr("Todo"),
tr("Can not edit data, currently syncing"));
return;
}
OTodo ev = m_todoMgr.event( currentView()->current() );
/* let's generate a new uid */
ev.setUid(-1);
m_todoMgr.add( ev );
currentView()->addEvent( ev );
raiseCurrentView();
}
@@ -484,48 +483,50 @@ void MainWindow::slotDeleteCompleted() {
// FIXME
//m_todoMgr.remove( currentView()->completed() );
currentView()->updateView( );
}
void MainWindow::slotFind() {
}
void MainWindow::slotEdit() {
slotEdit( currentView()->current() );
}
/*
* set the category
*/
void MainWindow::setCategory( int c) {
if ( c <= 0 ) return;
+
qWarning("Iterating over cats %d", c );
for ( unsigned int i = 1; i < m_catMenu->count(); i++ )
m_catMenu->setItemChecked(i, c == (int)i );
if (c == 1 ) {
m_curCat = QString::null;
setCaption( tr("Todo") + " - " + tr("All Categories" ) );
}else if ( c == (int)m_catMenu->count() - 1 ) {
m_curCat = tr("Unfiled");
setCaption( tr("Todo") + " - " + tr("Unfiled") );
}else {
m_curCat = m_todoMgr.categories()[c-2];
setCaption( tr("Todo") + " - " + m_curCat );
}
m_catMenu->setItemChecked( c, true );
+
currentView()->setShowCategory( m_curCat );
raiseCurrentView();
}
void MainWindow::slotShowDeadLine( bool dead) {
m_deadline = dead;
currentView()->setShowDeadline( dead );
}
void MainWindow::slotShowCompleted( bool show) {
m_completed = show;
currentView()->setShowCompleted( m_completed );
}
bool MainWindow::showOverDue()const {
return m_overdue;
}
void MainWindow::setDocument( const QString& ) {
@@ -536,34 +537,33 @@ void MainWindow::slotBeam() {
void MainWindow::beamDone( Ir* ) {
}
void MainWindow::slotFlush() {
m_syncing = FALSE;
m_todoMgr.save();
}
void MainWindow::slotShowDetails() {
slotShow( currentView()->current() );
}
/*
* populate the Categories
* Menu
*/
void MainWindow::populateCategories() {
- if (m_todoMgr.isLoaded() )
- m_todoMgr.load();
+ m_todoMgr.load();
m_catMenu->clear();
int id, rememberId;
id = 1;
rememberId = 1;
m_catMenu->insertItem( tr( "All Categories" ), id++ );
m_catMenu->insertSeparator();
QStringList categories = m_todoMgr.categories();
categories.append( tr( "Unfiled" ) );
for ( QStringList::Iterator it = categories.begin();
it != categories.end(); ++it ) {
m_catMenu->insertItem( *it, id );
if ( *it == currentCategory() )
rememberId = id;
++id;
@@ -601,32 +601,33 @@ void MainWindow::slotShow( int uid ) {
void MainWindow::slotEdit( int uid ) {
if(m_syncing) {
QMessageBox::warning(this, tr("Todo"),
tr("Can not edit data, currently syncing"));
return;
}
OTodo todo = m_todoMgr.event( uid );
todo = currentEditor()->edit(this, todo );
/* if completed */
if ( currentEditor()->accepted() ) {
qWarning("Replacing now" );
m_todoMgr.update( todo.uid(), todo );
currentView()->replaceEvent( todo );
+ /* a Category might have changed */
populateCategories();
}
raiseCurrentView();
}
/*
void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) {
m_todoMgr.update( uid, ev );
}
*/
void MainWindow::updateTodo( const OTodo& ev) {
m_todoMgr.update( ev.uid() , ev );
}
/* The view changed it's configuration
* update the view menu
*/