• 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 KLibFactory
00216 {
00217   public:
00218     virtual Resource *resource( const KConfigGroup &group ) = 0;
00219     virtual Resource *resource() = 0;
00220 
00221     virtual ConfigWidget *configWidget( QWidget *parent ) = 0;
00222 
00223   protected:
00224     virtual QObject *createObject( QObject *parent, const char *className,
00225                                    const QStringList &args );
00226 };
00227 
00228 template<class TR,class TC>
00229 class PluginFactory : public PluginFactoryBase
00230 {
00231   public:
00232     virtual Resource *resource( const KConfigGroup &group )
00233     {
00234       return new TR( group );
00235     }
00236     virtual Resource *resource()
00237     {
00238       return new TR();
00239     }
00240 
00241     ConfigWidget *configWidget( QWidget *parent )
00242     {
00243       return new TC( parent );
00244     }
00245 };
00246 
00247 }
00248 
00249 #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