1
/* This file is part of the KDE project
2
Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3
2001, 2002 Michael Brade <brade@kde.org>
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public
7
License as published by the Free Software Foundation; either
8
version 2 of the License, or (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 GNU
13
General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; see the file COPYING. If not, write to
17
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
Boston, MA 02111-1307, USA.
21
#include "konq_treeviewwidget.h"
22
#include "konq_listview.h"
25
/**************************************************************
29
**************************************************************/
31
KonqListViewDir::KonqListViewDir( KonqTreeViewWidget *_parent, KFileItem* _fileitem )
32
:KonqListViewItem( _parent, _fileitem )
34
setExpandable( true );
36
_parent->addSubDir( this );
39
KonqListViewDir::KonqListViewDir( KonqTreeViewWidget *_treeview, KonqListViewDir * _parent, KFileItem* _fileitem )
40
:KonqListViewItem(_treeview,_parent,_fileitem)
42
setExpandable( true );
44
_treeview->addSubDir( this );
47
KonqListViewDir::~KonqListViewDir()
49
static_cast<KonqTreeViewWidget*>(m_pListViewWidget)->m_dictSubDirs.remove(url(-1));
52
void KonqListViewDir::setOpen( bool _open )
57
void KonqListViewDir::open( bool _open, bool _reload )
59
if ( _open != isOpen() || _reload )
61
KonqTreeViewWidget* treeView = static_cast<KonqTreeViewWidget *>(listView());
65
if ( !m_bComplete || _reload ) // complete it before opening
66
treeView->openSubFolder( this, _reload );
69
// we need to add the items to the counts for the statusbar
71
lst.setAutoDelete( false );
73
QListViewItem* it = firstChild();
76
lst.append( static_cast<KonqListViewItem*>(it)->item() );
77
it = it->nextSibling();
80
// tell the view about the new items to count
81
treeView->m_pBrowserView->newItems( lst );
86
treeView->stopListingSubFolder( this );
88
QListViewItem* it = firstChild();
91
// unselect the items in the closed folder
92
treeView->setSelected( it, false );
93
// delete the item from the counts for the statusbar
94
KFileItem* item = static_cast<KonqListViewItem*>(it)->item();
95
treeView->m_pBrowserView->deleteItem( item );
96
it = it->nextSibling();
100
QListViewItem::setOpen( _open );
101
treeView->slotOnViewport();
105
QString KonqListViewDir::url( int _trailing )
107
return m_fileitem->url().url( _trailing );