Allow building KIO/Dolphin against Qt/KF 6
* Avoid using function that is deprecated in Qt 6 * Remove unused include not available in KF6 * Don't hardcode CMake-package-prefix of KF modules
This commit is contained in:
parent
60b70a3ce0
commit
eef47e7ef1
|
@ -31,7 +31,19 @@ use_syncthingmodel()
|
|||
# link also explicitly against the following Qt and KF modules
|
||||
list(APPEND ADDITIONAL_QT_MODULES Network)
|
||||
list(APPEND ADDITIONAL_KF_MODULES KIO)
|
||||
set(KIO_MODULE_TARGETS KF5::KIOCore KF5::KIOFileWidgets KF5::KIOWidgets KF5::KIONTLM)
|
||||
set(KF_PACKAGE_PREFIX
|
||||
"KF5"
|
||||
CACHE STRING "specifies the prefix for KDE Frameworks packages")
|
||||
set(KIO_MODULE_TARGETS "${KF_PACKAGE_PREFIX}::KIOCore" "${KF_PACKAGE_PREFIX}::KIOFileWidgets"
|
||||
"${KF_PACKAGE_PREFIX}::KIOWidgets")
|
||||
if (KF_PACKAGE_PREFIX MATCHES ".*KF([0-9]+).*")
|
||||
set(KF_VERSION ${CMAKE_MATCH_1})
|
||||
if (KF_VERSION GREATER_EQUAL 6)
|
||||
list(APPEND KIO_MODULE_TARGETS)
|
||||
else ()
|
||||
list(APPEND KIO_MODULE_TARGETS "${KF_PACKAGE_PREFIX}::KIONTLM")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# include modules to apply configuration
|
||||
include(BasicConfig)
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include <KFileItem>
|
||||
#include <KPluginFactory>
|
||||
#include <KPluginLoader>
|
||||
|
||||
#include <QAction>
|
||||
#include <QDir>
|
||||
|
@ -70,7 +69,7 @@ QList<QAction *> SyncthingFileItemAction::actions(const KFileItemListProperties
|
|||
parentWidget->installEventFilter(this);
|
||||
}
|
||||
|
||||
topLevelActions << new SyncthingMenuAction(fileItemInfo, subActions, this);
|
||||
topLevelActions << new SyncthingMenuAction(fileItemInfo, subActions, parentWidget);
|
||||
return topLevelActions;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,10 +19,11 @@
|
|||
using namespace CppUtilities;
|
||||
using namespace Data;
|
||||
|
||||
SyncthingMenuAction::SyncthingMenuAction(const KFileItemListProperties &properties, const QList<QAction *> &actions, QObject *parent)
|
||||
: QAction(parent)
|
||||
SyncthingMenuAction::SyncthingMenuAction(const KFileItemListProperties &properties, const QList<QAction *> &actions, QWidget *parentWidget)
|
||||
: QAction(parentWidget)
|
||||
, m_properties(properties)
|
||||
, m_notifier(SyncthingFileItemAction::staticData().connection())
|
||||
, m_parentWidget(parentWidget)
|
||||
{
|
||||
#ifdef CPP_UTILITIES_DEBUG_BUILD
|
||||
std::cerr << EscapeCodes::Phrases::Info << "Creating SyncthingMenuAction: " << this << EscapeCodes::Phrases::EndFlush;
|
||||
|
@ -88,7 +89,7 @@ void SyncthingMenuAction::createMenu(const QList<QAction *> &actions)
|
|||
if (actions.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
auto *const menu = new QMenu(parentWidget());
|
||||
auto *const menu = new QMenu(m_parentWidget);
|
||||
menu->addActions(actions);
|
||||
setMenu(menu);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
#include <QAction>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QWidget)
|
||||
|
||||
namespace Data {
|
||||
enum class SyncthingStatus;
|
||||
}
|
||||
|
@ -19,7 +21,7 @@ class SyncthingMenuAction : public QAction {
|
|||
|
||||
public:
|
||||
explicit SyncthingMenuAction(const KFileItemListProperties &properties = KFileItemListProperties(),
|
||||
const QList<QAction *> &actions = QList<QAction *>(), QObject *parent = nullptr);
|
||||
const QList<QAction *> &actions = QList<QAction *>(), QWidget *parentWidget = nullptr);
|
||||
#ifdef CPP_UTILITIES_DEBUG_BUILD
|
||||
~SyncthingMenuAction() override;
|
||||
#endif
|
||||
|
@ -33,6 +35,7 @@ private:
|
|||
|
||||
KFileItemListProperties m_properties;
|
||||
Data::SyncthingNotifier m_notifier;
|
||||
QWidget *m_parentWidget;
|
||||
};
|
||||
|
||||
#endif // SYNCTHINGMENUACTION_H
|
||||
|
|
Loading…
Reference in New Issue