• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

kresources

resource.h

00001 /*
00002     This file is part of libkresources
00003 
00004     Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
00005     Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020     Boston, MA 02110-1301, USA.
00021 */
00022 #ifndef KRESOURCES_RESOURCE_H
00023 #define KRESOURCES_RESOURCE_H
00024 
00025 #include "kresources_export.h"
00026 
00027 #include <klibloader.h>
00028 
00029 #include <QtCore/QMutex>
00030 #include <QtGui/QWidget>
00031 
00032 class KConfig;
00033 class KConfigGroup;
00034 
00035 namespace KRES {
00036 
00037 class ConfigWidget;
00038 
00075 class KRESOURCES_EXPORT Resource : public QObject
00076 {
00077     friend class Factory;
00078     friend class ManagerImpl;
00079 
00080     Q_OBJECT
00081   public:
00082     typedef QList<Resource *> List;
00083 
00087     Resource();
00088 
00093     explicit Resource( const KConfigGroup &group );
00094 
00098     virtual ~Resource();
00099 
00106     virtual void writeConfig( KConfigGroup &group );
00107 
00117     bool open();
00118 
00125     void close();
00126 
00130     bool isOpen() const;
00131 
00135     void setIdentifier( const QString &identifier );
00136 
00143     QString identifier() const;
00144 
00148     void setType( const QString &type );
00149 
00153     QString type() const;
00154 
00159     virtual void setReadOnly( bool value );
00160 
00164     virtual bool readOnly() const;
00165 
00170     virtual void setResourceName( const QString &name );
00171 
00175     virtual QString resourceName() const;
00176 
00180     void setActive( bool active );
00181 
00185     bool isActive() const;
00186 
00190     virtual void dump() const;
00191 
00192   protected:
00202     virtual bool doOpen();
00203 
00208     virtual void doClose();
00209 
00210   private:
00211     class ResourcePrivate;
00212     ResourcePrivate *const d;
00213 };
00214 
00215 class KRESOURCES_EXPORT PluginFactoryBase : public KPluginFactory
00216 {
00217   public:
00218     explicit PluginFactoryBase(const char* componentName = 0, const char *catalogName = 0, QObject *parent = 0)
00219       : KPluginFactory(componentName, catalogName, parent) {}
00220     explicit PluginFactoryBase(const KAboutData &aboutData, QObject *parent = 0)
00221       : KPluginFactory(aboutData, parent) {}
00222 
00223     virtual Resource *resource( const KConfigGroup &group ) = 0;
00224     virtual Resource *resource() = 0;
00225 
00226     virtual ConfigWidget *configWidget( QWidget *parent ) = 0;
00227 
00228   protected:
00229     virtual QObject *createObject( QObject *parent, const char *className,
00230                                    const QStringList &args );
00231 };
00232 
00233 template<class TR,class TC>
00234 class PluginFactory : public PluginFactoryBase
00235 {
00236   public:
00237     explicit PluginFactory(const char* componentName = 0, const char *catalogName = 0, QObject *parent = 0)
00238       : PluginFactoryBase(componentName, catalogName, parent) {}
00239     explicit PluginFactory(const KAboutData &aboutData, QObject *parent = 0)
00240       : PluginFactoryBase(aboutData, parent) {}
00241 
00242     virtual Resource *resource( const KConfigGroup &group )
00243     {
00244       return new TR( group );
00245     }
00246     virtual Resource *resource()
00247     {
00248       return new TR();
00249     }
00250 
00251     ConfigWidget *configWidget( QWidget *parent )
00252     {
00253       return new TC( parent );
00254     }
00255 };
00256 
00257 }
00258 
00259 #endif

kresources

Skip menu "kresources"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.6
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal