┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNicolas Fella <[email protected]>2022-10-18 22:38:45 +0200
committerDāvis Mosāns <[email protected]>2023-03-04 23:49:48 +0000
commitc64059bd02061968b184c6c8e3d862423afd2547 (patch)
treecf09912cf19d4d6c5fb46fda6f51e35af1b9f93c /src
parentc2ef0392e985988a248854523362c39824480d1e (diff)
Port away from deprecated KNewFileMenu ctor
Diffstat (limited to 'src')
-rw-r--r--src/dolphincontextmenu.cpp3
-rw-r--r--src/dolphinmainwindow.cpp4
-rw-r--r--src/dolphinnewfilemenu.cpp7
-rw-r--r--src/dolphinpart.cpp3
4 files changed, 17 insertions, 0 deletions
diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp
index 94fed1872..8130772d2 100644
--- a/src/dolphincontextmenu.cpp
+++ b/src/dolphincontextmenu.cpp
@@ -170,6 +170,9 @@ void DolphinContextMenu::addDirectoryItemContextMenu()
// set up 'Create New' menu
DolphinNewFileMenu *newFileMenu = new DolphinNewFileMenu(m_mainWindow->actionCollection(), m_mainWindow);
+#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0)
+ newFileMenu->setNewFolderShortcutAction(m_mainWindow->actionCollection()->action("create_dir"));
+#endif
newFileMenu->checkUpToDate();
#if KIO_VERSION >= QT_VERSION_CHECK(5, 97, 0)
newFileMenu->setWorkingDirectory(m_fileInfo.url());
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 9c3d9862b..cf1b98f87 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -163,6 +163,10 @@ DolphinMainWindow::DolphinMainWindow()
connect(m_actionHandler, &DolphinViewActionHandler::createDirectoryTriggered, this, &DolphinMainWindow::createDirectory);
connect(m_actionHandler, &DolphinViewActionHandler::selectionModeChangeTriggered, this, &DolphinMainWindow::slotSetSelectionMode);
+#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0)
+ m_newFileMenu->setNewFolderShortcutAction(actionCollection()->action("create_dir"));
+#endif
+
m_remoteEncoding = new DolphinRemoteEncoding(this, m_actionHandler);
connect(this, &DolphinMainWindow::urlChanged, m_remoteEncoding, &DolphinRemoteEncoding::slotAboutToOpenUrl);
diff --git a/src/dolphinnewfilemenu.cpp b/src/dolphinnewfilemenu.cpp
index 8de4347b8..43fbdf5c9 100644
--- a/src/dolphinnewfilemenu.cpp
+++ b/src/dolphinnewfilemenu.cpp
@@ -10,10 +10,17 @@
#include <KActionCollection>
#include <KIO/Job>
+#include <kio_version.h>
DolphinNewFileMenu::DolphinNewFileMenu(KActionCollection *collection, QObject *parent)
+#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0)
+ : KNewFileMenu(parent)
+{
+ Q_UNUSED(collection)
+#else
: KNewFileMenu(collection, QStringLiteral("new_menu"), parent)
{
+#endif
DolphinNewFileMenuObserver::instance().attach(this);
}
diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp
index e97417994..cb5d31c1f 100644
--- a/src/dolphinpart.cpp
+++ b/src/dolphinpart.cpp
@@ -143,6 +143,9 @@ void DolphinPart::createActions()
m_newFileMenu = new DolphinNewFileMenu(actionCollection(), this);
m_newFileMenu->setParentWidget(widget());
+#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0)
+ m_newFileMenu->setNewFolderShortcutAction(actionCollection()->action("create_dir"));
+#endif
connect(m_newFileMenu->menu(), &QMenu::aboutToShow, this, &DolphinPart::updateNewMenu);
QAction *editMimeTypeAction = actionCollection()->addAction(QStringLiteral("editMimeType"));