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

umbrello/umbrello

  • sources
  • kde-4.12
  • kdesdk
  • umbrello
  • umbrello
  • _unused
configurable.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Mon Jan 13 2003
3  copyright : (C) 2003 by Andrew Sutton
4  email : ansutton@kent.edu
5 ***************************************************************************/
6 
7 /***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  * copyright (C) 2004-2007 *
15  * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
16  ***************************************************************************/
17 
18 // own header
19 #include "configurable.h"
20 
21 // Qt includes
22 #include <qstringlist.h>
23 
24 // KDE includes
25 #include <kdebug.h>
26 #include <kconfig.h>
27 #include <kconfiggroup.h>
28 
29 // local includes
30 #include "pluginloader.h"
31 #include "plugin.h"
32 
33 using namespace Umbrello;
34 
35 
36 Configurable::Configurable() :
37  _plugins()
38 {
39 }
40 
41 Configurable::~Configurable()
42 {
43  unloadPlugins();
44 }
45 
46 bool
47 Configurable::loadPlugins(KConfig *config,
48  const QString &group,
49  const QString &key)
50 {
51  bool ret = true;
52  KConfigGroup grp(config, group);
53 
54  QStringList names = grp.readEntry(key,QStringList());
55  for (int i = 0; i != names.size(); i++) {
56  const QString &name = names[i];
57 
58  kDebug() << "loading plugin " << name;
59 
60  // load the plugin
61  Plugin *plugin = PluginLoader::instance()->loadPlugin(name);
62 
63  // keep the plugin
64  if(plugin) {
65  _plugins.append(plugin);
66  }
67  }
68 
69  return ret;
70 }
71 
72 bool
73 Configurable::unloadPlugins()
74 {
75  // just iterate through and dereference all the
76  // plugins.
77  for(uint i = 0; i != _plugins.count(); i++) {
78  Plugin *plugin = _plugins.at(i);
79  plugin->unload();
80  }
81  _plugins.clear();
82  return true;
83 }
Umbrello::Configurable::Configurable
Configurable()
Construct a configurable object.
Definition: configurable.cpp:36
Umbrello::Configurable::unloadPlugins
bool unloadPlugins()
This is a convenience method for derived classes.
Definition: configurable.cpp:73
pluginloader.h
plugin.h
Umbrello::Configurable::loadPlugins
bool loadPlugins(KConfig *config, const QString &group, const QString &key)
This is a convenience method for derived classes.
Definition: configurable.cpp:47
Umbrello::PluginLoader::instance
static PluginLoader * instance()
Singleton accessor.
Definition: pluginloader.cpp:49
Umbrello::Configurable::~Configurable
virtual ~Configurable()
Destroy a configurable object.
Definition: configurable.cpp:41
Umbrello::Plugin::unload
void unload()
Unload the plugin.
Definition: plugin.cpp:53
Umbrello::Plugin
The Plugin class is the base class for all modular functionality in the core Umbrello library...
Definition: plugin.h:87
Umbrello::PluginLoader::loadPlugin
Plugin * loadPlugin(const QString &name)
Load a plugin.
Definition: pluginloader.cpp:56
configurable.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:05:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

umbrello/umbrello

Skip menu "umbrello/umbrello"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

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