diff options
Diffstat (limited to 'tderesources/featureplan')
-rw-r--r-- | tderesources/featureplan/CMakeLists.txt | 74 | ||||
-rw-r--r-- | tderesources/featureplan/Makefile.am | 61 | ||||
-rw-r--r-- | tderesources/featureplan/benchmarkfeaturelist.cpp | 98 | ||||
-rw-r--r-- | tderesources/featureplan/dumpfeaturelist.cpp | 102 | ||||
-rw-r--r-- | tderesources/featureplan/kcal_resourcefeatureplan.cpp | 152 | ||||
-rw-r--r-- | tderesources/featureplan/kcal_resourcefeatureplan.desktop | 41 | ||||
-rw-r--r-- | tderesources/featureplan/kcal_resourcefeatureplan.h | 68 | ||||
-rw-r--r-- | tderesources/featureplan/kcal_resourcefeatureplanconfig.cpp | 92 | ||||
-rw-r--r-- | tderesources/featureplan/kcal_resourcefeatureplanconfig.h | 54 | ||||
-rw-r--r-- | tderesources/featureplan/kcal_resourcefeatureplanplugin.cpp | 40 | ||||
-rw-r--r-- | tderesources/featureplan/kde-features.dtd | 25 | ||||
-rw-r--r-- | tderesources/featureplan/kde-features.rng | 150 | ||||
-rw-r--r-- | tderesources/featureplan/prefs.kcfgc | 9 | ||||
-rw-r--r-- | tderesources/featureplan/tderesources_kcal_featureplan.kcfg | 20 |
14 files changed, 986 insertions, 0 deletions
diff --git a/tderesources/featureplan/CMakeLists.txt b/tderesources/featureplan/CMakeLists.txt new file mode 100644 index 000000000..76e279c80 --- /dev/null +++ b/tderesources/featureplan/CMakeLists.txt @@ -0,0 +1,74 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +if( BUILD_KODE ) + set( KXML_COMPILER_EXECUTABLE ${CMAKE_BINARY_DIR}/kode/kxml_compiler/kxml_compiler ) + set( KXML_COMPILER_TARGET kxml_compiler ) +else( ) + find_program( KXML_COMPILER_EXECUTABLE + NAMES kxml_compiler + HINTS ${TDE_BIN_DIR} ${BIN_INSTALL_DIR} ) + if( NOT KXML_COMPILER_EXECUTABLE ) + tde_message_fatal( "kxml_compiler is NOT found.\n kode package is correctly installed?" ) + endif( ) +endif( ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/libtdepim + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES + kcal_resourcefeatureplan.desktop + DESTINATION ${SERVICES_INSTALL_DIR}/tderesources/kcal ) + + +##### kcal_resourcefeatureplan (module) ######### + +tde_add_kpart( kcal_resourcefeatureplan AUTOMOC + SOURCES kcal_resourcefeatureplanplugin.cpp + LINK kcal_resourcefeatureplan-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) + + +##### featureplancommon (static) ################ + +add_custom_command( + OUTPUT kde-features.h kde-features.cpp kde-features_parser.h kde-features_parser.cpp + COMMAND ${KXML_COMPILER_EXECUTABLE} --custom-parser ${CMAKE_CURRENT_SOURCE_DIR}/kde-features.rng >/dev/null + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/kde-features.rng ${KXML_COMPILER_TARGET} ) + +tde_add_library( featureplancommon STATIC_PIC + SOURCES + kde-features.cpp kde-features_parser.cpp prefs.kcfgc +) + + +##### kcal_resourcefeatureplan (shared) ######### + +tde_add_library( kcal_resourcefeatureplan SHARED AUTOMOC + SOURCES + kcal_resourcefeatureplan.cpp kcal_resourcefeatureplanconfig.cpp + VERSION 1.0.0 + LINK featureplancommon-static tdepim-shared + DESTINATION ${LIB_INSTALL_DIR} +) diff --git a/tderesources/featureplan/Makefile.am b/tderesources/featureplan/Makefile.am new file mode 100644 index 000000000..f37d5c6ba --- /dev/null +++ b/tderesources/featureplan/Makefile.am @@ -0,0 +1,61 @@ +INCLUDES = -I$(top_srcdir) $(all_includes) + +lib_LTLIBRARIES = libkcal_resourcefeatureplan.la + +noinst_LTLIBRARIES = libfeatureplancommon.la +libfeatureplancommon_la_SOURCES = kde-features.cpp kde-features_parser.cpp \ + prefs.kcfgc + +libkcal_resourcefeatureplan_la_SOURCES = kcal_resourcefeatureplan.cpp \ + kcal_resourcefeatureplanconfig.cpp +libkcal_resourcefeatureplan_la_LDFLAGS = $(KDE_RPATH) $(all_libraries) \ + -version-info 1:0:0 -no-undefined +libkcal_resourcefeatureplan_la_LIBADD = libfeatureplancommon.la \ + $(top_builddir)/libkcal/libkcal.la \ + $(top_builddir)/libtdepim/libtdepim.la +libkcal_resourcefeatureplan_la_COMPILE_FIRST = kde-features.h prefs.h + + +kde_module_LTLIBRARIES = kcal_resourcefeatureplan.la + +kcal_resourcefeatureplan_la_SOURCES = kcal_resourcefeatureplanplugin.cpp +kcal_resourcefeatureplan_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +kcal_resourcefeatureplan_la_LIBADD = libkcal_resourcefeatureplan.la +kcal_resourcefeatureplan_la_COMPILE_FIRST = kde-features.h prefs.h + +kcal_servicedir = $(kde_servicesdir)/tderesources/kcal +kcal_service_DATA = kcal_resourcefeatureplan.desktop + +check_PROGRAMS = dumpfeaturelist benchmarkfeaturelist + +dumpfeaturelist_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor +dumpfeaturelist_LDADD = libfeatureplancommon.la $(LIB_TDECORE) +dumpfeaturelist_SOURCES = dumpfeaturelist.cpp +dumpfeaturelist_COMPILE_FIRST = kde-features.h + +benchmarkfeaturelist_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor +benchmarkfeaturelist_LDADD = libfeatureplancommon.la $(LIB_TDECORE) +benchmarkfeaturelist_SOURCES = benchmarkfeaturelist.cpp +benchmarkfeaturelist_COMPILE_FIRST = kde-features.h + +kde-features.cpp: kde-features.h +kde-features_parser.h kde-features_parser.cpp: kde-features.h + +kde-features.h kde-features.cpp kde-features_parser.h kde-features_parser.cpp: $(srcdir)/kde-features.rng \ + $(top_builddir)/kode/kxml_compiler/kxml_compiler + $(top_builddir)/kode/kxml_compiler/kxml_compiler \ + --custom-parser $(srcdir)/kde-features.rng + +METASOURCES = AUTO +DISTCLEANFILES = kde-features.h kde-features.cpp \ + kde-features_parser.h kde-features_parser.cpp \ + kde-features.h.backup kde-features.cpp.backup \ + kde-features_parser.h.backup kde-features_parser.cpp.backup + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kres_featureplan.pot + +kcal_resourcefeatureplan.lo: kde-features_parser.h +kde-features.lo: kde-features.h +kde-features_parser.lo: kde-features_parser.h kde-features.h + diff --git a/tderesources/featureplan/benchmarkfeaturelist.cpp b/tderesources/featureplan/benchmarkfeaturelist.cpp new file mode 100644 index 000000000..f9f88c5cc --- /dev/null +++ b/tderesources/featureplan/benchmarkfeaturelist.cpp @@ -0,0 +1,98 @@ +/* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <schumacher@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 as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 "kde-features.h" +#include "kde-features_parser.h" + +#include <kapplication.h> +#include <kcmdlineargs.h> +#include <kaboutdata.h> +#include <kdebug.h> + +#include <tqfile.h> +#include <tqtextstream.h> + +#include <iostream> + +static const KCmdLineOptions options[] = +{ + { "+featurelist", "Name of featurelist XML file", 0 }, + KCmdLineLastOption +}; + +void displayFeature( Feature *f ) +{ + std::cout << "FEATURE: " << f->summary().local8Bit() << std::endl; + Responsible::List r = f->responsibleList(); + Responsible::List::ConstIterator it; + for( it = r.begin(); it != r.end(); ++it ) { + std::cout << " RESPONSIBLE: " << (*it)->name().local8Bit() << " (" + << (*it)->email().local8Bit() << ")" << std::endl; + } + std::cout << " TARGET: " << f->target().local8Bit() << std::endl; + std::cout << " STATUS: " << f->status().local8Bit() << std::endl; +} + +void displayCategory( const TQValueList<Category *> categories ) +{ + Category::List::ConstIterator it; + for( it = categories.begin(); it != categories.end(); ++it ) { + std::cout << "CATEGORY: " << (*it)->name().local8Bit() << std::endl; + + Feature::List features = (*it)->featureList(); + Feature::List::ConstIterator it2; + for( it2 = features.begin(); it2 != features.end(); ++it2 ) { + displayFeature( *it2 ); + } + + displayCategory( (*it)->categoryList() ); + } +} + +int main( int argc, char **argv ) +{ + TDEAboutData aboutData( "benchmarkfeaturelist", + "Benchmark for feature list XML parser", + "0.1" ); + TDECmdLineArgs::init( argc, argv, &aboutData ); + TDECmdLineArgs::addCmdLineOptions( options ); + + TDEApplication app( false, false ); + + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + + if ( args->count() != 1 ) { + args->usage( "Wrong number of arguments." ); + } + + TQString filename = TQFile::decodeName( args->arg( 0 ) ); + + for( int i = 0; i < 1; ++i ) { + FeaturesParser parser; + + Features *features = parser.parseFile( filename ); + + if ( !features ) { + kdError() << "Parse error" << endl; + return 1; + } + } +} diff --git a/tderesources/featureplan/dumpfeaturelist.cpp b/tderesources/featureplan/dumpfeaturelist.cpp new file mode 100644 index 000000000..a007b70dc --- /dev/null +++ b/tderesources/featureplan/dumpfeaturelist.cpp @@ -0,0 +1,102 @@ +/* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <schumacher@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 as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 "kde-features.h" +#include "kde-features_parser.h" + +#include <kapplication.h> +#include <kcmdlineargs.h> +#include <kaboutdata.h> +#include <kdebug.h> + +#include <tqfile.h> +#include <tqtextstream.h> + +#include <iostream> + +static const KCmdLineOptions options[] = +{ + { "+featurelist", "Name of featurelist XML file", 0 }, + KCmdLineLastOption +}; + +void displayFeature( Feature *f ) +{ + std::cout << "FEATURE: " << f->summary().local8Bit() << std::endl; + Responsible::List r = f->responsibleList(); + Responsible::List::ConstIterator it; + for( it = r.begin(); it != r.end(); ++it ) { + std::cout << " RESPONSIBLE: " << (*it)->name().local8Bit() << " (" + << (*it)->email().local8Bit() << ")" << std::endl; + } + std::cout << " TARGET: " << f->target().local8Bit() << std::endl; + std::cout << " STATUS: " << f->status().local8Bit() << std::endl; +} + +void displayCategory( const TQValueList<Category *> categories ) +{ + Category::List::ConstIterator it; + for( it = categories.begin(); it != categories.end(); ++it ) { + std::cout << "CATEGORY: " << (*it)->name().local8Bit() << std::endl; + + Feature::List features = (*it)->featureList(); + Feature::List::ConstIterator it2; + for( it2 = features.begin(); it2 != features.end(); ++it2 ) { + displayFeature( *it2 ); + } + + displayCategory( (*it)->categoryList() ); + } +} + +int main( int argc, char **argv ) +{ + TDEAboutData aboutData( "dumpfeaturelist", "Dump XML feature list to stdout", + "0.1" ); + TDECmdLineArgs::init( argc, argv, &aboutData ); + TDECmdLineArgs::addCmdLineOptions( options ); + + TDEApplication app( false, false ); + + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + + if ( args->count() != 1 ) { + args->usage( "Wrong number of arguments." ); + } + + TQString filename = TQFile::decodeName( args->arg( 0 ) ); + + FeaturesParser parser; + + Features *features = parser.parseFile( filename ); + + if ( !features ) { + kdError() << "Parse error" << endl; + } else { + TQValueList<Category *> categories = features->categoryList(); + displayCategory( categories ); + + TQString out = filename + ".out"; + if ( !features->writeFile( out ) ) { + kdError() << "Write error" << endl; + } + } +} diff --git a/tderesources/featureplan/kcal_resourcefeatureplan.cpp b/tderesources/featureplan/kcal_resourcefeatureplan.cpp new file mode 100644 index 000000000..2bddc7fd9 --- /dev/null +++ b/tderesources/featureplan/kcal_resourcefeatureplan.cpp @@ -0,0 +1,152 @@ +/* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <schumacher@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 as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 "kcal_resourcefeatureplan.h" + +#include "kcal_resourcefeatureplanconfig.h" + +#include "kde-features.h" +#include "kde-features_parser.h" + +#include <tqapplication.h> +#include <tqdatetime.h> +#include <tqptrlist.h> +#include <tqstringlist.h> +#include <tqtimer.h> + +#include <kabc/locknull.h> +#include <kdebug.h> +#include <klocale.h> +#include <tderesources/configwidget.h> +#include <kstandarddirs.h> +#include <kstringhandler.h> +#include <kurl.h> +#include <libtdepim/kpimprefs.h> + +using namespace KCal; + +ResourceFeaturePlan::ResourceFeaturePlan( const TDEConfig *config ) + : ResourceCached( config ), mLock( true ) +{ + mPrefs = new Prefs; + + if ( config ) readConfig( config ); +} + +ResourceFeaturePlan::~ResourceFeaturePlan() +{ +} + +Prefs *ResourceFeaturePlan::prefs() +{ + return mPrefs; +} + +void ResourceFeaturePlan::readConfig( const TDEConfig * ) +{ + mPrefs->readConfig(); +} + +void ResourceFeaturePlan::writeConfig( TDEConfig *config ) +{ + ResourceCalendar::writeConfig( config ); + + mPrefs->writeConfig(); +} + +bool ResourceFeaturePlan::doLoad() +{ + kdDebug() << "ResourceFeaturePlan::load()" << endl; + + mCalendar.close(); + + FeaturesParser parser; + + Features *features = parser.parseFile( mPrefs->filename() ); + + if ( !features ) { + return false; + } else { + Category::List categories = features->categoryList(); + + KCal::Todo *masterTodo = new KCal::Todo; + masterTodo->setSummary( i18n("Feature Plan") ); + mCalendar.addTodo( masterTodo ); + + insertCategories( categories, masterTodo ); + } + + emit resourceChanged( this ); + + return true; +} + +void ResourceFeaturePlan::insertCategories( const Category::List &categories, + Todo *parent ) +{ + Category::List::ConstIterator it; + for( it = categories.begin(); it != categories.end(); ++it ) { + Category *c = *it; + + Todo *categoryTodo = new Todo; + categoryTodo->setSummary( c->name() ); + categoryTodo->setRelatedTo( parent ); + + insertCategories( c->categoryList(), categoryTodo ); + + Feature::List features = (*it)->featureList(); + Feature::List::ConstIterator it2; + for( it2 = features.begin(); it2 != features.end(); ++it2 ) { + Feature *f = *it2; + Todo *todo = new Todo; + + TQString summary = f->summary(); + int pos = summary.find( '\n' ); + if ( pos > 0 ) summary = summary.left( pos ) + "..."; + todo->setSummary( summary ); + + todo->setDescription( f->summary() ); + + todo->setRelatedTo( categoryTodo ); + + int completed; + if ( f->status() == "done" ) completed = 100; + else if ( f->status() == "inprogress" ) completed = 50; + else completed = 0; + todo->setPercentComplete( completed ); + + mCalendar.addTodo( todo ); + } + } +} + +bool ResourceFeaturePlan::doSave() +{ + return true; +} + +KABC::Lock *ResourceFeaturePlan::lock() +{ + return &mLock; +} + + +#include "kcal_resourcefeatureplan.moc" diff --git a/tderesources/featureplan/kcal_resourcefeatureplan.desktop b/tderesources/featureplan/kcal_resourcefeatureplan.desktop new file mode 100644 index 000000000..2bca3fbe4 --- /dev/null +++ b/tderesources/featureplan/kcal_resourcefeatureplan.desktop @@ -0,0 +1,41 @@ +[Desktop Entry] +Name=XML Feature Plan +Name[af]=XML eienskappe plan +Name[ca]=Pla de característiques XML +Name[cs]=XML plán vlastností +Name[da]=XML Funktionsplan +Name[el]=Σχέδιο χαρακτηριστικών XML +Name[eo]=XML-Trajtplano +Name[es]=Plan de características XML +Name[et]=XML võimaluste plaan +Name[eu]=XML eginbide plana +Name[fa]=نقشۀ ویژگی XML +Name[fi]=XML-ominaisuussuunnitelma +Name[fr]=Plan de fonctionnalités XML +Name[fy]=Funksjonaliteitsplanning yn XML +Name[gl]=Plan de Características en XML +Name[hu]=XML FeaturePlan +Name[is]=XML fídusa áætlun +Name[it]=Piano caratteristiche XML +Name[km]=គ្រោងលក្ខណៈពិសេស XML +Name[lt]=XML bruožų planas +Name[ms]=Pelan Cirian XML +Name[nds]=XML-Funkschonenplaan +Name[ne]=एक्सएमएल विशेषता योजना +Name[nl]=Functionaliteitsplanning in XML +Name[pl]=Plan funkcjonalności XML +Name[pt]=Plano de Funcionalidades em XML +Name[pt_BR]=Plano de Funcionalidades XML +Name[sk]=XML plán vlastností +Name[sl]=Načrt zmožnosti v XML +Name[sr]=XML план могућности +Name[sr@Latn]=XML plan mogućnosti +Name[ta]=XML பண்பு திட்டம் +Name[tr]=XML Özellik Planı +Name[zh_CN]=XML 特性计划 +Name[zh_TW]=XML 功能計畫 +X-TDE-Library=kcal_resourcefeatureplan +Type=Service +ServiceTypes=KResources/Plugin +X-TDE-ResourceFamily=calendar +X-TDE-ResourceType=featureplan diff --git a/tderesources/featureplan/kcal_resourcefeatureplan.h b/tderesources/featureplan/kcal_resourcefeatureplan.h new file mode 100644 index 000000000..2808aef71 --- /dev/null +++ b/tderesources/featureplan/kcal_resourcefeatureplan.h @@ -0,0 +1,68 @@ + /* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <schumacher@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 as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 KCAL_RESOURCEFEATUREPLAN_H +#define KCAL_RESOURCEFEATUREPLAN_H + +#include "prefs.h" + +#include "kde-features.h" + +#include <libkcal/resourcecached.h> + +#include <kabc/locknull.h> + +#include <tdepimmacros.h> +#include <kconfig.h> + +namespace KCal { + +/** + This class represents a featureplan (in KDE XML format) +*/ +class KDE_EXPORT ResourceFeaturePlan : public ResourceCached +{ + Q_OBJECT + + public: + ResourceFeaturePlan( const TDEConfig * ); + virtual ~ResourceFeaturePlan(); + + void readConfig( const TDEConfig *config ); + void writeConfig( TDEConfig *config ); + + Prefs *prefs(); + + bool doLoad(); + bool doSave(); + + KABC::Lock *lock(); + + protected: + void insertCategories( const Category::List &categories, Todo *parent ); + + private: + Prefs *mPrefs; + KABC::LockNull mLock; +}; + +} + +#endif diff --git a/tderesources/featureplan/kcal_resourcefeatureplanconfig.cpp b/tderesources/featureplan/kcal_resourcefeatureplanconfig.cpp new file mode 100644 index 000000000..55d12cbd9 --- /dev/null +++ b/tderesources/featureplan/kcal_resourcefeatureplanconfig.cpp @@ -0,0 +1,92 @@ +/* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <schumacher@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 as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 <tqlabel.h> +#include <tqlayout.h> +#include <tqcheckbox.h> + +#include <kdebug.h> +#include <kdialog.h> +#include <klineedit.h> +#include <klocale.h> +#include <knuminput.h> +#include <kurlrequester.h> + +#include "kcal_resourcefeatureplan.h" +#include "kcal_resourcefeatureplanconfig.h" + +using namespace KCal; + +ResourceFeaturePlanConfig::ResourceFeaturePlanConfig( TQWidget *parent, + const char *name ) + : KRES::ConfigWidget( parent, name ) +{ + TQGridLayout *topLayout = new TQGridLayout( this, 3, 2, 0, + KDialog::spacingHint() ); + + TQLabel *label = new TQLabel( i18n( "Filename:" ), this ); + mFilename = new KURLRequester( this ); + + topLayout->addWidget( label, 0, 0 ); + topLayout->addWidget( mFilename, 0, 1 ); + + label = new TQLabel( i18n( "Filter email:" ), this ); + mFilterEmail = new KLineEdit( this ); + + topLayout->addWidget( label, 1, 0 ); + topLayout->addWidget( mFilterEmail, 1, 1 ); + + mCvsCheck = new TQCheckBox( i18n("Use CVS"), this ); + + topLayout->addMultiCellWidget( mCvsCheck, 2, 2, 0, 1 ); +} + +void ResourceFeaturePlanConfig::loadSettings( KRES::Resource *res ) +{ + ResourceFeaturePlan *resource = dynamic_cast<ResourceFeaturePlan *>( res ); + + if ( !resource ) { + kdDebug(5700) << "ResourceFeaturePlanConfig::loadSettings(): cast failed" << endl; + return; + } + + Prefs *p = resource->prefs(); + mFilename->setURL( p->filename() ); + mFilterEmail->setText( p->filterEmail() ); + mCvsCheck->setChecked( p->useCvs() ); +} + +void ResourceFeaturePlanConfig::saveSettings( KRES::Resource *res ) +{ + ResourceFeaturePlan *resource = dynamic_cast<ResourceFeaturePlan *>( res ); + + if ( !resource ) { + kdDebug(5700) << "ResourceFeaturePlanConfig::saveSettings(): cast failed" << endl; + return; + } + + Prefs *p = resource->prefs(); + p->setFilename( mFilename->url() ); + p->setFilterEmail( mFilterEmail->text() ); + p->setUseCvs( mCvsCheck->isChecked() ); +} + +#include "kcal_resourcefeatureplanconfig.moc" diff --git a/tderesources/featureplan/kcal_resourcefeatureplanconfig.h b/tderesources/featureplan/kcal_resourcefeatureplanconfig.h new file mode 100644 index 000000000..aa00123f6 --- /dev/null +++ b/tderesources/featureplan/kcal_resourcefeatureplanconfig.h @@ -0,0 +1,54 @@ +/* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <schumacher@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 as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 RESOURCEFEATUREPLANCONFIG_H +#define RESOURCEFEATUREPLANCONFIG_H + +#include <tderesources/configwidget.h> +#include <tdepimmacros.h> + +class KLineEdit; +class KURLRequester; +class TQCheckBox; + +namespace KCal { + +class KDE_EXPORT ResourceFeaturePlanConfig : public KRES::ConfigWidget +{ + Q_OBJECT + + + public: + ResourceFeaturePlanConfig( TQWidget *parent = 0, const char *name = 0 ); + + public slots: + void loadSettings( KRES::Resource * ); + void saveSettings( KRES::Resource * ); + + private: + KURLRequester *mFilename; + KLineEdit *mFilterEmail; + TQCheckBox *mCvsCheck; +}; + +} + +#endif diff --git a/tderesources/featureplan/kcal_resourcefeatureplanplugin.cpp b/tderesources/featureplan/kcal_resourcefeatureplanplugin.cpp new file mode 100644 index 000000000..ae2759e46 --- /dev/null +++ b/tderesources/featureplan/kcal_resourcefeatureplanplugin.cpp @@ -0,0 +1,40 @@ +/* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <schumacher@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 as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 "kcal_resourcefeatureplan.h" +#include "kcal_resourcefeatureplanconfig.h" + +#include <kglobal.h> +#include <klocale.h> + +using namespace KCal; + +typedef KRES::PluginFactory< ResourceFeaturePlan, ResourceFeaturePlanConfig > FeatureplanFactory; +// FIXME K_EXPORT_COMPONENT_FACTORY( kcal_resourcefeatureplan, FeatureplanFactory ) +// Problem: How to insert the catalogue! +extern "C" +{ + void* init_kcal_resourcefeatureplan() + { + TDEGlobal::locale()->insertCatalogue( "kres_featureplan" ); + return new FeatureplanFactory; + } +} diff --git a/tderesources/featureplan/kde-features.dtd b/tderesources/featureplan/kde-features.dtd new file mode 100644 index 000000000..732c447d2 --- /dev/null +++ b/tderesources/featureplan/kde-features.dtd @@ -0,0 +1,25 @@ + +<!ELEMENT features (category+)> + +<!ELEMENT category (feature|category)*> +<!ATTLIST category name CDATA #REQUIRED > + +<!ELEMENT feature (summary?,responsible*)> +<!ATTLIST feature status (inprogress|todo|done) "todo" + target CDATA #REQUIRED> + +<!ELEMENT responsible EMPTY> +<!ATTLIST responsible name CDATA #IMPLIED + email CDATA #IMPLIED> + +<!ELEMENT summary (#PCDATA|i|a|b|em|strong|br)*> + +<!ELEMENT i (#PCDATA)> +<!ELEMENT b (#PCDATA)> +<!ELEMENT em (#PCDATA)> +<!ELEMENT strong (#PCDATA)> +<!ELEMENT br EMPTY> + +<!ELEMENT a (#PCDATA)> +<!ATTLIST a href CDATA #IMPLIED> +<!ATTLIST a title CDATA #IMPLIED> diff --git a/tderesources/featureplan/kde-features.rng b/tderesources/featureplan/kde-features.rng new file mode 100644 index 000000000..89a31dcb4 --- /dev/null +++ b/tderesources/featureplan/kde-features.rng @@ -0,0 +1,150 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0"> + <define name="features"> + <element name="features"> + <ref name="attlist.features"/> + <oneOrMore> + <ref name="category"/> + </oneOrMore> + </element> + </define> + <define name="attlist.features" combine="interleave"> + <empty/> + </define> + <define name="category"> + <element name="category"> + <ref name="attlist.category"/> + <zeroOrMore> + <choice> + <ref name="feature"/> + <ref name="category"/> + </choice> + </zeroOrMore> + </element> + </define> + <define name="attlist.category" combine="interleave"> + <attribute name="name"/> + </define> + <define name="feature"> + <element name="feature"> + <ref name="attlist.feature"/> + <optional> + <ref name="summary"/> + </optional> + <zeroOrMore> + <ref name="responsible"/> + </zeroOrMore> + </element> + </define> + <define name="attlist.feature" combine="interleave"> + <optional> + <attribute name="status" a:defaultValue="todo"> + <choice> + <value>inprogress</value> + <value>todo</value> + <value>done</value> + </choice> + </attribute> + </optional> + <attribute name="target"/> + </define> + <define name="responsible"> + <element name="responsible"> + <ref name="attlist.responsible"/> + <empty/> + </element> + </define> + <define name="attlist.responsible" combine="interleave"> + <optional> + <attribute name="name"/> + </optional> + <optional> + <attribute name="email"/> + </optional> + </define> + <define name="summary"> + <element name="summary"> + <ref name="attlist.summary"/> + <zeroOrMore> + <choice> + <text/> + <ref name="i"/> + <ref name="a"/> + <ref name="b"/> + <ref name="em"/> + <ref name="strong"/> + <ref name="br"/> + </choice> + </zeroOrMore> + </element> + </define> + <define name="attlist.summary" combine="interleave"> + <empty/> + </define> + <define name="i"> + <element name="i"> + <ref name="attlist.i"/> + <text/> + </element> + </define> + <define name="attlist.i" combine="interleave"> + <empty/> + </define> + <define name="b"> + <element name="b"> + <ref name="attlist.b"/> + <text/> + </element> + </define> + <define name="attlist.b" combine="interleave"> + <empty/> + </define> + <define name="em"> + <element name="em"> + <ref name="attlist.em"/> + <text/> + </element> + </define> + <define name="attlist.em" combine="interleave"> + <empty/> + </define> + <define name="strong"> + <element name="strong"> + <ref name="attlist.strong"/> + <text/> + </element> + </define> + <define name="attlist.strong" combine="interleave"> + <empty/> + </define> + <define name="br"> + <element name="br"> + <ref name="attlist.br"/> + <empty/> + </element> + </define> + <define name="attlist.br" combine="interleave"> + <empty/> + </define> + <define name="a"> + <element name="a"> + <ref name="attlist.a"/> + <text/> + </element> + </define> + <define name="attlist.a" combine="interleave"> + <optional> + <attribute name="href"/> + </optional> + </define> + <define name="attlist.a" combine="interleave"> + <optional> + <attribute name="title"/> + </optional> + </define> + <start> + <choice> + <ref name="features"/> + </choice> + </start> +</grammar> diff --git a/tderesources/featureplan/prefs.kcfgc b/tderesources/featureplan/prefs.kcfgc new file mode 100644 index 000000000..0866d4e38 --- /dev/null +++ b/tderesources/featureplan/prefs.kcfgc @@ -0,0 +1,9 @@ +# Code generation options for kconfig_compiler +File=tderesources_kcal_featureplan.kcfg +ClassName=Prefs +#NameSpace=KBB +Singleton=false +Mutators=true +GlobalEnums=true +#ItemAccessors=true +#SetUserTexts=true diff --git a/tderesources/featureplan/tderesources_kcal_featureplan.kcfg b/tderesources/featureplan/tderesources_kcal_featureplan.kcfg new file mode 100644 index 000000000..64d44ae58 --- /dev/null +++ b/tderesources/featureplan/tderesources_kcal_featureplan.kcfg @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 + http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > + <kcfgfile name="tderesources_kcal_bugzillarc"/> + + <group name="General"> + <entry type="String" name="Filename"> + <label>Filename</label> + </entry> + <entry type="String" name="FilterEmail"> + <label>Filter for Email</label> + </entry> + <entry type="Bool" name="UseCvs"> + <label>Use CVS</label> + </entry> + </group> + +</kcfg> |