From c021cc982f81fae73a134a1caee7f8dafffaf2f9 Mon Sep 17 00:00:00 2001 From: Till Adam Date: Sun, 22 Jun 2008 16:56:34 +0000 Subject: [PATCH] Speed up the folderselector to bare-able performance again by expanding all folders in one go at the end of a reload, instead of triggering updates after every folder that is added and by disabling sorting, the order should be that of the main folder tree anyhow, and given the quick search, the ability to sort adds nothing, it just slows things down on initial load. svn path=/branches/kdepim/enterprise4/kdepim/; revision=823147 --- folderselectiondialog.cpp | 2 ++ folderselectiontreewidget.cpp | 11 ++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/folderselectiondialog.cpp b/folderselectiondialog.cpp index 2562edb97..eedca11ac 100644 --- a/folderselectiondialog.cpp +++ b/folderselectiondialog.cpp @@ -65,6 +65,7 @@ void FolderSelectionDialog::init( KMFolderTree *tree, bool mustBeReadWrite ) QWidget *vbox = new KVBox( this ); setMainWidget( vbox ); mTreeView = new KMail::FolderSelectionTreeWidget( vbox, tree ); + mTreeView->setSortingEnabled( false ); mTreeView->reload( mustBeReadWrite, true, true, preSelection ); mTreeView->setFocus(); connect( mTreeView, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int ) ), @@ -73,6 +74,7 @@ void FolderSelectionDialog::init( KMFolderTree *tree, bool mustBeReadWrite ) this, SLOT( slotUpdateBtnStatus() ) ); connect(this, SIGNAL( user1Clicked() ), mTreeView, SLOT( addChildFolder() ) ); readConfig(); + mTreeView->resizeColumnToContents(0); } FolderSelectionDialog::~FolderSelectionDialog() diff --git a/folderselectiontreewidget.cpp b/folderselectiontreewidget.cpp index 684aa06a0..cd85a2770 100644 --- a/folderselectiontreewidget.cpp +++ b/folderselectiontreewidget.cpp @@ -96,7 +96,6 @@ void FolderSelectionTreeWidget::recursiveReload( KMFolderTreeItem *fti, FolderSe item->setFolderType( static_cast( fti->type() ) ); QPixmap pix = fti->normalIcon( KIconLoader::SizeSmall ); item->setIcon( mNameColumnIndex, pix.isNull() ? SmallIcon( "folder" ) : QIcon( pix ) ); - item->setExpanded( true ); // Make items without folders and readonly items unselectable // if we're told so @@ -130,18 +129,16 @@ void FolderSelectionTreeWidget::reload( bool mustBeReadWrite, bool showOutbox, mFilter = QString(); - // Calling setUpdatesEnabled() here causes weird effects (including crashes) - // in the folder requester (used by the filtering dialog). - // So disable it for now, this makes the folderselection dialog appear much - // slower though :( - //setUpdatesEnabled( false ); for ( KMFolderTreeItem * fti = static_cast( mFolderTree->firstChild() ) ; fti; fti = static_cast( fti->nextSibling() ) ) recursiveReload( fti, 0 ); - //setUpdatesEnabled( true ); + + // we do this here in one go after all items have been created, as that is + // faster than expanding each item, which triggers a lot of updates + expandAll(); if ( !preSelection.isEmpty() ) setFolder( preSelection );