Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / runtime / khelpcenter / navigatoritem.cpp
blob29238d1fb73cf1d45a20f9ff812aa2de55c6645f
1 /*
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"
23 #include "toc.h"
24 #include "docentry.h"
26 #include <kdebug.h>
27 #include <kiconloader.h>
28 #include <QPixmap>
29 using namespace KHC;
31 NavigatorItem::NavigatorItem( DocEntry *entry, Q3ListView *parent,
32 Q3ListViewItem *after )
33 : Q3ListViewItem( parent, after )
35 init( entry );
38 NavigatorItem::NavigatorItem( DocEntry *entry, Q3ListViewItem *parent,
39 Q3ListViewItem *after )
40 : Q3ListViewItem( parent, after )
42 init( entry );
45 NavigatorItem::NavigatorItem( DocEntry *entry, Q3ListView *parent )
46 : Q3ListViewItem( parent )
48 init( entry );
51 NavigatorItem::NavigatorItem( DocEntry *entry, Q3ListViewItem *parent )
52 : Q3ListViewItem( parent )
54 init( entry );
57 NavigatorItem::~NavigatorItem()
59 delete mToc;
61 if ( mAutoDeleteDocEntry ) delete mEntry;
64 void NavigatorItem::init( DocEntry *entry )
66 mEntry = entry;
67 mAutoDeleteDocEntry = false;
68 mToc = 0;
70 updateItem();
73 DocEntry *NavigatorItem::entry() const
75 return mEntry;
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 );
92 return mToc;
95 void NavigatorItem::setOpen( bool open )
97 Q3ListViewItem::setOpen( open );
99 if ( entry()->icon().isEmpty() || entry()->icon() == "contents2" ) {
100 if ( open && childCount() > 0 ) setPixmap( 0, SmallIcon( "help-contents" ) );
101 else setPixmap( 0, SmallIcon( "contents2" ) );
105 // vim:ts=2:sw=2:et