knotify: drop support for plugins

there are six already

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-12-14 17:21:20 +02:00
parent b301dbc302
commit 8fa5d7dbd3
7 changed files with 25 additions and 72 deletions

View file

@ -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 #########

View file

@ -27,7 +27,6 @@
#include <kdebug.h>
#include <kglobal.h>
#include <klocale.h>
#include <kservicetypetrader.h>
#include <config-workspace.h>
@ -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<KNotifyPlugin>(this, args, &error);
if (plugin)
{
addPlugin(plugin);
}
else
{
kDebug() << "Could not load plugin" << service->name() << "due to:" << error;
}
}
}
void KNotify::addPlugin( KNotifyPlugin * p )

View file

@ -27,14 +27,12 @@
#include <QPixmap>
#include <QObject> //for Wid
#include "knotify_export.h"
typedef QList< QPair<QString,QString> > 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 <ogoffart@kde.org>
*/
class KNOTIFY_EXPORT KNotifyConfig
class KNotifyConfig
{
public:
KNotifyConfig(const QString &appname, const ContextList &_contexts , const QString &_eventid);

View file

@ -1,3 +0,0 @@
[Desktop Entry]
Type=ServiceType
X-KDE-ServiceType=KNotify/NotifyMethod

View file

@ -18,8 +18,6 @@
*/
#include <KPluginFactory>
#include "knotifyplugin.h"
KNotifyPlugin::KNotifyPlugin(QObject *parent, const QVariantList &args)

View file

@ -24,9 +24,7 @@
#define KNOTIFYPLUGIN_H
#include <QtCore/QObject>
#include <KPluginFactory>
#include "knotify_export.h"
#include <QtCore/QVariant>
class KNotifyConfig;
@ -40,7 +38,7 @@ class KNotifyConfig;
*
* @author Olivier Goffart <ogoffart at kde.org>
*/
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<classname>();) \
K_EXPORT_PLUGIN(KNotifyMethodPluginFactory("knotify_method_" #libname))
#endif

View file

@ -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: