1
/* This file is part of the KDE project
2
Copyright (C) 2004 Jens Dagerbo <jens.dagerbo@swipnet.se>
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License as published by the Free Software Foundation; either
7
version 2 of the License, or (at your option) any later version.
9
This library is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
Library General Public License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this library; see the file COPYING.LIB. If not, write to
16
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
Boston, MA 02111-1307, USA.
26
#include <kdialogbase.h>
27
#include <kiconloader.h>
32
#include "configwidgetproxy.h"
35
ConfigWidgetProxy::ConfigWidgetProxy( KDevCore * core )
37
connect( core, SIGNAL(configWidget(KDialogBase*)), this, SLOT(slotConfigWidget( KDialogBase*)) );
38
connect( core, SIGNAL(projectConfigWidget(KDialogBase*)), this, SLOT(slotProjectConfigWidget( KDialogBase*)) );
41
ConfigWidgetProxy::~ConfigWidgetProxy()
44
void ConfigWidgetProxy::createGlobalConfigPage( QString const & title, unsigned int pagenumber, QString const & icon )
46
_globalTitleMap.insert( pagenumber, qMakePair( title, icon ) );
49
void ConfigWidgetProxy::createProjectConfigPage( QString const & title, unsigned int pagenumber, QString const & icon )
51
_projectTitleMap.insert( pagenumber, qMakePair( title, icon ) );
54
void ConfigWidgetProxy::removeConfigPage( int pagenumber )
56
_globalTitleMap.remove( pagenumber );
57
_projectTitleMap.remove( pagenumber );
60
void ConfigWidgetProxy::slotConfigWidget( KDialogBase * dlg )
62
TitleMap::Iterator it = _globalTitleMap.begin();
63
while ( it != _globalTitleMap.end() )
65
_pageMap.insert( dlg->addVBoxPage( it.data().first, it.data().first, BarIcon( it.data().second, KIcon::SizeMedium ) ), it.key() );
69
connect( dlg, SIGNAL(aboutToShowPage(QWidget*)), this, SLOT( slotAboutToShowPage(QWidget*)) );
70
connect( dlg, SIGNAL(destroyed()), this, SLOT(slotConfigWidgetDestroyed()) );
73
void ConfigWidgetProxy::slotProjectConfigWidget( KDialogBase * dlg )
75
TitleMap::Iterator it = _projectTitleMap.begin();
76
while ( it != _projectTitleMap.end() )
78
_pageMap.insert( dlg->addVBoxPage( it.data().first, it.data().first, BarIcon( it.data().second, KIcon::SizeMedium ) ), it.key() );
82
connect( dlg, SIGNAL(aboutToShowPage(QWidget*)), this, SLOT( slotAboutToShowPage(QWidget*)) );
83
connect( dlg, SIGNAL(destroyed()), this, SLOT(slotConfigWidgetDestroyed()) );
86
void ConfigWidgetProxy::slotConfigWidgetDestroyed( )
91
void ConfigWidgetProxy::slotAboutToShowPage( QWidget * page )
95
PageMap::Iterator it = _pageMap.find( page );
96
if ( it != _pageMap.end() )
98
emit insertConfigWidget( static_cast<KDialogBase*>(const_cast<QObject*>(sender())), page, it.data() );
99
_pageMap.remove( it );
103
#include "configwidgetproxy.moc"
105
// kate: space-indent off; indent-width 4; replace-tabs off; tab-width 4;