Bug 259080 - [regression] "Jump to" feature no longer works
Summary: [regression] "Jump to" feature no longer works
Status: RESOLVED FIXED
Alias: None
Product: kmail2
Classification: Applications
Component: folders (show other bugs)
Version: 2.0.89
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-07 09:41 UTC by Thiago Macieira
Modified: 2010-12-31 15:32 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thiago Macieira 2010-12-07 09:41:01 UTC
Version:           2.0.89 (using Devel) 
OS:                Linux

Trying to jump to a different folder using the keyboard shortcuts no longer works.

Reproducible: Always

Steps to Reproduce:
1. Select a folder
2. Press J
3. Select another folder

Actual Results:  
Nothing happens

Expected Results:  
Should be in another folder.

OS: Linux (i686) release 2.6.35.2-server-1mnb
Compiler: gcc
Comment 1 Thiago Macieira 2010-12-07 09:53:38 UTC
More information: *something* happens after I tell kmail to jump. If I was viewing an HTML message and jump to a folder with HTML turned off, the message will redisplay in text only. And the Folder menu options change (for example, I could not select "Prefer HTML to plain text", it was greyed out)
Comment 2 Thiago Macieira 2010-12-07 12:27:20 UTC
This includes per-folder shortcuts too. Pressing the combination assigned to a folder has a full flicker and redraw of the message list and message view, but it shows the message it was already showing.
Comment 3 Thiago Macieira 2010-12-15 12:58:58 UTC
More info: I can jump to folders in the first account (in alphabetical order). I cannot jump to folders in any other account.
Comment 4 Tobias Koenig 2010-12-31 15:32:05 UTC
commit 1a9ac7a1589f2aca8b49b7afabbac41185f4286c
branch master
Author: Tobias Koenig <tokoe@kde.org>
Date:   Fri Dec 31 15:34:36 2010 +0100

    Replace ETM::match() with ETM::modelIndexForCollection()
    
    This fixes the bug that folders of another resource can not
    be used as target for 'Jump to folder' functionality.
    
    BUG: 259080

diff --git a/mailcommon/foldertreewidget.cpp b/mailcommon/foldertreewidget.cpp
index a168a4b..94d7532 100644
--- a/mailcommon/foldertreewidget.cpp
+++ b/mailcommon/foldertreewidget.cpp
@@ -160,22 +160,13 @@ void FolderTreeWidget::disableContextMenuAndExtraColumn()
   d->folderTreeView->disableContextMenuAndExtraColumn();
 }
 
-void FolderTreeWidget::selectCollectionFolder( const Akonadi::Collection & col )
+void FolderTreeWidget::selectCollectionFolder( const Akonadi::Collection &collection )
 {
+  const QModelIndex index = Akonadi::EntityTreeModel::modelIndexForCollection( d->folderTreeView->model(), collection );
 
-  //TODO fix it when we select an col in imap folder. Doesn't work for the moment Don't know why
-  const QModelIndex idx = d->folderTreeView->model()->index( 0, 0, QModelIndex() );
-  const QModelIndexList rows = d->folderTreeView->model()->match( idx,
-                    Akonadi::EntityTreeModel::CollectionIdRole, col.id(), -1,
-                    Qt::MatchRecursive | Qt::MatchExactly );
-  if ( rows.size() < 1 )
-    return;
-  const QModelIndex colIndex = rows.first();
-  d->folderTreeView->selectionModel()->select(colIndex,
-                                              QItemSelectionModel::SelectCurrent
-                                              | QItemSelectionModel::Rows);
-  d->folderTreeView->setExpanded( colIndex, true );
-  d->folderTreeView->scrollTo( colIndex );
+  d->folderTreeView->selectionModel()->select( index, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows );
+  d->folderTreeView->setExpanded( index, true );
+  d->folderTreeView->scrollTo( index );
 }
 
 void FolderTreeWidget::setSelectionMode( QAbstractItemView::SelectionMode mode )