- connect(undoManager, SIGNAL(undoAvailable(bool)),
- this, SLOT(slotUndoAvailable(bool)));
- connect(undoManager, SIGNAL(undoTextChanged(const QString&)),
- this, SLOT(slotUndoTextChanged(const QString&)));
- connect(undoManager, SIGNAL(jobRecordingStarted(CommandType)),
- this, SLOT(clearStatusBar()));
- connect(undoManager, SIGNAL(jobRecordingFinished(CommandType)),
- this, SLOT(showCommand(CommandType)));
- connect(DolphinSettings::instance().placesModel(), SIGNAL(errorMessage(const QString&)),
- this, SLOT(showErrorMessage(const QString&)));
- connect(&DragAndDropHelper::instance(), SIGNAL(errorMessage(const QString&)),
- this, SLOT(showErrorMessage(const QString&)));
+ connect(undoManager, static_cast<void(KIO::FileUndoManager::*)(bool)>(&KIO::FileUndoManager::undoAvailable),
+ this, &DolphinMainWindow::slotUndoAvailable);
+ connect(undoManager, &KIO::FileUndoManager::undoTextChanged,
+ this, &DolphinMainWindow::slotUndoTextChanged);
+ connect(undoManager, &KIO::FileUndoManager::jobRecordingStarted,
+ this, &DolphinMainWindow::clearStatusBar);
+ connect(undoManager, &KIO::FileUndoManager::jobRecordingFinished,
+ this, &DolphinMainWindow::showCommand);
+
+ GeneralSettings* generalSettings = GeneralSettings::self();
+ const bool firstRun = (generalSettings->version() < 200);
+ if (firstRun) {
+ generalSettings->setViewPropsTimestamp(QDateTime::currentDateTime());
+ }
+
+ setAcceptDrops(true);
+
+ m_tabWidget = new DolphinTabWidget(this);
+ m_tabWidget->setObjectName("tabWidget");
+ connect(m_tabWidget, &DolphinTabWidget::activeViewChanged,
+ this, &DolphinMainWindow::activeViewChanged);
+ connect(m_tabWidget, &DolphinTabWidget::tabCountChanged,
+ this, &DolphinMainWindow::tabCountChanged);
+ connect(m_tabWidget, &DolphinTabWidget::currentUrlChanged,
+ this, &DolphinMainWindow::updateWindowTitle);
+ setCentralWidget(m_tabWidget);
+
+ setupActions();
+
+ m_actionHandler = new DolphinViewActionHandler(actionCollection(), this);
+ connect(m_actionHandler, &DolphinViewActionHandler::actionBeingHandled, this, &DolphinMainWindow::clearStatusBar);
+ connect(m_actionHandler, &DolphinViewActionHandler::createDirectoryTriggered, this, &DolphinMainWindow::createDirectory);
+
+ m_remoteEncoding = new DolphinRemoteEncoding(this, m_actionHandler);
+ connect(this, &DolphinMainWindow::urlChanged,
+ m_remoteEncoding, &DolphinRemoteEncoding::slotAboutToOpenUrl);
+
+ setupDockWidgets();
+
+ setupGUI(Keys | Save | Create | ToolBar);
+ stateChanged(QStringLiteral("new_file"));
+
+ QClipboard* clipboard = QApplication::clipboard();
+ connect(clipboard, &QClipboard::dataChanged,
+ this, &DolphinMainWindow::updatePasteAction);
+
+ QAction* showFilterBarAction = actionCollection()->action(QStringLiteral("show_filter_bar"));
+ showFilterBarAction->setChecked(generalSettings->filterBar());
+
+ if (firstRun) {
+ menuBar()->setVisible(false);
+ // Assure a proper default size if Dolphin runs the first time
+ resize(750, 500);
+ }
+
+ const bool showMenu = !menuBar()->isHidden();
+ QAction* showMenuBarAction = actionCollection()->action(KStandardAction::name(KStandardAction::ShowMenubar));
+ showMenuBarAction->setChecked(showMenu); // workaround for bug #171080
+ if (!showMenu) {
+ createControlButton();
+ }
+
+ // enable middle-click on back/forward/up to open in a new tab
+ auto *middleClickEventFilter = new MiddleClickActionEventFilter(this);
+ connect(middleClickEventFilter, &MiddleClickActionEventFilter::actionMiddleClicked, this, &DolphinMainWindow::slotToolBarActionMiddleClicked);
+ toolBar()->installEventFilter(middleClickEventFilter);