From 8fa5d7dbd3e1326c0834cddc135d89894d4adffd Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Wed, 14 Dec 2022 17:21:20 +0200 Subject: [PATCH] knotify: drop support for plugins there are six already Signed-off-by: Ivailo Monev --- knotify/CMakeLists.txt | 47 +++++++++++++---------------- knotify/knotify.cpp | 19 ------------ knotify/knotifyconfig.h | 6 ++-- knotify/knotifynotifymethod.desktop | 3 -- knotify/knotifyplugin.cpp | 2 -- knotify/knotifyplugin.h | 10 ++---- knotify/main.cpp | 10 ------ 7 files changed, 25 insertions(+), 72 deletions(-) delete mode 100644 knotify/knotifynotifymethod.desktop diff --git a/knotify/CMakeLists.txt b/knotify/CMakeLists.txt index a42fd97c..d818d8a4 100644 --- a/knotify/CMakeLists.txt +++ b/knotify/CMakeLists.txt @@ -1,6 +1,6 @@ add_definitions(-DKDE_DEFAULT_DEBUG_AREA=901) -add_subdirectory( sounds ) +add_subdirectory(sounds) ########### next target ############### @@ -15,40 +15,35 @@ set(knotify_SRCS notifybyktts.cpp imageconverter.cpp ksolidnotify.cpp -) - -set(knotifyplugin_SRCS knotifyplugin.cpp knotifyconfig.cpp ) -set(knotifyplugin_HEADERS - knotifyplugin.h - knotifyconfig.h - ${CMAKE_CURRENT_BINARY_DIR}/knotify_export.h +add_executable(knotify4 ${knotify_SRCS}) + +target_link_libraries(knotify4 + ${KDE4_KDEUI_LIBS} + ${KDE4_SOLID_LIBS} + ${KDE4_KSPEECH_LIBS} + ${KDE4_KMEDIAPLAYER_LIBS} ) -add_executable( knotify ${knotify_SRCS}) +install(TARGETS knotify4 ${INSTALL_TARGETS_DEFAULT_ARGS}) -add_library( knotifyplugin SHARED ${knotifyplugin_SRCS}) - -target_link_libraries( knotify ${KDE4_KDEUI_LIBS} ${KDE4_SOLID_LIBS} ${KDE4_KSPEECH_LIBS} knotifyplugin kmediaplayer) - -target_link_libraries( knotifyplugin ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS}) - -generate_export_header(knotifyplugin BASE_NAME knotify) - -set_target_properties(knotify PROPERTIES OUTPUT_NAME knotify4 ) -install(TARGETS knotify ${INSTALL_TARGETS_DEFAULT_ARGS} ) ########### install files ############### -install( FILES kde.notifyrc DESTINATION ${KDE4_DATA_INSTALL_DIR}/kde ) -install( FILES hardwarenotifications.notifyrc DESTINATION ${KDE4_DATA_INSTALL_DIR}/hardwarenotifications ) -install( FILES knotify4.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR} ) - -install( FILES knotifynotifymethod.desktop DESTINATION ${KDE4_SERVICETYPES_INSTALL_DIR} ) -install( TARGETS knotifyplugin ${INSTALL_TARGETS_DEFAULT_ARGS} ) -install( FILES ${knotifyplugin_HEADERS} DESTINATION ${KDE4_INCLUDE_INSTALL_DIR} ) +install( + FILES kde.notifyrc + DESTINATION ${KDE4_DATA_INSTALL_DIR}/kde +) +install( + FILES hardwarenotifications.notifyrc + DESTINATION ${KDE4_DATA_INSTALL_DIR}/hardwarenotifications +) +install( + FILES knotify4.desktop + DESTINATION ${KDE4_SERVICES_INSTALL_DIR} +) ########### D-Bus Autostart Services ######### diff --git a/knotify/knotify.cpp b/knotify/knotify.cpp index edf540f1..97449bb7 100644 --- a/knotify/knotify.cpp +++ b/knotify/knotify.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include @@ -68,24 +67,6 @@ void KNotify::loadConfig() addPlugin(new NotifyByLogfile(this)); addPlugin(new NotifyByTaskbar(this)); addPlugin(new NotifyByKTTS(this)); - - KService::List offers = KServiceTypeTrader::self()->query("KNotify/NotifyMethod"); - - QVariantList args; - QString error; - - foreach (const KService::Ptr service, offers) - { - KNotifyPlugin *plugin = service->createInstance(this, args, &error); - if (plugin) - { - addPlugin(plugin); - } - else - { - kDebug() << "Could not load plugin" << service->name() << "due to:" << error; - } - } } void KNotify::addPlugin( KNotifyPlugin * p ) diff --git a/knotify/knotifyconfig.h b/knotify/knotifyconfig.h index 1348b838..cc4d358f 100644 --- a/knotify/knotifyconfig.h +++ b/knotify/knotifyconfig.h @@ -27,14 +27,12 @@ #include #include //for Wid -#include "knotify_export.h" - typedef QList< QPair > ContextList; /** * An image with lazy loading from the byte array */ -class KNOTIFY_EXPORT KNotifyImage +class KNotifyImage { public: KNotifyImage() : dirty(false) {} @@ -57,7 +55,7 @@ class KNOTIFY_EXPORT KNotifyImage * Represent the configuration for an event * @author Olivier Goffart */ -class KNOTIFY_EXPORT KNotifyConfig +class KNotifyConfig { public: KNotifyConfig(const QString &appname, const ContextList &_contexts , const QString &_eventid); diff --git a/knotify/knotifynotifymethod.desktop b/knotify/knotifynotifymethod.desktop deleted file mode 100644 index 72b7d183..00000000 --- a/knotify/knotifynotifymethod.desktop +++ /dev/null @@ -1,3 +0,0 @@ -[Desktop Entry] -Type=ServiceType -X-KDE-ServiceType=KNotify/NotifyMethod diff --git a/knotify/knotifyplugin.cpp b/knotify/knotifyplugin.cpp index 8fd2510e..9047ba8c 100644 --- a/knotify/knotifyplugin.cpp +++ b/knotify/knotifyplugin.cpp @@ -18,8 +18,6 @@ */ -#include - #include "knotifyplugin.h" KNotifyPlugin::KNotifyPlugin(QObject *parent, const QVariantList &args) diff --git a/knotify/knotifyplugin.h b/knotify/knotifyplugin.h index 2316ffe5..9782956d 100644 --- a/knotify/knotifyplugin.h +++ b/knotify/knotifyplugin.h @@ -24,9 +24,7 @@ #define KNOTIFYPLUGIN_H #include -#include - -#include "knotify_export.h" +#include class KNotifyConfig; @@ -40,7 +38,7 @@ class KNotifyConfig; * * @author Olivier Goffart */ -class KNOTIFY_EXPORT KNotifyPlugin : public QObject +class KNotifyPlugin : public QObject { Q_OBJECT public: KNotifyPlugin(QObject *parent=0l, const QVariantList &args=QVariantList()); @@ -100,8 +98,4 @@ class KNOTIFY_EXPORT KNotifyPlugin : public QObject }; -#define K_EXPORT_KNOTIFY_METHOD(libname,classname) \ -K_PLUGIN_FACTORY(KNotifyMethodPluginFactory, registerPlugin();) \ -K_EXPORT_PLUGIN(KNotifyMethodPluginFactory("knotify_method_" #libname)) - #endif diff --git a/knotify/main.cpp b/knotify/main.cpp index dc001573..e534420a 100644 --- a/knotify/main.cpp +++ b/knotify/main.cpp @@ -33,16 +33,6 @@ #include "knotify.h" -// NOTE: this has to be done before application instance is created and KAudioPlayer requires -// it, i.e. it is too late to do it from the kmediaplayer library itself if it is dlopen-ed -#if defined(Q_WS_X11) -static int knotify_x11_init_threads() { - QApplication::setAttribute(Qt::AA_X11InitThreads, true); - return 1; -}; -Q_CONSTRUCTOR_FUNCTION(knotify_x11_init_threads) -#endif - int main(int argc, char **argv) { // NOTE: disables session manager entirely, for reference: