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
wilder-work
Till Adam 18 years ago
parent 919fbe7331
commit c021cc982f
  1. 2
      folderselectiondialog.cpp
  2. 11
      folderselectiontreewidget.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()

@ -96,7 +96,6 @@ void FolderSelectionTreeWidget::recursiveReload( KMFolderTreeItem *fti, FolderSe
item->setFolderType( static_cast<KPIM::FolderTreeWidgetItem::FolderType>( 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<KMFolderTreeItem *>( mFolderTree->firstChild() ) ;
fti;
fti = static_cast<KMFolderTreeItem *>( 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 );

Loading…
Cancel
Save