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

kio/kfile

  • kio
  • kfile
kfileview.h
1 // -*- c++ -*-
2 /* This file is part of the KDE libraries
3  Copyright (C) 1997 Stephan Kulow <coolo@kde.org>
4  Copyright (C) 2001 Carsten Pfeiffer <pfeiffer@kde.org>
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 as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef KFILEVIEW_H
23 #define KFILEVIEW_H
24 
25 class TQPoint;
26 class KActionCollection;
27 
28 #include <tqwidget.h>
29 
30 #include "kfileitem.h"
31 #include "kfile.h"
32 
37 class KIO_EXPORT KFileViewSignaler : public TQObject
38 {
39  Q_OBJECT
40 
41 public:
46  void activate( const KFileItem *item ) {
47  if ( item->isDir() )
48  emit dirActivated( item );
49  else
50  emit fileSelected( item );
51  }
56  void highlightFile(const KFileItem *i) { emit fileHighlighted(i); }
57 
58  void activateMenu( const KFileItem *i, const TQPoint& pos ) {
59  emit activatedMenu( i, pos );
60  }
61 
62  void changeSorting( TQDir::SortSpec sorting ) {
63  emit sortingChanged( sorting );
64  }
65 
66  void dropURLs(const KFileItem *i, TQDropEvent*e, const KURL::List&urls) {
67  emit dropped(i, e, urls);
68  }
69 
70 signals:
71  void dirActivated(const KFileItem*);
72 
73  void sortingChanged( TQDir::SortSpec );
74 
79  void fileHighlighted(const KFileItem*);
80  void fileSelected(const KFileItem*);
81  void activatedMenu( const KFileItem *i, const TQPoint& );
82  void dropped(const KFileItem *, TQDropEvent*, const KURL::List&);
83 };
84 
98 class KIO_EXPORT KFileView {
99 
100 public:
101  KFileView();
102 
106  virtual ~KFileView();
107 
111  void addItemList(const KFileItemList &list);
112 
118  virtual TQWidget *widget() = 0;
119 
123  TQWidget *widget() const { return const_cast<KFileView*>(this)->widget(); }
124 
128  void setCurrentItem( const TQString &filename );
129 
134  virtual void setCurrentItem( const KFileItem *item ) = 0;
135 
141  virtual KFileItem *currentFileItem() const = 0;
142 
146  virtual void clear();
147 
156  virtual void updateView(bool f = true);
157 
158  virtual void updateView(const KFileItem*);
159 
164  virtual void removeItem(const KFileItem *item);
165 
171  virtual void listingCompleted();
172 
177  TQDir::SortSpec sorting() const { return m_sorting; }
178 
193  virtual void setSorting(TQDir::SortSpec sort);
194 
199  bool isReversed() const { return (m_sorting & TQDir::Reversed); }
200 
201  void sortReversed();
202 
206  uint count() const { return filesNumber + dirsNumber; }
207 
211  uint numFiles() const { return filesNumber; }
212 
216  uint numDirs() const { return dirsNumber; }
217 
218  virtual void setSelectionMode( KFile::SelectionMode sm );
219  virtual KFile::SelectionMode selectionMode() const;
220 
221  enum ViewMode {
222  Files = 1,
223  Directories = 2,
224  All = Files | Directories
225  };
226  virtual void setViewMode( ViewMode vm );
227  virtual ViewMode viewMode() const { return view_mode; }
228 
234  TQString viewName() const { return m_viewName; }
235 
240  void setViewName( const TQString& name ) { m_viewName = name; }
241 
242  virtual void setParentView(KFileView *parent);
243 
252  virtual void insertItem( KFileItem *i);
253 
258  virtual void clearView() = 0;
259 
264  virtual void ensureItemVisible( const KFileItem *i ) = 0;
265 
270  virtual void clearSelection() = 0;
271 
277  virtual void selectAll();
278 
283  virtual void invertSelection();
284 
289  virtual void setSelected(const KFileItem *, bool enable) = 0;
290 
295  virtual bool isSelected( const KFileItem * ) const = 0;
296 
300  const KFileItemList * selectedItems() const;
301 
305  const KFileItemList * items() const;
306 
307  virtual KFileItem * firstFileItem() const = 0;
308  virtual KFileItem * nextItem( const KFileItem * ) const = 0;
309  virtual KFileItem * prevItem( const KFileItem * ) const = 0;
310 
321  void setOnlyDoubleClickSelectsFiles( bool enable ) {
322  myOnlyDoubleClickSelectsFiles = enable;
323  }
324 
330  bool onlyDoubleClickSelectsFiles() const {
331  return myOnlyDoubleClickSelectsFiles;
332  }
333 
338  bool updateNumbers(const KFileItem *i);
339 
345  virtual KActionCollection * actionCollection() const;
346 
347  KFileViewSignaler * signaler() const { return sig; }
348 
349  virtual void readConfig( KConfig *, const TQString& group = TQString::null );
350  virtual void writeConfig( KConfig *, const TQString& group = TQString::null);
351 
359  enum DropOptions {
360  AutoOpenDirs = 1
361  };
367  // KDE 4: Make virtual
368  void setDropOptions(int options);
369 
375  int dropOptions();
376 
390  static TQString sortingKey( const TQString& value, bool isDir, int sortSpec);
391 
398  static TQString sortingKey( KIO::filesize_t value, bool isDir,int sortSpec);
399 
404  static int autoOpenDelay();
405 
406 protected:
411  KFileViewSignaler *sig;
412 
413 private:
414  static TQDir::SortSpec defaultSortSpec;
415  TQDir::SortSpec m_sorting;
416  TQString m_viewName;
417 
421  uint filesNumber;
422  uint dirsNumber;
423 
424  ViewMode view_mode;
425  KFile::SelectionMode selection_mode;
426 
427  // never use! It's only guaranteed to contain valid items in the items()
428  // method!
429  mutable KFileItemList m_itemList;
430 
431  mutable KFileItemList *m_selectedList;
432  bool myOnlyDoubleClickSelectsFiles;
433 
434 protected:
435  virtual void virtual_hook( int id, void* data );
436  /* @internal for virtual_hook */
437  enum { VIRTUAL_SET_DROP_OPTIONS = 1 };
438  void setDropOptions_impl(int options);
439 private:
440  class KFileViewPrivate;
441  KFileViewPrivate *d;
442 };
443 
444 #endif // KFILEINFOLISTWIDGET_H
KFileViewSignaler::activate
void activate(const KFileItem *item)
Call this method when an item is selected (depends on single click / double click configuration)...
Definition: kfileview.h:46
KFileView::onlyDoubleClickSelectsFiles
bool onlyDoubleClickSelectsFiles() const
Definition: kfileview.h:330
KFileViewSignaler::highlightFile
void highlightFile(const KFileItem *i)
emits the highlighted signal for item.
Definition: kfileview.h:56
KFileView::isReversed
bool isReversed() const
Tells whether the current items are in reversed order (shortcut to sorting() & TQDir::Reversed).
Definition: kfileview.h:199
KFileView
This class defines an interface to all file views.
Definition: kfileview.h:98
KFileView::sorting
TQDir::SortSpec sorting() const
Returns the sorting order of the internal list.
Definition: kfileview.h:177
KFileView::widget
TQWidget * widget() const
As const-method, to be fixed in 3.0
Definition: kfileview.h:123
KFileView::numFiles
uint numFiles() const
Definition: kfileview.h:211
KFileView::DropOptions
DropOptions
Various options for drag and drop support.
Definition: kfileview.h:359
KFileView::setViewName
void setViewName(const TQString &name)
Sets the name of the view, which could be displayed somewhere.
Definition: kfileview.h:240
KFileView::count
uint count() const
Definition: kfileview.h:206
KFileView::viewName
TQString viewName() const
Definition: kfileview.h:234
KFileViewSignaler
internal class to make easier to use signals possible
Definition: kfileview.h:37
KFileView::setOnlyDoubleClickSelectsFiles
void setOnlyDoubleClickSelectsFiles(bool enable)
This is a KFileDialog specific hack: we want to select directories with single click, but not files.
Definition: kfileview.h:321
KFileView::numDirs
uint numDirs() const
Definition: kfileview.h:216

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.13
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |