diff options
| author | Peter Penz <[email protected]> | 2011-03-08 22:25:53 +0100 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2011-03-08 22:32:49 +0100 |
| commit | 39911cad181a168b917b67fb2963e8ebb942210c (patch) | |
| tree | 8273260cbb08f9e24cb9a283d63c847e8acfaedf /src | |
| parent | 8d3b22169056d7774089c44dd7682ce7165b4fd5 (diff) | |
Prevent unnecessary reloading of KDirLister on startup
When Dolphin is started with a directory as argument unnecessary reload operations of KDirListers are done. The patch improves this by just letting the DolphinView internally do a loading as soon as it gets visible (and without reloading). Also in case if only one directory is passed as argument the current tab gets reused instead of creating new tabs and removing the current tab.
Thanks a lot to David Faure for pointing out this unefficient handling.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphinmainwindow.cpp | 8 | ||||
| -rw-r--r-- | src/views/dolphinview.cpp | 8 | ||||
| -rw-r--r-- | src/views/dolphinview.h | 1 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index c50a42a40..e0f6019c0 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -163,6 +163,11 @@ void DolphinMainWindow::openDirectories(const QList<KUrl>& dirs) return; } + if (dirs.count() == 1) { + m_activeViewContainer->setUrl(dirs.first()); + return; + } + const int oldOpenTabsCount = m_viewTab.count(); const GeneralSettings* generalSettings = DolphinSettings::instance().generalSettings(); @@ -419,7 +424,6 @@ void DolphinMainWindow::openNewTab(const KUrl& url) viewTab.primaryView = new DolphinViewContainer(url, viewTab.splitter); viewTab.primaryView->setActive(false); connectViewSignals(viewTab.primaryView); - viewTab.primaryView->view()->reload(); m_viewTab.append(viewTab); @@ -1307,7 +1311,6 @@ void DolphinMainWindow::init() m_activeViewContainer = m_viewTab[m_tabIndex].primaryView; connectViewSignals(m_activeViewContainer); DolphinView* view = m_activeViewContainer->view(); - view->reload(); m_activeViewContainer->show(); m_actionHandler->setCurrentView(view); @@ -1924,7 +1927,6 @@ void DolphinMainWindow::createSecondaryView(int tabIndex) splitter->addWidget(m_viewTab[tabIndex].secondaryView); splitter->setSizes(QList<int>() << newWidth << newWidth); connectViewSignals(m_viewTab[tabIndex].secondaryView); - m_viewTab[tabIndex].secondaryView->view()->reload(); m_viewTab[tabIndex].secondaryView->setActive(false); m_viewTab[tabIndex].secondaryView->show(); } diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 4ab16e052..6108c9d4a 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -768,6 +768,14 @@ bool DolphinView::eventFilter(QObject* watched, QEvent* event) return QWidget::eventFilter(watched, event); } +void DolphinView::showEvent(QShowEvent* event) +{ + QWidget::showEvent(event); + if (!event->spontaneous()) { + loadDirectory(url()); + } +} + void DolphinView::activate() { setActive(true); diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index 1d1d316ea..48967e62b 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -559,6 +559,7 @@ protected: /** @see QWidget::mouseReleaseEvent */ virtual void mouseReleaseEvent(QMouseEvent* event); virtual bool eventFilter(QObject* watched, QEvent* event); + virtual void showEvent(QShowEvent* event); private slots: /** |
