• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kio

kfiletreeview.h

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2000 David Faure <faure@kde.org>
00003                  2000 Carsten Pfeiffer <pfeiffer@kde.org>
00004          2002 Klaas Freitag <freitag@suse.de>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License version 2 as published by the Free Software Foundation.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018    Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef kfile_tree_view_h
00022 #define kfile_tree_view_h
00023 
00024 #include <qmap.h>
00025 #include <qpoint.h>
00026 #include <qpixmap.h>
00027 #include <qstrlist.h>
00028 #include <qtooltip.h>
00029 
00030 #include <klistview.h>
00031 #include <kdirnotify.h>
00032 #include <kio/job.h>
00033 #include <kfiletreeviewitem.h>
00034 #include <kfiletreebranch.h>
00035 
00036 class QTimer;
00037 
00038 
00039 
00040 class KIO_EXPORT KFileTreeViewToolTip : public QToolTip
00041 {
00042 public:
00043     KFileTreeViewToolTip( QListView *view ) : QToolTip( view ), m_view( view ) {}
00044 
00045 protected:
00046     virtual void maybeTip( const QPoint & );
00047 
00048 private:
00049     QListView *m_view;
00050 };
00051 
00052 
00066 class KIO_EXPORT KFileTreeView : public KListView
00067 {
00068     Q_OBJECT
00069 public:
00070     KFileTreeView( QWidget *parent, const char *name = 0 );
00071     virtual ~KFileTreeView();
00072 
00076     KFileTreeViewItem * currentKFileTreeViewItem() const;
00077 
00081     KURL currentURL() const;
00082 
00096    KFileTreeBranch* addBranch( const KURL &path, const QString& name, bool showHidden = false );
00097 
00101    virtual KFileTreeBranch* addBranch( const KURL &path, const QString& name ,
00102                        const QPixmap& pix, bool showHidden = false  );
00103 
00107    virtual KFileTreeBranch* addBranch( KFileTreeBranch * );
00108 
00114    virtual bool removeBranch( KFileTreeBranch *branch );
00115 
00120    KFileTreeBranch *branch( const QString& searchName );
00121 
00122 
00126    KFileTreeBranchList& branches();
00127 
00132    virtual void setDirOnlyMode( KFileTreeBranch *branch, bool );
00133 
00142    KFileTreeViewItem *findItem( KFileTreeBranch* brnch, const QString& relUrl );
00143 
00147    KFileTreeViewItem *findItem( const QString& branchName, const QString& relUrl );
00148 
00152    bool showFolderOpenPixmap() const { return m_wantOpenFolderPixmaps; };
00153 
00154 public slots:
00155 
00163    virtual void setShowFolderOpenPixmap( bool showIt = true )
00164       { m_wantOpenFolderPixmaps = showIt; }
00165 
00166 protected:
00171    virtual bool acceptDrag(QDropEvent* event) const;
00172     virtual QDragObject * dragObject();
00173 
00174     virtual void startAnimation( KFileTreeViewItem* item, const char * iconBaseName = "kde", uint iconCount = 6 );
00175     virtual void stopAnimation( KFileTreeViewItem* item );
00176     virtual void contentsDragEnterEvent( QDragEnterEvent *e );
00177     virtual void contentsDragMoveEvent( QDragMoveEvent *e );
00178     virtual void contentsDragLeaveEvent( QDragLeaveEvent *e );
00179     virtual void contentsDropEvent( QDropEvent *ev );
00180 
00181 protected slots:
00182     virtual void slotNewTreeViewItems( KFileTreeBranch*,
00183                        const KFileTreeViewItemList& );
00184 
00185     virtual void slotSetNextUrlToSelect( const KURL &url )
00186       { m_nextUrlToSelect = url; }
00187 
00188     virtual QPixmap itemIcon( KFileTreeViewItem*, int gap = 0 ) const;
00189 
00190 private slots:
00191     void slotExecuted( QListViewItem * );
00192     void slotExpanded( QListViewItem * );
00193     void slotCollapsed( QListViewItem *item );
00194 
00195     void slotSelectionChanged();
00196 
00197     void slotAnimation();
00198 
00199     void slotAutoOpenFolder();
00200 
00201     void slotOnItem( QListViewItem * );
00202     void slotItemRenamed(QListViewItem*, const QString &, int);
00203 
00204    void slotPopulateFinished( KFileTreeViewItem* );
00205 
00206 
00207 signals:
00208 
00209    void onItem( const QString& );
00210    /* New signals if you like it ? */
00211    void dropped( QWidget*, QDropEvent* );
00212    void dropped( QWidget*, QDropEvent*, KURL::List& );
00213    void dropped( KURL::List&, KURL& );
00214    // The drop event allows to differentiate between move and copy
00215    void dropped( QWidget*, QDropEvent*, KURL::List&, KURL& );
00216 
00217    void dropped( QDropEvent *e, QListViewItem * after);
00218    void dropped(KFileTreeView *, QDropEvent *, QListViewItem *);
00219    void dropped(QDropEvent *e, QListViewItem * parent, QListViewItem * after);
00220    void dropped(KFileTreeView *, QDropEvent *, QListViewItem *, QListViewItem *);
00221 
00222 protected:
00223    KURL m_nextUrlToSelect;
00224 
00225 
00226 private:
00227     // Returns whether item is still a valid item in the tree
00228     bool isValidItem( QListViewItem *item);
00229     void clearTree();
00230 
00231 
00232    /* List that holds the branches */
00233     KFileTreeBranchList m_branches;
00234 
00235 
00236     struct AnimationInfo
00237     {
00238         AnimationInfo( const char * _iconBaseName, uint _iconCount, const QPixmap & _originalPixmap )
00239             : iconBaseName(_iconBaseName), iconCount(_iconCount), iconNumber(1), originalPixmap(_originalPixmap) {}
00240         AnimationInfo() : iconCount(0) {}
00241         QCString iconBaseName;
00242         uint iconCount;
00243         uint iconNumber;
00244         QPixmap originalPixmap;
00245     };
00246     typedef QMap<KFileTreeViewItem *, AnimationInfo> MapCurrentOpeningFolders;
00247     MapCurrentOpeningFolders m_mapCurrentOpeningFolders;
00248 
00249 
00250     QTimer *m_animationTimer;
00251 
00252     QPoint m_dragPos;
00253     bool m_bDrag;
00254 
00255    bool m_wantOpenFolderPixmaps; // Flag weather the folder should have open-folder pixmaps
00256 
00257     QListViewItem *m_currentBeforeDropItem; // The item that was current before the drag-enter event happened
00258     QListViewItem *m_dropItem; // The item we are moving the mouse over (during a drag)
00259     QStrList m_lstDropFormats;
00260    QPixmap  m_openFolderPixmap;
00261     QTimer *m_autoOpenTimer;
00262 
00263     KFileTreeViewToolTip m_toolTip;
00264 
00265 
00266 protected:
00267    virtual void virtual_hook( int id, void* data );
00268 private:
00269    class KFileTreeViewPrivate;
00270    KFileTreeViewPrivate *d;
00271 };
00272 
00273 #endif

kio

Skip menu "kio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal