Commit 6481152f authored by Laurent Montel's avatar Laurent Montel 😁

Remove duplicate code

parent e54fd2e1
...@@ -1061,8 +1061,8 @@ void Pane::readConfig(bool restoreSession) ...@@ -1061,8 +1061,8 @@ void Pane::readConfig(bool restoreSession)
createNewTab(); createNewTab();
} else { } else {
for(int i = 0; i<numberOfTab; ++i) { for(int i = 0; i<numberOfTab; ++i) {
KConfigGroup grp(MessageList::Core::Settings::self()->config(),QString::fromLatin1("MessageListTab%1").arg(i)); restoreHeaderSettings(i);
QItemSelectionModel *selectionModel = createNewTab(); createNewTab();
#if 0 #if 0
Akonadi::Collection::Id id = grp.readEntry(QLatin1String("collectionId"),-1); Akonadi::Collection::Id id = grp.readEntry(QLatin1String("collectionId"),-1);
ETMViewStateSaver *saver = new ETMViewStateSaver; ETMViewStateSaver *saver = new ETMViewStateSaver;
...@@ -1075,24 +1075,24 @@ void Pane::readConfig(bool restoreSession) ...@@ -1075,24 +1075,24 @@ void Pane::readConfig(bool restoreSession)
saver->selectCollections(Akonadi::Collection::List()<<Akonadi::Collection(id)); saver->selectCollections(Akonadi::Collection::List()<<Akonadi::Collection(id));
saver->restoreCurrentItem( QString::fromLatin1("c%1").arg(id) ); saver->restoreCurrentItem( QString::fromLatin1("c%1").arg(id) );
} }
#else
Q_UNUSED( selectionModel );
#endif #endif
Widget *w = qobject_cast<Widget *>( widget( i ) );
w->view()->header()->restoreState(grp.readEntry(QLatin1String("HeaderState"),QByteArray()));
} }
setCurrentIndex(conf.readEntry(QLatin1String("currentIndex"),0)); setCurrentIndex(conf.readEntry(QLatin1String("currentIndex"),0));
} }
} else { } else {
createNewTab(); createNewTab();
KConfigGroup grp(MessageList::Core::Settings::self()->config(),QString::fromLatin1("MessageListTab%1").arg(0)); restoreHeaderSettings(0);
if (grp.exists()) {
Widget *w = qobject_cast<Widget *>( widget( 0 ) );
w->view()->header()->restoreState(grp.readEntry(QLatin1String("HeaderState"),QByteArray()));
}
} }
} }
void Pane::restoreHeaderSettings(int index)
{
KConfigGroup grp(MessageList::Core::Settings::self()->config(),QString::fromLatin1("MessageListTab%1").arg(index));
if (grp.exists()) {
Widget *w = qobject_cast<Widget *>( widget( index ) );
w->view()->header()->restoreState(grp.readEntry(QLatin1String("HeaderState"),QByteArray()));
}
}
bool Pane::searchEditHasFocus() const bool Pane::searchEditHasFocus() const
{ {
......
...@@ -457,8 +457,7 @@ signals: ...@@ -457,8 +457,7 @@ signals:
private: private:
void restoreHeaderSettings(int index);
void readConfig(bool restoreSession); void readConfig(bool restoreSession);
Q_PRIVATE_SLOT(d, void onSelectionChanged( const QItemSelection&, const QItemSelection& )) Q_PRIVATE_SLOT(d, void onSelectionChanged( const QItemSelection&, const QItemSelection& ))
......
Markdown is supported
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