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

Engines

ion.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2007 by Shawn Starr <shawn.starr@rogers.com>            *
00003  *                                                                         *
00004  *   This program is free software; you can redistribute it and/or modify  *
00005  *   it under the terms of the GNU General Public License as published by  *
00006  *   the Free Software Foundation; either version 2 of the License, or     *
00007  *   (at your option) any later version.                                   *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU General Public License     *
00015  *   along with this program; if not, write to the                         *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA          *
00018  ***************************************************************************/
00019 
00020 #include "ion.h"
00021 #include "ion.moc"
00022 
00023 class IonInterface::Private : public QObject
00024 {
00025 public:
00026     Private(IonInterface *i)
00027             : ion(i),
00028             initialized(false) {}
00029 
00030     int ref;
00031     IonInterface *ion;
00032     bool initialized;
00033 };
00034 
00035 IonInterface::IonInterface(QObject *parent, const QVariantList &args)
00036         : Plasma::DataEngine(parent, args),
00037         d(new Private(this))
00038 {
00039 // Initialize the loaded ion with a reference count of 0.
00040     d->ref = 0;
00041 }
00042 
00043 // Increment reference counter
00044 void IonInterface::ref()
00045 {
00046     ++d->ref;
00047 }
00048 
00049 // Decrement reference counter
00050 void IonInterface::deref()
00051 {
00052     --d->ref;
00053 }
00054 
00055 // Check if Ion is used
00056 bool IonInterface::isUsed() const
00057 {
00058     return d->ref != 0;
00059 }
00060 
00064 bool IonInterface::sourceRequestEvent(const QString &source)
00065 {
00066     kDebug() << "sourceRequested()";
00067     if (d->initialized) {
00068         return updateIonSource(source);
00069     } else {
00070         setData(source, Plasma::DataEngine::Data());
00071     }
00072 
00073     return true;
00074 }
00075 
00079 bool IonInterface::updateSourceEvent(const QString& source)
00080 {
00081     kDebug() << "updateSource()";
00082     if (d->initialized) {
00083         return updateIonSource(source);
00084     }
00085 
00086     return false;
00087 }
00088 
00092 void IonInterface::setInitialized(bool initialized)
00093 {
00094     d->initialized = initialized;
00095 
00096     if (d->initialized) {
00097         foreach(const QString &source, sources()) {
00098             updateSourceEvent(source);
00099         }
00100     }
00101 }

Engines

Skip menu "Engines"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libplasma
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference 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