diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-26 13:17:59 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-26 13:17:59 -0600 |
commit | 1515a4f2eb9cf023ed7f9c2e10106b5e93164a08 (patch) | |
tree | d5617734090b254659ff331ce7d1e574c4807caf /kbugbuster/tderesources | |
parent | f8069e2ea048f2657cc417d83820576ec55c181b (diff) | |
download | tdesdk-1515a4f2eb9cf023ed7f9c2e10106b5e93164a08.tar.gz tdesdk-1515a4f2eb9cf023ed7f9c2e10106b5e93164a08.zip |
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'kbugbuster/tderesources')
-rw-r--r-- | kbugbuster/tderesources/CMakeLists.txt | 43 | ||||
-rw-r--r-- | kbugbuster/tderesources/ConfigureChecks.cmake | 36 | ||||
-rw-r--r-- | kbugbuster/tderesources/Makefile.am | 20 | ||||
-rw-r--r-- | kbugbuster/tderesources/bugzilla.desktop | 48 | ||||
-rw-r--r-- | kbugbuster/tderesources/kcalresource.cpp | 316 | ||||
-rw-r--r-- | kbugbuster/tderesources/kcalresource.h | 124 | ||||
-rw-r--r-- | kbugbuster/tderesources/kcalresource_plugin.cpp | 37 | ||||
-rw-r--r-- | kbugbuster/tderesources/kcalresourceconfig.cpp | 92 | ||||
-rw-r--r-- | kbugbuster/tderesources/kcalresourceconfig.h | 54 | ||||
-rw-r--r-- | kbugbuster/tderesources/resourceprefs.kcfgc | 9 | ||||
-rw-r--r-- | kbugbuster/tderesources/tderesources_kcal_bugzilla.kcfg | 20 |
11 files changed, 799 insertions, 0 deletions
diff --git a/kbugbuster/tderesources/CMakeLists.txt b/kbugbuster/tderesources/CMakeLists.txt new file mode 100644 index 00000000..ec5956a3 --- /dev/null +++ b/kbugbuster/tderesources/CMakeLists.txt @@ -0,0 +1,43 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include( ConfigureChecks.cmake ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../backend + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${LIBKCAL_INCLUDE_DIR} +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${LIBKCAL_LIBRARY_DIR} +) + + +##### other data ################################ + +install( FILES + bugzilla.desktop + DESTINATION ${SERVICES_INSTALL_DIR}/tderesources/kcal ) + + +##### kcal_bugzilla (module) #################### + +tde_add_kpart( kcal_bugzilla AUTOMOC + SOURCES + kcalresource.cpp kcalresourceconfig.cpp + kcalresource_plugin.cpp resourceprefs.kcfgc + LINK kbbbackend_pic-static tdecore-shared kio-shared kabc kcal tderesources + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/kbugbuster/tderesources/ConfigureChecks.cmake b/kbugbuster/tderesources/ConfigureChecks.cmake new file mode 100644 index 00000000..b12337a1 --- /dev/null +++ b/kbugbuster/tderesources/ConfigureChecks.cmake @@ -0,0 +1,36 @@ +################################################# +# +# (C) 2012 Slavek Banko +# slavek (DOT) banko (AT) axis.cz +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +message( "-- checking for 'libkcal'" ) + +find_path( + LIBKCAL_INCLUDE_DIR + kcalversion.h + PATHS + ${TDE_INCLUDE_DIR}/libkcal + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +find_library( + LIBKCAL_LIBRARY + kcal + PATHS + ${TDE_LIB_DIR} + ${TQT_LIBRARY_DIRS} +) +if( LIBKCAL_LIBRARY ) + get_filename_component( LIBKCAL_LIBRARY_DIR ${LIBKCAL_LIBRARY} PATH CACHE ) +endif( ) + +if( NOT LIBKCAL_INCLUDE_DIR OR NOT LIBKCAL_LIBRARY_DIR ) + tde_message_fatal( "libkcal required, but was not found on your system" ) +endif( ) diff --git a/kbugbuster/tderesources/Makefile.am b/kbugbuster/tderesources/Makefile.am new file mode 100644 index 00000000..ebd63550 --- /dev/null +++ b/kbugbuster/tderesources/Makefile.am @@ -0,0 +1,20 @@ +if include_kcalresource +LIBKCAL_INCLUDES= $(KDE_INCLUDES)/libkcal +endif + +INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/kbugbuster/backend $(all_includes) $(KDE_INCLUDES) $(LIBKCAL_INCLUDES) + +kde_module_LTLIBRARIES = kcal_bugzilla.la + +kcal_bugzilla_la_SOURCES = kcalresource.cpp kcalresourceconfig.cpp \ + kcalresource_plugin.cpp resourceprefs.kcfgc +kcal_bugzilla_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +kcal_bugzilla_la_LIBADD = ../backend/libkbbbackend.la -lkcal + +servicedir = $(kde_servicesdir)/tderesources/kcal +service_DATA = bugzilla.desktop + +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kres_bugzilla.pot diff --git a/kbugbuster/tderesources/bugzilla.desktop b/kbugbuster/tderesources/bugzilla.desktop new file mode 100644 index 00000000..767b06cd --- /dev/null +++ b/kbugbuster/tderesources/bugzilla.desktop @@ -0,0 +1,48 @@ +[Desktop Entry] +Name=Bugzilla To-do List +Name[bg]=Задачи (Bugzilla) +Name[ca]=Llista de pendents de Bugzilla +Name[cs]=Seznam úkolů (Bugzilla) +Name[da]=Bugzilla gøremålsliste +Name[de]=Bugzilla Todo-Liste +Name[el]=Προς υλοποίηση λίστα του Bugzilla +Name[es]=Listado de tareas pendientes de BugZilla +Name[et]=Bugzilla ülesannete nimekiri +Name[eu]=Bugzilla-ren egiteke zerrenda +Name[fa]=فهرست کار انجامی Bugzilla +Name[fi]=Bugzilla-tehtäväluettelo +Name[fr]=Liste de tâches de Bugzilla +Name[ga]=Tascliosta Bugzilla +Name[gl]=Lista de itens por facer de Bugzilla +Name[he]=רשימת מטלות של Bugzilla +Name[hu]=Bugzilla feladatlista +Name[is]=Bugzilla verklisti +Name[it]=Lista delle cosa da fare di Bugzilla +Name[ja]=BugzillaToDo リスト +Name[ka]=Bugzilla-ს დავალებათა სია +Name[kk]=Bugzilla To-do тізімі +Name[lt]=Bugzilla darbų sąrašas +Name[nb]=Bugzilla-huskeliste +Name[nds]=Bugzilla-Opgavenlist +Name[ne]=बगजिला गर्नुपर्ने कार्य सूची +Name[nl]=Bugzilla Todo-lijst +Name[nn]=Bugzilla-hugseliste +Name[pa]=ਬੱਗਜੀਲਾ ਕਰਨ ਸੂਚੀ +Name[pl]=Lista rzeczy do zrobienia w Bugzilli +Name[pt]=Lista de Itens Por-Fazer do Bugzilla +Name[pt_BR]=Lista de Itens Por-Fazer do Bugzilla +Name[ru]=Список TODO Bugzilla +Name[sk]=Zoznam úloh v Bugzille +Name[sl]=Seznam »za-narediti« v Bugzilli +Name[sr]=Листа послова Bugzilla-е +Name[sr@Latn]=Lista poslova Bugzilla-e +Name[sv]=Bugzilla uppgiftslista +Name[tr]=Bugzilla To-do Listesi +Name[uk]=Список завдань Bugzilla +Name[zh_CN]=Bugzilla 待办列表 +Name[zh_TW]=Bugzilla 待辦清單 +X-TDE-Library=kcal_bugzilla +Type=Service +ServiceTypes=KResources/Plugin +X-TDE-ResourceFamily=calendar +X-TDE-ResourceType=bugzilla diff --git a/kbugbuster/tderesources/kcalresource.cpp b/kbugbuster/tderesources/kcalresource.cpp new file mode 100644 index 00000000..62051bc5 --- /dev/null +++ b/kbugbuster/tderesources/kcalresource.cpp @@ -0,0 +1,316 @@ +/* + This file is part of KBugBuster. + + Copyright (c) 2003 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 <typeinfo> +#include <stdlib.h> + +#include <tqdatetime.h> +#include <tqstring.h> +#include <tqptrlist.h> + +#include <kdebug.h> +#include <kurl.h> +#include <kio/job.h> +#include <klocale.h> +#include <kstandarddirs.h> + +#include <vcaldrag.h> +#include <vcalformat.h> +#include <icalformat.h> +#include <exceptions.h> +#include <incidence.h> +#include <event.h> +#include <todo.h> +#include <journal.h> +#include <filestorage.h> + +#include <kabc/locknull.h> + +#include <tderesources/configwidget.h> + +#include "bugsystem.h" +#include "bugserver.h" + +#include "kcalresourceconfig.h" +#include "resourceprefs.h" + +#include "kcalresource.h" + +KCalResource::KCalResource( const TDEConfig* config ) + : ResourceCached( config ), mLock( 0 ) +{ + mPrefs = new KBB::ResourcePrefs; + + TDEConfigSkeletonItem::List items = mPrefs->items(); + TDEConfigSkeletonItem::List::Iterator it; + for( it = items.begin(); it != items.end(); ++it ) { + (*it)->setGroup( identifier() ); + } + + if ( config ) { + readConfig( config ); + } + + init(); +} + +KCalResource::~KCalResource() +{ + close(); + + if ( mDownloadJob ) mDownloadJob->kill(); + if ( mUploadJob ) mUploadJob->kill(); + + delete mLock; +} + +void KCalResource::init() +{ + mDownloadJob = 0; + mUploadJob = 0; + + setType( "remote" ); + + mOpen = false; + + mLock = new KABC::LockNull( true ); + + TDEConfig config( "kbugbusterrc" ); + + BugSystem::self()->readConfig( &config ); +} + +KBB::ResourcePrefs *KCalResource::prefs() +{ + return mPrefs; +} + +void KCalResource::readConfig( const TDEConfig * ) +{ + mPrefs->readConfig(); +} + +void KCalResource::writeConfig( TDEConfig *config ) +{ + kdDebug() << "KCalResource::writeConfig()" << endl; + + ResourceCalendar::writeConfig( config ); + + mPrefs->writeConfig(); +} + +TQString KCalResource::cacheFile() +{ + TQString file = locateLocal( "cache", "kcal/tderesources/" + identifier() ); + kdDebug() << "KCalResource::cacheFile(): " << file << endl; + return file; +} + +bool KCalResource::doOpen() +{ + kdDebug(5800) << "KCalResource::doOpen()" << endl; + + mOpen = true; + + return true; +} + +bool KCalResource::doLoad() +{ + kdDebug() << "KCalResource::doLoad()" << endl; + + if ( !mOpen ) return true; + + if ( mDownloadJob ) { + kdWarning() << "KCalResource::doLoad(): download still in progress." + << endl; + return false; + } + if ( mUploadJob ) { + kdWarning() << "KCalResource::doLoad(): upload still in progress." + << endl; + return false; + } + + mCalendar.close(); + + mCalendar.load( cacheFile() ); + + BugSystem *kbb = BugSystem::self(); + + kdDebug() << "KNOWN SERVERS:" << endl; + TQValueList<BugServer *> servers = kbb->serverList(); + TQValueList<BugServer *>::ConstIterator it; + for( it = servers.begin(); it != servers.end(); ++it ) { + kdDebug() << " " << (*it)->identifier() << endl; + } + + kbb->setCurrentServer( mPrefs->server() ); + if ( !kbb->server() ) { + kdError() << "Server not found." << endl; + return false; + } else { + kdDebug() << "CURRENT SERVER: " << kbb->server()->identifier() << endl; + } + + kbb->retrievePackageList(); + + Package package = kbb->package( mPrefs->product() ); + + connect( kbb, TQT_SIGNAL( bugListAvailable( const Package &, const TQString &, + const Bug::List & ) ), + TQT_SLOT( slotBugListAvailable( const Package &, const TQString &, + const Bug::List & ) ) ); + + kbb->retrieveBugList( package, mPrefs->component() ); + + return true; +} + +void KCalResource::slotBugListAvailable( const Package &, const TQString &, + const Bug::List &bugs ) +{ + kdDebug() << "KCalResource::slotBugListAvailable()" << endl; + + if ( bugs.isEmpty() ) return; + + TQString masterUid = "kbb_" + BugSystem::self()->server()->identifier(); + KCal::Todo *masterTodo = mCalendar.todo( masterUid ); + if ( !masterTodo ) { + masterTodo = new KCal::Todo; + masterTodo->setUid( masterUid ); + masterTodo->setSummary( resourceName() ); + mCalendar.addTodo( masterTodo ); + } + + Bug::List::ConstIterator it; + for( it = bugs.begin(); it != bugs.end(); ++it ) { + Bug bug = *it; + kdDebug() << " Bug " << bug.number() << ": " << bug.title() << endl; + TQString uid = "KBugBuster_" + bug.number(); + KCal::Todo *newTodo = 0; + KCal::Todo *todo = mCalendar.todo( uid ); + if ( !todo ) { + newTodo = new KCal::Todo; + newTodo->setUid( uid ); + TQString uri = "http://bugs.trinitydesktop.org/show_bug.cgi?id=%1"; + newTodo->addAttachment( new KCal::Attachment( uri.arg( bug.number() ) ) ); + todo = newTodo; + } + + todo->setSummary( bug.number() + ": " + bug.title() ); + todo->setRelatedTo( masterTodo ); + + if ( newTodo ) mCalendar.addTodo( newTodo ); + } + + emit resourceChanged( this ); +} + +void KCalResource::slotLoadJobResult( TDEIO::Job *job ) +{ + if ( job->error() ) { + job->showErrorDialog( 0 ); + } else { + kdDebug() << "KCalResource::slotLoadJobResult() success" << endl; + + mCalendar.close(); + mCalendar.load( cacheFile() ); + + emit resourceChanged( this ); + } + + mDownloadJob = 0; + + emit resourceLoaded( this ); +} + +bool KCalResource::doSave() +{ + kdDebug() << "KCalResource::doSave()" << endl; + + if ( !mOpen ) return true; + + if ( readOnly() ) { + emit resourceSaved( this ); + return true; + } + + if ( mDownloadJob ) { + kdWarning() << "KCalResource::save(): download still in progress." + << endl; + return false; + } + if ( mUploadJob ) { + kdWarning() << "KCalResource::save(): upload still in progress." + << endl; + return false; + } + + mCalendar.save( cacheFile() ); + + mUploadJob = TDEIO::file_copy( KURL( cacheFile() ), mUploadUrl, -1, true ); + connect( mUploadJob, TQT_SIGNAL( result( TDEIO::Job * ) ), + TQT_SLOT( slotSaveJobResult( TDEIO::Job * ) ) ); + + return true; +} + +bool KCalResource::isSaving() +{ + return mUploadJob; +} + +void KCalResource::slotSaveJobResult( TDEIO::Job *job ) +{ + if ( job->error() ) { + job->showErrorDialog( 0 ); + } else { + kdDebug() << "KCalResource::slotSaveJobResult() success" << endl; + } + + mUploadJob = 0; + + emit resourceSaved( this ); +} + +void KCalResource::doClose() +{ + if ( !mOpen ) return; + + mCalendar.close(); + mOpen = false; +} + +KABC::Lock *KCalResource::lock() +{ + return mLock; +} + +void KCalResource::dump() const +{ + ResourceCalendar::dump(); + kdDebug(5800) << " DownloadUrl: " << mDownloadUrl.url() << endl; + kdDebug(5800) << " UploadUrl: " << mUploadUrl.url() << endl; + kdDebug(5800) << " ReloadPolicy: " << mReloadPolicy << endl; +} + +#include "kcalresource.moc" diff --git a/kbugbuster/tderesources/kcalresource.h b/kbugbuster/tderesources/kcalresource.h new file mode 100644 index 00000000..cfa4e2a6 --- /dev/null +++ b/kbugbuster/tderesources/kcalresource.h @@ -0,0 +1,124 @@ +/* + This file is part of KBugBuster. + + Copyright (c) 2003 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 KCALRESOURCE_H +#define KCALRESOURCE_H + +#include <tqptrlist.h> +#include <tqstring.h> +#include <tqdatetime.h> + +#include <kurl.h> +#include <kconfig.h> +#include <kdirwatch.h> + +#include <incidence.h> +#include <calendarlocal.h> +#include <icalformat.h> +#include <resourcecached.h> + +#include <bugsystem.h> + +namespace TDEIO { +class FileCopyJob; +class Job; +} + +namespace KBB { +class ResourcePrefs; +} + +/** + This class provides a calendar stored as a remote file. +*/ +class KCalResource : public KCal::ResourceCached +{ + Q_OBJECT + + + friend class KCalResourceConfig; + + public: + /** + Reload policy. + + @see setReloadPolicy(), reloadPolicy() + */ + enum { ReloadNever, ReloadOnStartup, ReloadOnceADay, ReloadAlways }; + + /** + Create resource from configuration information stored in TDEConfig object. + */ + KCalResource( const TDEConfig * ); + ~KCalResource(); + + void readConfig( const TDEConfig *config ); + void writeConfig( TDEConfig *config ); + + KBB::ResourcePrefs *prefs(); + + /** + Return name of file used as cache for remote file. + */ + TQString cacheFile(); + + KABC::Lock *lock(); + + bool isSaving(); + + void dump() const; + + protected slots: + void slotBugListAvailable( const Package &, const TQString &, + const Bug::List &bugs ); + + void slotLoadJobResult( TDEIO::Job * ); + void slotSaveJobResult( TDEIO::Job * ); + + protected: + bool doOpen(); + void doClose(); + bool doLoad(); + bool doSave(); + + private: + void init(); + + KBB::ResourcePrefs *mPrefs; + + KURL mDownloadUrl; + KURL mUploadUrl; + + int mReloadPolicy; + + KCal::ICalFormat mFormat; + + bool mOpen; + + TDEIO::FileCopyJob *mDownloadJob; + TDEIO::FileCopyJob *mUploadJob; + + KABC::Lock *mLock; + + class Private; + Private *d; +}; + +#endif diff --git a/kbugbuster/tderesources/kcalresource_plugin.cpp b/kbugbuster/tderesources/kcalresource_plugin.cpp new file mode 100644 index 00000000..7cf81289 --- /dev/null +++ b/kbugbuster/tderesources/kcalresource_plugin.cpp @@ -0,0 +1,37 @@ +/* + This file is part of KBugBuster. + + Copyright (c) 2003 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 "kcalresourceconfig.h" +#include "kcalresource.h" + +#include <kglobal.h> +#include <klocale.h> + +using namespace KCal; + +extern "C" +{ + KDE_EXPORT void *init_kcal_bugzilla() + { + TDEGlobal::locale()->insertCatalogue( "kres_bugzilla" ); + return new KRES::PluginFactory<KCalResource,KCalResourceConfig>(); + } +} diff --git a/kbugbuster/tderesources/kcalresourceconfig.cpp b/kbugbuster/tderesources/kcalresourceconfig.cpp new file mode 100644 index 00000000..58466642 --- /dev/null +++ b/kbugbuster/tderesources/kcalresourceconfig.cpp @@ -0,0 +1,92 @@ +/* + This file is part of KBugBuster. + + Copyright (c) 2003 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 <typeinfo> + +#include <tqlabel.h> +#include <tqlayout.h> + +#include <klineedit.h> +#include <klocale.h> +#include <kdebug.h> +#include <kstandarddirs.h> +#include <kdialog.h> + +#include "kcalresource.h" +#include "resourceprefs.h" +#include "kcalresourceconfig.h" + +KCalResourceConfig::KCalResourceConfig( TQWidget* parent, const char* name ) + : KRES::ConfigWidget( parent, name ) +{ + resize( 245, 115 ); + + TQGridLayout *mainLayout = new TQGridLayout( this, 2, 2 ); + mainLayout->setSpacing( KDialog::spacingHint() ); + + TQLabel *label = new TQLabel( i18n("Server:"), this ); + mainLayout->addWidget( label, 0, 0 ); + + mServerEdit = new KLineEdit( this ); + mainLayout->addWidget( mServerEdit, 0, 1 ); + + + label = new TQLabel( i18n("Product:"), this ); + mainLayout->addWidget( label, 1, 0 ); + + mProductEdit = new KLineEdit( this ); + mainLayout->addWidget( mProductEdit, 1, 1 ); + + + label = new TQLabel( i18n("Component:"), this ); + mainLayout->addWidget( label, 2, 0 ); + + mComponentEdit = new KLineEdit( this ); + mainLayout->addWidget( mComponentEdit, 2, 1 ); +} + +void KCalResourceConfig::loadSettings( KRES::Resource *resource ) +{ + KCalResource *res = static_cast<KCalResource *>( resource ); + if ( res ) { + KBB::ResourcePrefs *p = res->prefs(); + mServerEdit->setText( p->server() ); + mProductEdit->setText( p->product() ); + mComponentEdit->setText( p->component() ); + } else { + kdError(5700) << "KCalResourceConfig::loadSettings(): no KCalResource, cast failed" << endl; + } +} + +void KCalResourceConfig::saveSettings( KRES::Resource *resource ) +{ + KCalResource *res = static_cast<KCalResource*>( resource ); + if ( res ) { + KBB::ResourcePrefs *p = res->prefs(); + p->setServer( mServerEdit->text() ); + p->setProduct( mProductEdit->text() ); + p->setComponent( mComponentEdit->text() ); + } else { + kdError(5700) << "KCalResourceConfig::saveSettings(): no KCalResource, cast failed" << endl; + } +} + +#include "kcalresourceconfig.moc" diff --git a/kbugbuster/tderesources/kcalresourceconfig.h b/kbugbuster/tderesources/kcalresourceconfig.h new file mode 100644 index 00000000..f0eae40e --- /dev/null +++ b/kbugbuster/tderesources/kcalresourceconfig.h @@ -0,0 +1,54 @@ +/* + This file is part of KBugBuster. + + Copyright (c) 2003 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 KCALRESOURCECONFIG_H +#define KCALRESOURCECONFIG_H + +#include <tderesources/resource.h> +#include <tderesources/configwidget.h> + +class KLineEdit; + +/** + Configuration widget for remote resource. + + @see KCalResource +*/ +class KCalResourceConfig : public KRES::ConfigWidget +{ + Q_OBJECT + + public: + KCalResourceConfig( TQWidget *parent = 0, const char *name = 0 ); + + public slots: + virtual void loadSettings( KRES::Resource *resource ); + virtual void saveSettings( KRES::Resource *resource ); + + private: + KLineEdit *mServerEdit; + KLineEdit *mComponentEdit; + KLineEdit *mProductEdit; + + class Private; + Private *d; +}; + +#endif diff --git a/kbugbuster/tderesources/resourceprefs.kcfgc b/kbugbuster/tderesources/resourceprefs.kcfgc new file mode 100644 index 00000000..88125829 --- /dev/null +++ b/kbugbuster/tderesources/resourceprefs.kcfgc @@ -0,0 +1,9 @@ +# Code generation options for kconfig_compiler +File=tderesources_kcal_bugzilla.kcfg +ClassName=ResourcePrefs +NameSpace=KBB +Singleton=false +Mutators=true +GlobalEnums=true +#ItemAccessors=true +#SetUserTexts=true diff --git a/kbugbuster/tderesources/tderesources_kcal_bugzilla.kcfg b/kbugbuster/tderesources/tderesources_kcal_bugzilla.kcfg new file mode 100644 index 00000000..360a2144 --- /dev/null +++ b/kbugbuster/tderesources/tderesources_kcal_bugzilla.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="Server"> + <label>Server</label> + </entry> + <entry type="String" name="Product"> + <label>Product</label> + </entry> + <entry type="String" name="Component"> + <label>Component</label> + </entry> + </group> + +</kcfg> |