• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdeutils
  • Sitemap
  • Contact Us
 

superkaramba

karambamanager.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2007 Alexander Wiedenbruch <mail@wiedenbruch.de>
00003  *
00004  * This file is part of SuperKaramba.
00005  *
00006  *  SuperKaramba is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  SuperKaramba is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with SuperKaramba; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00019  ****************************************************************************/
00020 
00021 #include "karambamanager.h"
00022 
00023 #include <KGlobal>
00024 
00025 KarambaManager* KarambaManager::instance = 0;
00026 
00027 class KarambaManager::Private
00028 {
00029     public:
00030         QList<Karamba*> karambaList;
00031 };
00032 
00033 KarambaManager::KarambaManager()
00034     : d(new Private)
00035 {
00036 }
00037 
00038 KarambaManager::~KarambaManager()
00039 {
00040     while (d->karambaList.count() > 0) {
00041         d->karambaList[0]->closeWidget();
00042     }
00043 
00044     delete d;
00045 }
00046 
00047 KarambaManager* KarambaManager::self()
00048 {
00049     if (instance == 0) {
00050         instance = new KarambaManager;
00051     }
00052 
00053     return instance;
00054 }
00055 
00056 void KarambaManager::addKaramba(Karamba *newKaramba)
00057 {
00058     d->karambaList.append(newKaramba);
00059     emit karambaStarted(newKaramba);
00060 }
00061 
00062 void KarambaManager::removeKaramba(Karamba *karamba)
00063 {
00064     d->karambaList.removeAll(karamba);
00065     emit karambaClosed(karamba);
00066     karamba->deleteLater();
00067 }
00068 
00069 Karamba* KarambaManager::getKaramba(const QString &prettyThemeName) const
00070 {
00071     foreach (Karamba *k, d->karambaList) {
00072         if (prettyThemeName == k->prettyName()) {
00073             return k;
00074         }
00075     }
00076 
00077     return 0;
00078 }
00079 
00080 Karamba* KarambaManager::getKarambaByName(const QString &name) const
00081 {
00082     foreach (Karamba *k, d->karambaList) {
00083         if (name == k->theme().name()) {
00084             return k;
00085         }
00086     }
00087 
00088     return 0;
00089 }
00090 
00091 QList<Karamba*> KarambaManager::getKarambas() const
00092 {
00093     return d->karambaList;
00094 }
00095 
00096 bool KarambaManager::checkKaramba(const Karamba *karamba) const
00097 {
00098     return d->karambaList.contains(const_cast<Karamba*>(karamba));
00099 }
00100 
00101 
00102 #include "karambamanager.moc"
00103 

superkaramba

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

kdeutils

Skip menu "kdeutils"
  • ark
  • kcalc
  • kcharselect
  • kdelirc
  • kdessh
  • kdf
  • kfloppy
  • kgpg
  • kjots
  • klaptopdaemon
  • kmilo
  • ksim
  • ktimer
  • kwallet
  • superkaramba
Generated for kdeutils by doxygen 1.5.4
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