mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-28 03:21:56 +00:00
dolphinpart: port to new KPluginMetaData-based KParts API
This commit is contained in:
parent
07b7f76f7c
commit
9826d81034
|
@ -176,6 +176,7 @@ install(TARGETS dolphinprivate ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMEL
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dolphin_export.h DESTINATION ${KDE_INSTALL_INCLUDEDIR} COMPONENT Devel)
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dolphin_export.h DESTINATION ${KDE_INSTALL_INCLUDEDIR} COMPONENT Devel)
|
||||||
|
|
||||||
##########################################
|
##########################################
|
||||||
|
configure_file(dolphinpart.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/dolphinpart.desktop @ONLY)
|
||||||
|
|
||||||
set(dolphinpart_SRCS
|
set(dolphinpart_SRCS
|
||||||
dolphinpart.cpp
|
dolphinpart.cpp
|
||||||
|
@ -186,7 +187,7 @@ set(dolphinpart_SRCS
|
||||||
qt5_add_resources(dolphinpart_SRCS dolphinpart.qrc)
|
qt5_add_resources(dolphinpart_SRCS dolphinpart.qrc)
|
||||||
|
|
||||||
add_library(dolphinpart MODULE ${dolphinpart_SRCS})
|
add_library(dolphinpart MODULE ${dolphinpart_SRCS})
|
||||||
kcoreaddons_desktop_to_json(dolphinpart dolphinpart.desktop)
|
kcoreaddons_desktop_to_json(dolphinpart ${CMAKE_CURRENT_BINARY_DIR}/dolphinpart.desktop)
|
||||||
|
|
||||||
target_link_libraries(dolphinpart
|
target_link_libraries(dolphinpart
|
||||||
dolphinprivate
|
dolphinprivate
|
||||||
|
@ -194,7 +195,7 @@ target_link_libraries(dolphinpart
|
||||||
|
|
||||||
install(TARGETS dolphinpart DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/parts)
|
install(TARGETS dolphinpart DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/parts)
|
||||||
|
|
||||||
install(FILES dolphinpart.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dolphinpart.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
|
||||||
|
|
||||||
##########################################
|
##########################################
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "views/dolphinview.h"
|
#include "views/dolphinview.h"
|
||||||
#include "views/dolphinviewactionhandler.h"
|
#include "views/dolphinviewactionhandler.h"
|
||||||
|
|
||||||
#include <KAboutData>
|
#include <KPluginMetaData>
|
||||||
#include <KActionCollection>
|
#include <KActionCollection>
|
||||||
#include <KAuthorized>
|
#include <KAuthorized>
|
||||||
#include <KConfigGroup>
|
#include <KConfigGroup>
|
||||||
|
@ -47,13 +47,15 @@
|
||||||
|
|
||||||
K_PLUGIN_CLASS_WITH_JSON(DolphinPart, "dolphinpart.json")
|
K_PLUGIN_CLASS_WITH_JSON(DolphinPart, "dolphinpart.json")
|
||||||
|
|
||||||
DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantList& args)
|
DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent,
|
||||||
|
const KPluginMetaData& metaData, const QVariantList& args)
|
||||||
: KParts::ReadOnlyPart(parent)
|
: KParts::ReadOnlyPart(parent)
|
||||||
,m_openTerminalAction(nullptr)
|
,m_openTerminalAction(nullptr)
|
||||||
,m_removeAction(nullptr)
|
,m_removeAction(nullptr)
|
||||||
{
|
{
|
||||||
Q_UNUSED(args)
|
Q_UNUSED(args)
|
||||||
setComponentData(*createAboutData(), false);
|
setMetaData(metaData);
|
||||||
|
|
||||||
m_extension = new DolphinPartBrowserExtension(this);
|
m_extension = new DolphinPartBrowserExtension(this);
|
||||||
|
|
||||||
// make sure that other apps using this part find Dolphin's view-file-columns icons
|
// make sure that other apps using this part find Dolphin's view-file-columns icons
|
||||||
|
@ -141,7 +143,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
|
||||||
// TODO there was a "always open a new window" (when clicking on a directory) setting in konqueror
|
// TODO there was a "always open a new window" (when clicking on a directory) setting in konqueror
|
||||||
// (sort of spacial navigation)
|
// (sort of spacial navigation)
|
||||||
|
|
||||||
loadPlugins(this, this, componentData());
|
loadPlugins(this, this, componentName());
|
||||||
}
|
}
|
||||||
|
|
||||||
DolphinPart::~DolphinPart()
|
DolphinPart::~DolphinPart()
|
||||||
|
@ -281,11 +283,6 @@ void DolphinPart::updatePasteAction()
|
||||||
Q_EMIT m_extension->setActionText( "paste", pasteInfo.second );
|
Q_EMIT m_extension->setActionText( "paste", pasteInfo.second );
|
||||||
}
|
}
|
||||||
|
|
||||||
KAboutData* DolphinPart::createAboutData()
|
|
||||||
{
|
|
||||||
return new KAboutData(QStringLiteral("dolphinpart"), i18nc("@title", "Dolphin Part"), QStringLiteral("0.1"));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DolphinPart::openUrl(const QUrl &url)
|
bool DolphinPart::openUrl(const QUrl &url)
|
||||||
{
|
{
|
||||||
bool reload = arguments().reload();
|
bool reload = arguments().reload();
|
||||||
|
|
|
@ -58,6 +58,11 @@ X-KDE-BrowserView-Built-Into=konqueror
|
||||||
Icon=view-icon
|
Icon=view-icon
|
||||||
InitialPreference=7
|
InitialPreference=7
|
||||||
|
|
||||||
|
X-KDE-PluginInfo-Name=dolphinpart
|
||||||
|
X-KDE-PluginInfo-Version=@DOLPHIN_VERSION@
|
||||||
|
X-KDE-PluginInfo-License=LGPL v2+
|
||||||
|
|
||||||
|
|
||||||
# Provide info about the view modes using the Actions mechanism so that KService parses it.
|
# Provide info about the view modes using the Actions mechanism so that KService parses it.
|
||||||
# Konqueror then queries KService to get hold of the translated texts for the view modes
|
# Konqueror then queries KService to get hold of the translated texts for the view modes
|
||||||
Actions=icons;details;compact;
|
Actions=icons;details;compact;
|
|
@ -20,7 +20,6 @@ class DolphinPartBrowserExtension;
|
||||||
class DolphinRemoteEncoding;
|
class DolphinRemoteEncoding;
|
||||||
class KDirLister;
|
class KDirLister;
|
||||||
class DolphinView;
|
class DolphinView;
|
||||||
class KAboutData;
|
|
||||||
class DolphinRemoveAction;
|
class DolphinRemoveAction;
|
||||||
|
|
||||||
class DolphinPart : public KParts::ReadOnlyPart
|
class DolphinPart : public KParts::ReadOnlyPart
|
||||||
|
@ -40,11 +39,10 @@ class DolphinPart : public KParts::ReadOnlyPart
|
||||||
Q_PROPERTY( QList<QUrl> filesToSelect READ filesToSelect WRITE setFilesToSelect )
|
Q_PROPERTY( QList<QUrl> filesToSelect READ filesToSelect WRITE setFilesToSelect )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantList& args);
|
explicit DolphinPart(QWidget* parentWidget, QObject* parent,
|
||||||
|
const KPluginMetaData& metaData, const QVariantList& args);
|
||||||
~DolphinPart() override;
|
~DolphinPart() override;
|
||||||
|
|
||||||
static KAboutData* createAboutData();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard KParts::ReadOnlyPart openUrl method.
|
* Standard KParts::ReadOnlyPart openUrl method.
|
||||||
* Called by Konqueror to view a directory in DolphinPart.
|
* Called by Konqueror to view a directory in DolphinPart.
|
||||||
|
|
Loading…
Reference in a new issue