2 * This file is part of the KDE Help Center
4 * Copyright (C) 1999 Matthias Elter (me@kde.org)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "navigatoritem.h"
27 #include <kiconloader.h>
31 NavigatorItem::NavigatorItem( DocEntry
*entry
, Q3ListView
*parent
,
32 Q3ListViewItem
*after
)
33 : Q3ListViewItem( parent
, after
)
38 NavigatorItem::NavigatorItem( DocEntry
*entry
, Q3ListViewItem
*parent
,
39 Q3ListViewItem
*after
)
40 : Q3ListViewItem( parent
, after
)
45 NavigatorItem::NavigatorItem( DocEntry
*entry
, Q3ListView
*parent
)
46 : Q3ListViewItem( parent
)
51 NavigatorItem::NavigatorItem( DocEntry
*entry
, Q3ListViewItem
*parent
)
52 : Q3ListViewItem( parent
)
57 NavigatorItem::~NavigatorItem()
61 if ( mAutoDeleteDocEntry
) delete mEntry
;
64 void NavigatorItem::init( DocEntry
*entry
)
67 mAutoDeleteDocEntry
= false;
73 DocEntry
*NavigatorItem::entry() const
78 void NavigatorItem::setAutoDeleteDocEntry( bool enabled
)
80 mAutoDeleteDocEntry
= enabled
;
83 void NavigatorItem::updateItem()
85 setText( 0, entry()->name() );
86 setPixmap( 0, SmallIcon( entry()->icon() ) );
89 TOC
*NavigatorItem::createTOC()
91 mToc
= new TOC( this );
95 void NavigatorItem::setOpen( bool open
)
97 Q3ListViewItem::setOpen( open
);
99 // TODO: was contents2 -> needs to be changed to help-contents-alternate or similar
100 if ( entry()->icon().isEmpty() || entry()->icon() == "help-contents" ) {
101 if ( open
&& childCount() > 0 ) setPixmap( 0, SmallIcon( "help-contents" ) );
102 // TODO: was contents2 -> needs to be changed to help-contents-alternate or similar
103 else setPixmap( 0, SmallIcon( "help-contents" ) );