From: Frank Reininghaus Date: Wed, 21 May 2014 20:49:40 +0000 (+0200) Subject: Merge remote-tracking branch 'origin/master' into frameworks X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/a46121dc510f987f2d164b43eaf5f84ea8c83cb8?hp=-c Merge remote-tracking branch 'origin/master' into frameworks Conflicts: dolphin/src/search/filenamesearchprotocol.cpp --- a46121dc510f987f2d164b43eaf5f84ea8c83cb8 diff --combined src/dolphinmainwindow.cpp index dc5e37ff7,0ad224cbc..049c44088 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@@ -53,10 -53,9 +53,10 @@@ #include #include #include +#include +#include #include #include -#include #include #include #include @@@ -87,8 -86,6 +87,8 @@@ #include #include #include +#include +#include namespace { // Used for GeneralSettings::version() to determine whether @@@ -130,20 -127,20 +130,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(&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); @@@ -161,8 -158,8 +161,8 @@@ 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); @@@ -173,28 -170,28 +173,28 @@@ 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(&DolphinMainWindow::closeTab)); + connect(m_tabBar, &KTabBar::contextMenu, + this, &DolphinMainWindow::openTabContextMenu); + connect(m_tabBar, &KTabBar::newTabRequest, + this, static_cast(&DolphinMainWindow::openNewTab)); + connect(m_tabBar, &KTabBar::testCanDecode, + this, &DolphinMainWindow::slotTestCanDecode); + connect(m_tabBar, &KTabBar::mouseMiddleClick, + this, static_cast(&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 @@@ -213,13 -210,14 +213,14 @@@ 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(); } updateEditActions(); + updatePasteAction(); updateViewActions(); updateGoActions(); @@@ -359,14 -357,15 +360,15 @@@ void DolphinMainWindow::changeUrl(cons if (view) { view->setUrl(url); updateEditActions(); + updatePasteAction(); updateViewActions(); updateGoActions(); setUrlAsCaption(url); if (m_viewTab.count() > 1) { m_tabBar->setTabText(m_tabIndex, squeezedText(tabName(m_activeViewContainer->url()))); } - const QString iconName = KMimeType::iconNameForUrl(url); - m_tabBar->setTabIcon(m_tabIndex, KIcon(iconName)); + const QString iconName = KIO::iconNameForUrl(url); + m_tabBar->setTabIcon(m_tabIndex, QIcon::fromTheme(iconName)); emit urlChanged(url); } } @@@ -466,12 -465,12 +468,12 @@@ void DolphinMainWindow::openNewTab(cons // Only one view is open currently and hence no tab is shown at // all. Before creating a tab for 'url', provide a tab for the current URL. const KUrl currentUrl = m_activeViewContainer->url(); - m_tabBar->addTab(KIcon(KMimeType::iconNameForUrl(currentUrl)), + m_tabBar->addTab(QIcon::fromTheme(KIO::iconNameForUrl(currentUrl)), squeezedText(tabName(currentUrl))); m_tabBar->blockSignals(false); } - m_tabBar->addTab(KIcon(KMimeType::iconNameForUrl(url)), + m_tabBar->addTab(QIcon::fromTheme(KIO::iconNameForUrl(url)), squeezedText(tabName(url))); ViewTab viewTab; @@@ -555,7 -554,7 +557,7 @@@ void DolphinMainWindow::openInNewWindow } if (!newWindowUrl.isEmpty()) { - KRun::run("dolphin %u", KUrl::List() << newWindowUrl, this); + KRun::run("dolphin %u", QList() << newWindowUrl, this); } } @@@ -598,19 -597,18 +600,19 @@@ void DolphinMainWindow::closeEvent(QClo // KDialog::Yes -> Quit // KDialog::No -> Close only the current tab // KDialog::Cancel -> do nothing - KDialog *dialog = new KDialog(this, Qt::Dialog); - dialog->setCaption(i18nc("@title:window", "Confirmation")); - dialog->setButtons(KDialog::Yes | KDialog::No | KDialog::Cancel); + QDialog *dialog = new QDialog(this, Qt::Dialog); + dialog->setWindowTitle(i18nc("@title:window", "Confirmation")); dialog->setModal(true); - dialog->setButtonGuiItem(KDialog::Yes, KStandardGuiItem::quit()); - dialog->setButtonGuiItem(KDialog::No, KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close"))); - dialog->setButtonGuiItem(KDialog::Cancel, KStandardGuiItem::cancel()); - dialog->setDefaultButton(KDialog::Yes); + QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::No | QDialogButtonBox::Cancel); + KGuiItem::assign(buttons->button(QDialogButtonBox::Yes), KStandardGuiItem::quit()); + KGuiItem::assign(buttons->button(QDialogButtonBox::No), KGuiItem(i18n("C&lose Current Tab"), QIcon::fromTheme("tab-close"))); + KGuiItem::assign(buttons->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel()); + buttons->button(QDialogButtonBox::Yes)->setDefault(true); bool doNotAskAgainCheckboxResult = false; const int result = KMessageBox::createKMessageBox(dialog, + buttons, QMessageBox::Warning, i18n("You have multiple tabs open in this window, are you sure you want to quit?"), QStringList(), @@@ -1064,7 -1062,7 +1066,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; @@@ -1172,14 -1170,14 +1174,14 @@@ void DolphinMainWindow::openTabContextM { KMenu menu(this); - QAction* newTabAction = menu.addAction(KIcon("tab-new"), i18nc("@action:inmenu", "New Tab")); + QAction* newTabAction = menu.addAction(QIcon::fromTheme("tab-new"), i18nc("@action:inmenu", "New Tab")); newTabAction->setShortcut(actionCollection()->action("new_tab")->shortcut()); - QAction* detachTabAction = menu.addAction(KIcon("tab-detach"), i18nc("@action:inmenu", "Detach Tab")); + QAction* detachTabAction = menu.addAction(QIcon::fromTheme("tab-detach"), i18nc("@action:inmenu", "Detach Tab")); - QAction* closeOtherTabsAction = menu.addAction(KIcon("tab-close-other"), i18nc("@action:inmenu", "Close Other Tabs")); + QAction* closeOtherTabsAction = menu.addAction(QIcon::fromTheme("tab-close-other"), i18nc("@action:inmenu", "Close Other Tabs")); - QAction* closeTabAction = menu.addAction(KIcon("tab-close"), i18nc("@action:inmenu", "Close Tab")); + QAction* closeTabAction = menu.addAction(QIcon::fromTheme("tab-close"), i18nc("@action:inmenu", "Close Tab")); closeTabAction->setShortcut(actionCollection()->action("close_tab")->shortcut()); QAction* selectedAction = menu.exec(pos); if (selectedAction == newTabAction) { @@@ -1240,10 -1238,10 +1242,10 @@@ void DolphinMainWindow::handleUrl(cons // stat the URL to see if it is a dir or not m_lastHandleUrlStatJob = KIO::stat(url, KIO::HideProgressInfo); if (m_lastHandleUrlStatJob->ui()) { - m_lastHandleUrlStatJob->ui()->setWindow(this); + 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 @@@ -1293,13 -1291,12 +1295,13 @@@ void DolphinMainWindow::openContextMenu switch (command) { case DolphinContextMenu::OpenParentFolderInNewWindow: { - KRun::run("dolphin %u", KUrl::List() << item.url().upUrl(), this); + + KRun::run("dolphin %u", QList() << KIO::upUrl(item.url()), this); break; } case DolphinContextMenu::OpenParentFolderInNewTab: - openNewTab(item.url().upUrl()); + openNewTab(KIO::upUrl(item.url())); break; case DolphinContextMenu::None: @@@ -1366,7 -1363,7 +1368,7 @@@ void DolphinMainWindow::updateControlMe // 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))); @@@ -1376,7 -1373,7 +1378,7 @@@ // 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")); @@@ -1390,7 -1387,7 +1392,7 @@@ // 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(); @@@ -1452,14 -1449,15 +1454,15 @@@ void DolphinMainWindow::setActiveViewCo // 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()); updateHistory(); updateEditActions(); + updatePasteAction(); updateViewActions(); updateGoActions(); @@@ -1467,7 -1465,7 +1470,7 @@@ setUrlAsCaption(url); if (m_viewTab.count() > 1) { m_tabBar->setTabText(m_tabIndex, tabName(url)); - m_tabBar->setTabIcon(m_tabIndex, KIcon(KMimeType::iconNameForUrl(url))); + m_tabBar->setTabIcon(m_tabIndex, QIcon::fromTheme(KIO::iconNameForUrl(url))); } emit urlChanged(url); @@@ -1489,31 -1487,31 +1492,31 @@@ void DolphinMainWindow::setupActions( { // setup 'File' menu m_newFileMenu = new DolphinNewFileMenu(actionCollection(), this); - KMenu* menu = m_newFileMenu->menu(); + QMenu* menu = m_newFileMenu->menu(); menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New")); - menu->setIcon(KIcon("document-new")); + menu->setIcon(QIcon::fromTheme("document-new")); m_newFileMenu->setDelayed(false); - connect(menu, SIGNAL(aboutToShow()), - this, SLOT(updateNewMenu())); + connect(menu, &QMenu::aboutToShow, + this, &DolphinMainWindow::updateNewMenu); - KAction* newWindow = actionCollection()->addAction("new_window"); - newWindow->setIcon(KIcon("window-new")); + QAction* newWindow = actionCollection()->addAction("new_window"); + newWindow->setIcon(QIcon::fromTheme("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); - KAction* newTab = actionCollection()->addAction("new_tab"); - newTab->setIcon(KIcon("tab-new")); + QAction* newTab = actionCollection()->addAction("new_tab"); + newTab->setIcon(QIcon::fromTheme("tab-new")); newTab->setText(i18nc("@action:inmenu File", "New Tab")); - newTab->setShortcut(KShortcut(Qt::CTRL | Qt::Key_T, Qt::CTRL | Qt::SHIFT | Qt::Key_N)); - connect(newTab, SIGNAL(triggered()), this, SLOT(openNewTab())); + newTab->setShortcuts(QList() << QKeySequence(Qt::CTRL | Qt::Key_T) << QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_N)); + connect(newTab, &QAction::triggered, this, static_cast(&DolphinMainWindow::openNewTab)); - KAction* closeTab = actionCollection()->addAction("close_tab"); - closeTab->setIcon(KIcon("tab-close")); + QAction* closeTab = actionCollection()->addAction("close_tab"); + closeTab->setIcon(QIcon::fromTheme("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(&DolphinMainWindow::closeTab)); KStandardAction::quit(this, SLOT(quit()), actionCollection()); @@@ -1524,12 -1522,12 +1527,12 @@@ // need to remove shift+del from cut action, else the shortcut for deletejob // doesn't work - KAction* cut = KStandardAction::cut(this, SLOT(cut()), actionCollection()); - KShortcut cutShortcut = cut->shortcut(); - cutShortcut.remove(Qt::SHIFT | Qt::Key_Delete, KShortcut::KeepEmpty); - cut->setShortcut(cutShortcut); + QAction* cut = KStandardAction::cut(this, SLOT(cut()), actionCollection()); + auto cutShortcuts = cut->shortcuts(); + cutShortcuts.removeAll(QKeySequence(Qt::SHIFT | Qt::Key_Delete)); + cut->setShortcuts(cutShortcuts); KStandardAction::copy(this, SLOT(copy()), actionCollection()); - KAction* paste = KStandardAction::paste(this, SLOT(paste()), actionCollection()); + QAction* paste = KStandardAction::paste(this, SLOT(paste()), actionCollection()); // The text of the paste-action is modified dynamically by Dolphin // (e. g. to "Paste One Folder"). To prevent that the size of the toolbar changes // due to the long text, the text "Paste" is used: @@@ -1537,139 -1535,139 +1540,139 @@@ KStandardAction::find(this, SLOT(find()), actionCollection()); - KAction* selectAll = actionCollection()->addAction("select_all"); + 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); - KAction* invertSelection = actionCollection()->addAction("invert_selection"); + 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) - KAction* split = actionCollection()->addAction("split_view"); + 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); - KAction* reload = actionCollection()->addAction("reload"); + 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())); + reload->setIcon(QIcon::fromTheme("view-refresh")); + connect(reload, &QAction::triggered, this, &DolphinMainWindow::reloadView); - KAction* stop = actionCollection()->addAction("stop"); + 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())); + stop->setIcon(QIcon::fromTheme("process-stop")); + connect(stop, &QAction::triggered, this, &DolphinMainWindow::stopLoading); KToggleAction* editableLocation = actionCollection()->add("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); - KAction* replaceLocation = actionCollection()->addAction("replace_location"); + 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 - KAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection()); - connect(backAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goBack(Qt::MouseButtons))); - KShortcut backShortcut = backAction->shortcut(); - backShortcut.setAlternate(Qt::Key_Backspace); - backAction->setShortcut(backShortcut); + QAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection()); + connect(backAction, &QAction::triggered, this, static_cast(&DolphinMainWindow::goBack)); + auto backShortcuts = backAction->shortcuts(); + backShortcuts.append(QKeySequence(Qt::Key_Backspace)); + backAction->setShortcuts(backShortcuts); m_recentTabsMenu = new KActionMenu(i18n("Recently Closed Tabs"), this); - m_recentTabsMenu->setIcon(KIcon("edit-undo")); + m_recentTabsMenu->setIcon(QIcon::fromTheme("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")); + action->setIcon(QIcon::fromTheme("edit-clear-list")); action->setData(QVariant::fromValue(true)); m_recentTabsMenu->addAction(action); m_recentTabsMenu->addSeparator(); m_recentTabsMenu->setEnabled(false); - KAction* forwardAction = KStandardAction::forward(this, SLOT(goForward()), actionCollection()); - connect(forwardAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goForward(Qt::MouseButtons))); + QAction* forwardAction = KStandardAction::forward(this, SLOT(goForward()), actionCollection()); + connect(forwardAction, &QAction::triggered, this, static_cast(&DolphinMainWindow::goForward)); - KAction* upAction = KStandardAction::up(this, SLOT(goUp()), actionCollection()); - connect(upAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goUp(Qt::MouseButtons))); + QAction* upAction = KStandardAction::up(this, SLOT(goUp()), actionCollection()); + connect(upAction, &QAction::triggered, this, static_cast(&DolphinMainWindow::goUp)); - KAction* homeAction = KStandardAction::home(this, SLOT(goHome()), actionCollection()); - connect(homeAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goHome(Qt::MouseButtons))); + QAction* homeAction = KStandardAction::home(this, SLOT(goHome()), actionCollection()); + connect(homeAction, &QAction::triggered, this, static_cast(&DolphinMainWindow::goHome)); // setup 'Tools' menu - KAction* showFilterBar = actionCollection()->addAction("show_filter_bar"); + QAction* showFilterBar = actionCollection()->addAction("show_filter_bar"); showFilterBar->setText(i18nc("@action:inmenu Tools", "Show Filter Bar")); - showFilterBar->setIcon(KIcon("view-filter")); + showFilterBar->setIcon(QIcon::fromTheme("view-filter")); showFilterBar->setShortcut(Qt::CTRL | Qt::Key_I); - connect(showFilterBar, SIGNAL(triggered()), this, SLOT(showFilterBar())); + connect(showFilterBar, &QAction::triggered, this, &DolphinMainWindow::showFilterBar); - KAction* compareFiles = actionCollection()->addAction("compare_files"); + QAction* compareFiles = actionCollection()->addAction("compare_files"); compareFiles->setText(i18nc("@action:inmenu Tools", "Compare Files")); - compareFiles->setIcon(KIcon("kompare")); + compareFiles->setIcon(QIcon::fromTheme("kompare")); compareFiles->setEnabled(false); - connect(compareFiles, SIGNAL(triggered()), this, SLOT(compareFiles())); + connect(compareFiles, &QAction::triggered, this, &DolphinMainWindow::compareFiles); - KAction* openTerminal = actionCollection()->addAction("open_terminal"); + QAction* openTerminal = actionCollection()->addAction("open_terminal"); openTerminal->setText(i18nc("@action:inmenu Tools", "Open Terminal")); - openTerminal->setIcon(KIcon("utilities-terminal")); + openTerminal->setIcon(QIcon::fromTheme("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 QList nextTabKeys; - nextTabKeys.append(KStandardShortcut::tabNext().primary()); + nextTabKeys.append(KStandardShortcut::tabNext().first()); //TODO: is this correct nextTabKeys.append(QKeySequence(Qt::CTRL | Qt::Key_Tab)); QList prevTabKeys; - prevTabKeys.append(KStandardShortcut::tabPrev().primary()); + prevTabKeys.append(KStandardShortcut::tabPrev().first()); //TODO: is this correct prevTabKeys.append(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_Tab)); - KAction* activateNextTab = actionCollection()->addAction("activate_next_tab"); + QAction* activateNextTab = actionCollection()->addAction("activate_next_tab"); activateNextTab->setIconText(i18nc("@action:inmenu", "Next Tab")); activateNextTab->setText(i18nc("@action:inmenu", "Activate Next Tab")); activateNextTab->setEnabled(false); - connect(activateNextTab, SIGNAL(triggered()), SLOT(activateNextTab())); + connect(activateNextTab, &QAction::triggered, this, &DolphinMainWindow::activateNextTab); activateNextTab->setShortcuts(QApplication::isRightToLeft() ? prevTabKeys : nextTabKeys); - KAction* activatePrevTab = actionCollection()->addAction("activate_prev_tab"); + QAction* activatePrevTab = actionCollection()->addAction("activate_prev_tab"); activatePrevTab->setIconText(i18nc("@action:inmenu", "Previous Tab")); activatePrevTab->setText(i18nc("@action:inmenu", "Activate Previous Tab")); activatePrevTab->setEnabled(false); - connect(activatePrevTab, SIGNAL(triggered()), SLOT(activatePrevTab())); + connect(activatePrevTab, &QAction::triggered, this, &DolphinMainWindow::activatePrevTab); activatePrevTab->setShortcuts(QApplication::isRightToLeft() ? nextTabKeys : prevTabKeys); // for context menu - KAction* openInNewTab = actionCollection()->addAction("open_in_new_tab"); + 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())); + openInNewTab->setIcon(QIcon::fromTheme("tab-new")); + connect(openInNewTab, &QAction::triggered, this, &DolphinMainWindow::openInNewTab); - KAction* openInNewTabs = actionCollection()->addAction("open_in_new_tabs"); + 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())); + openInNewTabs->setIcon(QIcon::fromTheme("tab-new")); + connect(openInNewTabs, &QAction::triggered, this, &DolphinMainWindow::openInNewTab); - KAction* openInNewWindow = actionCollection()->addAction("open_in_new_window"); + 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())); + openInNewWindow->setIcon(QIcon::fromTheme("window-new")); + connect(openInNewWindow, &QAction::triggered, this, &DolphinMainWindow::openInNewWindow); } void DolphinMainWindow::setupDockWidgets() @@@ -1678,32 -1676,32 +1681,32 @@@ KDualAction* lockLayoutAction = actionCollection()->add("lock_panels"); lockLayoutAction->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels")); - lockLayoutAction->setActiveIcon(KIcon("object-unlocked")); + lockLayoutAction->setActiveIcon(QIcon::fromTheme("object-unlocked")); lockLayoutAction->setInactiveText(i18nc("@action:inmenu Panels", "Lock Panels")); - lockLayoutAction->setInactiveIcon(KIcon("object-locked")); + lockLayoutAction->setInactiveIcon(QIcon::fromTheme("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() << 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"); + createPanelAction(QIcon::fromTheme("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")); @@@ -1715,17 -1713,17 +1718,17 @@@ foldersDock->setWidget(foldersPanel); QAction* foldersAction = foldersDock->toggleViewAction(); - createPanelAction(KIcon("folder"), Qt::Key_F7, foldersAction, "show_folders_panel"); + createPanelAction(QIcon::fromTheme("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(&DolphinMainWindow::openNewTab)); + connect(foldersPanel, &FoldersPanel::errorMessage, + this, &DolphinMainWindow::slotPanelErrorMessage); // Setup "Terminal" #ifndef Q_OS_WIN @@@ -1733,21 -1731,21 +1736,21 @@@ 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() << 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"); + createPanelAction(QIcon::fromTheme("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) { @@@ -1769,21 -1767,21 +1772,21 @@@ placesDock->setWidget(placesPanel); QAction* placesAction = placesDock->toggleViewAction(); - createPanelAction(KIcon("bookmarks"), Qt::Key_F9, placesAction, "show_places_panel"); + createPanelAction(QIcon::fromTheme("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(&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); @@@ -1824,7 -1822,6 +1827,6 @@@ void DolphinMainWindow::updateEditActio deleteWithTrashShortcut->setEnabled(capabilities.supportsDeleting() && !enableMoveToTrash); cutAction->setEnabled(capabilities.supportsMoving()); } - updatePasteAction(); } void DolphinMainWindow::updateViewActions() @@@ -1856,29 -1853,29 +1858,29 @@@ void DolphinMainWindow::createControlBu Q_ASSERT(!m_controlButton); m_controlButton = new QToolButton(this); - m_controlButton->setIcon(KIcon("applications-system")); + m_controlButton->setIcon(QIcon::fromTheme("applications-system")); m_controlButton->setText(i18nc("@action", "Control")); m_controlButton->setPopupMode(QToolButton::InstantPopup); 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() @@@ -1908,10 -1905,10 +1910,10 @@@ bool DolphinMainWindow::addActionToMenu void DolphinMainWindow::rememberClosedTab(int index) { - KMenu* tabsMenu = m_recentTabsMenu->menu(); + QMenu* tabsMenu = m_recentTabsMenu->menu(); const QString primaryPath = m_viewTab[index].primaryView->url().path(); - const QString iconName = KMimeType::iconNameForUrl(primaryPath); + const QString iconName = KIO::iconNameForUrl(primaryPath); QAction* action = new QAction(squeezedText(primaryPath), tabsMenu); @@@ -1926,7 -1923,7 +1928,7 @@@ } action->setData(QVariant::fromValue(closedTab)); - action->setIcon(KIcon(iconName)); + action->setIcon(QIcon::fromTheme(iconName)); // add the closed tab menu entry after the separator and // "Empty Recently Closed Tabs" entry @@@ -1985,40 -1982,40 +1987,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)), - this, SLOT(openContextMenu(QPoint,KFileItem,KUrl,QList))); - 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(&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(&DolphinMainWindow::goBack)); + connect(view, &DolphinView::goForwardRequested, + this, static_cast(&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(&DolphinMainWindow::openNewTab)); } void DolphinMainWindow::updateSplitAction() @@@ -2028,16 -2025,16 +2030,16 @@@ if (m_activeViewContainer == m_viewTab[m_tabIndex].secondaryView) { splitAction->setText(i18nc("@action:intoolbar Close right view", "Close")); splitAction->setToolTip(i18nc("@info", "Close right view")); - splitAction->setIcon(KIcon("view-right-close")); + splitAction->setIcon(QIcon::fromTheme("view-right-close")); } else { splitAction->setText(i18nc("@action:intoolbar Close left view", "Close")); splitAction->setToolTip(i18nc("@info", "Close left view")); - splitAction->setIcon(KIcon("view-left-close")); + splitAction->setIcon(QIcon::fromTheme("view-left-close")); } } else { splitAction->setText(i18nc("@action:intoolbar Split view", "Split")); splitAction->setToolTip(i18nc("@info", "Split view")); - splitAction->setIcon(KIcon("view-right-new")); + splitAction->setIcon(QIcon::fromTheme("view-right-new")); } } @@@ -2123,20 -2120,20 +2125,20 @@@ QString DolphinMainWindow::squeezedText return fm.elidedText(text, Qt::ElideMiddle, fm.maxWidth() * 10); } -void DolphinMainWindow::createPanelAction(const KIcon& icon, +void DolphinMainWindow::createPanelAction(const QIcon& icon, const QKeySequence& shortcut, QAction* dockAction, const QString& actionName) { - KAction* panelAction = actionCollection()->addAction(actionName); + QAction* panelAction = actionCollection()->addAction(actionName); panelAction->setCheckable(true); panelAction->setChecked(dockAction->isChecked()); panelAction->setText(dockAction->text()); 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() : diff --combined src/kitemviews/kfileitemmodel.cpp index 196172f1d,de3c3eb22..51bf546f9 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@@ -25,7 -25,6 +25,7 @@@ #include #include #include +#include //TODO: port to QCollator #include "private/kfileitemmodelsortalgorithm.h" #include "private/kfileitemmodeldirlister.h" @@@ -69,17 -68,17 +69,17 @@@ KFileItemModel::KFileItemModel(QObject m_dirLister->setMainWindow(parentWidget->window()); } - connect(m_dirLister, SIGNAL(started(KUrl)), this, SIGNAL(directoryLoadingStarted())); - connect(m_dirLister, SIGNAL(canceled()), this, SLOT(slotCanceled())); - connect(m_dirLister, SIGNAL(completed(KUrl)), this, SLOT(slotCompleted())); - connect(m_dirLister, SIGNAL(itemsAdded(KUrl,KFileItemList)), this, SLOT(slotItemsAdded(KUrl,KFileItemList))); - connect(m_dirLister, SIGNAL(itemsDeleted(KFileItemList)), this, SLOT(slotItemsDeleted(KFileItemList))); - connect(m_dirLister, SIGNAL(refreshItems(QList >)), this, SLOT(slotRefreshItems(QList >))); - connect(m_dirLister, SIGNAL(clear()), this, SLOT(slotClear())); - connect(m_dirLister, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString))); - connect(m_dirLister, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString))); - connect(m_dirLister, SIGNAL(redirection(KUrl,KUrl)), this, SIGNAL(directoryRedirection(KUrl,KUrl))); - connect(m_dirLister, SIGNAL(urlIsFileError(KUrl)), this, SIGNAL(urlIsFileError(KUrl))); + connect(m_dirLister, &KFileItemModelDirLister::started, this, &KFileItemModel::directoryLoadingStarted); + connect(m_dirLister, static_cast(&KFileItemModelDirLister::canceled), this, &KFileItemModel::slotCanceled); + connect(m_dirLister, static_cast(&KFileItemModelDirLister::completed), this, &KFileItemModel::slotCompleted); + connect(m_dirLister, &KFileItemModelDirLister::itemsAdded, this, &KFileItemModel::slotItemsAdded); + connect(m_dirLister, &KFileItemModelDirLister::itemsDeleted, this, &KFileItemModel::slotItemsDeleted); + connect(m_dirLister, &KFileItemModelDirLister::refreshItems, this, &KFileItemModel::slotRefreshItems); + connect(m_dirLister, static_cast(&KFileItemModelDirLister::clear), this, &KFileItemModel::slotClear); + connect(m_dirLister, &KFileItemModelDirLister::infoMessage, this, &KFileItemModel::infoMessage); + connect(m_dirLister, &KFileItemModelDirLister::errorMessage, this, &KFileItemModel::errorMessage); + connect(m_dirLister, static_cast(&KFileItemModelDirLister::redirection), this, &KFileItemModel::directoryRedirection); + connect(m_dirLister, &KFileItemModelDirLister::urlIsFileError, this, &KFileItemModel::urlIsFileError); // Apply default roles that should be determined resetRoles(); @@@ -95,7 -94,7 +95,7 @@@ m_maximumUpdateIntervalTimer = new QTimer(this); m_maximumUpdateIntervalTimer->setInterval(2000); m_maximumUpdateIntervalTimer->setSingleShot(true); - connect(m_maximumUpdateIntervalTimer, SIGNAL(timeout()), this, SLOT(dispatchPendingItemsToInsert())); + connect(m_maximumUpdateIntervalTimer, &QTimer::timeout, this, &KFileItemModel::dispatchPendingItemsToInsert); // When changing the value of an item which represents the sort-role a resorting must be // triggered. Especially in combination with KFileItemModelRolesUpdater this might be done @@@ -104,10 -103,9 +104,10 @@@ m_resortAllItemsTimer = new QTimer(this); m_resortAllItemsTimer->setInterval(500); m_resortAllItemsTimer->setSingleShot(true); - connect(m_resortAllItemsTimer, SIGNAL(timeout()), this, SLOT(resortAllItems())); + connect(m_resortAllItemsTimer, &QTimer::timeout, this, &KFileItemModel::resortAllItems); - connect(KGlobalSettings::self(), SIGNAL(naturalSortingChanged()), this, SLOT(slotNaturalSortingChanged())); + connect(KGlobalSettings::self(), &KGlobalSettings::naturalSortingChanged, + this, &KFileItemModel::slotNaturalSortingChanged); } KFileItemModel::~KFileItemModel() @@@ -365,7 -363,7 +365,7 @@@ KFileItem KFileItemModel::fileItem(cons int KFileItemModel::index(const KFileItem& item) const { - return index(item.url()); + return index(KUrl(item.url())); } int KFileItemModel::index(const KUrl& url) const @@@ -488,6 -486,18 +488,18 @@@ bool KFileItemModel::setExpanded(int in m_urlsToExpand.insert(url); } } else { + // Note that there might be (indirect) children of the folder which is to be collapsed in + // m_pendingItemsToInsert. To prevent that they will be inserted into the model later, + // possibly without a parent, which might result in a crash, we insert all pending items + // right now. All new items which would be without a parent will then be removed. + dispatchPendingItemsToInsert(); + + // Check if the index of the collapsed folder has changed. If that is the case, then items + // were inserted before the collapsed folder, and its index needs to be updated. + if (m_itemData.at(index)->item != item) { + index = this->index(item); + } + m_expandedDirs.remove(targetUrl); m_dirLister->stop(url); @@@ -502,7 -512,9 +514,9 @@@ ItemData* itemData = m_itemData.at(childIndex); if (itemData->values.value("isExpanded").toBool()) { const KUrl targetUrl = itemData->item.targetUrl(); + const KUrl url = itemData->item.url(); m_expandedDirs.remove(targetUrl); + m_dirLister->stop(url); // TODO: try to unit-test this, see https://bugs.kde.org/show_bug.cgi?id=332102#c11 expandedChildren.append(targetUrl); } ++childIndex; @@@ -868,7 -880,7 +882,7 @@@ void KFileItemModel::slotItemsAdded(con // might result in emitting the same items twice due to the Keep-parameter. // This case happens if an item gets expanded, collapsed and expanded again // before the items could be loaded for the first expansion. - if (index(items.first().url()) >= 0) { + if (index(KUrl(items.first().url())) >= 0) { // The items are already part of the model. return; } @@@ -1463,8 -1475,8 +1477,8 @@@ QHash KFileItemMo // Don't use KFileItem::timeString() as this is too expensive when // having several thousands of items. Instead the formatting of the // date-time will be done on-demand by the view when the date will be shown. - const KDateTime dateTime = item.time(KFileItem::ModificationTime); - data.insert(sharedValue("date"), dateTime.dateTime()); + const QDateTime dateTime = item.time(KFileItem::ModificationTime); + data.insert(sharedValue("date"), dateTime); } if (m_requestRole[PermissionsRole]) { @@@ -1489,7 -1501,7 +1503,7 @@@ if (m_requestRole[PathRole]) { QString path; - if (item.url().protocol() == QLatin1String("trash")) { + if (item.url().scheme() == QLatin1String("trash")) { path = item.entry().stringValue(KIO::UDSEntry::UDS_EXTRA); } else { // For performance reasons cache the home-path in a static QString @@@ -1668,8 -1680,8 +1682,8 @@@ int KFileItemModel::sortRoleCompare(con } case DateRole: { - const KDateTime dateTimeA = itemA.time(KFileItem::ModificationTime); - const KDateTime dateTimeB = itemB.time(KFileItem::ModificationTime); + const QDateTime dateTimeA = itemA.time(KFileItem::ModificationTime); + const QDateTime dateTimeB = itemB.time(KFileItem::ModificationTime); if (dateTimeA < dateTimeB) { result = -1; } else if (dateTimeA > dateTimeB) { @@@ -1861,7 -1873,7 +1875,7 @@@ QList > KFileItemM const int maxIndex = count() - 1; QList > groups; - const QDate currentDate = KDateTime::currentLocalDateTime().date(); + const QDate currentDate = QDate::currentDate(); QDate previousModifiedDate; QString groupValue; @@@ -1870,7 -1882,7 +1884,7 @@@ continue; } - const KDateTime modifiedTime = m_itemData.at(i)->item.time(KFileItem::ModificationTime); + const QDateTime modifiedTime = m_itemData.at(i)->item.time(KFileItem::ModificationTime); const QDate modifiedDate = modifiedTime.date(); if (modifiedDate == previousModifiedDate) { // The current item is in the same group as the previous item @@@ -1957,7 -1969,7 +1971,7 @@@ QList > KFileItemM } permissionsString = newPermissionsString; - const QFileInfo info(itemData->item.url().pathOrUrl()); + const QFileInfo info(itemData->item.url().toLocalFile()); // Set user string QString user; diff --combined src/panels/places/placesitem.cpp index 41c2e809f,539b9263d..1729bbd19 --- a/src/panels/places/placesitem.cpp +++ b/src/panels/places/placesitem.cpp @@@ -69,8 -69,8 +69,8 @@@ void PlacesItem::setUrl(const KUrl& url m_trashDirLister = new KDirLister(); m_trashDirLister->setAutoErrorHandlingEnabled(false, 0); m_trashDirLister->setDelayedMimeTypes(true); - QObject::connect(m_trashDirLister, SIGNAL(completed()), - m_signalHandler, SLOT(onTrashDirListerCompleted())); + QObject::connect(m_trashDirLister.data(), static_cast(&KDirLister::completed), + m_signalHandler.data(), &PlacesItemSignalHandler::onTrashDirListerCompleted); m_trashDirLister->openUrl(url); } @@@ -135,7 -135,7 +135,7 @@@ void PlacesItem::setBookmark(const KBoo const QString udi = bookmark.metaDataItem("UDI"); if (udi.isEmpty()) { setIcon(bookmark.icon()); - setText(bookmark.text()); + setText(i18nc("KFile System Bookmarks", bookmark.text().toUtf8().data())); setUrl(bookmark.url()); } else { initializeDevice(udi); @@@ -271,8 -271,8 +271,8 @@@ void PlacesItem::initializeDevice(cons if (m_access) { setUrl(m_access->filePath()); - QObject::connect(m_access, SIGNAL(accessibilityChanged(bool,QString)), - m_signalHandler, SLOT(onAccessibilityChanged())); + QObject::connect(m_access.data(), &Solid::StorageAccess::accessibilityChanged, + m_signalHandler.data(), &PlacesItemSignalHandler::onAccessibilityChanged); } else if (m_disc && (m_disc->availableContent() & Solid::OpticalDisc::Audio) != 0) { Solid::Block *block = m_device.as(); if (block) { diff --combined src/search/filenamesearchprotocol.cpp index 3333dcc07,38dd26b23..b56a99580 --- a/src/search/filenamesearchprotocol.cpp +++ b/src/search/filenamesearchprotocol.cpp @@@ -25,7 -25,6 +25,7 @@@ #include #include #include +#include #include #include @@@ -45,22 -44,22 +45,22 @@@ FileNameSearchProtocol::~FileNameSearch cleanup(); } -void FileNameSearchProtocol::listDir(const KUrl& url) +void FileNameSearchProtocol::listDir(const QUrl& url) { cleanup(); - const QString search = url.queryItem("search"); + const QString search = url.queryItemValue("search"); if (!search.isEmpty()) { m_regExp = new QRegExp(search, Qt::CaseInsensitive, QRegExp::Wildcard); } m_checkContent = false; - const QString checkContent = url.queryItem("checkContent"); + const QString checkContent = url.queryItemValue("checkContent"); if (checkContent == QLatin1String("yes")) { m_checkContent = true; } - const QString urlString = url.queryItem("url"); + const QString urlString = url.queryItemValue("url"); searchDirectory(KUrl(urlString)); cleanup(); @@@ -81,8 -80,8 +81,8 @@@ void FileNameSearchProtocol::searchDire dirLister->openUrl(directory); QEventLoop eventLoop; - QObject::connect(dirLister, SIGNAL(canceled()), &eventLoop, SLOT(quit())); - QObject::connect(dirLister, SIGNAL(completed()), &eventLoop, SLOT(quit())); + QObject::connect(dirLister, static_cast(&KDirLister::canceled), &eventLoop, &QEventLoop::quit); + QObject::connect(dirLister, static_cast(&KDirLister::completed), &eventLoop, &QEventLoop::quit); eventLoop.exec(); // Visualize all items that match the search pattern @@@ -92,11 -91,8 +92,8 @@@ bool addItem = false; if (!m_regExp || item.name().contains(*m_regExp)) { addItem = true; - } else if (m_checkContent && item.determineMimeType()->is(QLatin1String("text/plain"))) { + } else if (m_checkContent && item.determineMimeType().inherits(QLatin1String("text/plain"))) { - qDebug() << "### Checking" << item; addItem = contentContainsPattern(item.url()); - } else { - qDebug() << "### NOT Checking" << item; } if (addItem) { diff --combined src/settings/additionalinfodialog.cpp index 9d854ba0f,0de639540..db9258ae8 --- a/src/settings/additionalinfodialog.cpp +++ b/src/settings/additionalinfodialog.cpp @@@ -75,14 -75,13 +75,13 @@@ AdditionalInfoDialog::AdditionalInfoDia QVBoxLayout* layout = new QVBoxLayout(mainWidget); layout->addWidget(header); layout->addWidget(m_listWidget); - layout->addStretch(1); setMainWidget(mainWidget); const KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "AdditionalInfoDialog"); restoreDialogSize(dialogConfig); - connect(this, SIGNAL(okClicked()), this, SLOT(slotOk())); + connect(this, &AdditionalInfoDialog::okClicked, this, &AdditionalInfoDialog::slotOk); } AdditionalInfoDialog::~AdditionalInfoDialog()