add_subdirectory(kdeeduui)
add_subdirectory(extdate)
add_subdirectory(libscience)
-add_subdirectory(widgets)
+add_subdirectory(plasma)
--- /dev/null
+find_package(Plasma REQUIRED)
+include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
+add_subdirectory(engines)
--- /dev/null
+add_subdirectory(chemical-data)
--- /dev/null
+include_directories(
+ ${CMAKE_SOURCE_DIR}/libkdeedu/libscience/
+ ${CMAKE_CURRENT_BINARY_DIR}/..
+)
+
+set(chemicaldata_engine_SRCS
+ chemicaldata.cpp
+ )
+
+kde4_automoc(${chemicaldata_engine_SRCS})
+kde4_add_plugin(plasma_engine_chemicaldata ${chemicaldata_engine_SRCS})
+target_link_libraries(plasma_engine_chemicaldata ${KDE4_KDECORE_LIBS} ${PLASMA_LIBRARIES} ${QT_QTXML_LIBRARY} science )
+
+install(TARGETS plasma_engine_chemicaldata DESTINATION ${PLUGIN_INSTALL_DIR})
+install(FILES plasma-engine-chemicaldata.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
+
--- /dev/null
+/*
+ * Copyright (C) 2007 Aaron Seigo <aseigo@kde.org>
+ * Copyright (C) 2007 Sebastian Kuegler <sebas@kde.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License version 2 as
+ * published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "chemicaldata.h"
+#include "element.h"
+#include "elementparser.h"
+
+//solid specific includes
+#include <KDebug>
+#include <KLocale>
+#include <kstandarddirs.h>
+
+#include "plasma/datasource.h"
+
+#include <QFile>
+
+ChemicalDataEngine::ChemicalDataEngine(QObject* parent, const QStringList& args)
+ : Plasma::DataEngine(parent)
+{
+ Q_UNUSED(args)
+
+ ElementSaxParser * parser = new ElementSaxParser();
+ QFile xmlFile( KStandardDirs::locate( "data", "libkdeedu/data/elements.xml" ) );
+ QXmlInputSource source(&xmlFile);
+ QXmlSimpleReader reader;
+
+ reader.setContentHandler(parser);
+ reader.parse(source);
+
+ m_elements = parser->getElements();
+}
+
+ChemicalDataEngine::~ChemicalDataEngine()
+{}
+
+void ChemicalDataEngine::init()
+{}
+
+bool ChemicalDataEngine::sourceRequested(const QString &name)
+{
+ kDebug() << "ChemicalDataEngine::sourceRequested()" << endl;
+ int num = name.toInt(); num -= 1;
+ QString e_name = m_elements.at(num)->dataAsString( ChemicalDataObject::name );
+ QString e_symbol = m_elements.at(num)->dataAsString( ChemicalDataObject::symbol );
+ QString e_weight = m_elements.at(num)->dataAsString( ChemicalDataObject::mass );
+ setData( e_name, "Symbol", e_symbol );
+ setData( e_name, "Mass", e_weight );
+
+ checkForUpdates( );
+
+ return true;
+}
+
+#include "chemicaldata.moc"
--- /dev/null
+#ifndef CHEMICALDATA_H
+#define CHEMICALDATA_H
+/*
+ * Copyright (C) 2007 Carsten Niehaus <cniehaus@kde.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License version 2 as
+ * published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#include "plasma/dataengine.h"
+#include "element.h"
+#include "chemicaldataobject.h"
+
+#include <QtXml/qxml.h>
+#include <QList>
+
+/**
+ * This class provides runtime information about the battery and AC status
+ * for use in a simple batter monitor application.
+ */
+class ChemicalDataEngine : public Plasma::DataEngine
+{
+ Q_OBJECT
+
+public:
+ ChemicalDataEngine( QObject* parent, const QStringList& args );
+ ~ChemicalDataEngine();
+
+protected:
+ bool sourceRequested(const QString &name);
+ void init();
+
+private:
+ /**
+ * Set the Element
+ * @param number The number of the Element (1 == H and so on)
+ */
+ void setElement( int number );
+
+ QList<Element*> m_elements;
+};
+
+
+K_EXPORT_PLASMA_DATAENGINE(chemicaldata, ChemicalDataEngine)
+
+#endif // CHEMICALDATA_H
--- /dev/null
+[Desktop Entry]
+Name=Chemical Data Engine
+ServiceTypes=Plasma/DataEngine
+Type=Service
+Icon=kalzium
+X-KDE-Library=plasma_engine_chemicaldata
+X-EngineName=chemicaldata