Port simple DataEngine example

REVIEW: 112510
This commit is contained in:
Bhushan Shah 2013-09-04 18:14:53 +05:30
parent 9527b34ce8
commit 8557409793
4 changed files with 17 additions and 9 deletions

View File

@ -1,3 +1,4 @@
add_subdirectory(applets) add_subdirectory(applets)
add_subdirectory(containments) add_subdirectory(containments)
add_subdirectory(wallpapers) add_subdirectory(wallpapers)
add_subdirectory(dataengines)

View File

@ -1,4 +1,3 @@
add_subdirectory(simpleEngine) add_subdirectory(simpleEngine)
add_subdirectory(sourcesOnRequest) #add_subdirectory(sourcesOnRequest)
add_subdirectory(customDataContainers) #add_subdirectory(customDataContainers)

View File

@ -2,8 +2,15 @@ set(simpleEngine_SRCS
simpleEngine.cpp simpleEngine.cpp
) )
kde4_add_plugin(plasma_dataengine_example_simpleEngine ${simpleEngine_SRCS}) kservice_desktop_to_json(plasma-dataengine-example-simpleEngine.desktop)
target_link_libraries(plasma_dataengine_example_simpleEngine ${KDE4_PLASMA_LIBS})
plasma_add_plugin(plasma_dataengine_example_simpleEngine ${simpleEngine_SRCS})
target_link_libraries(plasma_dataengine_example_simpleEngine
plasma
${KService_LIBRARIES}
${KI18n_LIBRARIES}
)
install(TARGETS plasma_dataengine_example_simpleEngine DESTINATION ${PLUGIN_INSTALL_DIR}) install(TARGETS plasma_dataengine_example_simpleEngine DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-dataengine-example-simpleEngine.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) install(FILES plasma-dataengine-example-simpleEngine.desktop DESTINATION ${SERVICES_INSTALL_DIR} )

View File

@ -26,6 +26,8 @@
#include <QColor> #include <QColor>
#include <QTime> #include <QTime>
#include <klocalizedstring.h>
#include "simpleEngine.h" #include "simpleEngine.h"
/* /*
@ -39,13 +41,12 @@ SimpleEngine::SimpleEngine(QObject *parent, const QVariantList &args)
: Plasma::DataEngine(parent, args) : Plasma::DataEngine(parent, args)
{ {
// we've passed the constructor's args to our parent class // we've passed the constructor's args to our parent class
// we're done for now! // we're done for now! Call init()
init();
} }
void SimpleEngine::init() void SimpleEngine::init()
{ {
// init() is called after construction but before anything actually
// gets to use the Engine; it's a nice plce for delayed initialization.
// So now we will set up some sources. // So now we will set up some sources.
// Each DataEngine will, generally, be loaded once. Each DataEngine // Each DataEngine will, generally, be loaded once. Each DataEngine
@ -73,7 +74,7 @@ void SimpleEngine::init()
} }
// export the plugin; use the plugin name and the class name // export the plugin; use the plugin name and the class name
K_EXPORT_PLASMA_DATAENGINE(org.kde.examples.simpleEngine, SimpleEngine) K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(org.kde.examples.simpleEngine, SimpleEngine, "plasma-dataengine-example-simpleEngine.json")
// include the moc file so the build system makes it for us // include the moc file so the build system makes it for us
#include "simpleEngine.moc" #include "simpleEngine.moc"