00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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