diff --git a/lib/contextmanager.cpp b/lib/contextmanager.cpp --- a/lib/contextmanager.cpp +++ b/lib/contextmanager.cpp @@ -35,6 +35,7 @@ #include #include #include +#include namespace Gwenview { @@ -300,7 +301,19 @@ { GV_RETURN_IF_FAIL(url.isValid()); d->mUrlToSelect = url; - setCurrentDirUrl(url.adjusted(QUrl::RemoveFilename)); + + // Make sure that an url passed as command line argument is loaded + // and shown before a possibly long running dirlister on a slow + // network device is started. So start the dirlister with a delay. + if (UrlUtils::urlIsFastLocalFile(url.adjusted(QUrl::RemoveFilename))) { + setCurrentDirUrl(url.adjusted(QUrl::RemoveFilename)); + } + else { + QTimer::singleShot(1000, [=]() { + setCurrentDirUrl(url.adjusted(QUrl::RemoveFilename)); + }); + } + setCurrentUrl(url); selectUrlToSelect(); }