Commit c3bb265e authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix Bug 176355 - Switching layout in kmail empties message list

We restore current selected folder now.

FIXED-IN: 4.9.1
BUG: 176355
parent a30ed173
......@@ -324,7 +324,7 @@ K_GLOBAL_STATIC( KMMainWidget::PtrList, theMainWidgetList )
}
void KMMainWidget::restoreCollectionFolderViewConfig()
void KMMainWidget::restoreCollectionFolderViewConfig(Akonadi::Collection::Id id)
{
ETMViewStateSaver *saver = new ETMViewStateSaver;
saver->setView( mFolderTreeWidget->folderTreeView() );
......@@ -332,9 +332,14 @@ void KMMainWidget::restoreCollectionFolderViewConfig()
mFolderTreeWidget->restoreHeaderState( cfg.readEntry( "HeaderState", QByteArray() ) );
saver->restoreState( cfg );
//Restore startup folder
Akonadi::Collection::Id startupFolder = GlobalSettings::self()->startupFolder();
if ( startupFolder > 0 )
saver->restoreCurrentItem( QString::fromLatin1("c%1").arg(startupFolder) );
if(id == -1) {
Akonadi::Collection::Id startupFolder = GlobalSettings::self()->startupFolder();
if ( startupFolder > 0 )
saver->restoreCurrentItem( QString::fromLatin1("c%1").arg(startupFolder) );
} else {
saver->restoreCurrentItem( QString::fromLatin1("c%1").arg(id) );
}
}
......@@ -879,7 +884,11 @@ void KMMainWidget::readConfig()
if( layoutChanged ) {
deleteWidgets();
createWidgets();
restoreCollectionFolderViewConfig();
Akonadi::Collection::Id id = -1;
if(mCurrentFolder && mCurrentFolder->collection().isValid() ) {
id = mCurrentFolder->collection().id();
}
restoreCollectionFolderViewConfig(id);
} else if ( oldFolderQuickSearch != mEnableFolderQuickSearch ) {
if ( mEnableFolderQuickSearch )
mFolderTreeWidget->filterFolderLineEdit()->show();
......
......@@ -296,7 +296,7 @@ class KMAIL_EXPORT KMMainWidget : public QWidget
void captionChangeRequest( const QString &caption );
protected:
void restoreCollectionFolderViewConfig();
void restoreCollectionFolderViewConfig(Akonadi::Collection::Id id = -1);
void setupActions();
void createWidgets();
void deleteWidgets();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment