diff options
author | Timothy Pearson <[email protected]> | 2013-02-15 21:57:54 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2013-02-15 21:57:54 -0600 |
commit | ed99a30644c19b0a3cf0d2147243532df4daa16b (patch) | |
tree | 7f3f2850e59824fdf100a642367a82b1e7f0204f /tdeabc/plugins/dir | |
parent | e5f2d46e9caf6942f365f1b454087dda71a340f7 (diff) | |
download | tdelibs-ed99a30644c19b0a3cf0d2147243532df4daa16b.tar.gz tdelibs-ed99a30644c19b0a3cf0d2147243532df4daa16b.zip |
Rename additional header files to avoid conflicts with KDE4
Diffstat (limited to 'tdeabc/plugins/dir')
-rw-r--r-- | tdeabc/plugins/dir/CMakeLists.txt | 73 | ||||
-rw-r--r-- | tdeabc/plugins/dir/Makefile.am | 28 | ||||
-rw-r--r-- | tdeabc/plugins/dir/dir.desktop | 92 | ||||
-rw-r--r-- | tdeabc/plugins/dir/resourcedir.cpp | 310 | ||||
-rw-r--r-- | tdeabc/plugins/dir/resourcedir.h | 113 | ||||
-rw-r--r-- | tdeabc/plugins/dir/resourcedirconfig.cpp | 107 | ||||
-rw-r--r-- | tdeabc/plugins/dir/resourcedirconfig.h | 54 | ||||
-rw-r--r-- | tdeabc/plugins/dir/resourcedirplugin.cpp | 32 |
8 files changed, 809 insertions, 0 deletions
diff --git a/tdeabc/plugins/dir/CMakeLists.txt b/tdeabc/plugins/dir/CMakeLists.txt new file mode 100644 index 000000000..fd4161342 --- /dev/null +++ b/tdeabc/plugins/dir/CMakeLists.txt @@ -0,0 +1,73 @@ +################################################# +# +# (C) 2010 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR}/kabc + ${CMAKE_SOURCE_DIR}/kabc + + ${TQT_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/tdecore + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/dcop + ${CMAKE_SOURCE_DIR}/tdecore + ${CMAKE_SOURCE_DIR}/tdeui + ${CMAKE_SOURCE_DIR}/tdeio + ${CMAKE_SOURCE_DIR}/tdeio/tdeio + ${CMAKE_SOURCE_DIR}/tdeio/tdefile +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### headers ################################### + +install( FILES + resourcedir.h + DESTINATION ${INCLUDE_INSTALL_DIR}/kabc ) + + +##### other data ################################ + +install( FILES dir.desktop DESTINATION ${SERVICES_INSTALL_DIR}/tderesources/kabc ) + + +##### kabc_dir (library) ######################## + +set( target kabc_dir ) + +set( ${target}_SRCS + resourcedir.cpp resourcedirconfig.cpp +) + +tde_add_library( ${target} SHARED AUTOMOC + SOURCES ${${target}_SRCS} + VERSION 1.0.0 + LINK tdeabc-shared + DESTINATION ${LIB_INSTALL_DIR} +) + + +##### kabc_dir (module) ######################### + +set( target kabc_dir ) + +set( ${target}_SRCS + resourcedirplugin.cpp +) + +tde_add_kpart( ${target} + SOURCES ${${target}_SRCS} + LINK kabc_dir-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdeabc/plugins/dir/Makefile.am b/tdeabc/plugins/dir/Makefile.am new file mode 100644 index 000000000..94ddad3cc --- /dev/null +++ b/tdeabc/plugins/dir/Makefile.am @@ -0,0 +1,28 @@ +INCLUDES = -I$(top_builddir)/kabc -I$(top_srcdir)/kabc -I$(top_builddir) $(all_includes) + +# these are the headers for your project +noinst_HEADERS = resourcedirconfig.h + +lib_LTLIBRARIES = libkabc_dir.la +libkabc_dir_la_SOURCES = resourcedir.cpp resourcedirconfig.cpp +libkabc_dir_la_LDFLAGS = $(KDE_RPATH) $(all_libraries) -version-info 1:0:0 -no-undefined +libkabc_dir_la_LIBADD = $(LIB_KABC) $(LIB_QT) $(top_builddir)/tderesources/libtderesources.la $(LIB_TDECORE) $(LIB_TDEFILE) $(LIB_TDEUI) +libkabc_dir_la_COMPILE_FIRST = $(top_builddir)/tdeabc/addressee.h + +kde_module_LTLIBRARIES = kabc_dir.la +kabc_dir_la_SOURCES = resourcedirplugin.cpp +kabc_dir_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) -no-undefined +kabc_dir_la_LIBADD = libkabc_dir.la $(LIB_QT) $(LIB_TDECORE) + +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kabc_dir.pot + +kabcincludedir = $(includedir)/kabc +kabcinclude_HEADERS = resourcedir.h + +servicedir = $(kde_servicesdir)/tderesources/kabc +service_DATA = dir.desktop + +resourcedirplugin.lo: ../../addressee.h diff --git a/tdeabc/plugins/dir/dir.desktop b/tdeabc/plugins/dir/dir.desktop new file mode 100644 index 000000000..a841040f9 --- /dev/null +++ b/tdeabc/plugins/dir/dir.desktop @@ -0,0 +1,92 @@ +[Desktop Entry] +Name=Directory +Name[af]=Gids +Name[ar]=دليل +Name[az]=Cərgə +Name[be]=Тэчка +Name[bn]=ডিরেক্টরি +Name[br]=Renkell +Name[bs]=Direktorij +Name[ca]=Directori +Name[cs]=Adresář +Name[csb]=Katalog +Name[cy]=Cyfeiriadur +Name[da]=Mappe +Name[de]=Verzeichnis +Name[el]=Κατάλογος +Name[eo]=Dosierujo +Name[es]=Directorio +Name[et]=Kataloog +Name[eu]=Direktorioa +Name[fa]=فهرست راهنما +Name[fi]=Hakemisto +Name[fo]=Fíluskrá +Name[fr]=Dossier +Name[fy]=Map +Name[ga]=Comhadlann +Name[gl]=Directório +Name[he]=ספריה +Name[hi]=डिरेक्ट्री +Name[hr]=Mapa +Name[hsb]=Zapisk +Name[hu]=Könyvtár +Name[id]=Direktori +Name[is]=Mappa +Name[it]=Cartella +Name[ja]=ディレクトリ +Name[ka]=დასტა +Name[kk]=Каталог +Name[km]=ថត +Name[ko]=자료방 +Name[ku]=Peldank +Name[lb]=Verzeechnis +Name[lt]=Aplankas +Name[lv]=Direktorija +Name[mk]=Именик +Name[mn]=Лавлах +Name[ms]=Direktori +Name[mt]=Direttorju +Name[nb]=Katalog +Name[nds]=Orner +Name[ne]=डाइरेक्टरी +Name[nl]=Map +Name[nn]=Katalog +Name[nso]=Tshupetso +Name[oc]=Directori +Name[pa]=ਡਾਇਰੈਕਟਰੀ +Name[pl]=Katalog +Name[pt]=Directoria +Name[pt_BR]=Diretório +Name[ro]=Director +Name[ru]=Каталог +Name[rw]=ububiko +Name[se]=Ohcu +Name[sk]=Priečinok +Name[sl]=Imenik +Name[sq]=Fioka +Name[sr]=Фасцикла +Name[sr@Latn]=Fascikla +Name[ss]=I-directory +Name[sv]=Katalog +Name[ta]=அடைவு +Name[te]=డైరక్టరి +Name[tg]=Феҳраст +Name[th]=ไดเรกทอรี +Name[tr]=Dizin +Name[tt]=Törgäk +Name[uk]=Каталог +Name[uz]=Jild +Name[uz@cyrillic]=Жилд +Name[ven]=Tsumbavhulwo +Name[vi]=Thư mục +Name[wa]=Ridant +Name[xh]=Ulawulo +Name[zh_CN]=目录 +Name[zh_HK]=目錄 +Name[zh_TW]=目錄 +Name[zu]=Uhlu lwamafayela +X-TDE-Library=kabc_dir +Type=Service +ServiceTypes=KResources/Plugin +X-TDE-ResourceFamily=contact +X-TDE-ResourceType=dir diff --git a/tdeabc/plugins/dir/resourcedir.cpp b/tdeabc/plugins/dir/resourcedir.cpp new file mode 100644 index 000000000..53f178a6d --- /dev/null +++ b/tdeabc/plugins/dir/resourcedir.cpp @@ -0,0 +1,310 @@ +/* + This file is part of libkabc. + Copyright (c) 2002 - 2003 Tobias Koenig <[email protected]> + + 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 <errno.h> +#include <signal.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> + +#include <tqregexp.h> +#include <tqtimer.h> +#include <tqwidget.h> + +#include <tdeapplication.h> +#include <tdeconfig.h> +#include <kdebug.h> +#include <kgenericfactory.h> +#include <tdeglobal.h> +#include <tdelocale.h> +#include <kstandarddirs.h> +#include <kurlrequester.h> + +#include "addressbook.h" +#include "formatfactory.h" +#include "resourcedirconfig.h" +#include "stdaddressbook.h" +#include "lock.h" + +#include "resourcedir.h" + +using namespace KABC; + +extern "C" +{ + void *init_kabc_dir() + { + return new KRES::PluginFactory<ResourceDir,ResourceDirConfig>(); + } +} + + +ResourceDir::ResourceDir( const TDEConfig *config ) + : Resource( config ), mAsynchronous( false ) +{ + if ( config ) { + init( config->readPathEntry( "FilePath", StdAddressBook::directoryName() ), + config->readEntry( "FileFormat", "vcard" ) ); + } else { + init( StdAddressBook::directoryName(), "vcard" ); + } +} + +ResourceDir::ResourceDir( const TQString &path, const TQString &format ) + : Resource( 0 ), mAsynchronous( false ) +{ + init( path, format ); +} + +void ResourceDir::init( const TQString &path, const TQString &format ) +{ + mFormatName = format; + + FormatFactory *factory = FormatFactory::self(); + mFormat = factory->format( mFormatName ); + + if ( !mFormat ) { + mFormatName = "vcard"; + mFormat = factory->format( mFormatName ); + } + + mLock = 0; + + connect( &mDirWatch, TQT_SIGNAL( dirty(const TQString&) ), TQT_SLOT( pathChanged() ) ); + connect( &mDirWatch, TQT_SIGNAL( created(const TQString&) ), TQT_SLOT( pathChanged() ) ); + connect( &mDirWatch, TQT_SIGNAL( deleted(const TQString&) ), TQT_SLOT( pathChanged() ) ); + + setPath( path ); +} + +ResourceDir::~ResourceDir() +{ + delete mFormat; + mFormat = 0; +} + +void ResourceDir::writeConfig( TDEConfig *config ) +{ + Resource::writeConfig( config ); + + if ( mPath == StdAddressBook::directoryName() ) + config->deleteEntry( "FilePath" ); + else + config->writePathEntry( "FilePath", mPath ); + + config->writeEntry( "FileFormat", mFormatName ); +} + +Ticket *ResourceDir::requestSaveTicket() +{ + kdDebug(5700) << "ResourceDir::requestSaveTicket()" << endl; + + if ( !addressBook() ) return 0; + + delete mLock; + mLock = new Lock( mPath ); + + if ( mLock->lock() ) { + addressBook()->emitAddressBookLocked(); + } else { + addressBook()->error( mLock->error() ); + kdDebug(5700) << "ResourceFile::requestSaveTicket(): Unable to lock path '" + << mPath << "': " << mLock->error() << endl; + return 0; + } + + return createTicket( this ); +} + +void ResourceDir::releaseSaveTicket( Ticket *ticket ) +{ + delete ticket; + + delete mLock; + mLock = 0; +} + +bool ResourceDir::doOpen() +{ + TQDir dir( mPath ); + if ( !dir.exists() ) { // no directory available + return dir.mkdir( dir.path() ); + } else { + TQString testName = dir.entryList( TQDir::Files )[0]; + if ( testName.isNull() || testName.isEmpty() ) // no file in directory + return true; + + TQFile file( mPath + "/" + testName ); + if ( file.open( IO_ReadOnly ) ) + return true; + + if ( file.size() == 0 ) + return true; + + bool ok = mFormat->checkFormat( &file ); + file.close(); + return ok; + } +} + +void ResourceDir::doClose() +{ +} + +bool ResourceDir::load() +{ + kdDebug(5700) << "ResourceDir::load(): '" << mPath << "'" << endl; + + mAsynchronous = false; + + TQDir dir( mPath ); + TQStringList files = dir.entryList( TQDir::Files ); + + TQStringList::Iterator it; + bool ok = true; + for ( it = files.begin(); it != files.end(); ++it ) { + TQFile file( mPath + "/" + (*it) ); + + if ( !file.open( IO_ReadOnly ) ) { + addressBook()->error( i18n( "Unable to open file '%1' for reading" ).arg( file.name() ) ); + ok = false; + continue; + } + + if ( !mFormat->loadAll( addressBook(), this, &file ) ) + ok = false; + + file.close(); + } + + return ok; +} + +bool ResourceDir::asyncLoad() +{ + mAsynchronous = true; + + bool ok = load(); + if ( !ok ) + emit loadingError( this, i18n( "Loading resource '%1' failed!" ) + .arg( resourceName() ) ); + else + emit loadingFinished( this ); + + return ok; +} + +bool ResourceDir::save( Ticket * ) +{ + kdDebug(5700) << "ResourceDir::save(): '" << mPath << "'" << endl; + + Addressee::Map::Iterator it; + bool ok = true; + + mDirWatch.stopScan(); + + for ( it = mAddrMap.begin(); it != mAddrMap.end(); ++it ) { + if ( !it.data().changed() ) + continue; + + TQFile file( mPath + "/" + (*it).uid() ); + if ( !file.open( IO_WriteOnly ) ) { + addressBook()->error( i18n( "Unable to open file '%1' for writing" ).arg( file.name() ) ); + continue; + } + + mFormat->save( *it, &file ); + + // mark as unchanged + (*it).setChanged( false ); + + file.close(); + } + + mDirWatch.startScan(); + + return ok; +} + +bool ResourceDir::asyncSave( Ticket *ticket ) +{ + bool ok = save( ticket ); + if ( !ok ) + emit savingError( this, i18n( "Saving resource '%1' failed!" ) + .arg( resourceName() ) ); + else + emit savingFinished( this ); + + return ok; +} + +void ResourceDir::setPath( const TQString &path ) +{ + mDirWatch.stopScan(); + if ( mDirWatch.contains( mPath ) ) + mDirWatch.removeDir( mPath ); + + mPath = path; + mDirWatch.addDir( mPath, true ); + mDirWatch.startScan(); +} + +TQString ResourceDir::path() const +{ + return mPath; +} + +void ResourceDir::setFormat( const TQString &format ) +{ + mFormatName = format; + + if ( mFormat ) + delete mFormat; + + FormatFactory *factory = FormatFactory::self(); + mFormat = factory->format( mFormatName ); +} + +TQString ResourceDir::format() const +{ + return mFormatName; +} + +void ResourceDir::pathChanged() +{ + if ( !addressBook() ) + return; + + clear(); + if ( mAsynchronous ) + asyncLoad(); + else { + load(); + addressBook()->emitAddressBookChanged(); + } +} + +void ResourceDir::removeAddressee( const Addressee& addr ) +{ + TQFile::remove( mPath + "/" + addr.uid() ); + mAddrMap.erase( addr.uid() ); +} + +#include "resourcedir.moc" diff --git a/tdeabc/plugins/dir/resourcedir.h b/tdeabc/plugins/dir/resourcedir.h new file mode 100644 index 000000000..dc3bdbd23 --- /dev/null +++ b/tdeabc/plugins/dir/resourcedir.h @@ -0,0 +1,113 @@ +/* + This file is part of libkabc. + Copyright (c) 2002 - 2003 Tobias Koenig <[email protected]> + + 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 KABC_RESOURCEDIR_H +#define KABC_RESOURCEDIR_H + +#include <tdeconfig.h> +#include <kdirwatch.h> + +#include <sys/types.h> + +#include <tdeabc/resource.h> + +class TQTimer; + +namespace KABC { + +class FormatPlugin; +class Lock; + +/** + @internal +*/ +class KABC_EXPORT ResourceDir : public Resource +{ + Q_OBJECT + + public: + ResourceDir( const TDEConfig* ); + ResourceDir( const TQString &path, const TQString &type = "vcard" ); + ~ResourceDir(); + + virtual void writeConfig( TDEConfig* ); + + virtual bool doOpen(); + virtual void doClose(); + + virtual Ticket *requestSaveTicket(); + virtual void releaseSaveTicket( Ticket* ); + + virtual bool load(); + virtual bool asyncLoad(); + virtual bool save( Ticket* ticket ); + virtual bool asyncSave( Ticket* ticket ); + + /** + Set path to be used for saving. + */ + void setPath( const TQString & ); + + /** + Return path used for loading and saving the address book. + */ + TQString path() const; + + /** + Set the format by name. + */ + void setFormat( const TQString &format ); + + /** + Returns the format name. + */ + TQString format() const; + + /** + Remove a addressee from its source. + This method is mainly called by KABC::AddressBook. + */ + virtual void removeAddressee( const Addressee& addr ); + + protected slots: + void pathChanged(); + + protected: + void init( const TQString &path, const TQString &format ); + + private: + FormatPlugin *mFormat; + + KDirWatch mDirWatch; + + TQString mPath; + TQString mFormatName; + + Lock *mLock; + + bool mAsynchronous; + + class ResourceDirPrivate; + ResourceDirPrivate *d; +}; + +} + +#endif diff --git a/tdeabc/plugins/dir/resourcedirconfig.cpp b/tdeabc/plugins/dir/resourcedirconfig.cpp new file mode 100644 index 000000000..2807872f8 --- /dev/null +++ b/tdeabc/plugins/dir/resourcedirconfig.cpp @@ -0,0 +1,107 @@ +/* + This file is part of libkabc. + Copyright (c) 2002 Tobias Koenig <[email protected]> + + 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 <kdebug.h> +#include <tdelocale.h> +#include <kstandarddirs.h> +#include <kdialog.h> + +#include "formatfactory.h" +#include "resourcedir.h" +#include "stdaddressbook.h" + +#include "resourcedirconfig.h" + +using namespace KABC; + +ResourceDirConfig::ResourceDirConfig( TQWidget* parent, const char* name ) + : KRES::ConfigWidget( parent, name ) +{ + TQGridLayout *mainLayout = new TQGridLayout( this, 2, 2, 0, + KDialog::spacingHint() ); + + TQLabel *label = new TQLabel( i18n( "Format:" ), this ); + mFormatBox = new KComboBox( this ); + + mainLayout->addWidget( label, 0, 0 ); + mainLayout->addWidget( mFormatBox, 0, 1 ); + + label = new TQLabel( i18n( "Location:" ), this ); + mFileNameEdit = new KURLRequester( this ); + mFileNameEdit->setMode( KFile::Directory ); + + mainLayout->addWidget( label, 1, 0 ); + mainLayout->addWidget( mFileNameEdit, 1, 1 ); + + FormatFactory *factory = FormatFactory::self(); + TQStringList formats = factory->formats(); + TQStringList::Iterator it; + for ( it = formats.begin(); it != formats.end(); ++it ) { + FormatInfo *info = factory->info( *it ); + if ( info ) { + mFormatTypes << (*it); + mFormatBox->insertItem( info->nameLabel ); + } + } + + mInEditMode = false; +} + +void ResourceDirConfig::setEditMode( bool value ) +{ + mFormatBox->setEnabled( !value ); + mInEditMode = value; +} + +void ResourceDirConfig::loadSettings( KRES::Resource *res ) +{ + ResourceDir *resource = dynamic_cast<ResourceDir*>( res ); + + if ( !resource ) { + kdDebug(5700) << "ResourceDirConfig::loadSettings(): cast failed" << endl; + return; + } + + mFormatBox->setCurrentItem( mFormatTypes.findIndex( resource->format() ) ); + + mFileNameEdit->setURL( resource->path() ); + if ( mFileNameEdit->url().isEmpty() ) + mFileNameEdit->setURL( KABC::StdAddressBook::directoryName() ); +} + +void ResourceDirConfig::saveSettings( KRES::Resource *res ) +{ + ResourceDir *resource = dynamic_cast<ResourceDir*>( res ); + + if ( !resource ) { + kdDebug(5700) << "ResourceDirConfig::loadSettings(): cast failed" << endl; + return; + } + + if ( mInEditMode ) + resource->setFormat( mFormatTypes[ mFormatBox->currentItem() ] ); + + resource->setPath( mFileNameEdit->url() ); +} + +#include "resourcedirconfig.moc" diff --git a/tdeabc/plugins/dir/resourcedirconfig.h b/tdeabc/plugins/dir/resourcedirconfig.h new file mode 100644 index 000000000..9df1778d3 --- /dev/null +++ b/tdeabc/plugins/dir/resourcedirconfig.h @@ -0,0 +1,54 @@ +/* + This file is part of libkabc. + Copyright (c) 2002 Tobias Koenig <[email protected]> + + 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 RESOURCEDIRCONFIG_H +#define RESOURCEDIRCONFIG_H + +#include <kcombobox.h> +#include <kurlrequester.h> + +#include <tderesources/configwidget.h> + +namespace KABC { + +class KABC_EXPORT ResourceDirConfig : public KRES::ConfigWidget +{ + Q_OBJECT + +public: + ResourceDirConfig( TQWidget* parent = 0, const char* name = 0 ); + + void setEditMode( bool value ); + +public slots: + void loadSettings( KRES::Resource* ); + void saveSettings( KRES::Resource* ); + +private: + KComboBox* mFormatBox; + KURLRequester* mFileNameEdit; + + TQStringList mFormatTypes; + + bool mInEditMode; +}; + +} +#endif diff --git a/tdeabc/plugins/dir/resourcedirplugin.cpp b/tdeabc/plugins/dir/resourcedirplugin.cpp new file mode 100644 index 000000000..a2bd6d138 --- /dev/null +++ b/tdeabc/plugins/dir/resourcedirplugin.cpp @@ -0,0 +1,32 @@ +/* + This file is part of libkabc. + Copyright (c) 2002 - 2003 Tobias Koenig <[email protected]> + + 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 "resourcedir.h" +#include "resourcedirconfig.h" + +using namespace KABC; + +extern "C" +{ + KDE_EXPORT void *init_kabc_dir() + { + return new KRES::PluginFactory<ResourceDir, ResourceDirConfig>(); + } +} |