summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRagnar Thomsen <[email protected]>2015-05-29 23:40:31 +0200
committerRagnar Thomsen <[email protected]>2015-05-29 23:40:31 +0200
commit2b2f46fcedc4a97790984bb5cc1d14cd1a487153 (patch)
tree3ebfe5053a2120ab8340bfacb2b6fe3aff64ba6f
parent95c5b119bb5bb7f6ebe290ca6466ea8c995a594a (diff)
Use KIO::DndPopupMenuPlugin instead of KonqDndPopupMenuPlugin
KonqDndPopupMenuPlugin has been moved to KIO. This reimplements the "Extract here" menu option when dragging an Ark-supported archive in Dolphin. The extracthere plugin no longer installs a desktop file, but uses json metadata.
-rw-r--r--app/CMakeLists.txt20
-rw-r--r--app/ark_dndextract.desktop.cmake6
-rw-r--r--app/extractHereDndPlugin.cpp21
-rw-r--r--app/extractHereDndPlugin.h10
4 files changed, 25 insertions, 32 deletions
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 1ac3034..9f7a7e1 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -37,20 +37,12 @@ install( PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/org.kde.ark.desktop DESTINATION ${
install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/ark.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR} )
install( FILES arkui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/ark )
-########### konqueror ark_extract_here plugin ###############
-set(LIBKONQ_MIN_VERSION "5.96.0")
+############ ark_extract_here plugin ###############
-find_package(KF5Konq ${LIBKONQ_MIN_VERSION} CONFIG)
-set_package_properties(LibKonq PROPERTIES DESCRIPTION "Provides high-level file management functions"
- URL "https://projects.kde.org/projects/kde/applications/kde-baseapps" TYPE OPTIONAL
- PURPOSE "Need to integrate in konqueror")
+set(extracthere_SRCS batchextract.cpp extractHereDndPlugin.cpp)
-if (KF5Konq_FOUND)
- set(extracthere_SRCS batchextract.cpp extractHereDndPlugin.cpp)
- add_library(extracthere MODULE ${extracthere_SRCS})
- target_link_libraries(extracthere kerfuffle KF5::Parts KF5::Konq )
- install( TARGETS extracthere DESTINATION ${PLUGIN_INSTALL_DIR} )
- install( FILES ${CMAKE_CURRENT_BINARY_DIR}/ark_dndextract.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
-
-endif()
+add_library(extracthere MODULE ${extracthere_SRCS})
+kcoreaddons_desktop_to_json(extracthere ${CMAKE_CURRENT_BINARY_DIR}/ark_dndextract.desktop)
+target_link_libraries(extracthere kerfuffle KF5::Parts KF5::KIOWidgets)
+install( TARGETS extracthere DESTINATION ${PLUGIN_INSTALL_DIR}/kf5/kio_dnd )
diff --git a/app/ark_dndextract.desktop.cmake b/app/ark_dndextract.desktop.cmake
index f1ac26a..7019672 100644
--- a/app/ark_dndextract.desktop.cmake
+++ b/app/ark_dndextract.desktop.cmake
@@ -1,7 +1,7 @@
[Desktop Entry]
Type=Service
-X-KDE-ServiceTypes=KonqDndPopupMenu/Plugin
-X-KDE-Library=libextracthere
+X-KDE-ServiceTypes=KIO/DndPopupMenu/Plugin
+X-KDE-Library=extracthere
Name=Ark Extract Here
Name[ar]=أرك استخرج هنا
Name[ast]=Estrayer equí con Ark
@@ -18,7 +18,7 @@ Name[es]=Extraer aquí con Ark
Name[et]=Paki siia lahti
Name[eu]=Ark: atera hemen
Name[fi]=Ark – Pura tähän
-Name[fr]=Extraire un fichier « Ark » ici
+Name[fr]=Extraire un fichier « Ark » ici
Name[ga]=Bain an chartlann Ark amach agus cuir é anseo
Name[gl]=Extraer aquí con Ark
Name[hr]=Ovdje Ark-otpakiraj
diff --git a/app/extractHereDndPlugin.cpp b/app/extractHereDndPlugin.cpp
index 623c420..d654121 100644
--- a/app/extractHereDndPlugin.cpp
+++ b/app/extractHereDndPlugin.cpp
@@ -33,10 +33,8 @@
Q_LOGGING_CATEGORY(ARK, "ark.extracthere", QtWarningMsg)
-K_PLUGIN_FACTORY(ExtractHerePluginFactory,
- registerPlugin<ExtractHereDndPlugin>();
- )
-K_EXPORT_PLUGIN(ExtractHerePluginFactory("stupidname", "ark"))
+K_PLUGIN_FACTORY_WITH_JSON(ExtractHereDndPluginFactory, "ark_dndextract.json",
+ registerPlugin<ExtractHereDndPlugin>();)
void ExtractHereDndPlugin::slotTriggered()
{
@@ -55,19 +53,20 @@ void ExtractHereDndPlugin::slotTriggered()
}
ExtractHereDndPlugin::ExtractHereDndPlugin(QObject* parent, const QVariantList&)
- : KonqDndPopupMenuPlugin(parent)
+ : KIO::DndPopupMenuPlugin(parent)
{
}
-void ExtractHereDndPlugin::setup(const KFileItemListProperties& popupMenuInfo,
- QUrl destination,
- QList<QAction*>& userActions)
+QList<QAction *> ExtractHereDndPlugin::setup(const KFileItemListProperties& popupMenuInfo,
+ const QUrl& destination)
{
+ QList<QAction *> actionList;
+
const QString extractHereMessage = i18nc("@action:inmenu Context menu shown when an archive is being drag'n'dropped", "Extract here");
if (!Kerfuffle::supportedMimeTypes().contains(popupMenuInfo.mimeType())) {
qCWarning(ARK) << popupMenuInfo.mimeType() << "is not a supported mimetype";
- return;
+ return actionList;
}
qCDebug(ARK) << "Plugin executed";
@@ -76,9 +75,11 @@ void ExtractHereDndPlugin::setup(const KFileItemListProperties& popupMenuInfo,
extractHereMessage, NULL);
connect(action, &QAction::triggered, this, &ExtractHereDndPlugin::slotTriggered);
- userActions.append(action);
+ actionList.append(action);
m_dest = destination;
m_urls = popupMenuInfo.urlList();
+
+ return actionList;
}
#include "extractHereDndPlugin.moc"
diff --git a/app/extractHereDndPlugin.h b/app/extractHereDndPlugin.h
index df7214d..13ff284 100644
--- a/app/extractHereDndPlugin.h
+++ b/app/extractHereDndPlugin.h
@@ -23,9 +23,9 @@
#define EXTRACTHEREDNDPLUGIN_H
#include <qurl.h>
-#include <konq_dndpopupmenuplugin.h>
+#include <KIO/DndPopupMenuPlugin>
-class ExtractHereDndPlugin : public KonqDndPopupMenuPlugin
+class ExtractHereDndPlugin : public KIO::DndPopupMenuPlugin
{
Q_OBJECT
@@ -35,9 +35,9 @@ private slots:
public:
ExtractHereDndPlugin(QObject* parent, const QVariantList&);
- virtual void setup(const KFileItemListProperties& popupMenuInfo,
- QUrl destination,
- QList<QAction*>& userActions);
+ virtual QList<QAction *> setup(const KFileItemListProperties& popupMenuInfo,
+ const QUrl& destination);
+
private:
QUrl m_dest;
QList<QUrl> m_urls;