Commit 513fe3bb authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Port from KNewFileMenu::setPopupFiles to KNewFileMenu::setWorkingDirectory

The former is deprecated
parent 05941a52
Pipeline #204946 passed with stage
in 6 minutes and 35 seconds
......@@ -31,6 +31,7 @@
#include <KPluginMetaData>
#include <KStandardAction>
#include <KToolBar>
#include <kio_version.h>
#include <QApplication>
#include <QClipboard>
......@@ -175,7 +176,11 @@ void DolphinContextMenu::addDirectoryItemContextMenu()
// set up 'Create New' menu
DolphinNewFileMenu* newFileMenu = new DolphinNewFileMenu(m_mainWindow->actionCollection(), m_mainWindow);
newFileMenu->checkUpToDate();
#if KIO_VERSION >= QT_VERSION_CHECK(5, 97, 0)
newFileMenu->setWorkingDirectory(m_fileInfo.url());
#else
newFileMenu->setPopupFiles(QList<QUrl>() << m_fileInfo.url());
#endif
newFileMenu->setEnabled(selectedItemsProps.supportsWriting());
connect(newFileMenu, &DolphinNewFileMenu::fileCreated, newFileMenu, &DolphinNewFileMenu::deleteLater);
connect(newFileMenu, &DolphinNewFileMenu::directoryCreated, newFileMenu, &DolphinNewFileMenu::deleteLater);
......@@ -280,7 +285,11 @@ void DolphinContextMenu::addViewportContextMenu()
// Set up and insert 'Create New' menu
KNewFileMenu* newFileMenu = m_mainWindow->newFileMenu();
newFileMenu->checkUpToDate();
#if KIO_VERSION >= QT_VERSION_CHECK(5, 97, 0)
newFileMenu->setWorkingDirectory(m_baseUrl);
#else
newFileMenu->setPopupFiles(QList<QUrl>() << m_baseUrl);
#endif
addMenu(newFileMenu->menu());
// Show "open with" menu items even if the dir is empty, because there are legitimate
......
......@@ -661,12 +661,20 @@ void DolphinMainWindow::readProperties(const KConfigGroup& group)
void DolphinMainWindow::updateNewMenu()
{
m_newFileMenu->checkUpToDate();
#if KIO_VERSION >= QT_VERSION_CHECK(5, 97, 0)
m_newFileMenu->setWorkingDirectory(activeViewContainer()->url());
#else
m_newFileMenu->setPopupFiles(QList<QUrl>() << activeViewContainer()->url());
#endif
}
void DolphinMainWindow::createDirectory()
{
#if KIO_VERSION >= QT_VERSION_CHECK(5, 97, 0)
m_newFileMenu->setWorkingDirectory(activeViewContainer()->url());
#else
m_newFileMenu->setPopupFiles(QList<QUrl>() << activeViewContainer()->url());
#endif
m_newFileMenu->createDirectory();
}
......
......@@ -33,6 +33,7 @@
#include <KPluginMetaData>
#include <KSharedConfig>
#include <KTerminalLauncherJob>
#include <kio_version.h>
#include <QActionGroup>
#include <QApplication>
......@@ -589,7 +590,11 @@ void DolphinPart::updateNewMenu()
// As requested by KNewFileMenu :
m_newFileMenu->checkUpToDate();
// And set the files that the menu apply on :
#if KIO_VERSION >= QT_VERSION_CHECK(5, 97, 0)
m_newFileMenu->setWorkingDirectory(url());
#else
m_newFileMenu->setPopupFiles(QList<QUrl>() << url());
#endif
}
void DolphinPart::updateStatusBar()
......@@ -604,7 +609,11 @@ void DolphinPart::updateProgress(int percent)
void DolphinPart::createDirectory()
{
#if KIO_VERSION >= QT_VERSION_CHECK(5, 97, 0)
m_newFileMenu->setWorkingDirectory(url());
#else
m_newFileMenu->setPopupFiles(QList<QUrl>() << url());
#endif
m_newFileMenu->createDirectory();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment