diff --git a/krusader/Panel/panelfunc.cpp b/krusader/Panel/panelfunc.cpp --- a/krusader/Panel/panelfunc.cpp +++ b/krusader/Panel/panelfunc.cpp @@ -308,6 +308,7 @@ // may get a new vfs for this url vfs* vfs = KrVfsHandler::instance().getVfs(url, files()); + vfs->setParentWindow(krMainWindow); connect(vfs, &vfs::aboutToOpenDir, &krMtMan, &KMountMan::autoMount, Qt::DirectConnection); if (vfs != vfsP) { panel->view->setFiles(0); diff --git a/krusader/VFS/default_vfs.cpp b/krusader/VFS/default_vfs.cpp --- a/krusader/VFS/default_vfs.cpp +++ b/krusader/VFS/default_vfs.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -212,6 +213,12 @@ connect(job, &KIO::ListJob::permanentRedirection, this, &default_vfs::slotRedirection); connect(job, SIGNAL(result(KJob*)), this, SLOT(slotListResult(KJob*))); + // ensure connection credentials are asked only once + if(!parentWindow.isNull()) { + KIO::JobUiDelegate *ui = static_cast(job->uiDelegate()); + ui->setWindow(parentWindow); + } + emit refreshJobStarted(job); _listError = false; diff --git a/krusader/VFS/vfs.h b/krusader/VFS/vfs.h --- a/krusader/VFS/vfs.h +++ b/krusader/VFS/vfs.h @@ -147,6 +147,9 @@ /// Add 'file' scheme to non-empty URL without scheme static QUrl preferLocalUrl(const QUrl &url); + // set the parent window to be used for dialogs + void setParentWindow(QWidget *widget) { parentWindow = widget; } + public slots: /// Re-read the current directory files or change to another directory. Blocking. /// Returns true if directory was read. Returns false if failed or refresh job was killed. @@ -201,6 +204,7 @@ VFS_TYPE _type; // the vfs type. QUrl _currentDirectory; // the path or file the VFS originates from. bool _isRefreshing; // true if vfs is busy with refreshing + QPointer parentWindow; protected slots: /// Handle result after job (except when refreshing!) finished