mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 01:40:02 +00:00
Port from KNewFileMenu::setPopupFiles to KNewFileMenu::setWorkingDirectory
The former is deprecated
This commit is contained in:
parent
05941a522b
commit
513fe3bb42
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue