lib

mainmodule.cpp

00001 /***************************************************************************
00002  * mainmodule.cpp
00003  * This file is part of the KDE project
00004  * copyright (C)2004-2005 by Sebastian Sauer (mail@dipe.org)
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this program; see the file COPYING.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  ***************************************************************************/
00019 
00020 #include "mainmodule.h"
00021 
00022 #include <kdebug.h>
00023 
00024 using namespace Kross::Api;
00025 
00026 namespace Kross { namespace Api {
00027 
00029     class MainModulePrivate
00030     {
00031         public:
00036             Exception::Ptr exception;
00037     };
00038 
00039 }}
00040 
00041 MainModule::MainModule(const QString& name)
00042     : Module(name)
00043     , d(new MainModulePrivate())
00044 {
00045     d->exception = 0;
00046 }
00047 
00048 MainModule::~MainModule()
00049 {
00050     delete d;
00051 }
00052 
00053 const QString MainModule::getClassName() const
00054 {
00055     return "Kross::Api::MainModule";
00056 }
00057 
00058 bool MainModule::hadException()
00059 {
00060     return d->exception != 0;
00061 }
00062 
00063 Exception::Ptr MainModule::getException()
00064 {
00065     return d->exception;
00066 }
00067 
00068 void MainModule::setException(Exception::Ptr exception)
00069 {
00070     d->exception = exception;
00071 }
00072 
00073 bool MainModule::hasChild(const QString& name) const
00074 {
00075     return Object::hasChild(name);
00076 }
00077 
00078 EventSignal::Ptr MainModule::addSignal(const QString& name, QObject* sender, QCString signal)
00079 {
00080     EventSignal* event = new EventSignal(name, this, sender, signal);
00081     if(! addChild(event)) {
00082         kdWarning() << QString("Failed to add signal name='%1' signature='%2'").arg(name).arg(signal) << endl;
00083         return 0;
00084     }
00085     return event;
00086 }
00087 
00088 EventSlot::Ptr MainModule::addSlot(const QString& name, QObject* receiver, QCString slot)
00089 {
00090     EventSlot* event = new EventSlot(name, this, receiver, slot);
00091     if(! addChild(event)) {
00092         kdWarning() << QString("Failed to add slot name='%1' signature='%2'").arg(name).arg(slot) << endl;
00093         delete event;
00094         return 0;
00095     }
00096     return event;
00097 }
00098 
00099 QtObject::Ptr MainModule::addQObject(QObject* object, const QString& name)
00100 {
00101     QtObject* qtobject = new QtObject(this, object, name);
00102     if(! addChild(qtobject)) {
00103         kdWarning() << QString("Failed to add QObject name='%1'").arg(object->name()) << endl;
00104         delete qtobject;
00105         return 0;
00106     }
00107     return qtobject;
00108 }
00109 
00110 EventAction::Ptr MainModule::addKAction(KAction* action, const QString& name)
00111 {
00112     EventAction* event = new EventAction(name, this, action);
00113     if(! addChild(event)) {
00114         kdWarning() << QString("Failed to add KAction name='%1'").arg(action->name()) << endl;
00115         delete event;
00116         return 0;
00117     }
00118     return event;
00119 }
00120 
KDE Home | KDE Accessibility Home | Description of Access Keys