X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/31ee4085c2b2c374158fb956ac376399ff375b5a..321f747ddf9cf71ed3c8fa4de287d131cd22c2d8:/src/dolphinviewcontainer.cpp diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 9d75ad816..5f8b8f3b4 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -45,7 +45,6 @@ #include #include "dolphin_generalsettings.h" -#include "dolphinmainwindow.h" #include "filterbar/filterbar.h" #include "search/dolphinsearchbox.h" #include "statusbar/dolphinstatusbar.h" @@ -64,7 +63,8 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) : m_filterBar(0), m_statusBar(0), m_statusBarTimer(0), - m_statusBarTimestamp() + m_statusBarTimestamp(), + m_autoGrabFocus(true) { hide(); @@ -111,8 +111,6 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) : connect(m_view, SIGNAL(selectionChanged(KFileItemList)), this, SLOT(delayedStatusBarUpdate())); connect(m_view, SIGNAL(urlAboutToBeChanged(KUrl)), this, SLOT(slotViewUrlAboutToBeChanged(KUrl))); connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(showErrorMessage(QString))); - connect(m_view, SIGNAL(infoMessage(QString)), this, SLOT(showInfoMessage(QString))); - connect(m_view, SIGNAL(operationCompletedMessage(QString)), m_statusBar, SLOT(setText(QString))); connect(m_urlNavigator, SIGNAL(urlAboutToBeChanged(KUrl)), this, SLOT(slotUrlNavigatorLocationAboutToBeChanged(KUrl))); @@ -125,10 +123,12 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) : m_statusBar = new DolphinStatusBar(this); m_statusBar->setUrl(m_view->url()); m_statusBar->setZoomLevel(m_view->zoomLevel()); - connect(m_view, SIGNAL(urlChanged(KUrl)), m_statusBar, SLOT(setUrl(KUrl))); - connect(m_view, SIGNAL(zoomLevelChanged(int,int)), m_statusBar, SLOT(setZoomLevel(int))); - connect(m_statusBar, SIGNAL(stopPressed()), this, SLOT(stopDirectoryLoading())); - connect(m_statusBar, SIGNAL(zoomLevelChanged(int)), this, SLOT(slotStatusBarZoomLevelChanged(int))); + connect(m_view, SIGNAL(urlChanged(KUrl)), m_statusBar, SLOT(setUrl(KUrl))); + connect(m_view, SIGNAL(zoomLevelChanged(int,int)), m_statusBar, SLOT(setZoomLevel(int))); + connect(m_view, SIGNAL(infoMessage(QString)), m_statusBar, SLOT(setText(QString))); + connect(m_view, SIGNAL(operationCompletedMessage(QString)), m_statusBar, SLOT(setText(QString))); + connect(m_statusBar, SIGNAL(stopPressed()), this, SLOT(stopDirectoryLoading())); + connect(m_statusBar, SIGNAL(zoomLevelChanged(int)), this, SLOT(slotStatusBarZoomLevelChanged(int))); m_statusBarTimer = new QTimer(this); m_statusBarTimer->setSingleShot(true); @@ -180,6 +180,16 @@ bool DolphinViewContainer::isActive() const return m_view->isActive(); } +void DolphinViewContainer::setAutoGrabFocus(bool grab) +{ + m_autoGrabFocus = grab; +} + +bool DolphinViewContainer::autoGrabFocus() const +{ + return m_autoGrabFocus; +} + const DolphinStatusBar* DolphinViewContainer::statusBar() const { return m_statusBar; @@ -210,16 +220,6 @@ DolphinView* DolphinViewContainer::view() return m_view; } -const DolphinSearchBox* DolphinViewContainer::searchBox() const -{ - return m_searchBox; -} - -DolphinSearchBox* DolphinViewContainer::searchBox() -{ - return m_searchBox; -} - void DolphinViewContainer::showMessage(const QString& msg, MessageType type) { if (msg.isEmpty()) { @@ -308,8 +308,6 @@ void DolphinViewContainer::setSearchModeEnabled(bool enabled) } } } - - emit searchModeChanged(enabled); } bool DolphinViewContainer::isSearchModeEnabled() const @@ -508,7 +506,7 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const KUrl& url) setSearchModeEnabled(isSearchUrl(url)); m_view->setUrl(url); - if (isActive() && !isSearchUrl(url)) { + if (m_autoGrabFocus && isActive() && !isSearchUrl(url)) { // 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. @@ -617,11 +615,6 @@ void DolphinViewContainer::showErrorMessage(const QString& msg) showMessage(msg, Error); } -void DolphinViewContainer::showInfoMessage(const QString& msg) -{ - showMessage(msg, Information); -} - bool DolphinViewContainer::isSearchUrl(const KUrl& url) const { const QString protocol = url.protocol();