filetreeviewwidgetimpl.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 * Copyright (C) 2003 by Mario Scalas * 00003 * mario.scalas@libero.it * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 ***************************************************************************/ 00011 00012 #ifndef FILETREEVIEWWIDGETIMPL_H 00013 #define FILETREEVIEWWIDGETIMPL_H 00014 00015 #include <qobject.h> 00016 #include <qvaluelist.h> 00017 #include <kfiletreeview.h> 00018 #include <qdom.h> 00019 00020 #include "fileitemfactory.h" 00021 00022 class FileTreeWidget; 00023 namespace filetreeview 00024 { 00025 class FileTreeViewItem; 00026 class FileTreeBranchItem; 00027 class BranchItemFactory; 00028 } 00029 class FileViewPart; 00030 class QHeader; 00031 class KToggleAction; 00032 class QPopupMenu; 00033 00039 class FileTreeViewWidgetImpl : public QObject 00040 { 00041 Q_OBJECT 00042 public: 00043 FileTreeViewWidgetImpl( FileTreeWidget *parent, const char *name ); 00044 virtual ~FileTreeViewWidgetImpl(); 00045 00047 KURL::List selectedPathUrls(); 00048 // shortcuts 00049 FileTreeWidget *fileTree() const; 00050 QDomDocument &projectDom() const; 00051 QHeader *header() const { return fileTree()->header(); } 00052 void setColumnWidth( int column, int w ) { fileTree()->setColumnWidth( column, w ); } 00053 int contentsWidth() const { return fileTree()->contentsWidth(); } 00054 void triggerUpdate() { fileTree()->triggerUpdate(); } 00055 FileViewPart *part() const { return m_part; } 00056 filetreeview::FileTreeViewItem *currentItem() const { return static_cast<filetreeview::FileTreeViewItem*>( fileTree()->currentItem() ); } 00061 filetreeview::BranchItemFactory *branchItemFactory() const { return m_branchItemFactory; } 00066 virtual bool canReloadTree() const = 0; 00073 virtual void fillPopupMenu( QPopupMenu *popupMenu, QListViewItem *item ) const; 00077 bool showNonProjectFiles() const; 00078 00079 signals: 00084 void implementationInvalidated(); 00085 00086 private slots: 00087 void slotReloadTree(); 00088 void slotToggleShowNonProjectFiles(); 00089 00090 protected: 00091 void setBranchItemFactory( filetreeview::BranchItemFactory *aFactory ) { m_branchItemFactory = aFactory; } 00092 QString projectDirectory() const; 00093 00094 private: 00095 QValueList<QListViewItem*> allSelectedItems( QListViewItem * item ) const; 00096 filetreeview::BranchItemFactory *m_branchItemFactory; 00097 00098 FileViewPart *m_part; 00099 00100 bool m_isReloadingTree; 00101 00102 KToggleAction *m_actionToggleShowNonProjectFiles; 00103 }; 00104 00105 #endif