• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kio/kfile
 

kio/kfile

  • kio
  • kfile
kfileiconview.h
1 // -*- c++ -*-
2 /* This file is part of the KDE libraries
3  Copyright (C) 1997 Stephan Kulow <coolo@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
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 KFILEICONVIEW_H
22 #define KFILEICONVIEW_H
23 
24 #include <tqt.h>
25 
26 #include <kiconview.h>
27 #include <kiconloader.h>
28 #include <kfileview.h>
29 #include <kmimetyperesolver.h>
30 #include <kfile.h>
31 
32 class KFileItem;
33 class TQWidget;
34 class TQLabel;
35 
40 class KIO_EXPORT KFileIconViewItem : public KIconViewItem
41 {
42 public:
43  KFileIconViewItem( TQIconView *parent, const TQString &text,
44  const TQPixmap &pixmap,
45  KFileItem *fi )
46  : KIconViewItem( parent, text, pixmap ), inf( fi ) {}
50  KFileIconViewItem( TQIconView *parent, KFileItem *fi )
51  : KIconViewItem( parent ), inf( fi ) {}
52 
53  virtual ~KFileIconViewItem();
54 
58  KFileItem *fileInfo() const {
59  return inf;
60  }
61 
62 private:
63  KFileItem *inf;
64 
65 private:
66  class KFileIconViewItemPrivate;
67  KFileIconViewItemPrivate *d;
68 
69 };
70 
71 namespace KIO {
72  class Job;
73 }
74 
83 class KIO_EXPORT KFileIconView : public KIconView, public KFileView
84 {
85  Q_OBJECT
86 
87 public:
88  KFileIconView(TQWidget *parent, const char *name);
89  virtual ~KFileIconView();
90 
91  virtual TQWidget *widget() { return this; }
92  virtual void clearView();
93  virtual void setAutoUpdate( bool ) {} // ### unused. remove in KDE4
94 
95  virtual void updateView( bool );
96  virtual void updateView(const KFileItem*);
97  virtual void removeItem(const KFileItem*);
98 
99  virtual void listingCompleted();
100 
101  virtual void insertItem( KFileItem *i );
102  virtual void setSelectionMode( KFile::SelectionMode sm );
103 
104  virtual void setSelected(const KFileItem *, bool);
105  virtual bool isSelected(const KFileItem *i) const;
106  virtual void clearSelection();
107  virtual void selectAll();
108  virtual void invertSelection();
109 
110  virtual void setCurrentItem( const KFileItem * );
111  virtual KFileItem * currentFileItem() const;
112  virtual KFileItem * firstFileItem() const;
113  virtual KFileItem * nextItem( const KFileItem * ) const;
114  virtual KFileItem * prevItem( const KFileItem * ) const;
115 
119  void setIconSize( int size );
120 
124  void setPreviewSize( int size );
125 
133  void setIgnoreMaximumSize(bool ignoreSize=true);
134 
138  int iconSize() const { return myIconSize; }
139 
140  void ensureItemVisible( const KFileItem * );
141 
142  virtual void setSorting(TQDir::SortSpec sort);
143 
144  virtual void readConfig( KConfig *, const TQString& group = TQString::null );
145  virtual void writeConfig( KConfig *, const TQString& group = TQString::null);
146 
147  // for KMimeTypeResolver
148  void mimeTypeDeterminationFinished();
149  void determineIcon( KFileIconViewItem *item );
150  TQScrollView *scrollWidget() const { return (TQScrollView*) this; }
151  void setAcceptDrops(bool b)
152  {
153  KIconView::setAcceptDrops(b);
154  viewport()->setAcceptDrops(b);
155  }
156 
157 public slots:
164  void showPreviews();
165 
166  void zoomIn();
167 
168  void zoomOut();
169 
174  virtual void arrangeItemsInGrid( bool updated = true );
175 
176 protected:
180  virtual void keyPressEvent( TQKeyEvent * );
181 
185  virtual void hideEvent( TQHideEvent * );
186 
187  // ### workaround for Qt3 bug (see #35080)
188  virtual void showEvent( TQShowEvent * );
189 
190  virtual bool eventFilter( TQObject *o, TQEvent *e );
191 
192  // DND support
193  virtual TQDragObject *dragObject();
194  virtual void contentsDragEnterEvent( TQDragEnterEvent *e );
195  virtual void contentsDragMoveEvent( TQDragMoveEvent *e );
196  virtual void contentsDragLeaveEvent( TQDragLeaveEvent *e );
197  virtual void contentsDropEvent( TQDropEvent *ev );
198 
199  // KDE4: Make virtual
200  bool acceptDrag(TQDropEvent* e ) const;
201 
202 private slots:
203  void selected( TQIconViewItem *item );
204  void slotActivate( TQIconViewItem * );
205  void highlighted( TQIconViewItem *item );
206  void showToolTip( TQIconViewItem *item );
207  void removeToolTip();
208  void slotActivateMenu( TQIconViewItem *, const TQPoint& );
209  void slotSelectionChanged();
210 
211  void slotSmallColumns();
212  void slotLargeRows();
213  void slotPreviewsToggled( bool );
214 
215  void slotPreviewResult( KIO::Job * );
216  void gotPreview( const KFileItem *item, const TQPixmap& pix );
217  void slotAutoOpen();
218 
219 signals:
226  void dropped(TQDropEvent *event, KFileItem *fileItem);
233  void dropped(TQDropEvent *event, const KURL::List &urls, const KURL &url);
234 
235 private:
236  KMimeTypeResolver<KFileIconViewItem,KFileIconView> *m_resolver;
237 
238  TQLabel *toolTip;
239  int th;
240  int myIconSize;
241 
242  virtual void insertItem(TQIconViewItem *a, TQIconViewItem *b) { KIconView::insertItem(a, b); }
243  virtual void setSelectionMode(TQIconView::SelectionMode m) { KIconView::setSelectionMode(m); }
244  virtual void setSelected(TQIconViewItem *i, bool a, bool b) { KIconView::setSelected(i, a, b); }
245 
246  bool canPreview( const KFileItem * ) const;
247  void stopPreview();
248 
249  void updateIcons();
250 
251  inline KFileIconViewItem * viewItem( const KFileItem *item ) const {
252  if ( item )
253  return (KFileIconViewItem *) item->extraData( this );
254  return 0L;
255  }
256 
257  void initItem(KFileIconViewItem *item, const KFileItem *i,
258  bool updateTextAndPixmap );
259 
260 protected:
261  virtual void virtual_hook( int id, void* data );
262 private:
263  class KFileIconViewPrivate;
264  KFileIconViewPrivate *d;
265 };
266 
267 #endif // KFILESIMPLEVIEW_H
KFileIconViewItem
An item for the iconview, that has a reference to its corresponding KFileItem.
Definition: kfileiconview.h:40
KFileView::setCurrentItem
void setCurrentItem(const TQString &filename)
Sets filename the current item in the view, if available.
Definition: kfileview.cpp:268
KFileIconView::widget
virtual TQWidget * widget()
a pure virtual function to get a TQWidget, that can be added to other widgets.
Definition: kfileiconview.h:91
KFileIconViewItem::KFileIconViewItem
KFileIconViewItem(TQIconView *parent, KFileItem *fi)
Definition: kfileiconview.h:50
KFileView::insertItem
virtual void insertItem(KFileItem *i)
The derived view must implement this function to add the file in the widget.
Definition: kfileview.cpp:147
KFileView
This class defines an interface to all file views.
Definition: kfileview.h:98
KFileView::clearSelection
virtual void clearSelection()=0
Clears any selection, unhighlights everything.
KFileView::selectAll
virtual void selectAll()
Selects all items.
Definition: kfileview.cpp:312
KFileView::currentFileItem
virtual KFileItem * currentFileItem() const =0
KFileView::setSelected
virtual void setSelected(const KFileItem *, bool enable)=0
Tells the view that it should highlight the item.
KFileIconView::iconSize
int iconSize() const
Definition: kfileiconview.h:138
KFileView::isSelected
virtual bool isSelected(const KFileItem *) const =0
KFileView::removeItem
virtual void removeItem(const KFileItem *item)
Removes an item from the list; has to be implemented by the view.
Definition: kfileview.cpp:346
KFileView::invertSelection
virtual void invertSelection()
Inverts the current selection, i.e.
Definition: kfileview.cpp:323
KFileIconViewItem::fileInfo
KFileItem * fileInfo() const
Definition: kfileiconview.h:58
KFileView::setSorting
virtual void setSorting(TQDir::SortSpec sort)
Sets the sorting order of the view.
Definition: kfileview.cpp:151
KFileView::updateView
virtual void updateView(bool f=true)
does a repaint of the view.
Definition: kfileview.cpp:259
KFileView::ensureItemVisible
virtual void ensureItemVisible(const KFileItem *i)=0
pure virtual function, that should be implemented to make item i visible, i.e.
KFileView::clearView
virtual void clearView()=0
pure virtual function, that should be implemented to clear the view.
KFileIconView
An icon-view capable of showing KFileItem's.
Definition: kfileiconview.h:83
KFileView::listingCompleted
virtual void listingCompleted()
This hook is called when all items of the currently listed directory are listed and inserted into the...
Definition: kfileview.cpp:360

kio/kfile

Skip menu "kio/kfile"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kio/kfile

Skip menu "kio/kfile"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kio/kfile by doxygen 1.8.6
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |