kexi

scriptmanager.cpp

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library 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 GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  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 "scriptmanager.h"
00021 #include "formscript.h"
00022 
00023 #include "form.h"
00024 #include "formmanager.h"
00025 // Kross includes
00026 #include "main/manager.h"
00027 
00028 using KFormDesigner::Form;
00029 
00030 ScriptManager::ScriptManager(QObject *parent, const char *name)
00031  : QObject(parent, name)
00032 {
00033     m_manager = Kross::Api::Manager::scriptManager();
00034     m_dict.setAutoDelete(true);
00035 }
00036 
00037 ScriptManager::~ScriptManager()
00038 {
00039 }
00040 
00041 FormScript*
00042 ScriptManager::newFormScript(Form *form)
00043 {
00044     FormScript *script = new FormScript(form, this);
00045     m_dict.insert(form, script);
00046     return script;
00047 }
00048 
00049 FormScript*
00050 ScriptManager::scriptForForm(Form *form)
00051 {
00052     return m_dict[form];
00053 }
00054 
00055 void
00056 ScriptManager::setFormManager(FormManager *manager)
00057 {
00058     m_formManager = manager;
00059     connect(m_formManager, SIGNAL(aboutToDeleteForm(KFormDesigner::Form*)), this, SLOT(slotFormDeleted(KFormDesigner::Form*)));
00060     connect(m_formManager, SIGNAL(formCreated(KFormDesigner::Form*)), this, SLOT(newFormScript(KFormDesigner::Form*)));
00061 }
00062 
00063 void
00064 ScriptManager::slotFormDeleted(KFormDesigner::Form *form)
00065 {
00066     m_dict.remove(form);
00067 }
00068 
00069 #include "scriptmanager.moc"
00070 
KDE Home | KDE Accessibility Home | Description of Access Keys