diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphinmainwindow.cpp | 8 | ||||
| -rw-r--r-- | src/kitemviews/kfileitemmodel.cpp | 7 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 17268297c..babaf1486 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -2057,7 +2057,13 @@ void DolphinMainWindow::createSecondaryView(int tabIndex) const int newWidth = (viewTab.primaryView->width() - splitter->handleWidth()) / 2; const DolphinView* view = viewTab.primaryView->view(); - viewTab.secondaryView = createViewContainer(view->url(), 0); + // The final parent of the new view container will be set by adding it + // to the splitter. However, we must make sure that the DolphinMainWindow + // is a parent of the view container already when it is constructed + // because this enables the container's KFileItemModel to assign its + // dir lister to the right main window. The dir lister can then cache + // authentication data. + viewTab.secondaryView = createViewContainer(view->url(), this); splitter->addWidget(viewTab.secondaryView); splitter->setSizes(QList<int>() << newWidth << newWidth); diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 752bc9365..61f512a8e 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -31,6 +31,7 @@ #include <QApplication> #include <QMimeData> #include <QTimer> +#include <QWidget> // #define KFILEITEMMODEL_DEBUG @@ -59,7 +60,11 @@ KFileItemModel::KFileItemModel(QObject* parent) : m_dirLister = new KFileItemModelDirLister(this); m_dirLister->setAutoUpdate(true); m_dirLister->setDelayedMimeTypes(true); - m_dirLister->setMainWindow(qApp->activeWindow()); + + const QWidget* parentWidget = qobject_cast<QWidget*>(parent); + if (parentWidget) { + m_dirLister->setMainWindow(parentWidget->window()); + } connect(m_dirLister, SIGNAL(started(KUrl)), this, SIGNAL(directoryLoadingStarted())); connect(m_dirLister, SIGNAL(canceled()), this, SLOT(slotCanceled())); |
