mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-19 16:31:21 +00:00
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.
This commit is contained in:
parent
8d3b221690
commit
39911cad18
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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:
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue