mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 01:40:02 +00:00
dolphin: convert the remaining code to Qt5 signal/slot syntax
Middle clicking on Forward/Backward/Home/etc. will no longer open a new tab since the QAction triggered signal no longer tell us which mouse button was pressed
This commit is contained in:
parent
7a26fbc5c5
commit
00ee5d6727
|
@ -203,8 +203,8 @@ void DolphinContextMenu::openItemContextMenu()
|
|||
newFileMenu->checkUpToDate();
|
||||
newFileMenu->setPopupFiles(m_fileInfo.url());
|
||||
newFileMenu->setEnabled(selectedItemsProps.supportsWriting());
|
||||
connect(newFileMenu, SIGNAL(fileCreated(KUrl)), newFileMenu, SLOT(deleteLater()));
|
||||
connect(newFileMenu, SIGNAL(directoryCreated(KUrl)), newFileMenu, SLOT(deleteLater()));
|
||||
connect(newFileMenu, &DolphinNewFileMenu::fileCreated, newFileMenu, &DolphinNewFileMenu::deleteLater);
|
||||
connect(newFileMenu, &DolphinNewFileMenu::directoryCreated, newFileMenu, &DolphinNewFileMenu::deleteLater);
|
||||
|
||||
QMenu* menu = newFileMenu->menu();
|
||||
menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
|
||||
|
@ -434,7 +434,7 @@ QAction* DolphinContextMenu::createPasteAction()
|
|||
const QMimeData* mimeData = QApplication::clipboard()->mimeData();
|
||||
const KUrl::List pasteData = KUrl::List::fromMimeData(mimeData);
|
||||
action->setEnabled(!pasteData.isEmpty() && selectedItemsProperties().supportsWriting());
|
||||
connect(action, SIGNAL(triggered()), m_mainWindow, SLOT(pasteIntoFolder()));
|
||||
connect(action, &QAction::triggered, m_mainWindow, &DolphinMainWindow::pasteIntoFolder);
|
||||
} else {
|
||||
action = m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::Paste));
|
||||
}
|
||||
|
|
|
@ -132,20 +132,20 @@ DolphinMainWindow::DolphinMainWindow() :
|
|||
ViewTab& viewTab = m_viewTab[m_tabIndex];
|
||||
viewTab.wasActive = true; // The first opened tab is automatically active
|
||||
|
||||
connect(&DolphinNewFileMenuObserver::instance(), SIGNAL(errorMessage(QString)),
|
||||
this, SLOT(showErrorMessage(QString)));
|
||||
connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage,
|
||||
this, &DolphinMainWindow::showErrorMessage);
|
||||
|
||||
KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self();
|
||||
undoManager->setUiInterface(new UndoUiInterface());
|
||||
|
||||
connect(undoManager, SIGNAL(undoAvailable(bool)),
|
||||
this, SLOT(slotUndoAvailable(bool)));
|
||||
connect(undoManager, SIGNAL(undoTextChanged(QString)),
|
||||
this, SLOT(slotUndoTextChanged(QString)));
|
||||
connect(undoManager, SIGNAL(jobRecordingStarted(CommandType)),
|
||||
this, SLOT(clearStatusBar()));
|
||||
connect(undoManager, SIGNAL(jobRecordingFinished(CommandType)),
|
||||
this, SLOT(showCommand(CommandType)));
|
||||
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);
|
||||
|
@ -163,8 +163,8 @@ DolphinMainWindow::DolphinMainWindow() :
|
|||
const KUrl homeUrl(generalSettings->homeUrl());
|
||||
setUrlAsCaption(homeUrl);
|
||||
m_actionHandler = new DolphinViewActionHandler(actionCollection(), this);
|
||||
connect(m_actionHandler, SIGNAL(actionBeingHandled()), SLOT(clearStatusBar()));
|
||||
connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory()));
|
||||
connect(m_actionHandler, &DolphinViewActionHandler::actionBeingHandled, this, &DolphinMainWindow::clearStatusBar);
|
||||
connect(m_actionHandler, &DolphinViewActionHandler::createDirectory, this, &DolphinMainWindow::createDirectory);
|
||||
|
||||
viewTab.primaryView = createViewContainer(homeUrl, viewTab.splitter);
|
||||
|
||||
|
@ -175,28 +175,28 @@ DolphinMainWindow::DolphinMainWindow() :
|
|||
m_actionHandler->setCurrentView(view);
|
||||
|
||||
m_remoteEncoding = new DolphinRemoteEncoding(this, m_actionHandler);
|
||||
connect(this, SIGNAL(urlChanged(KUrl)),
|
||||
m_remoteEncoding, SLOT(slotAboutToOpenUrl()));
|
||||
connect(this, &DolphinMainWindow::urlChanged,
|
||||
m_remoteEncoding, &DolphinRemoteEncoding::slotAboutToOpenUrl);
|
||||
|
||||
m_tabBar = new KTabBar(this);
|
||||
m_tabBar->setMovable(true);
|
||||
m_tabBar->setTabsClosable(true);
|
||||
connect(m_tabBar, SIGNAL(currentChanged(int)),
|
||||
this, SLOT(setActiveTab(int)));
|
||||
connect(m_tabBar, SIGNAL(tabCloseRequested(int)),
|
||||
this, SLOT(closeTab(int)));
|
||||
connect(m_tabBar, SIGNAL(contextMenu(int,QPoint)),
|
||||
this, SLOT(openTabContextMenu(int,QPoint)));
|
||||
connect(m_tabBar, SIGNAL(newTabRequest()),
|
||||
this, SLOT(openNewTab()));
|
||||
connect(m_tabBar, SIGNAL(testCanDecode(const QDragMoveEvent*,bool&)),
|
||||
this, SLOT(slotTestCanDecode(const QDragMoveEvent*,bool&)));
|
||||
connect(m_tabBar, SIGNAL(mouseMiddleClick(int)),
|
||||
this, SLOT(closeTab(int)));
|
||||
connect(m_tabBar, SIGNAL(tabMoved(int,int)),
|
||||
this, SLOT(slotTabMoved(int,int)));
|
||||
connect(m_tabBar, SIGNAL(receivedDropEvent(int,QDropEvent*)),
|
||||
this, SLOT(tabDropEvent(int,QDropEvent*)));
|
||||
connect(m_tabBar, &KTabBar::currentChanged,
|
||||
this, &DolphinMainWindow::setActiveTab);
|
||||
connect(m_tabBar, &KTabBar::tabCloseRequested,
|
||||
this, static_cast<void(DolphinMainWindow::*)(int)>(&DolphinMainWindow::closeTab));
|
||||
connect(m_tabBar, &KTabBar::contextMenu,
|
||||
this, &DolphinMainWindow::openTabContextMenu);
|
||||
connect(m_tabBar, &KTabBar::newTabRequest,
|
||||
this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::openNewTab));
|
||||
connect(m_tabBar, &KTabBar::testCanDecode,
|
||||
this, &DolphinMainWindow::slotTestCanDecode);
|
||||
connect(m_tabBar, &KTabBar::mouseMiddleClick,
|
||||
this, static_cast<void(DolphinMainWindow::*)(int)>(&DolphinMainWindow::closeTab));
|
||||
connect(m_tabBar, &KTabBar::tabMoved,
|
||||
this, &DolphinMainWindow::slotTabMoved);
|
||||
connect(m_tabBar, &KTabBar::receivedDropEvent,
|
||||
this, &DolphinMainWindow::tabDropEvent);
|
||||
|
||||
m_tabBar->blockSignals(true); // signals get unblocked after at least 2 tabs are open
|
||||
|
||||
|
@ -215,8 +215,8 @@ DolphinMainWindow::DolphinMainWindow() :
|
|||
stateChanged("new_file");
|
||||
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
connect(clipboard, SIGNAL(dataChanged()),
|
||||
this, SLOT(updatePasteAction()));
|
||||
connect(clipboard, &QClipboard::dataChanged,
|
||||
this, &DolphinMainWindow::updatePasteAction);
|
||||
|
||||
if (generalSettings->splitView()) {
|
||||
toggleSplitView();
|
||||
|
@ -1064,7 +1064,7 @@ void DolphinMainWindow::editSettings()
|
|||
|
||||
const KUrl url = container->url();
|
||||
DolphinSettingsDialog* settingsDialog = new DolphinSettingsDialog(url, this);
|
||||
connect(settingsDialog, SIGNAL(settingsChanged()), this, SLOT(refreshViews()));
|
||||
connect(settingsDialog, &DolphinSettingsDialog::settingsChanged, this, &DolphinMainWindow::refreshViews);
|
||||
settingsDialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
settingsDialog->show();
|
||||
m_settingsDialog = settingsDialog;
|
||||
|
@ -1240,8 +1240,8 @@ void DolphinMainWindow::handleUrl(const KUrl& url)
|
|||
if (m_lastHandleUrlStatJob->ui()) {
|
||||
KJobWidgets::setWindow(m_lastHandleUrlStatJob, this);
|
||||
}
|
||||
connect(m_lastHandleUrlStatJob, SIGNAL(result(KJob*)),
|
||||
this, SLOT(slotHandleUrlStatFinished(KJob*)));
|
||||
connect(m_lastHandleUrlStatJob, &KIO::Job::result,
|
||||
this, &DolphinMainWindow::slotHandleUrlStatFinished);
|
||||
|
||||
} else {
|
||||
new KRun(url, this); // Automatically deletes itself after being finished
|
||||
|
@ -1364,7 +1364,7 @@ void DolphinMainWindow::updateControlMenu()
|
|||
|
||||
// Add "Go" menu
|
||||
KMenu* goMenu = new KMenu(i18nc("@action:inmenu", "Go"), menu);
|
||||
connect(menu, SIGNAL(aboutToHide()), goMenu, SLOT(deleteLater()));
|
||||
connect(menu, &KMenu::aboutToHide, goMenu, &KMenu::deleteLater);
|
||||
goMenu->addAction(ac->action(KStandardAction::name(KStandardAction::Back)));
|
||||
goMenu->addAction(ac->action(KStandardAction::name(KStandardAction::Forward)));
|
||||
goMenu->addAction(ac->action(KStandardAction::name(KStandardAction::Up)));
|
||||
|
@ -1374,7 +1374,7 @@ void DolphinMainWindow::updateControlMenu()
|
|||
|
||||
// Add "Tool" menu
|
||||
KMenu* toolsMenu = new KMenu(i18nc("@action:inmenu", "Tools"), menu);
|
||||
connect(menu, SIGNAL(aboutToHide()), toolsMenu, SLOT(deleteLater()));
|
||||
connect(menu, &KMenu::aboutToHide, toolsMenu, &KMenu::deleteLater);
|
||||
toolsMenu->addAction(ac->action("show_filter_bar"));
|
||||
toolsMenu->addAction(ac->action("compare_files"));
|
||||
toolsMenu->addAction(ac->action("open_terminal"));
|
||||
|
@ -1388,7 +1388,7 @@ void DolphinMainWindow::updateControlMenu()
|
|||
|
||||
// Add "Help" menu
|
||||
KMenu* helpMenu = new KMenu(i18nc("@action:inmenu", "Help"), menu);
|
||||
connect(menu, SIGNAL(aboutToHide()), helpMenu, SLOT(deleteLater()));
|
||||
connect(menu, &KMenu::aboutToHide, helpMenu, &KMenu::deleteLater);
|
||||
helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::HelpContents)));
|
||||
helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::WhatsThis)));
|
||||
helpMenu->addSeparator();
|
||||
|
@ -1450,9 +1450,9 @@ void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer* viewContain
|
|||
// Activating the view container might trigger a recursive setActiveViewContainer() call
|
||||
// inside DolphinMainWindow::toggleActiveView() when having a split view. Temporary
|
||||
// disconnect the activated() signal in this case:
|
||||
disconnect(m_activeViewContainer->view(), SIGNAL(activated()), this, SLOT(toggleActiveView()));
|
||||
disconnect(m_activeViewContainer->view(), &DolphinView::activated, this, &DolphinMainWindow::toggleActiveView);
|
||||
m_activeViewContainer->setActive(true);
|
||||
connect(m_activeViewContainer->view(), SIGNAL(activated()), this, SLOT(toggleActiveView()));
|
||||
connect(m_activeViewContainer->view(), &DolphinView::activated, this, &DolphinMainWindow::toggleActiveView);
|
||||
|
||||
m_actionHandler->setCurrentView(viewContainer->view());
|
||||
|
||||
|
@ -1491,27 +1491,27 @@ void DolphinMainWindow::setupActions()
|
|||
menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
|
||||
menu->setIcon(KIcon("document-new"));
|
||||
m_newFileMenu->setDelayed(false);
|
||||
connect(menu, SIGNAL(aboutToShow()),
|
||||
this, SLOT(updateNewMenu()));
|
||||
connect(menu, &QMenu::aboutToShow,
|
||||
this, &DolphinMainWindow::updateNewMenu);
|
||||
|
||||
QAction* newWindow = actionCollection()->addAction("new_window");
|
||||
newWindow->setIcon(KIcon("window-new"));
|
||||
newWindow->setText(i18nc("@action:inmenu File", "New &Window"));
|
||||
newWindow->setShortcut(Qt::CTRL | Qt::Key_N);
|
||||
connect(newWindow, SIGNAL(triggered()), this, SLOT(openNewMainWindow()));
|
||||
connect(newWindow, &QAction::triggered, this, &DolphinMainWindow::openNewMainWindow);
|
||||
|
||||
QAction* newTab = actionCollection()->addAction("new_tab");
|
||||
newTab->setIcon(KIcon("tab-new"));
|
||||
newTab->setText(i18nc("@action:inmenu File", "New Tab"));
|
||||
newTab->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL | Qt::Key_T) << QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_N));
|
||||
connect(newTab, SIGNAL(triggered()), this, SLOT(openNewTab()));
|
||||
connect(newTab, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::openNewTab));
|
||||
|
||||
QAction* closeTab = actionCollection()->addAction("close_tab");
|
||||
closeTab->setIcon(KIcon("tab-close"));
|
||||
closeTab->setText(i18nc("@action:inmenu File", "Close Tab"));
|
||||
closeTab->setShortcut(Qt::CTRL | Qt::Key_W);
|
||||
closeTab->setEnabled(false);
|
||||
connect(closeTab, SIGNAL(triggered()), this, SLOT(closeTab()));
|
||||
connect(closeTab, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::closeTab));
|
||||
|
||||
KStandardAction::quit(this, SLOT(quit()), actionCollection());
|
||||
|
||||
|
@ -1538,12 +1538,12 @@ void DolphinMainWindow::setupActions()
|
|||
QAction* selectAll = actionCollection()->addAction("select_all");
|
||||
selectAll->setText(i18nc("@action:inmenu Edit", "Select All"));
|
||||
selectAll->setShortcut(Qt::CTRL | Qt::Key_A);
|
||||
connect(selectAll, SIGNAL(triggered()), this, SLOT(selectAll()));
|
||||
connect(selectAll, &QAction::triggered, this, &DolphinMainWindow::selectAll);
|
||||
|
||||
QAction* invertSelection = actionCollection()->addAction("invert_selection");
|
||||
invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
|
||||
invertSelection->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_A);
|
||||
connect(invertSelection, SIGNAL(triggered()), this, SLOT(invertSelection()));
|
||||
connect(invertSelection, &QAction::triggered, this, &DolphinMainWindow::invertSelection);
|
||||
|
||||
// setup 'View' menu
|
||||
// (note that most of it is set up in DolphinViewActionHandler)
|
||||
|
@ -1551,33 +1551,33 @@ void DolphinMainWindow::setupActions()
|
|||
QAction* split = actionCollection()->addAction("split_view");
|
||||
split->setShortcut(Qt::Key_F3);
|
||||
updateSplitAction();
|
||||
connect(split, SIGNAL(triggered()), this, SLOT(toggleSplitView()));
|
||||
connect(split, &QAction::triggered, this, &DolphinMainWindow::toggleSplitView);
|
||||
|
||||
QAction* reload = actionCollection()->addAction("reload");
|
||||
reload->setText(i18nc("@action:inmenu View", "Reload"));
|
||||
reload->setShortcut(Qt::Key_F5);
|
||||
reload->setIcon(KIcon("view-refresh"));
|
||||
connect(reload, SIGNAL(triggered()), this, SLOT(reloadView()));
|
||||
connect(reload, &QAction::triggered, this, &DolphinMainWindow::reloadView);
|
||||
|
||||
QAction* stop = actionCollection()->addAction("stop");
|
||||
stop->setText(i18nc("@action:inmenu View", "Stop"));
|
||||
stop->setToolTip(i18nc("@info", "Stop loading"));
|
||||
stop->setIcon(KIcon("process-stop"));
|
||||
connect(stop, SIGNAL(triggered()), this, SLOT(stopLoading()));
|
||||
connect(stop, &QAction::triggered, this, &DolphinMainWindow::stopLoading);
|
||||
|
||||
KToggleAction* editableLocation = actionCollection()->add<KToggleAction>("editable_location");
|
||||
editableLocation->setText(i18nc("@action:inmenu Navigation Bar", "Editable Location"));
|
||||
editableLocation->setShortcut(Qt::Key_F6);
|
||||
connect(editableLocation, SIGNAL(triggered()), this, SLOT(toggleEditLocation()));
|
||||
connect(editableLocation, &KToggleAction::triggered, this, &DolphinMainWindow::toggleEditLocation);
|
||||
|
||||
QAction* replaceLocation = actionCollection()->addAction("replace_location");
|
||||
replaceLocation->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location"));
|
||||
replaceLocation->setShortcut(Qt::CTRL | Qt::Key_L);
|
||||
connect(replaceLocation, SIGNAL(triggered()), this, SLOT(replaceLocation()));
|
||||
connect(replaceLocation, &QAction::triggered, this, &DolphinMainWindow::replaceLocation);
|
||||
|
||||
// setup 'Go' menu
|
||||
QAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection());
|
||||
connect(backAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goBack(Qt::MouseButtons)));
|
||||
connect(backAction, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goBack));
|
||||
auto backShortcuts = backAction->shortcuts();
|
||||
backShortcuts.append(QKeySequence(Qt::Key_Backspace));
|
||||
backAction->setShortcuts(backShortcuts);
|
||||
|
@ -1586,8 +1586,8 @@ void DolphinMainWindow::setupActions()
|
|||
m_recentTabsMenu->setIcon(KIcon("edit-undo"));
|
||||
m_recentTabsMenu->setDelayed(false);
|
||||
actionCollection()->addAction("closed_tabs", m_recentTabsMenu);
|
||||
connect(m_recentTabsMenu->menu(), SIGNAL(triggered(QAction*)),
|
||||
this, SLOT(restoreClosedTab(QAction*)));
|
||||
connect(m_recentTabsMenu->menu(), &QMenu::triggered,
|
||||
this, &DolphinMainWindow::restoreClosedTab);
|
||||
|
||||
QAction* action = new QAction(i18n("Empty Recently Closed Tabs"), m_recentTabsMenu);
|
||||
action->setIcon(KIcon("edit-clear-list"));
|
||||
|
@ -1597,37 +1597,37 @@ void DolphinMainWindow::setupActions()
|
|||
m_recentTabsMenu->setEnabled(false);
|
||||
|
||||
QAction* forwardAction = KStandardAction::forward(this, SLOT(goForward()), actionCollection());
|
||||
connect(forwardAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goForward(Qt::MouseButtons)));
|
||||
connect(forwardAction, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goForward));
|
||||
|
||||
QAction* upAction = KStandardAction::up(this, SLOT(goUp()), actionCollection());
|
||||
connect(upAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goUp(Qt::MouseButtons)));
|
||||
connect(upAction, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goUp));
|
||||
|
||||
QAction* homeAction = KStandardAction::home(this, SLOT(goHome()), actionCollection());
|
||||
connect(homeAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goHome(Qt::MouseButtons)));
|
||||
connect(homeAction, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goHome));
|
||||
|
||||
// setup 'Tools' menu
|
||||
QAction* showFilterBar = actionCollection()->addAction("show_filter_bar");
|
||||
showFilterBar->setText(i18nc("@action:inmenu Tools", "Show Filter Bar"));
|
||||
showFilterBar->setIcon(KIcon("view-filter"));
|
||||
showFilterBar->setShortcut(Qt::CTRL | Qt::Key_I);
|
||||
connect(showFilterBar, SIGNAL(triggered()), this, SLOT(showFilterBar()));
|
||||
connect(showFilterBar, &QAction::triggered, this, &DolphinMainWindow::showFilterBar);
|
||||
|
||||
QAction* compareFiles = actionCollection()->addAction("compare_files");
|
||||
compareFiles->setText(i18nc("@action:inmenu Tools", "Compare Files"));
|
||||
compareFiles->setIcon(KIcon("kompare"));
|
||||
compareFiles->setEnabled(false);
|
||||
connect(compareFiles, SIGNAL(triggered()), this, SLOT(compareFiles()));
|
||||
connect(compareFiles, &QAction::triggered, this, &DolphinMainWindow::compareFiles);
|
||||
|
||||
QAction* openTerminal = actionCollection()->addAction("open_terminal");
|
||||
openTerminal->setText(i18nc("@action:inmenu Tools", "Open Terminal"));
|
||||
openTerminal->setIcon(KIcon("utilities-terminal"));
|
||||
openTerminal->setShortcut(Qt::SHIFT | Qt::Key_F4);
|
||||
connect(openTerminal, SIGNAL(triggered()), this, SLOT(openTerminal()));
|
||||
connect(openTerminal, &QAction::triggered, this, &DolphinMainWindow::openTerminal);
|
||||
|
||||
// setup 'Settings' menu
|
||||
KToggleAction* showMenuBar = KStandardAction::showMenubar(0, 0, actionCollection());
|
||||
connect(showMenuBar, SIGNAL(triggered(bool)), // Fixes #286822
|
||||
this, SLOT(toggleShowMenuBar()), Qt::QueuedConnection);
|
||||
connect(showMenuBar, &KToggleAction::triggered, // Fixes #286822
|
||||
this, &DolphinMainWindow::toggleShowMenuBar, Qt::QueuedConnection);
|
||||
KStandardAction::preferences(this, SLOT(editSettings()), actionCollection());
|
||||
|
||||
// not in menu actions
|
||||
|
@ -1641,29 +1641,29 @@ void DolphinMainWindow::setupActions()
|
|||
|
||||
QAction* activateNextTab = actionCollection()->addAction("activate_next_tab");
|
||||
activateNextTab->setText(i18nc("@action:inmenu", "Activate Next Tab"));
|
||||
connect(activateNextTab, SIGNAL(triggered()), SLOT(activateNextTab()));
|
||||
connect(activateNextTab, &QAction::triggered, this, &DolphinMainWindow::activateNextTab);
|
||||
activateNextTab->setShortcuts(QApplication::isRightToLeft() ? prevTabKeys : nextTabKeys);
|
||||
|
||||
QAction* activatePrevTab = actionCollection()->addAction("activate_prev_tab");
|
||||
activatePrevTab->setText(i18nc("@action:inmenu", "Activate Previous Tab"));
|
||||
connect(activatePrevTab, SIGNAL(triggered()), SLOT(activatePrevTab()));
|
||||
connect(activatePrevTab, &QAction::triggered, this, &DolphinMainWindow::activatePrevTab);
|
||||
activatePrevTab->setShortcuts(QApplication::isRightToLeft() ? nextTabKeys : prevTabKeys);
|
||||
|
||||
// for context menu
|
||||
QAction* openInNewTab = actionCollection()->addAction("open_in_new_tab");
|
||||
openInNewTab->setText(i18nc("@action:inmenu", "Open in New Tab"));
|
||||
openInNewTab->setIcon(KIcon("tab-new"));
|
||||
connect(openInNewTab, SIGNAL(triggered()), this, SLOT(openInNewTab()));
|
||||
connect(openInNewTab, &QAction::triggered, this, &DolphinMainWindow::openInNewTab);
|
||||
|
||||
QAction* openInNewTabs = actionCollection()->addAction("open_in_new_tabs");
|
||||
openInNewTabs->setText(i18nc("@action:inmenu", "Open in New Tabs"));
|
||||
openInNewTabs->setIcon(KIcon("tab-new"));
|
||||
connect(openInNewTabs, SIGNAL(triggered()), this, SLOT(openInNewTab()));
|
||||
connect(openInNewTabs, &QAction::triggered, this, &DolphinMainWindow::openInNewTab);
|
||||
|
||||
QAction* openInNewWindow = actionCollection()->addAction("open_in_new_window");
|
||||
openInNewWindow->setText(i18nc("@action:inmenu", "Open in New Window"));
|
||||
openInNewWindow->setIcon(KIcon("window-new"));
|
||||
connect(openInNewWindow, SIGNAL(triggered()), this, SLOT(openInNewWindow()));
|
||||
connect(openInNewWindow, &QAction::triggered, this, &DolphinMainWindow::openInNewWindow);
|
||||
}
|
||||
|
||||
void DolphinMainWindow::setupDockWidgets()
|
||||
|
@ -1676,28 +1676,28 @@ void DolphinMainWindow::setupDockWidgets()
|
|||
lockLayoutAction->setInactiveText(i18nc("@action:inmenu Panels", "Lock Panels"));
|
||||
lockLayoutAction->setInactiveIcon(KIcon("object-locked"));
|
||||
lockLayoutAction->setActive(lock);
|
||||
connect(lockLayoutAction, SIGNAL(triggered()), this, SLOT(togglePanelLockState()));
|
||||
connect(lockLayoutAction, &KDualAction::triggered, this, &DolphinMainWindow::togglePanelLockState);
|
||||
|
||||
// Setup "Information"
|
||||
DolphinDockWidget* infoDock = new DolphinDockWidget(i18nc("@title:window", "Information"));
|
||||
infoDock->setLocked(lock);
|
||||
infoDock->setObjectName("infoDock");
|
||||
infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
Panel* infoPanel = new InformationPanel(infoDock);
|
||||
InformationPanel* infoPanel = new InformationPanel(infoDock);
|
||||
infoPanel->setCustomContextMenuActions(QList<QAction*>() << lockLayoutAction);
|
||||
connect(infoPanel, SIGNAL(urlActivated(KUrl)), this, SLOT(handleUrl(KUrl)));
|
||||
connect(infoPanel, &InformationPanel::urlActivated, this, &DolphinMainWindow::handleUrl);
|
||||
infoDock->setWidget(infoPanel);
|
||||
|
||||
QAction* infoAction = infoDock->toggleViewAction();
|
||||
createPanelAction(KIcon("dialog-information"), Qt::Key_F11, infoAction, "show_information_panel");
|
||||
|
||||
addDockWidget(Qt::RightDockWidgetArea, infoDock);
|
||||
connect(this, SIGNAL(urlChanged(KUrl)),
|
||||
infoPanel, SLOT(setUrl(KUrl)));
|
||||
connect(this, SIGNAL(selectionChanged(KFileItemList)),
|
||||
infoPanel, SLOT(setSelection(KFileItemList)));
|
||||
connect(this, SIGNAL(requestItemInfo(KFileItem)),
|
||||
infoPanel, SLOT(requestDelayedItemInfo(KFileItem)));
|
||||
connect(this, &DolphinMainWindow::urlChanged,
|
||||
infoPanel, &InformationPanel::setUrl);
|
||||
connect(this, &DolphinMainWindow::selectionChanged,
|
||||
infoPanel, &InformationPanel::setSelection);
|
||||
connect(this, &DolphinMainWindow::requestItemInfo,
|
||||
infoPanel, &InformationPanel::requestDelayedItemInfo);
|
||||
|
||||
// Setup "Folders"
|
||||
DolphinDockWidget* foldersDock = new DolphinDockWidget(i18nc("@title:window", "Folders"));
|
||||
|
@ -1712,14 +1712,14 @@ void DolphinMainWindow::setupDockWidgets()
|
|||
createPanelAction(KIcon("folder"), Qt::Key_F7, foldersAction, "show_folders_panel");
|
||||
|
||||
addDockWidget(Qt::LeftDockWidgetArea, foldersDock);
|
||||
connect(this, SIGNAL(urlChanged(KUrl)),
|
||||
foldersPanel, SLOT(setUrl(KUrl)));
|
||||
connect(foldersPanel, SIGNAL(folderActivated(KUrl)),
|
||||
this, SLOT(changeUrl(KUrl)));
|
||||
connect(foldersPanel, SIGNAL(folderMiddleClicked(KUrl)),
|
||||
this, SLOT(openNewTab(KUrl)));
|
||||
connect(foldersPanel, SIGNAL(errorMessage(QString)),
|
||||
this, SLOT(slotPanelErrorMessage(QString)));
|
||||
connect(this, &DolphinMainWindow::urlChanged,
|
||||
foldersPanel, &FoldersPanel::setUrl);
|
||||
connect(foldersPanel, &FoldersPanel::folderActivated,
|
||||
this, &DolphinMainWindow::changeUrl);
|
||||
connect(foldersPanel, &FoldersPanel::folderMiddleClicked,
|
||||
this, static_cast<void(DolphinMainWindow::*)(const KUrl&)>(&DolphinMainWindow::openNewTab));
|
||||
connect(foldersPanel, &FoldersPanel::errorMessage,
|
||||
this, &DolphinMainWindow::slotPanelErrorMessage);
|
||||
|
||||
// Setup "Terminal"
|
||||
#ifndef Q_OS_WIN
|
||||
|
@ -1727,21 +1727,21 @@ void DolphinMainWindow::setupDockWidgets()
|
|||
terminalDock->setLocked(lock);
|
||||
terminalDock->setObjectName("terminalDock");
|
||||
terminalDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
|
||||
Panel* terminalPanel = new TerminalPanel(terminalDock);
|
||||
TerminalPanel* terminalPanel = new TerminalPanel(terminalDock);
|
||||
terminalPanel->setCustomContextMenuActions(QList<QAction*>() << lockLayoutAction);
|
||||
terminalDock->setWidget(terminalPanel);
|
||||
|
||||
connect(terminalPanel, SIGNAL(hideTerminalPanel()), terminalDock, SLOT(hide()));
|
||||
connect(terminalPanel, SIGNAL(changeUrl(KUrl)), this, SLOT(slotTerminalDirectoryChanged(KUrl)));
|
||||
connect(terminalDock, SIGNAL(visibilityChanged(bool)),
|
||||
terminalPanel, SLOT(dockVisibilityChanged()));
|
||||
connect(terminalPanel, &TerminalPanel::hideTerminalPanel, terminalDock, &DolphinDockWidget::hide);
|
||||
connect(terminalPanel, &TerminalPanel::changeUrl, this, &DolphinMainWindow::slotTerminalDirectoryChanged);
|
||||
connect(terminalDock, &DolphinDockWidget::visibilityChanged,
|
||||
terminalPanel, &TerminalPanel::dockVisibilityChanged);
|
||||
|
||||
QAction* terminalAction = terminalDock->toggleViewAction();
|
||||
createPanelAction(KIcon("utilities-terminal"), Qt::Key_F4, terminalAction, "show_terminal_panel");
|
||||
|
||||
addDockWidget(Qt::BottomDockWidgetArea, terminalDock);
|
||||
connect(this, SIGNAL(urlChanged(KUrl)),
|
||||
terminalPanel, SLOT(setUrl(KUrl)));
|
||||
connect(this, &DolphinMainWindow::urlChanged,
|
||||
terminalPanel, &TerminalPanel::setUrl);
|
||||
#endif
|
||||
|
||||
if (GeneralSettings::version() < 200) {
|
||||
|
@ -1766,18 +1766,18 @@ void DolphinMainWindow::setupDockWidgets()
|
|||
createPanelAction(KIcon("bookmarks"), Qt::Key_F9, placesAction, "show_places_panel");
|
||||
|
||||
addDockWidget(Qt::LeftDockWidgetArea, placesDock);
|
||||
connect(placesPanel, SIGNAL(placeActivated(KUrl)),
|
||||
this, SLOT(slotPlaceActivated(KUrl)));
|
||||
connect(placesPanel, SIGNAL(placeMiddleClicked(KUrl)),
|
||||
this, SLOT(openNewTab(KUrl)));
|
||||
connect(placesPanel, SIGNAL(errorMessage(QString)),
|
||||
this, SLOT(slotPanelErrorMessage(QString)));
|
||||
connect(this, SIGNAL(urlChanged(KUrl)),
|
||||
placesPanel, SLOT(setUrl(KUrl)));
|
||||
connect(placesDock, SIGNAL(visibilityChanged(bool)),
|
||||
this, SLOT(slotPlacesPanelVisibilityChanged(bool)));
|
||||
connect(this, SIGNAL(settingsChanged()),
|
||||
placesPanel, SLOT(readSettings()));
|
||||
connect(placesPanel, &PlacesPanel::placeActivated,
|
||||
this, &DolphinMainWindow::slotPlaceActivated);
|
||||
connect(placesPanel, &PlacesPanel::placeMiddleClicked,
|
||||
this, static_cast<void(DolphinMainWindow::*)(const KUrl&)>(&DolphinMainWindow::openNewTab));
|
||||
connect(placesPanel, &PlacesPanel::errorMessage,
|
||||
this, &DolphinMainWindow::slotPanelErrorMessage);
|
||||
connect(this, &DolphinMainWindow::urlChanged,
|
||||
placesPanel, &PlacesPanel::setUrl);
|
||||
connect(placesDock, &DolphinDockWidget::visibilityChanged,
|
||||
this, &DolphinMainWindow::slotPlacesPanelVisibilityChanged);
|
||||
connect(this, &DolphinMainWindow::settingsChanged,
|
||||
placesPanel, &PlacesPanel::readSettings);
|
||||
|
||||
// Add actions into the "Panels" menu
|
||||
KActionMenu* panelsMenu = new KActionMenu(i18nc("@action:inmenu View", "Panels"), this);
|
||||
|
@ -1856,23 +1856,23 @@ void DolphinMainWindow::createControlButton()
|
|||
m_controlButton->setToolButtonStyle(toolBar()->toolButtonStyle());
|
||||
|
||||
KMenu* controlMenu = new KMenu(m_controlButton);
|
||||
connect(controlMenu, SIGNAL(aboutToShow()), this, SLOT(updateControlMenu()));
|
||||
connect(controlMenu, &KMenu::aboutToShow, this, &DolphinMainWindow::updateControlMenu);
|
||||
|
||||
m_controlButton->setMenu(controlMenu);
|
||||
|
||||
toolBar()->addWidget(m_controlButton);
|
||||
connect(toolBar(), SIGNAL(iconSizeChanged(QSize)),
|
||||
m_controlButton, SLOT(setIconSize(QSize)));
|
||||
connect(toolBar(), SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle)),
|
||||
m_controlButton, SLOT(setToolButtonStyle(Qt::ToolButtonStyle)));
|
||||
connect(toolBar(), &KToolBar::iconSizeChanged,
|
||||
m_controlButton, &QToolButton::setIconSize);
|
||||
connect(toolBar(), &KToolBar::toolButtonStyleChanged,
|
||||
m_controlButton, &QToolButton::setToolButtonStyle);
|
||||
|
||||
// The added widgets are owned by the toolbar and may get deleted when e.g. the toolbar
|
||||
// gets edited. In this case we must add them again. The adding is done asynchronously by
|
||||
// m_updateToolBarTimer.
|
||||
connect(m_controlButton, SIGNAL(destroyed()), this, SLOT(slotControlButtonDeleted()));
|
||||
connect(m_controlButton, &QToolButton::destroyed, this, &DolphinMainWindow::slotControlButtonDeleted);
|
||||
m_updateToolBarTimer = new QTimer(this);
|
||||
m_updateToolBarTimer->setInterval(500);
|
||||
connect(m_updateToolBarTimer, SIGNAL(timeout()), this, SLOT(updateToolBar()));
|
||||
connect(m_updateToolBarTimer, &QTimer::timeout, this, &DolphinMainWindow::updateToolBar);
|
||||
}
|
||||
|
||||
void DolphinMainWindow::deleteControlButton()
|
||||
|
@ -1979,40 +1979,40 @@ void DolphinMainWindow::clearStatusBar()
|
|||
|
||||
void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
|
||||
{
|
||||
connect(container, SIGNAL(showFilterBarChanged(bool)),
|
||||
this, SLOT(updateFilterBarAction(bool)));
|
||||
connect(container, SIGNAL(writeStateChanged(bool)),
|
||||
this, SLOT(slotWriteStateChanged(bool)));
|
||||
connect(container, &DolphinViewContainer::showFilterBarChanged,
|
||||
this, &DolphinMainWindow::updateFilterBarAction);
|
||||
connect(container, &DolphinViewContainer::writeStateChanged,
|
||||
this, &DolphinMainWindow::slotWriteStateChanged);
|
||||
|
||||
DolphinView* view = container->view();
|
||||
connect(view, SIGNAL(selectionChanged(KFileItemList)),
|
||||
this, SLOT(slotSelectionChanged(KFileItemList)));
|
||||
connect(view, SIGNAL(requestItemInfo(KFileItem)),
|
||||
this, SLOT(slotRequestItemInfo(KFileItem)));
|
||||
connect(view, SIGNAL(activated()),
|
||||
this, SLOT(toggleActiveView()));
|
||||
connect(view, SIGNAL(tabRequested(KUrl)),
|
||||
this, SLOT(openNewTab(KUrl)));
|
||||
connect(view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)),
|
||||
this, SLOT(openContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)));
|
||||
connect(view, SIGNAL(directoryLoadingStarted()),
|
||||
this, SLOT(enableStopAction()));
|
||||
connect(view, SIGNAL(directoryLoadingCompleted()),
|
||||
this, SLOT(disableStopAction()));
|
||||
connect(view, SIGNAL(goBackRequested()),
|
||||
this, SLOT(goBack()));
|
||||
connect(view, SIGNAL(goForwardRequested()),
|
||||
this, SLOT(goForward()));
|
||||
connect(view, &DolphinView::selectionChanged,
|
||||
this, &DolphinMainWindow::slotSelectionChanged);
|
||||
connect(view, &DolphinView::requestItemInfo,
|
||||
this, &DolphinMainWindow::slotRequestItemInfo);
|
||||
connect(view, &DolphinView::activated,
|
||||
this, &DolphinMainWindow::toggleActiveView);
|
||||
connect(view, &DolphinView::tabRequested,
|
||||
this, static_cast<void(DolphinMainWindow::*)(const KUrl&)>(&DolphinMainWindow::openNewTab));
|
||||
connect(view, &DolphinView::requestContextMenu,
|
||||
this, &DolphinMainWindow::openContextMenu);
|
||||
connect(view, &DolphinView::directoryLoadingStarted,
|
||||
this, &DolphinMainWindow::enableStopAction);
|
||||
connect(view, &DolphinView::directoryLoadingCompleted,
|
||||
this, &DolphinMainWindow::disableStopAction);
|
||||
connect(view, &DolphinView::goBackRequested,
|
||||
this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goBack));
|
||||
connect(view, &DolphinView::goForwardRequested,
|
||||
this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goForward));
|
||||
|
||||
const KUrlNavigator* navigator = container->urlNavigator();
|
||||
connect(navigator, SIGNAL(urlChanged(KUrl)),
|
||||
this, SLOT(changeUrl(KUrl)));
|
||||
connect(navigator, SIGNAL(historyChanged()),
|
||||
this, SLOT(updateHistory()));
|
||||
connect(navigator, SIGNAL(editableStateChanged(bool)),
|
||||
this, SLOT(slotEditableStateChanged(bool)));
|
||||
connect(navigator, SIGNAL(tabRequested(KUrl)),
|
||||
this, SLOT(openNewTab(KUrl)));
|
||||
connect(navigator, &KUrlNavigator::urlChanged,
|
||||
this, &DolphinMainWindow::changeUrl);
|
||||
connect(navigator, &KUrlNavigator::historyChanged,
|
||||
this, &DolphinMainWindow::updateHistory);
|
||||
connect(navigator, &KUrlNavigator::editableStateChanged,
|
||||
this, &DolphinMainWindow::slotEditableStateChanged);
|
||||
connect(navigator, &KUrlNavigator::tabRequested,
|
||||
this, static_cast<void(DolphinMainWindow::*)(const KUrl&)>(&DolphinMainWindow::openNewTab));
|
||||
}
|
||||
|
||||
void DolphinMainWindow::updateSplitAction()
|
||||
|
@ -2129,8 +2129,8 @@ void DolphinMainWindow::createPanelAction(const KIcon& icon,
|
|||
panelAction->setIcon(icon);
|
||||
panelAction->setShortcut(shortcut);
|
||||
|
||||
connect(panelAction, SIGNAL(triggered()), dockAction, SLOT(trigger()));
|
||||
connect(dockAction, SIGNAL(toggled(bool)), panelAction, SLOT(setChecked(bool)));
|
||||
connect(panelAction, &QAction::triggered, dockAction, &QAction::trigger);
|
||||
connect(dockAction, &QAction::toggled, panelAction, &QAction::setChecked);
|
||||
}
|
||||
|
||||
DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
|
||||
|
|
|
@ -79,56 +79,56 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
|
|||
m_view->setTabsForFilesEnabled(true);
|
||||
setWidget(m_view);
|
||||
|
||||
connect(&DolphinNewFileMenuObserver::instance(), SIGNAL(errorMessage(QString)),
|
||||
this, SLOT(slotErrorMessage(QString)));
|
||||
connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage,
|
||||
this, &DolphinPart::slotErrorMessage);
|
||||
|
||||
connect(m_view, SIGNAL(directoryLoadingCompleted()), this, SIGNAL(completed()));
|
||||
connect(m_view, SIGNAL(directoryLoadingProgress(int)), this, SLOT(updateProgress(int)));
|
||||
connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(slotErrorMessage(QString)));
|
||||
connect(m_view, &DolphinView::directoryLoadingCompleted, this, static_cast<void(DolphinPart::*)()>(&DolphinPart::completed));
|
||||
connect(m_view, &DolphinView::directoryLoadingProgress, this, &DolphinPart::updateProgress);
|
||||
connect(m_view, &DolphinView::errorMessage, this, &DolphinPart::slotErrorMessage);
|
||||
|
||||
setXMLFile("dolphinpart.rc");
|
||||
|
||||
connect(m_view, SIGNAL(infoMessage(QString)),
|
||||
this, SLOT(slotMessage(QString)));
|
||||
connect(m_view, SIGNAL(operationCompletedMessage(QString)),
|
||||
this, SLOT(slotMessage(QString)));
|
||||
connect(m_view, SIGNAL(errorMessage(QString)),
|
||||
this, SLOT(slotErrorMessage(QString)));
|
||||
connect(m_view, SIGNAL(itemActivated(KFileItem)),
|
||||
this, SLOT(slotItemActivated(KFileItem)));
|
||||
connect(m_view, SIGNAL(itemsActivated(KFileItemList)),
|
||||
this, SLOT(slotItemsActivated(KFileItemList)));
|
||||
connect(m_view, SIGNAL(tabRequested(KUrl)),
|
||||
this, SLOT(createNewWindow(KUrl)));
|
||||
connect(m_view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)),
|
||||
this, SLOT(slotOpenContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)));
|
||||
connect(m_view, SIGNAL(selectionChanged(KFileItemList)),
|
||||
m_extension, SIGNAL(selectionInfo(KFileItemList)));
|
||||
connect(m_view, SIGNAL(selectionChanged(KFileItemList)),
|
||||
this, SLOT(slotSelectionChanged(KFileItemList)));
|
||||
connect(m_view, SIGNAL(requestItemInfo(KFileItem)),
|
||||
this, SLOT(slotRequestItemInfo(KFileItem)));
|
||||
connect(m_view, SIGNAL(modeChanged(DolphinView::Mode,DolphinView::Mode)),
|
||||
this, SIGNAL(viewModeChanged())); // relay signal
|
||||
connect(m_view, SIGNAL(redirection(KUrl,KUrl)),
|
||||
this, SLOT(slotDirectoryRedirection(KUrl,KUrl)));
|
||||
connect(m_view, &DolphinView::infoMessage,
|
||||
this, &DolphinPart::slotMessage);
|
||||
connect(m_view, &DolphinView::operationCompletedMessage,
|
||||
this, &DolphinPart::slotMessage);
|
||||
connect(m_view, &DolphinView::errorMessage,
|
||||
this, &DolphinPart::slotErrorMessage);
|
||||
connect(m_view, &DolphinView::itemActivated,
|
||||
this, &DolphinPart::slotItemActivated);
|
||||
connect(m_view, &DolphinView::itemsActivated,
|
||||
this, &DolphinPart::slotItemsActivated);
|
||||
connect(m_view, &DolphinView::tabRequested,
|
||||
this, &DolphinPart::createNewWindow);
|
||||
connect(m_view, &DolphinView::requestContextMenu,
|
||||
this, &DolphinPart::slotOpenContextMenu);
|
||||
connect(m_view, &DolphinView::selectionChanged,
|
||||
m_extension, static_cast<void(DolphinPartBrowserExtension::*)(const KFileItemList&)>(&DolphinPartBrowserExtension::selectionInfo));
|
||||
connect(m_view, &DolphinView::selectionChanged,
|
||||
this, &DolphinPart::slotSelectionChanged);
|
||||
connect(m_view, &DolphinView::requestItemInfo,
|
||||
this, &DolphinPart::slotRequestItemInfo);
|
||||
connect(m_view, &DolphinView::modeChanged,
|
||||
this, &DolphinPart::viewModeChanged); // relay signal
|
||||
connect(m_view, &DolphinView::redirection,
|
||||
this, &DolphinPart::slotDirectoryRedirection);
|
||||
|
||||
// Watch for changes that should result in updates to the
|
||||
// status bar text.
|
||||
connect(m_view, SIGNAL(itemCountChanged()), this, SLOT(updateStatusBar()));
|
||||
connect(m_view, SIGNAL(selectionChanged(KFileItemList)), this, SLOT(updateStatusBar()));
|
||||
connect(m_view, &DolphinView::itemCountChanged, this, &DolphinPart::updateStatusBar);
|
||||
connect(m_view, &DolphinView::selectionChanged, this, &DolphinPart::updateStatusBar);
|
||||
|
||||
m_actionHandler = new DolphinViewActionHandler(actionCollection(), this);
|
||||
m_actionHandler->setCurrentView(m_view);
|
||||
connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory()));
|
||||
connect(m_actionHandler, &DolphinViewActionHandler::createDirectory, this, &DolphinPart::createDirectory);
|
||||
|
||||
m_remoteEncoding = new DolphinRemoteEncoding(this, m_actionHandler);
|
||||
connect(this, SIGNAL(aboutToOpenURL()),
|
||||
m_remoteEncoding, SLOT(slotAboutToOpenUrl()));
|
||||
connect(this, &DolphinPart::aboutToOpenURL,
|
||||
m_remoteEncoding, &DolphinRemoteEncoding::slotAboutToOpenUrl);
|
||||
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
connect(clipboard, SIGNAL(dataChanged()),
|
||||
this, SLOT(updatePasteAction()));
|
||||
connect(clipboard, &QClipboard::dataChanged,
|
||||
this, &DolphinPart::updatePasteAction);
|
||||
|
||||
// Create file info and listing filter extensions.
|
||||
// NOTE: Listing filter needs to be instantiated after the creation of the view.
|
||||
|
@ -139,8 +139,8 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
|
|||
KDirLister* lister = m_view->m_model->m_dirLister;
|
||||
if (lister) {
|
||||
DolphinPartListingNotificationExtension* notifyExt = new DolphinPartListingNotificationExtension(this);
|
||||
connect(lister, SIGNAL(newItems(KFileItemList)), notifyExt, SLOT(slotNewItems(KFileItemList)));
|
||||
connect(lister, SIGNAL(itemsDeleted(KFileItemList)), notifyExt, SLOT(slotItemsDeleted(KFileItemList)));
|
||||
connect(lister, &KDirLister::newItems, notifyExt, &DolphinPartListingNotificationExtension::slotNewItems);
|
||||
connect(lister, &KDirLister::itemsDeleted, notifyExt, &DolphinPartListingNotificationExtension::slotItemsDeleted);
|
||||
} else {
|
||||
kWarning() << "NULL KDirLister object! KParts::ListingNotificationExtension will NOT be supported";
|
||||
}
|
||||
|
@ -169,40 +169,40 @@ void DolphinPart::createActions()
|
|||
|
||||
m_newFileMenu = new DolphinNewFileMenu(actionCollection(), this);
|
||||
m_newFileMenu->setParentWidget(widget());
|
||||
connect(m_newFileMenu->menu(), SIGNAL(aboutToShow()),
|
||||
this, SLOT(updateNewMenu()));
|
||||
connect(m_newFileMenu->menu(), &QMenu::aboutToShow,
|
||||
this, &DolphinPart::updateNewMenu);
|
||||
|
||||
QAction *editMimeTypeAction = actionCollection()->addAction( "editMimeType" );
|
||||
editMimeTypeAction->setText( i18nc("@action:inmenu Edit", "&Edit File Type..." ) );
|
||||
connect(editMimeTypeAction, SIGNAL(triggered()), SLOT(slotEditMimeType()));
|
||||
connect(editMimeTypeAction, &QAction::triggered, this, &DolphinPart::slotEditMimeType);
|
||||
|
||||
QAction* selectItemsMatching = actionCollection()->addAction("select_items_matching");
|
||||
selectItemsMatching->setText(i18nc("@action:inmenu Edit", "Select Items Matching..."));
|
||||
selectItemsMatching->setShortcut(Qt::CTRL | Qt::Key_S);
|
||||
connect(selectItemsMatching, SIGNAL(triggered()), this, SLOT(slotSelectItemsMatchingPattern()));
|
||||
connect(selectItemsMatching, &QAction::triggered, this, &DolphinPart::slotSelectItemsMatchingPattern);
|
||||
|
||||
QAction* unselectItemsMatching = actionCollection()->addAction("unselect_items_matching");
|
||||
unselectItemsMatching->setText(i18nc("@action:inmenu Edit", "Unselect Items Matching..."));
|
||||
connect(unselectItemsMatching, SIGNAL(triggered()), this, SLOT(slotUnselectItemsMatchingPattern()));
|
||||
connect(unselectItemsMatching, &QAction::triggered, this, &DolphinPart::slotUnselectItemsMatchingPattern);
|
||||
|
||||
actionCollection()->addAction(KStandardAction::SelectAll, "select_all", m_view, SLOT(selectAll()));
|
||||
|
||||
QAction* unselectAll = actionCollection()->addAction("unselect_all");
|
||||
unselectAll->setText(i18nc("@action:inmenu Edit", "Unselect All"));
|
||||
connect(unselectAll, SIGNAL(triggered()), m_view, SLOT(clearSelection()));
|
||||
connect(unselectAll, &QAction::triggered, m_view, &DolphinView::clearSelection);
|
||||
|
||||
QAction* invertSelection = actionCollection()->addAction("invert_selection");
|
||||
invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
|
||||
invertSelection->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_A);
|
||||
connect(invertSelection, SIGNAL(triggered()), m_view, SLOT(invertSelection()));
|
||||
connect(invertSelection, &QAction::triggered, m_view, &DolphinView::invertSelection);
|
||||
|
||||
// View menu: all done by DolphinViewActionHandler
|
||||
|
||||
// Go menu
|
||||
|
||||
QActionGroup* goActionGroup = new QActionGroup(this);
|
||||
connect(goActionGroup, SIGNAL(triggered(QAction*)),
|
||||
this, SLOT(slotGoTriggered(QAction*)));
|
||||
connect(goActionGroup, &QActionGroup::triggered,
|
||||
this, &DolphinPart::slotGoTriggered);
|
||||
|
||||
createGoAction("go_applications", "start-here-kde",
|
||||
i18nc("@action:inmenu Go", "App&lications"), QString("programs:/"),
|
||||
|
@ -225,13 +225,13 @@ void DolphinPart::createActions()
|
|||
m_findFileAction->setText(i18nc("@action:inmenu Tools", "Find File..."));
|
||||
m_findFileAction->setShortcut(Qt::CTRL | Qt::Key_F);
|
||||
m_findFileAction->setIcon(QIcon::fromTheme("edit-find"));
|
||||
connect(m_findFileAction, SIGNAL(triggered()), this, SLOT(slotFindFile()));
|
||||
connect(m_findFileAction, &QAction::triggered, this, &DolphinPart::slotFindFile);
|
||||
|
||||
if (KAuthorized::authorizeKAction("shell_access")) {
|
||||
m_openTerminalAction = actionCollection()->addAction("open_terminal");
|
||||
m_openTerminalAction->setIcon(QIcon::fromTheme("utilities-terminal"));
|
||||
m_openTerminalAction->setText(i18nc("@action:inmenu Tools", "Open &Terminal"));
|
||||
connect(m_openTerminalAction, SIGNAL(triggered()), SLOT(slotOpenTerminal()));
|
||||
connect(m_openTerminalAction, &QAction::triggered, this, &DolphinPart::slotOpenTerminal);
|
||||
m_openTerminalAction->setShortcut(Qt::Key_F4);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ DolphinRemoveAction::DolphinRemoveAction(QObject* parent, KActionCollection* col
|
|||
m_collection(collection)
|
||||
{
|
||||
update();
|
||||
connect(this, SIGNAL(triggered()), this, SLOT(slotRemoveActionTriggered()));
|
||||
connect(this, &DolphinRemoveAction::triggered, this, &DolphinRemoveAction::slotRemoveActionTriggered);
|
||||
}
|
||||
|
||||
void DolphinRemoveAction::slotRemoveActionTriggered()
|
||||
|
|
|
@ -83,12 +83,12 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) :
|
|||
m_topLayout->setMargin(0);
|
||||
|
||||
m_urlNavigator = new KUrlNavigator(new KFilePlacesModel(this), url, this);
|
||||
connect(m_urlNavigator, SIGNAL(urlsDropped(KUrl,QDropEvent*)),
|
||||
this, SLOT(dropUrls(KUrl,QDropEvent*)));
|
||||
connect(m_urlNavigator, SIGNAL(activated()),
|
||||
this, SLOT(activate()));
|
||||
connect(m_urlNavigator->editor(), SIGNAL(completionModeChanged(KCompletion::CompletionMode)),
|
||||
this, SLOT(saveUrlCompletionMode(KCompletion::CompletionMode)));
|
||||
connect(m_urlNavigator, &KUrlNavigator::urlsDropped,
|
||||
this, &DolphinViewContainer::dropUrls);
|
||||
connect(m_urlNavigator, &KUrlNavigator::activated,
|
||||
this, &DolphinViewContainer::activate);
|
||||
connect(m_urlNavigator->editor(), &KUrlComboBox::completionModeChanged,
|
||||
this, &DolphinViewContainer::saveUrlCompletionMode);
|
||||
|
||||
const GeneralSettings* settings = GeneralSettings::self();
|
||||
m_urlNavigator->setUrlEditable(settings->editableUrl());
|
||||
|
@ -99,74 +99,97 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) :
|
|||
|
||||
m_searchBox = new DolphinSearchBox(this);
|
||||
m_searchBox->hide();
|
||||
connect(m_searchBox, SIGNAL(activated()), this, SLOT(activate()));
|
||||
connect(m_searchBox, SIGNAL(closeRequest()), this, SLOT(closeSearchBox()));
|
||||
connect(m_searchBox, SIGNAL(searchRequest()), this, SLOT(startSearching()));
|
||||
connect(m_searchBox, SIGNAL(returnPressed(QString)), this, SLOT(requestFocus()));
|
||||
connect(m_searchBox, &DolphinSearchBox::activated, this, &DolphinViewContainer::activate);
|
||||
connect(m_searchBox, &DolphinSearchBox::closeRequest, this, &DolphinViewContainer::closeSearchBox);
|
||||
connect(m_searchBox, &DolphinSearchBox::searchRequest, this, &DolphinViewContainer::startSearching);
|
||||
connect(m_searchBox, &DolphinSearchBox::returnPressed, this, &DolphinViewContainer::requestFocus);
|
||||
|
||||
m_messageWidget = new KMessageWidget(this);
|
||||
m_messageWidget->setCloseButtonVisible(true);
|
||||
m_messageWidget->hide();
|
||||
|
||||
m_view = new DolphinView(url, this);
|
||||
connect(m_view, SIGNAL(urlChanged(KUrl)), m_urlNavigator, SLOT(setUrl(KUrl)));
|
||||
connect(m_view, SIGNAL(urlChanged(KUrl)), m_messageWidget, SLOT(hide()));
|
||||
connect(m_view, SIGNAL(writeStateChanged(bool)), this, SIGNAL(writeStateChanged(bool)));
|
||||
connect(m_view, SIGNAL(requestItemInfo(KFileItem)), this, SLOT(showItemInfo(KFileItem)));
|
||||
connect(m_view, SIGNAL(itemActivated(KFileItem)), this, SLOT(slotItemActivated(KFileItem)));
|
||||
connect(m_view, SIGNAL(itemsActivated(KFileItemList)), this, SLOT(slotItemsActivated(KFileItemList)));
|
||||
connect(m_view, SIGNAL(redirection(KUrl,KUrl)), this, SLOT(redirect(KUrl,KUrl)));
|
||||
connect(m_view, SIGNAL(directoryLoadingStarted()), this, SLOT(slotDirectoryLoadingStarted()));
|
||||
connect(m_view, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted()));
|
||||
connect(m_view, SIGNAL(directoryLoadingCanceled()), this, SLOT(slotDirectoryLoadingCanceled()));
|
||||
connect(m_view, SIGNAL(itemCountChanged()), this, SLOT(delayedStatusBarUpdate()));
|
||||
connect(m_view, SIGNAL(directoryLoadingProgress(int)), this, SLOT(updateDirectoryLoadingProgress(int)));
|
||||
connect(m_view, SIGNAL(directorySortingProgress(int)), this, SLOT(updateDirectorySortingProgress(int)));
|
||||
connect(m_view, SIGNAL(selectionChanged(KFileItemList)), this, SLOT(delayedStatusBarUpdate()));
|
||||
connect(m_view, SIGNAL(urlAboutToBeChanged(KUrl)), this, SLOT(slotViewUrlAboutToBeChanged(KUrl)));
|
||||
connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(showErrorMessage(QString)));
|
||||
connect(m_view, SIGNAL(urlIsFileError(KUrl)), this, SLOT(slotUrlIsFileError(KUrl)));
|
||||
connect(m_view, &DolphinView::urlChanged,
|
||||
m_urlNavigator, &KUrlNavigator::setUrl);
|
||||
connect(m_view, &DolphinView::urlChanged,
|
||||
m_messageWidget, &KMessageWidget::hide);
|
||||
connect(m_view, &DolphinView::writeStateChanged,
|
||||
this, &DolphinViewContainer::writeStateChanged);
|
||||
connect(m_view, &DolphinView::requestItemInfo,
|
||||
this, &DolphinViewContainer::showItemInfo);
|
||||
connect(m_view, &DolphinView::itemActivated,
|
||||
this, &DolphinViewContainer::slotItemActivated);
|
||||
connect(m_view, &DolphinView::itemsActivated,
|
||||
this, &DolphinViewContainer::slotItemsActivated);
|
||||
connect(m_view, &DolphinView::redirection,
|
||||
this, &DolphinViewContainer::redirect);
|
||||
connect(m_view, &DolphinView::directoryLoadingStarted,
|
||||
this, &DolphinViewContainer::slotDirectoryLoadingStarted);
|
||||
connect(m_view, &DolphinView::directoryLoadingCompleted,
|
||||
this, &DolphinViewContainer::slotDirectoryLoadingCompleted);
|
||||
connect(m_view, &DolphinView::directoryLoadingCanceled,
|
||||
this, &DolphinViewContainer::slotDirectoryLoadingCanceled);
|
||||
connect(m_view, &DolphinView::itemCountChanged,
|
||||
this, &DolphinViewContainer::delayedStatusBarUpdate);
|
||||
connect(m_view, &DolphinView::directoryLoadingProgress,
|
||||
this, &DolphinViewContainer::updateDirectoryLoadingProgress);
|
||||
connect(m_view, &DolphinView::directorySortingProgress,
|
||||
this, &DolphinViewContainer::updateDirectorySortingProgress);
|
||||
connect(m_view, &DolphinView::selectionChanged,
|
||||
this, &DolphinViewContainer::delayedStatusBarUpdate);
|
||||
connect(m_view, &DolphinView::urlAboutToBeChanged,
|
||||
this, &DolphinViewContainer::slotViewUrlAboutToBeChanged);
|
||||
connect(m_view, &DolphinView::errorMessage,
|
||||
this, &DolphinViewContainer::showErrorMessage);
|
||||
connect(m_view, &DolphinView::urlIsFileError,
|
||||
this, &DolphinViewContainer::slotUrlIsFileError);
|
||||
|
||||
connect(m_urlNavigator, SIGNAL(urlAboutToBeChanged(KUrl)),
|
||||
this, SLOT(slotUrlNavigatorLocationAboutToBeChanged(KUrl)));
|
||||
connect(m_urlNavigator, SIGNAL(urlChanged(KUrl)),
|
||||
this, SLOT(slotUrlNavigatorLocationChanged(KUrl)));
|
||||
connect(m_urlNavigator, SIGNAL(historyChanged()),
|
||||
this, SLOT(slotHistoryChanged()));
|
||||
connect(m_urlNavigator, SIGNAL(returnPressed()),
|
||||
this, SLOT(slotReturnPressed()));
|
||||
connect(m_urlNavigator, &KUrlNavigator::urlAboutToBeChanged,
|
||||
this, &DolphinViewContainer::slotUrlNavigatorLocationAboutToBeChanged);
|
||||
connect(m_urlNavigator, &KUrlNavigator::urlChanged,
|
||||
this, &DolphinViewContainer::slotUrlNavigatorLocationChanged);
|
||||
connect(m_urlNavigator, &KUrlNavigator::historyChanged,
|
||||
this, &DolphinViewContainer::slotHistoryChanged);
|
||||
connect(m_urlNavigator, &KUrlNavigator::returnPressed,
|
||||
this, &DolphinViewContainer::slotReturnPressed);
|
||||
|
||||
// Initialize status bar
|
||||
m_statusBar = new DolphinStatusBar(this);
|
||||
m_statusBar->setUrl(m_view->url());
|
||||
m_statusBar->setZoomLevel(m_view->zoomLevel());
|
||||
connect(m_view, SIGNAL(urlChanged(KUrl)), m_statusBar, SLOT(setUrl(KUrl)));
|
||||
connect(m_view, SIGNAL(zoomLevelChanged(int,int)), m_statusBar, SLOT(setZoomLevel(int)));
|
||||
connect(m_view, SIGNAL(infoMessage(QString)), m_statusBar, SLOT(setText(QString)));
|
||||
connect(m_view, SIGNAL(operationCompletedMessage(QString)), m_statusBar, SLOT(setText(QString)));
|
||||
connect(m_statusBar, SIGNAL(stopPressed()), this, SLOT(stopDirectoryLoading()));
|
||||
connect(m_statusBar, SIGNAL(zoomLevelChanged(int)), this, SLOT(slotStatusBarZoomLevelChanged(int)));
|
||||
connect(m_view, &DolphinView::urlChanged,
|
||||
m_statusBar, &DolphinStatusBar::setUrl);
|
||||
connect(m_view, &DolphinView::zoomLevelChanged,
|
||||
m_statusBar, &DolphinStatusBar::setZoomLevel);
|
||||
connect(m_view, &DolphinView::infoMessage,
|
||||
m_statusBar, &DolphinStatusBar::setText);
|
||||
connect(m_view, &DolphinView::operationCompletedMessage,
|
||||
m_statusBar, &DolphinStatusBar::setText);
|
||||
connect(m_statusBar, &DolphinStatusBar::stopPressed,
|
||||
this, &DolphinViewContainer::stopDirectoryLoading);
|
||||
connect(m_statusBar, &DolphinStatusBar::zoomLevelChanged,
|
||||
this, &DolphinViewContainer::slotStatusBarZoomLevelChanged);
|
||||
|
||||
m_statusBarTimer = new QTimer(this);
|
||||
m_statusBarTimer->setSingleShot(true);
|
||||
m_statusBarTimer->setInterval(300);
|
||||
connect(m_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar()));
|
||||
connect(m_statusBarTimer, &QTimer::timeout, this, &DolphinViewContainer::updateStatusBar);
|
||||
|
||||
KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self();
|
||||
connect(undoManager, SIGNAL(jobRecordingFinished(CommandType)),
|
||||
this, SLOT(delayedStatusBarUpdate()));
|
||||
connect(undoManager, &KIO::FileUndoManager::jobRecordingFinished,
|
||||
this, &DolphinViewContainer::delayedStatusBarUpdate);
|
||||
|
||||
// Initialize filter bar
|
||||
m_filterBar = new FilterBar(this);
|
||||
m_filterBar->setVisible(settings->filterBar());
|
||||
connect(m_filterBar, SIGNAL(filterChanged(QString)),
|
||||
this, SLOT(setNameFilter(QString)));
|
||||
connect(m_filterBar, SIGNAL(closeRequest()),
|
||||
this, SLOT(closeFilterBar()));
|
||||
connect(m_filterBar, SIGNAL(focusViewRequest()),
|
||||
this, SLOT(requestFocus()));
|
||||
connect(m_view, SIGNAL(urlChanged(KUrl)),
|
||||
m_filterBar, SLOT(slotUrlChanged()));
|
||||
connect(m_filterBar, &FilterBar::filterChanged,
|
||||
this, &DolphinViewContainer::setNameFilter);
|
||||
connect(m_filterBar, &FilterBar::closeRequest,
|
||||
this, &DolphinViewContainer::closeFilterBar);
|
||||
connect(m_filterBar, &FilterBar::focusViewRequest,
|
||||
this, &DolphinViewContainer::requestFocus);
|
||||
connect(m_view, &DolphinView::urlChanged,
|
||||
m_filterBar, &FilterBar::slotUrlChanged);
|
||||
|
||||
m_topLayout->addWidget(m_urlNavigator);
|
||||
m_topLayout->addWidget(m_searchBox);
|
||||
|
|
Loading…
Reference in a new issue