kfiletreebranch.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef kfile_tree_branch_h
00023 #define kfile_tree_branch_h
00024
00025 #include <qdict.h>
00026 #include <qlistview.h>
00027
00028 #include <kfileitem.h>
00029 #include <kio/global.h>
00030 #include <kdirlister.h>
00031 #include <kio/job.h>
00032 #include <kfiletreeviewitem.h>
00033
00034 class KURL;
00035 class KFileTreeView;
00036
00037
00048 class KFileTreeBranch : public KDirLister
00049 {
00050 Q_OBJECT
00051 public:
00062 KFileTreeBranch( KFileTreeView*, const KURL& url, const QString& name,
00063 const QPixmap& pix, bool showHidden = false,
00064 KFileTreeViewItem *branchRoot = 0 );
00065
00069 KURL rootUrl() const { return( m_startURL ); }
00070
00077 virtual void setRoot( KFileTreeViewItem *r ){ m_root = r; };
00078
00082 KFileTreeViewItem *root( ) { return( m_root );}
00083
00087 QString name() const { return( m_name ); }
00088
00092 virtual void setName( const QString n ) { m_name = n; };
00093
00094
00095
00096
00097
00098
00099 const QPixmap& pixmap(){ return(m_rootIcon); }
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109 const QPixmap& openPixmap() { return(m_openRootIcon); }
00110
00115 bool showExtensions( ) const;
00116
00120 void setOpen( bool setopen = true )
00121 { if( root() ) root()->setOpen( setopen ); }
00122
00131 void setChildRecurse( bool t=true );
00132
00137 bool childRecurse()
00138 { return m_recurseChildren; }
00139
00140 public slots:
00147 virtual bool populate( const KURL &url, KFileTreeViewItem* currItem );
00148
00155 virtual void setShowExtensions( bool visible = true );
00156
00157 void setOpenPixmap( const QPixmap& pix );
00158
00159 protected:
00164 virtual KFileTreeViewItem *createTreeViewItem( KFileTreeViewItem *parent,
00165 KFileItem *fileItem );
00166
00167 public:
00171 virtual KFileTreeViewItem *findTVIByURL( const KURL& );
00172
00173 signals:
00177 void populateFinished( KFileTreeViewItem * );
00178
00184 void newTreeViewItems( KFileTreeBranch*, const KFileTreeViewItemList& );
00185
00189 void directoryChildCount( KFileTreeViewItem* item, int count );
00190
00191 private slots:
00192 void addItems( const KFileItemList& );
00193 void slCompleted( const KURL& );
00194 void slotCanceled( const KURL& );
00195 void slotListerStarted( const KURL& );
00196 void slotDeleteItem( KFileItem* );
00197 void slotDirlisterClear();
00198 void slotDirlisterClearURL( const KURL& url );
00199 void slotRedirect( const KURL& oldUrl, const KURL&newUrl );
00200
00201 private:
00202 KFileTreeViewItem *parentKFTVItem( KFileItem *item );
00203 static void deleteChildrenOf( QListViewItem *parent );
00204
00205 KFileTreeViewItem *m_root;
00206 KURL m_startURL;
00207 QString m_name;
00208 QPixmap m_rootIcon;
00209 QPixmap m_openRootIcon;
00210
00211
00212 KURL::List m_openChildrenURLs;
00213
00214
00215
00216 KURL m_lastFoundURL;
00217 KFileTreeViewItem *m_lastFoundItem;
00218
00219 bool m_recurseChildren :1;
00220 bool m_showExtensions :1;
00221
00222 protected:
00223 virtual void virtual_hook( int id, void* data );
00224 private:
00225 class KFileTreeBranchPrivate;
00226 KFileTreeBranchPrivate *d;
00227 };
00228
00229
00233 typedef QPtrList<KFileTreeBranch> KFileTreeBranchList;
00234
00238 typedef QPtrListIterator<KFileTreeBranch> KFileTreeBranchIterator;
00239
00240 #endif
00241
This file is part of the documentation for kio Library Version 3.2.2.