• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

kresources

  • sources
  • kde-4.12
  • kdepimlibs
  • kresources
resource.h
1 /*
2  This file is part of libkresources
3 
4  Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
5  Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 #ifndef KRESOURCES_RESOURCE_H
23 #define KRESOURCES_RESOURCE_H
24 
25 #include "kresources_export.h"
26 
27 #include <kpluginfactory.h>
28 
29 #include <QtCore/QMutex>
30 #include <QWidget>
31 
32 class KConfig;
33 class KConfigGroup;
34 
35 namespace KRES {
36 
37 class ConfigWidget;
38 
75 class KRESOURCES_DEPRECATED_EXPORT Resource : public QObject
76 {
77  friend class Factory;
78  friend class ManagerImpl;
79 
80  Q_OBJECT
81  public:
82  typedef QList<Resource *> List;
83 
87  Resource();
88 
93  explicit Resource( const KConfigGroup &group );
94 
98  virtual ~Resource();
99 
106  virtual void writeConfig( KConfigGroup &group );
107 
117  bool open();
118 
125  void close();
126 
130  bool isOpen() const;
131 
135  void setIdentifier( const QString &identifier );
136 
143  QString identifier() const;
144 
148  void setType( const QString &type );
149 
153  QString type() const;
154 
159  virtual void setReadOnly( bool value );
160 
164  virtual bool readOnly() const;
165 
170  virtual void setResourceName( const QString &name );
171 
175  virtual QString resourceName() const;
176 
180  void setActive( bool active );
181 
185  bool isActive() const;
186 
190  virtual void dump() const;
191 
192  protected:
202  virtual bool doOpen();
203 
208  virtual void doClose();
209 
210  private:
211  class ResourcePrivate;
212  ResourcePrivate *const d;
213 };
214 
215 class KRESOURCES_DEPRECATED_EXPORT PluginFactoryBase : public KPluginFactory
216 {
217  public:
218  explicit PluginFactoryBase( const char *componentName=0,
219  const char *catalogName=0, QObject *parent=0 )
220  : KPluginFactory( componentName, catalogName, parent ) {}
221  explicit PluginFactoryBase( const KAboutData &aboutData, QObject *parent = 0 )
222  : KPluginFactory( aboutData, parent ) {}
223 
224  virtual Resource *resource( const KConfigGroup &group ) = 0;
225  virtual Resource *resource() = 0;
226 
227  virtual ConfigWidget *configWidget( QWidget *parent ) = 0;
228 
229  protected:
230  virtual QObject *createObject( QObject *parent, const char *className,
231  const QStringList &args );
232 };
233 
234 template<class TR,class TC>
235 class PluginFactory : public PluginFactoryBase
236 {
237  public:
238  explicit PluginFactory( const char *componentName=0,
239  const char *catalogName=0, QObject *parent=0 )
240  : PluginFactoryBase( componentName, catalogName, parent ) {}
241  explicit PluginFactory( const KAboutData &aboutData, QObject *parent = 0 )
242  : PluginFactoryBase( aboutData, parent ) {}
243 
244  virtual Resource *resource( const KConfigGroup &group )
245  {
246  return new TR( group );
247  }
248  virtual Resource *resource()
249  {
250  return new TR();
251  }
252 
253  ConfigWidget *configWidget( QWidget *parent )
254  {
255  return new TC( parent );
256  }
257 };
258 
259 }
260 
261 #endif
KRES::Resource
This class provides a resource which is managed in a general way.
Definition: resource.h:75
KRES::ManagerImpl
Definition: managerimpl.h:41
KRES::Factory
A class for loading resource plugins.
Definition: factory.h:73
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kresources

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

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal