+ actionCollection()->action(QStringLiteral("close_tab"))->setEnabled(enableTabActions);
+ actionCollection()->action(QStringLiteral("activate_next_tab"))->setEnabled(enableTabActions);
+ actionCollection()->action(QStringLiteral("activate_prev_tab"))->setEnabled(enableTabActions);
+}
+
+void DolphinMainWindow::setUrlAsCaption(const QUrl& url)
+{
+ static KFilePlacesModel s_placesModel;
+
+ QString schemePrefix;
+ if (!url.isLocalFile()) {
+ schemePrefix.append(url.scheme() + " - ");
+ if (!url.host().isEmpty()) {
+ schemePrefix.append(url.host() + " - ");
+ }
+ }
+
+ if (GeneralSettings::showFullPathInTitlebar()) {
+ const QString path = url.adjusted(QUrl::StripTrailingSlash).path();
+ setWindowTitle(schemePrefix + path);
+ return;
+ }
+
+ const auto& matchedPlaces = s_placesModel.match(s_placesModel.index(0,0), KFilePlacesModel::UrlRole, url, 1, Qt::MatchExactly);
+
+ if (!matchedPlaces.isEmpty()) {
+ setWindowTitle(s_placesModel.text(matchedPlaces.first()));
+ return;
+ }
+
+ QString fileName = url.adjusted(QUrl::StripTrailingSlash).fileName();
+ if (fileName.isEmpty()) {
+ fileName = '/';
+ }
+
+ if (m_activeViewContainer->isSearchModeEnabled()) {
+ if(m_activeViewContainer->currentSearchText().isEmpty()){
+ setWindowTitle(i18n("Search"));
+ } else {
+ const auto searchText = i18n("Search for %1", m_activeViewContainer->currentSearchText());
+ setWindowTitle(searchText);
+ }
+ return;
+ }
+
+ setWindowTitle(schemePrefix + fileName);
+}
+
+void DolphinMainWindow::slotStorageTearDownFromPlacesRequested(const QString& mountPath)
+{
+ if (m_terminalPanel->currentWorkingDirectory().startsWith(mountPath)) {
+ m_tearDownFromPlacesRequested = true;
+ m_terminalPanel->goHome();
+ // m_placesPanel->proceedWithTearDown() will be called in slotTerminalDirectoryChanged
+ } else {
+ m_placesPanel->proceedWithTearDown();
+ }
+}
+
+void DolphinMainWindow::slotStorageTearDownExternallyRequested(const QString& mountPath)
+{
+ if (m_terminalPanel->currentWorkingDirectory().startsWith(mountPath)) {
+ m_tearDownFromPlacesRequested = false;
+ m_terminalPanel->goHome();
+ }