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

kresources

  • 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
32class KConfig;
33class KConfigGroup;
34
35namespace KRES {
36
37class ConfigWidget;
38
75class 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
215class 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
234template<class TR,class TC>
235class 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::Factory
A class for loading resource plugins.
Definition factory.h:74
KRES::ManagerImpl
Definition managerimpl.h:42
KRES::Manager
This class provides a manager for resources of a specified family.
Definition manager.h:83
KRES::Manager::setActive
void setActive(Resource *resource, bool active)
Set active state of resource.
Definition manager.h:328
KRES::Manager::writeConfig
void writeConfig(KConfig *cfg=0)
Write configuration of Resource objects to configuration file.
Definition manager.h:272
KRES::Resource
This class provides a resource which is managed in a general way.
Definition resource.h:76
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Wed Jan 24 2024 00:00:00 by doxygen 1.10.0 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-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
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