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 using namespace Kross::Api;
00023 
00024 namespace Kross { namespace Api {
00025 
00027     class MainModulePrivate
00028     {
00029         public:
00034             Exception::Ptr exception;
00035     };
00036 
00037 }}
00038 
00039 MainModule::MainModule(const QString& name)
00040     : Module(name)
00041     , d(new MainModulePrivate())
00042 {
00043     d->exception = 0;
00044 }
00045 
00046 MainModule::~MainModule()
00047 {
00048     delete d;
00049 }
00050 
00051 const QString MainModule::getClassName() const
00052 {
00053     return "Kross::Api::MainModule";
00054 }
00055 
00056 bool MainModule::hadException()
00057 {
00058     return d->exception != 0;
00059 }
00060 
00061 Exception::Ptr MainModule::getException()
00062 {
00063     return d->exception;
00064 }
00065 
00066 void MainModule::setException(Exception::Ptr exception)
00067 {
00068     d->exception = exception;
00069 }
00070 
00071 #if 0
00072 bool MainModule::hasChild(const QString& name) const
00073 {
00074     return Callable::hasChild(name);
00075 }
00076 #endif
00077 
00078 EventSignal::Ptr MainModule::addSignal(const QString& name, QObject* sender, QCString signal)
00079 {
00080     EventSignal* event = new EventSignal(name, sender, signal);
00081     if(! addChild(name, event)) {
00082         krosswarning( QString("Failed to add signal name='%1' signature='%2'").arg(name).arg(signal) );
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, receiver, slot);
00091     if(! addChild(name, event)) {
00092         krosswarning( QString("Failed to add slot name='%1' signature='%2'").arg(name).arg(slot) );
00093         return 0;
00094     }
00095     return event;
00096 }
00097 
00098 QtObject::Ptr MainModule::addQObject(QObject* object, const QString& name)
00099 {
00100     QtObject* qtobject = new QtObject(object, name);
00101     if(! addChild(name, qtobject)) {
00102         krosswarning( QString("Failed to add QObject name='%1'").arg(object->name()) );
00103         return 0;
00104     }
00105     return qtobject;
00106 }
00107 
00108 EventAction::Ptr MainModule::addKAction(KAction* action, const QString& name)
00109 {
00110     EventAction* event = new EventAction(name, action);
00111     if(! addChild(name, event)) {
00112         krosswarning( QString("Failed to add KAction name='%1'").arg(action->name()) );
00113         return 0;
00114     }
00115     return event;
00116 }
00117 
KDE Home | KDE Accessibility Home | Description of Access Keys