~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to lib/util/configwidgetproxy.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2010-05-05 07:21:55 UTC
  • mfrom: (1.2.3 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505072155-h78lx19pu04sbhtn
Tags: 4:4.0.0-2
* Upload to unstable (Closes: #579947, #481832).
* Acknowledge obsolete NMU fixes (Closes: #562410, #546961).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* This file is part of the KDE project
2
 
   Copyright (C) 2004 Jens Dagerbo <jens.dagerbo@swipnet.se>
3
 
 
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.
8
 
 
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.
13
 
 
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.
18
 
*/
19
 
 
20
 
 
21
 
 
22
 
#include <qstring.h>
23
 
#include <qvbox.h>
24
 
 
25
 
#include <kdebug.h>
26
 
#include <kdialogbase.h>
27
 
#include <kiconloader.h>
28
 
 
29
 
#include <kdevcore.h>
30
 
 
31
 
 
32
 
#include "configwidgetproxy.h"
33
 
 
34
 
 
35
 
ConfigWidgetProxy::ConfigWidgetProxy( KDevCore * core )
36
 
{
37
 
        connect( core, SIGNAL(configWidget(KDialogBase*)), this, SLOT(slotConfigWidget( KDialogBase*)) );
38
 
        connect( core, SIGNAL(projectConfigWidget(KDialogBase*)), this, SLOT(slotProjectConfigWidget( KDialogBase*)) );
39
 
}
40
 
 
41
 
ConfigWidgetProxy::~ConfigWidgetProxy()
42
 
{}
43
 
 
44
 
void ConfigWidgetProxy::createGlobalConfigPage( QString const & title, unsigned int pagenumber, QString const & icon )
45
 
{
46
 
        _globalTitleMap.insert( pagenumber, qMakePair( title, icon ) );
47
 
}
48
 
 
49
 
void ConfigWidgetProxy::createProjectConfigPage( QString const & title, unsigned int pagenumber, QString const & icon )
50
 
{
51
 
        _projectTitleMap.insert( pagenumber, qMakePair( title, icon ) );
52
 
}
53
 
 
54
 
void ConfigWidgetProxy::removeConfigPage( int pagenumber )
55
 
{
56
 
        _globalTitleMap.remove( pagenumber );
57
 
        _projectTitleMap.remove( pagenumber );
58
 
}
59
 
 
60
 
void ConfigWidgetProxy::slotConfigWidget( KDialogBase * dlg )
61
 
{
62
 
        TitleMap::Iterator it = _globalTitleMap.begin();
63
 
        while ( it != _globalTitleMap.end() )
64
 
        {
65
 
                _pageMap.insert( dlg->addVBoxPage( it.data().first, it.data().first, BarIcon( it.data().second, KIcon::SizeMedium ) ), it.key() );
66
 
                ++it;
67
 
        }
68
 
 
69
 
        connect( dlg, SIGNAL(aboutToShowPage(QWidget*)), this, SLOT( slotAboutToShowPage(QWidget*)) );  
70
 
        connect( dlg, SIGNAL(destroyed()), this, SLOT(slotConfigWidgetDestroyed()) );
71
 
}
72
 
 
73
 
void ConfigWidgetProxy::slotProjectConfigWidget( KDialogBase * dlg )
74
 
{
75
 
        TitleMap::Iterator it = _projectTitleMap.begin();
76
 
        while ( it != _projectTitleMap.end() )
77
 
        {
78
 
                _pageMap.insert( dlg->addVBoxPage( it.data().first, it.data().first, BarIcon( it.data().second, KIcon::SizeMedium ) ), it.key() );
79
 
                ++it;
80
 
        }
81
 
        
82
 
        connect( dlg, SIGNAL(aboutToShowPage(QWidget*)), this, SLOT( slotAboutToShowPage(QWidget*)) );  
83
 
        connect( dlg, SIGNAL(destroyed()), this, SLOT(slotConfigWidgetDestroyed()) );
84
 
}
85
 
 
86
 
void ConfigWidgetProxy::slotConfigWidgetDestroyed( )
87
 
{
88
 
        _pageMap.clear();
89
 
}
90
 
 
91
 
void ConfigWidgetProxy::slotAboutToShowPage( QWidget * page )
92
 
{
93
 
        if ( !page ) return;
94
 
        
95
 
        PageMap::Iterator it = _pageMap.find( page );
96
 
        if ( it != _pageMap.end() )
97
 
        {
98
 
                emit insertConfigWidget( static_cast<KDialogBase*>(const_cast<QObject*>(sender())), page, it.data() );
99
 
                _pageMap.remove( it );
100
 
        }
101
 
}
102
 
 
103
 
#include "configwidgetproxy.moc"
104
 
 
105
 
// kate: space-indent off; indent-width 4; replace-tabs off; tab-width 4;