diff --git a/krusader/Panel/dirhistoryqueue.h b/krusader/Panel/dirhistoryqueue.h --- a/krusader/Panel/dirhistoryqueue.h +++ b/krusader/Panel/dirhistoryqueue.h @@ -38,9 +38,6 @@ ~DirHistoryQueue(); void clear(); - int state() { - return _state; - } int currentPos() { return _currentPos; } @@ -73,7 +70,6 @@ private: KrPanel* _panel; - int _state; // increments when we move inside the history, or a new item is added int _currentPos; QList _urlQueue; QStringList _currentItems; diff --git a/krusader/Panel/dirhistoryqueue.cpp b/krusader/Panel/dirhistoryqueue.cpp --- a/krusader/Panel/dirhistoryqueue.cpp +++ b/krusader/Panel/dirhistoryqueue.cpp @@ -29,7 +29,7 @@ #include DirHistoryQueue::DirHistoryQueue(KrPanel *panel) : - _panel(panel), _state(0), _currentPos(0) + _panel(panel), _currentPos(0) { } @@ -40,7 +40,6 @@ _urlQueue.clear(); _currentItems.clear(); _currentPos = 0; - _state++; } QUrl DirHistoryQueue::currentUrl() @@ -80,7 +79,6 @@ if(_urlQueue.isEmpty()) { _urlQueue.push_front(url); _currentItems.push_front(currentItem); - _state++; return; } @@ -106,8 +104,6 @@ saveCurrentItem(); _urlQueue.push_front(url); _currentItems.push_front(currentItem); - - _state++; } void DirHistoryQueue::pushBackRoot() @@ -121,7 +117,6 @@ if(pos >= 0 && pos < _urlQueue.count()) { saveCurrentItem(); _currentPos = pos; - _state++; return true; } return false; @@ -166,6 +161,5 @@ if(_currentPos >= _urlQueue.count() || _currentPos < 0) _currentPos = 0; - _state++; return true; } diff --git a/krusader/Panel/listpanel.cpp b/krusader/Panel/listpanel.cpp --- a/krusader/Panel/listpanel.cpp +++ b/krusader/Panel/listpanel.cpp @@ -1093,9 +1093,6 @@ void ListPanel::slotFilesystemError(QString msg) { - if (func->ignoreFileSystemErrors()) - return; - refreshColors(); fileSystemError->setText(i18n("Error: %1", msg)); fileSystemError->show(); diff --git a/krusader/Panel/panelfunc.h b/krusader/Panel/panelfunc.h --- a/krusader/Panel/panelfunc.h +++ b/krusader/Panel/panelfunc.h @@ -126,11 +126,9 @@ ListPanelFunc* otherFunc(); bool atHome(); - bool ignoreFileSystemErrors() { return _ignoreFileSystemErrors; } protected slots: - // Load the current url from history and refresh filesystem and panel to it. If this fails, try the - // next url in history until success (last try is root) + // Load the current url from history and refresh filesystem and panel to it void doRefresh(); void slotFileCreated(KJob *job); // a file has been created by editNewFile() void historyGotoPos(int pos); @@ -159,7 +157,6 @@ static QPointer copyToClipboardOrigin; private: - bool _ignoreFileSystemErrors; // ignore (repeated) errors emitted by filesystem; bool _isPaused; // do not refresh while panel is not visible bool _refreshAfterPaused; // refresh after not paused anymore }; diff --git a/krusader/Panel/panelfunc.cpp b/krusader/Panel/panelfunc.cpp --- a/krusader/Panel/panelfunc.cpp +++ b/krusader/Panel/panelfunc.cpp @@ -93,7 +93,7 @@ ListPanelFunc::ListPanelFunc(ListPanel *parent) : QObject(parent), panel(parent), fileSystemP(0), urlManuallyEntered(false), - _ignoreFileSystemErrors(false), _isPaused(true), _refreshAfterPaused(true) + _isPaused(true), _refreshAfterPaused(true) { history = new DirHistoryQueue(panel); delayTimer.setSingleShot(true); @@ -249,99 +249,74 @@ const QUrl url = history->currentUrl(); if(!url.isValid()) { - //FIXME go back in history here ? panel->slotStartUpdate(true); // refresh the panel urlManuallyEntered = false; return ; } panel->inlineRefreshCancel(); // if we are not refreshing to current URL - bool isEqualUrl = files()->currentDirectory().matches(url, QUrl::StripTrailingSlash); + const bool isEqualUrl = files()->currentDirectory().matches(url, QUrl::StripTrailingSlash); if (!isEqualUrl) { panel->setCursor(Qt::WaitCursor); panel->view->clearSavedSelection(); } - if(panel->fileSystemError) + if (panel->fileSystemError) { panel->fileSystemError->hide(); + } - bool refreshFailed = false; - while (true) { - QUrl url = history->currentUrl(); - - isEqualUrl = files()->currentDirectory().matches(url, QUrl::StripTrailingSlash); + panel->setNavigatorUrl(url); - // may get a new filesystem for this url - FileSystem *fileSystem = FileSystemProvider::instance().getFilesystem(url, files()); - fileSystem->setParentWindow(krMainWindow); - connect(fileSystem, &FileSystem::aboutToOpenDir, &krMtMan, &KMountMan::autoMount, Qt::DirectConnection); - if (fileSystem != fileSystemP) { - panel->view->setFiles(0); + // may get a new filesystem for this url + FileSystem *fileSystem = FileSystemProvider::instance().getFilesystem(url, files()); + fileSystem->setParentWindow(krMainWindow); + connect(fileSystem, &FileSystem::aboutToOpenDir, &krMtMan, &KMountMan::autoMount, Qt::DirectConnection); + if (fileSystem != fileSystemP) { + panel->view->setFiles(0); - // disconnect older signals - disconnect(fileSystemP, 0, panel, 0); + // disconnect older signals + disconnect(fileSystemP, 0, panel, 0); - fileSystemP->deleteLater(); - fileSystemP = fileSystem; // v != 0 so this is safe - } else { - if (fileSystemP->isRefreshing()) { - delayTimer.start(100); /* if filesystem is busy try refreshing later */ - return; - } - } - // (re)connect filesystem signals - disconnect(files(), 0, panel, 0); - connect(files(), SIGNAL(refreshDone(bool)), panel, SLOT(slotStartUpdate(bool))); - connect(files(), &FileSystem::fileSystemInfoChanged, panel, &ListPanel::updateFilesystemStats); - connect(files(), SIGNAL(refreshJobStarted(KIO::Job*)), - panel, SLOT(slotJobStarted(KIO::Job*))); - connect(files(), SIGNAL(error(QString)), - panel, SLOT(slotFilesystemError(QString))); - - panel->view->setFiles(files()); - - if(!history->currentItem().isEmpty() && isEqualUrl) { - // if the url we're refreshing into is the current one, then the - // partial refresh will not generate the needed signals to actually allow the - // view to use nameToMakeCurrent. do it here instead (patch by Thomas Jarosch) - panel->view->setCurrentItem(history->currentItem()); - panel->view->makeItemVisible(panel->view->getCurrentKrViewItem()); - } - panel->view->setNameToMakeCurrent(history->currentItem()); - - int savedHistoryState = history->state(); - - // NOTE: this is blocking. Returns false on error or interruption (cancel requested or panel - // was deleted) - const bool refreshed = fileSystemP->refresh(url); - if (refreshed) { - // update the history as the actual url might differ from the one requested - history->setCurrentUrl(url); - break; // we have a valid refreshed URL now - } - if (!panel || !panel->view) - // this panel was deleted while refreshing + fileSystemP->deleteLater(); + fileSystemP = fileSystem; // v != 0 so this is safe + } else { + if (fileSystemP->isRefreshing()) { + delayTimer.start(100); /* if filesystem is busy try refreshing later */ return; - - refreshFailed = true; - - panel->view->setNameToMakeCurrent(QString()); - - if(history->state() != savedHistoryState) // don't go back if the history was touched - break; - if(!history->goBack()) { - // put the root dir to the beginning of history, if it's not there yet - if (!url.matches(QUrl::fromLocalFile(ROOT_DIR), QUrl::StripTrailingSlash)) - history->pushBackRoot(); - else - break; } - _ignoreFileSystemErrors = true; } - _ignoreFileSystemErrors = false; + // (re)connect filesystem signals + disconnect(files(), 0, panel, 0); + connect(files(), SIGNAL(refreshDone(bool)), panel, SLOT(slotStartUpdate(bool))); + connect(files(), &FileSystem::fileSystemInfoChanged, panel, &ListPanel::updateFilesystemStats); + connect(files(), SIGNAL(refreshJobStarted(KIO::Job*)), + panel, SLOT(slotJobStarted(KIO::Job*))); + connect(files(), SIGNAL(error(QString)), + panel, SLOT(slotFilesystemError(QString))); + + panel->view->setFiles(files()); + + if(!history->currentItem().isEmpty() && isEqualUrl) { + // if the url we're refreshing into is the current one, then the + // partial refresh will not generate the needed signals to actually allow the + // view to use nameToMakeCurrent. do it here instead (patch by Thomas Jarosch) + panel->view->setCurrentItem(history->currentItem()); + panel->view->makeItemVisible(panel->view->getCurrentKrViewItem()); + } + panel->view->setNameToMakeCurrent(history->currentItem()); + + // NOTE: this is blocking. Returns false on error or interruption (cancel requested or panel + // was deleted) + const bool refreshed = fileSystemP->refresh(url); + if (refreshed) { + // update the history and address bar, as the actual url might differ from the one requested + history->setCurrentUrl(fileSystemP->currentDirectory()); + panel->setNavigatorUrl(fileSystemP->currentDirectory()); + } + panel->view->setNameToMakeCurrent(QString()); panel->setCursor(Qt::ArrowCursor); @@ -352,7 +327,7 @@ // see if the open url operation failed, and if so, // put the attempted url in the navigator bar and let the user change it - if (refreshFailed) { + if (!refreshed) { if(isSyncing(url)) panel->otherPanel()->gui->syncBrowseButton->setChecked(false); else if(urlManuallyEntered) {