--- a/src/eric7/ViewManager/ViewManager.py Sun Oct 13 17:27:55 2024 +0200 +++ b/src/eric7/ViewManager/ViewManager.py Sun Oct 13 17:43:11 2024 +0200 @@ -131,7 +131,7 @@ self.editorsCheckFocusIn = True self.recent = [] - self.__loadRecent() + ##self.__loadRecent() self.bookmarked = [] bs = Preferences.getSettings().value("Bookmarked/Sources") @@ -167,6 +167,8 @@ self.ui = ui self.dbs = dbs + + self.__remoteServer = remoteServerInterface self.__remotefsInterface = remoteServerInterface.getServiceInterface( "FileSystem" ) @@ -176,6 +178,8 @@ self.editorClosedEd.connect(self.__searchReplaceWidget.editorClosed) self.checkActions.connect(self.__searchReplaceWidget.updateSelectionCheckBox) + self.__loadRecent() + def searchReplaceWidget(self): """ Public method to get a reference to the search widget. @@ -194,7 +198,13 @@ rs = Preferences.Prefs.rsettings.value(recentNameFiles) if rs is not None: for f in EricUtilities.toList(rs): - if pathlib.Path(f).exists(): + if ( + FileSystemUtilities.isRemoteFileName(f) + and ( + not self.__remoteServer.isServerConnected() + or self.__remotefsInterface.exists(f) + ) + ) or pathlib.Path(f).exists(): self.recent.append(f) def __saveRecent(self): @@ -5979,7 +5989,9 @@ @type str """ for recent in self.recent[:]: - if FileSystemUtilities.samepath(fn, recent): + if ( + FileSystemUtilities.isRemoteFileName(recent) and recent == fn + ) or FileSystemUtilities.samepath(fn, recent): self.recent.remove(recent) self.recent.insert(0, fn) maxRecent = Preferences.getUI("RecentNumber") @@ -6587,11 +6599,26 @@ formatStr = "&{0:d}. {1}" if idx < 10 else "{0:d}. {1}" act = self.recentMenu.addAction( formatStr.format( - idx, FileSystemUtilities.compactPath(rs, self.ui.maxMenuFilePathLen) + idx, + ( + self.__remotefsInterface.compactPath( + rs, self.ui.maxMenuFilePathLen + ) + if FileSystemUtilities.isRemoteFileName(rs) + else FileSystemUtilities.compactPath( + rs, self.ui.maxMenuFilePathLen + ) + ), ) ) act.setData(rs) - act.setEnabled(pathlib.Path(rs).exists()) + if FileSystemUtilities.isRemoteFileName(rs): + act.setEnabled( + self.__remoteServer.isServerConnected + and self.__remotefsInterface.exists(rs) + ) + else: + act.setEnabled(pathlib.Path(rs).exists()) self.recentMenu.addSeparator() self.recentMenu.addAction(