• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdefile
 

tdeio/tdefile

  • tdeio
  • tdefile
tdefiletreeview.h
1 /* This file is part of the KDE project
2  Copyright (C) 2000 David Faure <faure@kde.org>
3  2000 Carsten Pfeiffer <pfeiffer@kde.org>
4  2002 Klaas Freitag <freitag@suse.de>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2 as published by the Free Software Foundation.
9 
10  This library 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  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #ifndef TDEFILE_TREE_VIEW_H
22 #define TDEFILE_TREE_VIEW_H
23 
24 #include <tqmap.h>
25 #include <tqpoint.h>
26 #include <tqpixmap.h>
27 #include <tqstrlist.h>
28 #include <tqtooltip.h>
29 
30 #include <tdelistview.h>
31 #include <kdirnotify.h>
32 #include <tdeio/job.h>
33 #include <tdefiletreeviewitem.h>
34 #include <tdefiletreebranch.h>
35 
36 class TQTimer;
37 
38 
39 
40 class TDEIO_EXPORT KFileTreeViewToolTip : public TQToolTip
41 {
42 public:
43  KFileTreeViewToolTip( TQListView *view ) : TQToolTip( view ), m_view( view ) {}
44 
45 protected:
46  virtual void maybeTip( const TQPoint & );
47 
48 private:
49  TQListView *m_view;
50 };
51 
52 
66 class TDEIO_EXPORT KFileTreeView : public TDEListView
67 {
68  TQ_OBJECT
69 public:
70  KFileTreeView( TQWidget *parent, const char *name = 0 );
71  virtual ~KFileTreeView();
72 
76  KFileTreeViewItem * currentKFileTreeViewItem() const;
77 
81  KURL currentURL() const;
82 
96  KFileTreeBranch* addBranch( const KURL &path, const TQString& name, bool showHidden = false );
97 
101  virtual KFileTreeBranch* addBranch( const KURL &path, const TQString& name ,
102  const TQPixmap& pix, bool showHidden = false );
103 
107  virtual KFileTreeBranch* addBranch( KFileTreeBranch * );
108 
114  virtual bool removeBranch( KFileTreeBranch *branch );
115 
120  KFileTreeBranch *branch( const TQString& searchName );
121 
122 
126  KFileTreeBranchList& branches();
127 
132  virtual void setDirOnlyMode( KFileTreeBranch *branch, bool );
133 
142  KFileTreeViewItem *findItem( KFileTreeBranch* brnch, const TQString& relUrl );
143 
147  KFileTreeViewItem *findItem( const TQString& branchName, const TQString& relUrl );
148 
152  bool showFolderOpenPixmap() const { return m_wantOpenFolderPixmaps; };
153 
154 public slots:
155 
163  virtual void setShowFolderOpenPixmap( bool showIt = true )
164  { m_wantOpenFolderPixmaps = showIt; }
165 
166 protected:
171  virtual bool acceptDrag(TQDropEvent* event) const;
172  virtual TQDragObject * dragObject();
173 
174  virtual void startAnimation( KFileTreeViewItem* item, const char * iconBaseName = "kde", uint iconCount = 6 );
175  virtual void stopAnimation( KFileTreeViewItem* item );
176  virtual void contentsDragEnterEvent( TQDragEnterEvent *e );
177  virtual void contentsDragMoveEvent( TQDragMoveEvent *e );
178  virtual void contentsDragLeaveEvent( TQDragLeaveEvent *e );
179  virtual void contentsDropEvent( TQDropEvent *ev );
180 
181 protected slots:
182  virtual void slotNewTreeViewItems( KFileTreeBranch*,
183  const KFileTreeViewItemList& );
184 
185  virtual void slotSetNextUrlToSelect( const KURL &url )
186  { m_nextUrlToSelect = url; }
187 
188  virtual TQPixmap itemIcon( KFileTreeViewItem*, int gap = 0 ) const;
189 
190 private slots:
191  void slotExecuted( TQListViewItem * );
192  void slotExpanded( TQListViewItem * );
193  void slotCollapsed( TQListViewItem *item );
194 
195  void slotSelectionChanged();
196 
197  void slotAnimation();
198 
199  void slotAutoOpenFolder();
200 
201  void slotOnItem( TQListViewItem * );
202  void slotItemRenamed(TQListViewItem*, const TQString &, int);
203 
204  void slotPopulateFinished( KFileTreeViewItem* );
205 
206 
207 signals:
208 
209  void onItem( const TQString& );
210  /* New signals if you like it ? */
211  void dropped( TQWidget*, TQDropEvent* );
212  void dropped( TQWidget*, TQDropEvent*, KURL::List& );
213  void dropped( KURL::List&, KURL& );
214  // The drop event allows to differentiate between move and copy
215  void dropped( TQWidget*, TQDropEvent*, KURL::List&, KURL& );
216 
217  void dropped( TQDropEvent *e, TQListViewItem * after);
218  void dropped(KFileTreeView *, TQDropEvent *, TQListViewItem *);
219  void dropped(TQDropEvent *e, TQListViewItem * parent, TQListViewItem * after);
220  void dropped(KFileTreeView *, TQDropEvent *, TQListViewItem *, TQListViewItem *);
221 
222 protected:
223  KURL m_nextUrlToSelect;
224 
225 
226 private:
227  // Returns whether item is still a valid item in the tree
228  bool isValidItem( TQListViewItem *item);
229  void clearTree();
230 
231 
232  /* List that holds the branches */
233  KFileTreeBranchList m_branches;
234 
235 
236  struct AnimationInfo
237  {
238  AnimationInfo( const char * _iconBaseName, uint _iconCount, const TQPixmap & _originalPixmap )
239  : iconBaseName(_iconBaseName), iconCount(_iconCount), iconNumber(1), originalPixmap(_originalPixmap) {}
240  AnimationInfo() : iconCount(0) {}
241  TQCString iconBaseName;
242  uint iconCount;
243  uint iconNumber;
244  TQPixmap originalPixmap;
245  };
246  typedef TQMap<KFileTreeViewItem *, AnimationInfo> MapCurrentOpeningFolders;
247  MapCurrentOpeningFolders m_mapCurrentOpeningFolders;
248 
249 
250  TQTimer *m_animationTimer;
251 
252  TQPoint m_dragPos;
253  bool m_bDrag;
254 
255  bool m_wantOpenFolderPixmaps; // Flag weather the folder should have open-folder pixmaps
256 
257  TQListViewItem *m_currentBeforeDropItem; // The item that was current before the drag-enter event happened
258  TQListViewItem *m_dropItem; // The item we are moving the mouse over (during a drag)
259  TQStrList m_lstDropFormats;
260  TQPixmap m_openFolderPixmap;
261  TQTimer *m_autoOpenTimer;
262 
263  KFileTreeViewToolTip m_toolTip;
264 
265 
266 protected:
267  virtual void virtual_hook( int id, void* data );
268 private:
269  class KFileTreeViewPrivate;
270  KFileTreeViewPrivate *d;
271 };
272 
273 #endif
KFileTreeBranch
This is the branch class of the KFileTreeView, which represents one branch in the treeview.
Definition: tdefiletreebranch.h:49
KFileTreeViewItem
An item for a KFileTreeView that knows about its own KFileItem.
Definition: tdefiletreeviewitem.h:41
KFileTreeView
The filetreeview offers a treeview on the file system which behaves like a QTreeView showing files an...
Definition: tdefiletreeview.h:67
KFileTreeView::showFolderOpenPixmap
bool showFolderOpenPixmap() const
Definition: tdefiletreeview.h:152
KFileTreeView::setShowFolderOpenPixmap
virtual void setShowFolderOpenPixmap(bool showIt=true)
set the flag to show 'extended' folder icons on or off.
Definition: tdefiletreeview.h:163

tdeio/tdefile

Skip menu "tdeio/tdefile"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeio/tdefile

Skip menu "tdeio/tdefile"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdefile by doxygen 1.9.1
This website is maintained by Timothy Pearson.