#include <QDialog>
#include <QFileInfo>
#include <QLineEdit>
-#include <QMenu>
#include <QMenuBar>
#include <QPushButton>
#include <QShowEvent>
QVector<DolphinViewContainer*> DolphinMainWindow::viewContainers() const
{
QVector<DolphinViewContainer*> viewContainers;
- viewContainers.reserve(m_tabWidget->count());
+
for (int i = 0; i < m_tabWidget->count(); ++i) {
- viewContainers << m_tabWidget->tabPageAt(i)->activeViewContainer();
+ DolphinTabPage *tabPage = m_tabWidget->tabPageAt(i);
+
+ viewContainers << tabPage->primaryViewContainer();
+ if (tabPage->splitViewEnabled()) {
+ viewContainers << tabPage->secondaryViewContainer();
+ }
}
return viewContainers;
}
closedByUser = false;
}
- if (m_tabWidget->count() > 1 && GeneralSettings::confirmClosingMultipleTabs() && closedByUser) {
+ if (m_tabWidget->count() > 1
+ && GeneralSettings::confirmClosingMultipleTabs()
+ && !GeneralSettings::rememberOpenedTabs()
+ && closedByUser) {
// Ask the user if he really wants to quit and close all tabs.
// Open a confirmation dialog with 3 buttons:
// QDialogButtonBox::Yes -> Quit
void DolphinMainWindow::slotStorageTearDownFromPlacesRequested(const QString& mountPath)
{
+ connect(m_placesPanel, &PlacesPanel::storageTearDownSuccessful, this, [this, mountPath]() {
+ setViewsToHomeIfMountPathOpen(mountPath);
+ });
+
if (m_terminalPanel && m_terminalPanel->currentWorkingDirectory().startsWith(mountPath)) {
m_tearDownFromPlacesRequested = true;
m_terminalPanel->goHome();
void DolphinMainWindow::slotStorageTearDownExternallyRequested(const QString& mountPath)
{
+ connect(m_placesPanel, &PlacesPanel::storageTearDownSuccessful, this, [this, mountPath]() {
+ setViewsToHomeIfMountPathOpen(mountPath);
+ });
+
if (m_terminalPanel && m_terminalPanel->currentWorkingDirectory().startsWith(mountPath)) {
m_tearDownFromPlacesRequested = false;
m_terminalPanel->goHome();
}
}
+void DolphinMainWindow::setViewsToHomeIfMountPathOpen(const QString& mountPath)
+{
+ const QVector<DolphinViewContainer*> theViewContainers = viewContainers();
+ for (DolphinViewContainer *viewContainer : theViewContainers) {
+ if (viewContainer && viewContainer->url().toLocalFile().startsWith(mountPath)) {
+ viewContainer->setUrl(QUrl::fromLocalFile(QDir::homePath()));
+ }
+ }
+ disconnect(m_placesPanel, &PlacesPanel::storageTearDownSuccessful, nullptr, nullptr);
+}
+
void DolphinMainWindow::setupActions()
{
// setup 'File' menu