KDevelop API Documentation

lib/util/configwidgetproxy.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 Copyright (C) 2004 Jens Dagerbo <jens.dagerbo@swipnet.se> 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., 59 Temple Place - Suite 330, 00017 Boston, MA 02111-1307, USA. 00018 */ 00019 00020 00021 00022 #include <qstring.h> 00023 #include <qvbox.h> 00024 00025 #include <kdebug.h> 00026 #include <kdialogbase.h> 00027 00028 #include <kdevcore.h> 00029 00030 00031 #include "configwidgetproxy.h" 00032 00033 00034 ConfigWidgetProxy::ConfigWidgetProxy( KDevCore * core ) 00035 { 00036 kdDebug() << k_funcinfo << endl; 00037 00038 connect( core, SIGNAL(configWidget(KDialogBase*)), this, SLOT(slotConfigWidget( KDialogBase*)) ); 00039 connect( core, SIGNAL(projectConfigWidget(KDialogBase*)), this, SLOT(slotProjectConfigWidget( KDialogBase*)) ); 00040 } 00041 00042 ConfigWidgetProxy::~ConfigWidgetProxy() 00043 { 00044 kdDebug() << k_funcinfo << endl; 00045 } 00046 00047 void ConfigWidgetProxy::createGlobalConfigPage( QString const & title, unsigned int pagenumber ) 00048 { 00049 _globalTitleMap.insert( pagenumber, title); 00050 } 00051 00052 void ConfigWidgetProxy::createProjectConfigPage( QString const & title, unsigned int pagenumber ) 00053 { 00054 _projectTitleMap.insert( pagenumber, title); 00055 } 00056 00057 void ConfigWidgetProxy::removeConfigPage( int pagenumber ) 00058 { 00059 _globalTitleMap.remove( pagenumber ); 00060 _projectTitleMap.remove( pagenumber ); 00061 } 00062 00063 void ConfigWidgetProxy::slotConfigWidget( KDialogBase * dlg ) 00064 { 00065 kdDebug() << k_funcinfo << endl; 00066 00067 TitleMap::Iterator it = _globalTitleMap.begin(); 00068 while ( it != _globalTitleMap.end() ) 00069 { 00070 _pageMap.insert( dlg->addVBoxPage( it.data() ), it.key() ); 00071 ++it; 00072 } 00073 00074 connect( dlg, SIGNAL(aboutToShowPage(QWidget*)), this, SLOT( slotAboutToShowPage(QWidget*)) ); 00075 connect( dlg, SIGNAL(destroyed()), this, SLOT(slotConfigWidgetDestroyed()) ); 00076 } 00077 00078 void ConfigWidgetProxy::slotProjectConfigWidget( KDialogBase * dlg ) 00079 { 00080 kdDebug() << k_funcinfo << endl; 00081 00082 TitleMap::Iterator it = _projectTitleMap.begin(); 00083 while ( it != _projectTitleMap.end() ) 00084 { 00085 _pageMap.insert( dlg->addVBoxPage( it.data() ), it.key() ); 00086 ++it; 00087 } 00088 00089 connect( dlg, SIGNAL(aboutToShowPage(QWidget*)), this, SLOT( slotAboutToShowPage(QWidget*)) ); 00090 connect( dlg, SIGNAL(destroyed()), this, SLOT(slotConfigWidgetDestroyed()) ); 00091 } 00092 00093 void ConfigWidgetProxy::slotConfigWidgetDestroyed( ) 00094 { 00095 kdDebug() << k_funcinfo << endl; 00096 00097 _pageMap.clear(); 00098 } 00099 00100 void ConfigWidgetProxy::slotAboutToShowPage( QWidget * page ) 00101 { 00102 kdDebug() << k_funcinfo << endl; 00103 00104 if ( !page ) return; 00105 00106 PageMap::Iterator it = _pageMap.find( page ); 00107 if ( it != _pageMap.end() ) 00108 { 00109 emit insertConfigWidget( static_cast<KDialogBase*>(const_cast<QObject*>(sender())), page, it.data() ); 00110 _pageMap.remove( it ); 00111 } 00112 } 00113 00114 #include "configwidgetproxy.moc" 00115 00116 // kate: space-indent off; indent-width 4; replace-tabs off; tab-width 4;
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Oct 19 08:01:48 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003