m_searchBox = new DolphinSearchBox(this);
m_searchBox->hide();
connect(m_searchBox, &DolphinSearchBox::activated, this, &DolphinViewContainer::activate);
+ connect(m_searchBox, &DolphinSearchBox::openRequest, this, &DolphinViewContainer::openSearchBox);
connect(m_searchBox, &DolphinSearchBox::closeRequest, this, &DolphinViewContainer::closeSearchBox);
connect(m_searchBox, &DolphinSearchBox::searchRequest, this, &DolphinViewContainer::startSearching);
connect(m_searchBox, &DolphinSearchBox::focusViewRequest, this, &DolphinViewContainer::requestFocus);
}
if (KProtocolManager::supportsListing(url)) {
- setSearchModeEnabled(isSearchUrl(url));
+ const bool searchBoxInitialized = isSearchModeEnabled() && m_searchBox->text().isEmpty();
+ setSearchModeEnabled(isSearchUrl(url) || searchBoxInitialized);
+
m_view->setUrl(url);
tryRestoreViewState();
- if (m_autoGrabFocus && isActive() && !isSearchUrl(url)) {
+ if (m_autoGrabFocus && isActive() && !isSearchModeEnabled()) {
// When an URL has been entered, the view should get the focus.
// The focus must be requested asynchronously, as changing the URL might create
// a new view widget.
}
}
+void DolphinViewContainer::openSearchBox()
+{
+ setSearchModeEnabled(true);
+}
+
void DolphinViewContainer::closeSearchBox()
{
setSearchModeEnabled(false);