2 Copyright (c) 2000 Matthias Elter <elter@kde.org>
3 Copyright (c) 2003 Frauke Oster <frauke.oster@t-online.de>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #include "indexwidget.h"
21 #include "moduletreeview.h"
22 #include "moduleiconview.h"
24 #include <Qt3Support/Q3CheckListItem>
26 #include "indexwidget.moc"
28 IndexWidget::IndexWidget(ConfigModuleList
*modules
, QWidget
*parent
,const char *)
29 : QStackedWidget(parent
)
38 IndexWidget::~IndexWidget() {}
40 void IndexWidget::reload()
46 Q3ListViewItem
*IndexWidget::firstTreeViewItem()
49 return _tree
->firstChild();
54 void IndexWidget::moduleSelected(ConfigModule
*m
)
56 const QObject
*obj
= sender();
59 emit
moduleActivated(m
);
61 if (obj
->inherits("ModuleIconView") && _tree
)
63 _tree
->makeVisible(m
);
65 _tree
->disconnect(SIGNAL(moduleSelected(ConfigModule
*)));
66 _tree
->makeSelected(m
);
67 connect(_tree
, SIGNAL(moduleSelected(ConfigModule
*)),
68 this, SLOT(moduleSelected(ConfigModule
*)));
70 else if (obj
->inherits("ModuleTreeView") && _icon
)
72 _icon
->makeVisible(m
);
74 _icon
->disconnect(SIGNAL(moduleSelected(ConfigModule
*)));
75 _icon
->makeSelected(m
);
76 connect(_icon
, SIGNAL(moduleSelected(ConfigModule
*)),
77 this, SLOT(moduleSelected(ConfigModule
*)));
81 void IndexWidget::makeSelected(ConfigModule
*module
)
85 _icon
->disconnect(SIGNAL(moduleSelected(ConfigModule
*)));
86 _icon
->makeSelected(module
);
87 connect(_icon
, SIGNAL(moduleSelected(ConfigModule
*)),
88 this, SLOT(moduleSelected(ConfigModule
*)));
92 _tree
->disconnect(SIGNAL(moduleSelected(ConfigModule
*)));
93 _tree
->makeSelected(module
);
94 connect(_tree
, SIGNAL(moduleSelected(ConfigModule
*)),
95 this, SLOT(moduleSelected(ConfigModule
*)));
99 void IndexWidget::makeVisible(ConfigModule
*module
)
102 _icon
->makeVisible(module
);
104 _tree
->makeVisible(module
);
107 void IndexWidget::activateView(IndexViewMode mode
)
115 _icon
=new ModuleIconView(_modules
, this);
118 connect(_icon
, SIGNAL(moduleSelected(ConfigModule
*)),
119 this, SLOT(moduleSelected(ConfigModule
*)));
121 setCurrentWidget( _icon
);
127 _tree
=new ModuleTreeView(_modules
, this);
130 connect(_tree
, SIGNAL(moduleSelected(ConfigModule
*)),
131 this, SLOT(moduleSelected(ConfigModule
*)));
132 connect(_tree
, SIGNAL(categorySelected(Q3ListViewItem
*)),
133 this, SIGNAL(categorySelected(Q3ListViewItem
*)));
135 setCurrentWidget( _tree
);