Index: kmail/kmmainwidget.h =================================================================== --- kmail/kmmainwidget.h +++ kmail/kmmainwidget.h @@ -200,6 +200,7 @@ void updateQuickSearchLineText(); void populateMessageListStatusFilterCombo(); + public Q_SLOTS: // Moving messages around /** Index: kmail/kmmainwidget.cpp =================================================================== --- kmail/kmmainwidget.cpp +++ kmail/kmmainwidget.cpp @@ -989,7 +989,7 @@ this); connect(KMKernel::self()->entityTreeModel(), &Akonadi::EntityTreeModel::collectionFetched, this, &KMMainWidget::slotCollectionFetched); - mMessagePane->hide();// hide the search bar + mMessagePane->show(); mMessagePane->setXmlGuiClient(mGUIClient); connect(mMessagePane, &MessageList::Pane::messageSelected, this, &KMMainWidget::slotMessageSelected); @@ -2536,11 +2536,7 @@ void KMMainWidget::slotSearchButton() { - if(mHideShowSearchBarAction->isChecked()){ - mMessagePane->show(); - } else { - mMessagePane->hide(); - } + mMessagePane->executeActionShowQuicksearch(); } void KMMainWidget::slotSelectPreviousUnreadMessage() @@ -3315,6 +3311,11 @@ mHideShowSearchBarAction->setChecked(false); connect(mHideShowSearchBarAction, &QAction::triggered, this, &KMMainWidget::slotSearchButton); + /* execute action for hidding the search bar at launch */ + if(mMessagePane->showHideQuicksearchIsChecked()) + mMessagePane->executeActionShowQuicksearch(); + + } { Index: messagelist/src/pane.h =================================================================== --- messagelist/src/pane.h +++ messagelist/src/pane.h @@ -29,6 +29,7 @@ #include #include #include +#include class KXMLGUIClient; class QAbstractItemModel; @@ -382,6 +383,10 @@ void populateStatusFilterCombo(); + void executeActionShowQuicksearch(); + + bool showHideQuicksearchIsChecked() const; + public Q_SLOTS: /** * Selects all the items in the current folder. @@ -463,6 +468,7 @@ class Private; Private *const d; + KToggleAction *showHideQuicksearch; }; } // namespace MessageList Index: messagelist/src/pane.cpp =================================================================== --- messagelist/src/pane.cpp +++ messagelist/src/pane.cpp @@ -25,7 +25,7 @@ #include #include #include -#include + #include #include @@ -216,7 +216,7 @@ { d->mXmlGuiClient = xmlGuiClient; - KToggleAction *const showHideQuicksearch = new KToggleAction(i18n("Show Quick Search Bar"), this); + showHideQuicksearch = new KToggleAction(i18n("Show Quick Search Bar"), this); d->mXmlGuiClient->actionCollection()->setDefaultShortcut(showHideQuicksearch, Qt::CTRL + Qt::Key_H); showHideQuicksearch->setChecked(MessageListSettings::showQuickSearch()); @@ -279,6 +279,14 @@ } } +void Pane::executeActionShowQuicksearch(){ + showHideQuicksearch->trigger(); +} + +bool Pane::showHideQuicksearchIsChecked() const{ + return showHideQuicksearch->isChecked(); +} + bool Pane::selectNextMessageItem(MessageList::Core::MessageTypeFilter messageTypeFilter, MessageList::Core::ExistingSelectionBehaviour existingSelectionBehaviour, bool centerItem, @@ -625,6 +633,12 @@ Widget *w = qobject_cast(q->widget(i)); w->changeQuicksearchVisibility(show); } + + /* Put the same state for the 2 QAction */ + if(q->showHideQuicksearchIsChecked()) + mXmlGuiClient->actionCollection()->action(QStringLiteral("search_button"))->setChecked(true); + else + mXmlGuiClient->actionCollection()->action(QStringLiteral("search_button"))->setChecked(false); } bool Pane::eventFilter(QObject *object, QEvent *event)