diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | ce599e4f9f94b4eb00c1b5edb85bce5431ab3df2 (patch) | |
tree | d3bb9f5d25a2dc09ca81adecf39621d871534297 /libkdeedu/kdeeducore | |
download | tdeedu-ce599e4f9f94b4eb00c1b5edb85bce5431ab3df2.tar.gz tdeedu-ce599e4f9f94b4eb00c1b5edb85bce5431ab3df2.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkdeedu/kdeeducore')
-rw-r--r-- | libkdeedu/kdeeducore/Makefile.am | 17 | ||||
-rw-r--r-- | libkdeedu/kdeeducore/kdeeducore.kdevprj | 84 | ||||
-rw-r--r-- | libkdeedu/kdeeducore/keduvocdata.cpp | 111 | ||||
-rw-r--r-- | libkdeedu/kdeeducore/keduvocdata.h | 51 | ||||
-rw-r--r-- | libkdeedu/kdeeducore/tests/Makefile.am | 10 | ||||
-rw-r--r-- | libkdeedu/kdeeducore/tests/loader.cpp | 7 |
6 files changed, 280 insertions, 0 deletions
diff --git a/libkdeedu/kdeeducore/Makefile.am b/libkdeedu/kdeeducore/Makefile.am new file mode 100644 index 00000000..57110b51 --- /dev/null +++ b/libkdeedu/kdeeducore/Makefile.am @@ -0,0 +1,17 @@ +INCLUDES= $(all_includes) +# there's nothing in tests for the moment, so I'm removing it from the compilation +#SUBDIRS = . tests +SUBDIRS = . + +lib_LTLIBRARIES = libkdeeducore.la + +libkdeeducore_la_SOURCES = keduvocdata.cpp +libkdeeducore_la_LDFLAGS = $(all_libraries) -no-undefined -version-info 3:0:2 + +libkdeeducode_includedir = $(includedir)/libkdeedu +libkdeeducode_include_HEADERS = keduvocdata.h + +libkdeeducore_la_LIBADD = $(LIB_KDECORE) + +METASOURCES = AUTO + diff --git a/libkdeedu/kdeeducore/kdeeducore.kdevprj b/libkdeedu/kdeeducore/kdeeducore.kdevprj new file mode 100644 index 00000000..a2b31cda --- /dev/null +++ b/libkdeedu/kdeeducore/kdeeducore.kdevprj @@ -0,0 +1,84 @@ +[./Makefile.am] +files=./kdeeducore.kdevprj, +sub_dirs= +type=normal + +[./kdeeducore.kdevprj] +dist=true +install=false +install_location= +type=DATA + +[Config for BinMakefileAm] +addcxxflags= +bin_program=kdeeducore +cflags= +cppflags= +cxxflags=\s-O0 +ldadd= +ldflags=\s +libtool_dir= +path_to_bin_program=. + +[General] +author=earnold +configure_args=\s--build=i386-linux --host=i386-linux --target=i386-linux\s +dir_where_make_will_be_called= +email=earnold@venus +kdevprj_version=1.3 +lfv_open_groups= +make_options=\s-j1 all\s +makefiles=./Makefile.am,Makefile.am,tests/Makefile.am +modifyMakefiles=false +project_name=kdeeducore +project_type=normal_empty +short_info= +sub_dir= +version=1.0 +version_control=CVS +workspace=1 + +[LFV Groups] +GNU=AUTHORS,COPYING,ChangeLog,INSTALL,README,TODO,NEWS, +Headers=*.h,*.hxx,*.hpp,*.H, +Others=*, +Sources=*.cpp,*.c,*.cc,*.C,*.cxx,*.ec,*.ecpp,*.lxx,*.l++,*.ll,*.l, +Translations=*.ts,*.po, +User Interface=*.ui,*.kdevdlg,*.rc, +groups=Headers,Sources,GNU,Translations,User Interface,Others + +[Makefile.am] +dist=true +files=Makefile.am,kedudata.cpp,kedudata.h +install=false +install_location= +sub_dirs=tests +type=static_library + +[kedudata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kedudata.h] +dist=true +install=false +install_location= +type=HEADER + +[tests/Makefile.am] +dist=true +files=tests/loader.cpp,tests/Makefile.am +install=false +install_location= +sharedlib_LDFLAGS=-version-info 0:0:0 +sharedlib_rootname=tests +sub_dirs= +type=DATA + +[tests/loader.cpp] +dist=true +install=false +install_location= +type=SOURCE diff --git a/libkdeedu/kdeeducore/keduvocdata.cpp b/libkdeedu/kdeeducore/keduvocdata.cpp new file mode 100644 index 00000000..6ffe1ebe --- /dev/null +++ b/libkdeedu/kdeeducore/keduvocdata.cpp @@ -0,0 +1,111 @@ +/* This file is part of the KDE Edu Library + Copyright (C) 2002 Scott Wheeler <wheeler@kde.org> + + This library 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 library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "keduvocdata.h" + +#include <qfile.h> + +#include <kdebug.h> + +//////////////////////////////////////////////////////////////////////////////// +// class KEduVocDataItem +//////////////////////////////////////////////////////////////////////////////// + +// public methods + +KEduVocDataItem::KEduVocDataItem() +{ + +} + +KEduVocDataItem::KEduVocDataItem(QDomElement &entry) +{ + domElement = entry; +} + +KEduVocDataItem::~KEduVocDataItem() +{ + +} + +QString KEduVocDataItem::originalText() const +{ + return getText("o"); +} + +QString KEduVocDataItem::translatedText() const +{ + return getText("t"); +} + +// protected methods + +QString KEduVocDataItem::getText(const QString &tagName) const +{ + if(!domElement.isNull()) { + + QDomNodeList list = domElement.elementsByTagName(tagName); + + if(list.count() > 0) { + + QDomElement element = list.item(0).toElement(); + + if(!element.isNull()) { + return element.text(); + } + else + return QString::null; + } + else + return QString::null; + } + else + return QString::null; +} + +//////////////////////////////////////////////////////////////////////////////// +// class KEduVocData +//////////////////////////////////////////////////////////////////////////////// + +// public static methods + +KEduVocDataItemList KEduVocData::parse(const QString &fileName) +{ + KEduVocDataItemList list; + + QDomDocument document; + QFile file(fileName); + document.setContent(&file); + + QDomNodeList entries = document.elementsByTagName("e"); + + // loop through the "e" (entry) tags looking for data + for(uint i = 0 ; i < entries.count() ; i++) { + + // get an entry to operate on + QDomElement entry = entries.item(i).toElement(); + + // if the "node" is in fact an element -- i.e. not null + if(!entry.isNull()) { + KEduVocDataItem item(entry); + list.append(item); + } + } + + return list; +} diff --git a/libkdeedu/kdeeducore/keduvocdata.h b/libkdeedu/kdeeducore/keduvocdata.h new file mode 100644 index 00000000..4284ff08 --- /dev/null +++ b/libkdeedu/kdeeducore/keduvocdata.h @@ -0,0 +1,51 @@ +/* This file is part of the KDE Edu Library + Copyright (C) 2002 Scott Wheeler <wheeler@kde.org> + + This library 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 library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef KEDUVOCDATA_H +#define KEDUVOCDATA_H + +#include <qdom.h> +#include <qvaluelist.h> +#include <kdemacros.h> + +class KDE_EXPORT KEduVocDataItem +{ +public: + KEduVocDataItem(); + KEduVocDataItem(QDomElement &entry); + virtual ~KEduVocDataItem(); + + QString originalText() const; + QString translatedText() const; + +protected: + QString getText(const QString &tagName) const; + +private: + QDomElement domElement; +}; + +typedef QValueList<KEduVocDataItem> KEduVocDataItemList; + +class KDE_EXPORT KEduVocData +{ +public: + static KEduVocDataItemList parse(const QString &fileName); +}; + +#endif // KEDUVOCDATA_H diff --git a/libkdeedu/kdeeducore/tests/Makefile.am b/libkdeedu/kdeeducore/tests/Makefile.am new file mode 100644 index 00000000..34e65598 --- /dev/null +++ b/libkdeedu/kdeeducore/tests/Makefile.am @@ -0,0 +1,10 @@ +SUBDIRS = . +INCLUDES = -I. -I$(top_srcdir)/kdeeducore $(all_includes) + +check_PROGRAMS = loader + +#all: check + +loader_SOURCES = loader.cpp +loader_LDFLAGS = $(all_libraries) +loader_LDADD = ../libkdeeducore.la diff --git a/libkdeedu/kdeeducore/tests/loader.cpp b/libkdeedu/kdeeducore/tests/loader.cpp new file mode 100644 index 00000000..8d793ca4 --- /dev/null +++ b/libkdeedu/kdeeducore/tests/loader.cpp @@ -0,0 +1,7 @@ + +int main (void) +{ + + + return 0; +} |