• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDE3Support

  • sources
  • kde-4.14
  • kdelibs
  • kde3support
  • kio
  • kfile
k3filetreeview.h
Go to the documentation of this file.
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 kfile_tree_view_h
22 #define kfile_tree_view_h
23 
24 #include <QtCore/QMap>
25 #include <QtCore/QPoint>
26 #include <QtGui/QPixmap>
27 
28 
29 
30 #include <k3listview.h>
31 #include <kdirnotify.h>
32 #include <kio/job.h>
33 #include <k3filetreeviewitem.h>
34 #include <kfiletreebranch.h>
35 
36 class QTimer;
37 
38 
39 
53 class KDE3SUPPORT_EXPORT K3FileTreeView : public K3ListView
54 {
55  Q_OBJECT
56 public:
57  K3FileTreeView( QWidget *parent );
58  virtual ~K3FileTreeView();
59 
63  K3FileTreeViewItem * currentKFileTreeViewItem() const;
64 
68  KUrl currentUrl() const;
69 
83  KFileTreeBranch* addBranch( const KUrl &path, const QString& name, bool showHidden = false );
84 
88  virtual KFileTreeBranch* addBranch( const KUrl &path, const QString& name ,
89  const QPixmap& pix, bool showHidden = false );
90 
94  virtual KFileTreeBranch* addBranch( KFileTreeBranch * );
95 
101  virtual bool removeBranch( KFileTreeBranch *branch );
102 
107  KFileTreeBranch *branch( const QString& searchName );
108 
109 
113  KFileTreeBranchList& branches();
114 
119  virtual void setDirOnlyMode( KFileTreeBranch *branch, bool );
120 
129  K3FileTreeViewItem *findItem( KFileTreeBranch* brnch, const QString& relUrl );
130 
134  K3FileTreeViewItem *findItem( const QString& branchName, const QString& relUrl );
135 
139  bool showFolderOpenPixmap() const;
140 
141 public Q_SLOTS:
142 
150  virtual void setShowFolderOpenPixmap( bool showIt = true );
151 
152 protected:
157  virtual bool acceptDrag(QDropEvent* event) const;
158  virtual Q3DragObject * dragObject();
159 
160  virtual void startAnimation( K3FileTreeViewItem* item, const char * iconBaseName = "kde", uint iconCount = 6 );
161  virtual void stopAnimation( K3FileTreeViewItem* item );
162  virtual void contentsDragEnterEvent( QDragEnterEvent *e );
163  virtual void contentsDragMoveEvent( QDragMoveEvent *e );
164  virtual void contentsDragLeaveEvent( QDragLeaveEvent *e );
165  virtual void contentsDropEvent( QDropEvent *ev );
166 
167 protected Q_SLOTS:
168  virtual void slotNewTreeViewItems( KFileTreeBranch*,
169  const K3FileTreeViewItemList& );
170 
171  virtual void slotSetNextUrlToSelect( const KUrl &url );
172 
173  virtual QPixmap itemIcon( K3FileTreeViewItem*, int gap = 0 ) const;
174 
175 private Q_SLOTS:
176  void slotExecuted( Q3ListViewItem * );
177  void slotExpanded( Q3ListViewItem * );
178  void slotCollapsed( Q3ListViewItem *item );
179 
180  void slotSelectionChanged();
181 
182  void slotAnimation();
183 
184  void slotAutoOpenFolder();
185 
186  void slotOnItem( Q3ListViewItem * );
187  void slotItemRenamed(Q3ListViewItem*, const QString &, int);
188 
189  void slotPopulateFinished( K3FileTreeViewItem* );
190 
191 
192 Q_SIGNALS:
193 
194  void onItem( const QString& );
195  /* New signals if you like it ? */
196  void dropped( QWidget*, QDropEvent* );
197  void dropped( QWidget*, QDropEvent*, KUrl::List& );
198  void dropped( KUrl::List&, KUrl& );
199  // The drop event allows to differentiate between move and copy
200  void dropped( QWidget*, QDropEvent*, KUrl::List&, KUrl& );
201 
202  void dropped( QDropEvent *, Q3ListViewItem * );
203  void dropped(K3FileTreeView *, QDropEvent *, Q3ListViewItem *);
204  void dropped(QDropEvent *, Q3ListViewItem *, Q3ListViewItem *);
205  void dropped(K3FileTreeView *, QDropEvent *, Q3ListViewItem *, Q3ListViewItem *);
206 
207 protected:
208  KUrl m_nextUrlToSelect;
209 
210 
211 private:
212  // Returns whether item is still a valid item in the tree
213  bool isValidItem( Q3ListViewItem *item);
214  void clearTree();
215 
216 
217  /* List that holds the branches */
218  KFileTreeBranchList m_branches;
219 
220 
221  struct AnimationInfo
222  {
223  AnimationInfo( const char * _iconBaseName, uint _iconCount, const QPixmap & _originalPixmap )
224  : iconBaseName(_iconBaseName), iconCount(_iconCount), iconNumber(1), originalPixmap(_originalPixmap) {}
225  AnimationInfo() : iconCount(0) {}
226  QByteArray iconBaseName;
227  uint iconCount;
228  uint iconNumber;
229  QPixmap originalPixmap;
230  };
231  typedef QMap<K3FileTreeViewItem *, AnimationInfo> MapCurrentOpeningFolders;
232  MapCurrentOpeningFolders m_mapCurrentOpeningFolders;
233 
234 
235  QTimer *m_animationTimer;
236 
237  QPoint m_dragPos;
238  bool m_bDrag;
239 
240  bool m_wantOpenFolderPixmaps; // Flag weather the folder should have open-folder pixmaps
241 
242  Q3ListViewItem *m_currentBeforeDropItem; // The item that was current before the drag-enter event happened
243  Q3ListViewItem *m_dropItem; // The item we are moving the mouse over (during a drag)
244  QPixmap m_openFolderPixmap;
245  QTimer *m_autoOpenTimer;
246 
247 private:
248  class K3FileTreeViewPrivate;
249  K3FileTreeViewPrivate *d;
250 };
251 
252 #endif
QWidget
Q3DragObject
QByteArray
QDragMoveEvent
kdirnotify.h
KFileTreeBranch
This is the branch class of the K3FileTreeView, which represents one branch in the treeview...
Definition: kfiletreebranch.h:49
QMap< K3FileTreeViewItem *, AnimationInfo >
name
const char * name(StandardAction id)
Q3ListView::onItem
void onItem(Q3ListViewItem *i)
Q3PtrList< KFileTreeBranch >
QPoint
K3ListView::contentsDragEnterEvent
virtual void contentsDragEnterEvent(QDragEnterEvent *)
Reimplemented for internal reasons.
Definition: k3listview.cpp:1282
KUrl
Q3ListViewItem
k3listview.h
QTimer
QDropEvent
k3filetreeviewitem.h
K3ListView::contentsDragMoveEvent
virtual void contentsDragMoveEvent(QDragMoveEvent *event)
Reimplemented for internal reasons.
Definition: k3listview.cpp:976
K3ListView::contentsDropEvent
virtual void contentsDropEvent(QDropEvent *)
Reimplemented for internal reasons.
Definition: k3listview.cpp:900
K3ListView::dropped
void dropped(QDropEvent *e, Q3ListViewItem *after)
This signal gets emitted whenever something acceptable is dropped onto the listview.
QString
K3ListView
This Widget extends the functionality of Q3ListView to honor the system wide settings for Single Clic...
Definition: k3listview.h:57
QPixmap
Q3ListView::findItem
Q3ListViewItem * findItem(const QString &text, int column, ComparisonFlags compare) const
K3ListView::contentsDragLeaveEvent
virtual void contentsDragLeaveEvent(QDragLeaveEvent *event)
Reimplemented for internal reasons.
Definition: k3listview.cpp:1028
QDragLeaveEvent
K3ListView::slotOnItem
void slotOnItem(Q3ListViewItem *item)
Accessory slot for AutoSelect.
Definition: k3listview.cpp:516
job.h
K3ListView::dragObject
virtual Q3DragObject * dragObject()
Definition: k3listview.cpp:1155
KUrl::List
K3FileTreeViewItem
An item for a K3FileTreeView that knows about its own KFileItem.
Definition: k3filetreeviewitem.h:41
K3ListView::acceptDrag
virtual bool acceptDrag(QDropEvent *event) const
Definition: k3listview.cpp:1409
QDragEnterEvent
K3FileTreeView
The filetreeview offers a treeview on the file system which behaves like a QTreeView showing files an...
Definition: k3filetreeview.h:53
kfiletreebranch.h
K3FileTreeView::m_nextUrlToSelect
KUrl m_nextUrlToSelect
Definition: k3filetreeview.h:208
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:26:47 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDE3Support

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal