plasma dataengine question

Farhad Hedayati-Fard hf.farhad at gmail.com
Wed Mar 16 18:48:28 CET 2011


On Monday 14 March 2011 17:51:54 Aaron J. Seigo wrote:
> On Tuesday, March 15, 2011, Farhad Hedayati-Fard wrote:
> > Hi!
> > I've written a translation dataengine... It needs 3 arguments to
> > initialize the translator object ( plugin name, source language and
> > destination language). I've put a Q_ASSERT on args.size() in
> > dataengine's constructor but now I can't test my dataengine using
> > plasmaengineexplorer because it crashes on the Q_ASSERT (no argument is
> > passed to the constructor):
> > 
> > TranslatorEngine::TranslatorEngine(QObject* parent, const QVariantList&
> > args): DataEngine(parent, args)
> > {
> > 
> >    Q_ASSERT(args.size() >= 3);
> >    QString from = args[0].toString();
> >    QString to = args[1].toString();
> >    QString name = args[2].toString();
> >    translator = new Translator((QWidget*)this, from, to, name);
> >    ....
> > 
> > }
> > 
> > What should I do to get this working??
> 
> the args passed in are currently always empty for the DataEngine
> constructor.
> 
> perhaps the misunderstanding here is that there is only ever one instance of
> the DataEngine loaded, and that one engine hosts multiple sources of data.
> 
> information such as the to/from language should be encoded in the source
> name, e.g. "en:de:flower" (which might have as its data: "Blume"). the
> DataEngine would process these requests in sourceRequestEvent.

Thank you Aaron, It's working now (using absolute path to the script file!) :)
I'm trying to add Plasma::Package support to the dataengine, but...

there is another problem here! I've inherited from Plasma::PackageStructure 
(Just like comic_package in comic dataengine)... but I still can't install my 
translator plugin with plasmapkg:
Could not find a suitable installer for package of type Plasma/Translator

I think there is a problem in my CMakeLists.txt file.... I'm not sure though! 
(there is no good tutorial on plasma packages too! at least I couldn't find any 
in techbase!)

btw, this is my CMakeLists file:


project(plasma-translator)
 
find_package(KDE4 REQUIRED)
include(KDE4Defaults)
 
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
include_directories(
   ${CMAKE_SOURCE_DIR}
   ${CMAKE_BINARY_DIR}
   ${KDE4_INCLUDES}
   )
 
set(translator_engine_SRCS translator-engine.cpp translator.cpp)
 
kde4_add_plugin(plasma_engine_translator ${translator_engine_SRCS})
target_link_libraries(plasma_engine_translator ${KDE4_KDECORE_LIBS} 
${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KROSSUI_LIBS} ${KDE4_KIO_LIBS} 
${KDE4_KROSSCORE_LIBS})


install(TARGETS plasma_engine_translator
        DESTINATION ${PLUGIN_INSTALL_DIR})
 
install(FILES plasma-engine-translator.desktop
        DESTINATION ${SERVICES_INSTALL_DIR})

install( FILES plasma-translationprovider.desktop DESTINATION 
${SERVICETYPES_INSTALL_DIR} )


kde4_add_plugin( plasma-packagestructure-translator translatorpackage.cpp )
target_link_libraries( plasma-packagestructure-translator ${KDE4_KDEUI_LIBS} 
${KDE4_PLASMA_LIBS} )
install( TARGETS plasma-packagestructure-translator DESTINATION 
${PLUGIN_INSTALL_DIR} )
install( FILES plasma-packagestructure-translator.desktop DESTINATION 
${SERVICES_INSTALL_DIR} )


Thanks again  :)
Farhad



More information about the Plasma-devel mailing list