KFileView Class Reference
This class defines an interface to all file views. A base class for views of the KDE file selector. More...
#include <kfileview.h>
Inheritance diagram for KFileView:

Public Types | |
enum | ViewMode { Files = 1, Directories = 2, All = Files | Directories } |
Public Member Functions | |
virtual | ~KFileView () |
Destructor. | |
void | addItemList (const KFileItemList &list) |
inserts a list of items. | |
virtual QWidget * | widget ()=0 |
a pure virtual function to get a QWidget, that can be added to other widgets. | |
QWidget * | widget () const |
### As const-method, to be fixed in 3.0 | |
void | setCurrentItem (const QString &filename) |
Sets filename the current item in the view, if available. | |
virtual void | setCurrentItem (const KFileItem *item)=0 |
Reimplement this to set item the current item in the view, e.g. | |
virtual KFileItem * | currentFileItem () const =0 |
virtual void | clear () |
Clears the view and all item lists. | |
virtual void | updateView (bool f=true) |
does a repaint of the view. | |
virtual void | updateView (const KFileItem *) |
virtual void | removeItem (const KFileItem *item) |
Removes an item from the list; has to be implemented by the view. | |
virtual void | listingCompleted () |
This hook is called when all items of the currently listed directory are listed and inserted into the view, i.e. | |
QDir::SortSpec | sorting () const |
Returns the sorting order of the internal list. | |
virtual void | setSorting (QDir::SortSpec sort) |
Sets the sorting order of the view. | |
bool | isReversed () const |
Tells whether the current items are in reversed order (shortcut to sorting() & QDir::Reversed). | |
void | sortReversed () |
uint | count () const |
uint | numFiles () const |
uint | numDirs () const |
virtual void | setSelectionMode (KFile::SelectionMode sm) |
virtual KFile::SelectionMode | selectionMode () const |
virtual void | setViewMode (ViewMode vm) |
virtual ViewMode | viewMode () const |
QString | viewName () const |
void | setViewName (const QString &name) |
Sets the name of the view, which could be displayed somewhere. | |
virtual void | setParentView (KFileView *parent) |
virtual void | insertItem (KFileItem *i) |
The derived view must implement this function to add the file in the widget. | |
virtual void | clearView ()=0 |
pure virtual function, that should be implemented to clear the view. | |
virtual void | ensureItemVisible (const KFileItem *i)=0 |
pure virtual function, that should be implemented to make item i visible, i.e. | |
virtual void | clearSelection ()=0 |
Clears any selection, unhighlights everything. | |
virtual void | selectAll () |
Selects all items. | |
virtual void | invertSelection () |
Inverts the current selection, i.e. | |
virtual void | setSelected (const KFileItem *, bool enable)=0 |
Tells the view that it should highlight the item. | |
virtual bool | isSelected (const KFileItem *) const =0 |
const KFileItemList * | selectedItems () const |
const KFileItemList * | items () const |
virtual KFileItem * | firstFileItem () const =0 |
virtual KFileItem * | nextItem (const KFileItem *) const =0 |
virtual KFileItem * | prevItem (const KFileItem *) const =0 |
void | setOnlyDoubleClickSelectsFiles (bool enable) |
This is a KFileDialog specific hack: we want to select directories with single click, but not files. | |
bool | onlyDoubleClickSelectsFiles () const |
bool | updateNumbers (const KFileItem *i) |
increases the number of dirs and files. | |
virtual KActionCollection * | actionCollection () const |
KFileViewSignaler * | signaler () const |
virtual void | readConfig (KConfig *, const QString &group=QString::null) |
virtual void | writeConfig (KConfig *, const QString &group=QString::null) |
Static Public Member Functions | |
QString | sortingKey (const QString &value, bool isDir, int sortSpec) |
This method calculates a QString from the given parameters, that is suitable for sorting with e.g. | |
QString | sortingKey (KIO::filesize_t value, bool isDir, int sortSpec) |
An overloaded method that takes not a QString, but a number as sort criterion. | |
Protected Member Functions | |
virtual void | virtual_hook (int id, void *data) |
Protected Attributes | |
KFileViewSignaler * | sig |
Detailed Description
This class defines an interface to all file views. A base class for views of the KDE file selector.Its intent is to allow to switch the view of the files in the selector very easily. It defines some pure virtual functions, that must be implemented to make a file view working.
Since this class is not a widget, but it's meant to be added to other widgets, its most important function is widget. This should return a pointer to the implemented widget.
- Author:
- Stephan Kulow <coolo@kde.org>
- Version:
- Id
- kfileview.h,v 1.44 2002/08/02 08:35:37 coolo Exp
Definition at line 94 of file kfileview.h.
Constructor & Destructor Documentation
|
Destructor.
Definition at line 81 of file kfileview.cpp. |
Member Function Documentation
|
inserts a list of items.
Definition at line 126 of file kfileview.cpp. References QPtrListIterator::current(), insertItem(), and updateNumbers(). Referenced by KDirOperator::insertNewFiles(). |
|
a pure virtual function to get a QWidget, that can be added to other widgets. This function is needed to make it possible for derived classes to derive from other widgets. Implemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview. Referenced by actionCollection(), KFilePreview::setFileView(), KDirOperator::setView(), updateView(), and KDirOperator::viewWidget(). |
|
### As const-method, to be fixed in 3.0
Definition at line 119 of file kfileview.h. |
|
Sets
Definition at line 264 of file kfileview.cpp. References QString::isNull(), and KFileItem::name(). Referenced by KDirOperator::insertNewFiles(), KFilePreview::setCurrentItem(), KDirOperator::setCurrentItem(), and KCombiView::setCurrentItem(). |
|
Reimplement this to set the item having focus. Implemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview. |
|
Implemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview. Referenced by KFilePreview::currentFileItem(), and KCombiView::currentFileItem(). |
|
Clears the view and all item lists.
Reimplemented in KCombiView, and KFilePreview. Definition at line 152 of file kfileview.cpp. References QPtrList::clear(), and clearView(). Referenced by KFilePreview::clear(), KCombiView::clear(), and KDirOperator::pathChanged(). |
|
does a repaint of the view. The default implementation calls
|
|
Removes an item from the list; has to be implemented by the view. Call KFileView::removeItem( item ) after removing it. Reimplemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview. Definition at line 342 of file kfileview.cpp. References KFileItem::isDir(), and QPtrList::removeRef(). Referenced by KDirOperator::itemDeleted(), KFilePreview::removeItem(), KFileIconView::removeItem(), KFileDetailView::removeItem(), and KCombiView::removeItem(). |
|
This hook is called when all items of the currently listed directory are listed and inserted into the view, i.e. there won't come any new items anymore. Reimplemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview. Definition at line 356 of file kfileview.cpp. Referenced by KFilePreview::listingCompleted(), KCombiView::listingCompleted(), and KDirOperator::updateDir(). |
|
Returns the sorting order of the internal list. Newly added files are added through this sorting. Definition at line 171 of file kfileview.h. Referenced by KFilePreview::setFileView(), KFilePreview::setSorting(), and KCombiView::setSorting(). |
|
Sets the sorting order of the view. Default is QDir::Name | QDir::IgnoreCase | QDir::DirsFirst Override this in your subclass and sort accordingly (usually by setting the sorting-key for every item and telling QIconView or QListView to sort. A view may choose to use a different sorting than QDir::Name, Time or Size. E.g. to sort by mimetype or any possible string. Set the sorting to QDir::Unsorted for that and do the rest internally.
Reimplemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview. Definition at line 147 of file kfileview.cpp. Referenced by KFilePreview::setFileView(), KFilePreview::setSorting(), KFileIconView::setSorting(), KFileDetailView::setSorting(), KDirOperator::setSorting(), KCombiView::setSorting(), and KDirOperator::setView(). |
|
Tells whether the current items are in reversed order (shortcut to sorting() & QDir::Reversed).
Definition at line 193 of file kfileview.h. Referenced by KFileIconView::setSorting(), and KDirOperator::updateSortActions(). |
|
Definition at line 200 of file kfileview.h. |
|
Definition at line 205 of file kfileview.h. Referenced by KDirOperator::insertNewFiles(), KDirOperator::itemDeleted(), and KDirOperator::numFiles(). |
|
Definition at line 210 of file kfileview.h. Referenced by KDirOperator::insertNewFiles(), KDirOperator::itemDeleted(), and KDirOperator::numDirs(). |
|
Definition at line 228 of file kfileview.h. Referenced by KCombiView::setRight(). |
|
Sets the name of the view, which could be displayed somewhere. E.g. "Image Preview". Definition at line 234 of file kfileview.h. References KStdAccel::name(). Referenced by KDirOperator::createView(), and KCombiView::setRight(). |
|
The derived view must implement this function to add the file in the widget. Make sure to call this implementation, i.e. KFileView::insertItem( i ); Reimplemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview. Definition at line 143 of file kfileview.cpp. Referenced by addItemList(), KFilePreview::insertItem(), KFileIconView::insertItem(), KFileDetailView::insertItem(), and KCombiView::insertItem(). |
|
pure virtual function, that should be implemented to clear the view. At this moment the list is already empty Implemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview. Referenced by clear(), KFilePreview::clearView(), and KCombiView::clearView(). |
|
pure virtual function, that should be implemented to make item i visible, i.e. by scrolling the view appropriately. Implemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview. Referenced by KFilePreview::ensureItemVisible(), KCombiView::ensureItemVisible(), KDirOperator::insertNewFiles(), and KDirOperator::setCurrentItem(). |
|
Clears any selection, unhighlights everything. Must be implemented by the view. Implemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview. Referenced by KFilePreview::clearSelection(), KCombiView::clearSelection(), KDirOperator::makeCompletion(), KDirOperator::makeDirCompletion(), and KDirOperator::setCurrentItem(). |
|
Selects all items. You may want to override this, if you can implement it more efficiently than calling setSelected() with every item. This works only in Multiselection mode of course. Reimplemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview. Definition at line 308 of file kfileview.cpp. References setSelected(). Referenced by KFilePreview::selectAll(), and KCombiView::selectAll(). |
|
Inverts the current selection, i.e. selects all items, that were up to now not selected and deselects the other. Reimplemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview. Definition at line 319 of file kfileview.cpp. References isSelected(), and setSelected(). Referenced by KFilePreview::invertSelection(), and KCombiView::invertSelection(). |
|
Tells the view that it should highlight the item. This function must be implemented by the view. Implemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview. Referenced by invertSelection(), selectAll(), KDirOperator::setCurrentItem(), KFilePreview::setSelected(), and KCombiView::setSelected(). |
|
Implemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview. Referenced by invertSelection(), KFilePreview::isSelected(), KDirOperator::isSelected(), KCombiView::isSelected(), KFilePreview::removeItem(), and selectedItems(). |
|
Definition at line 292 of file kfileview.cpp. References QPtrList::append(), QPtrList::clear(), and isSelected(). Referenced by KDirOperator::deleteSelected(), KDirOperator::selectedItems(), and KDirOperator::updateSelectionDependentActions(). |
|
Definition at line 279 of file kfileview.cpp. References QPtrList::append(), and QPtrList::clear(). Referenced by KDirOperator::prepareCompletionObjects(), KFileIconView::setSorting(), and KFileIconView::showPreviews(). |
|
This is a KFileDialog specific hack: we want to select directories with single click, but not files. But as a generic class, we have to be able to select files on single click as well. This gives us the opportunity to do both. Every view has to decide when to call select( item ) when a file was single-clicked, based on onlyDoubleClickSelectsFiles(). Definition at line 315 of file kfileview.h. Referenced by KDirOperator::createView(), KDirOperator::setOnlyDoubleClickSelectsFiles(), and KDirOperator::setView(). |
|
Definition at line 324 of file kfileview.h. |
|
increases the number of dirs and files.
Definition at line 106 of file kfileview.cpp. References KFileItem::isDir(), and KFileItem::isFile(). Referenced by addItemList(), and KCombiView::insertItem(). |
|
Reimplemented in KCombiView, and KFilePreview. Definition at line 361 of file kfileview.cpp. References widget(). Referenced by KFilePreview::actionCollection(), and KCombiView::actionCollection(). |
|
This method calculates a QString from the given parameters, that is suitable for sorting with e.g. QIconView or QListView. Their Item-classes usually have a setKey( const QString& ) method or a virtual method QString key() that is used for sorting.
Definition at line 376 of file kfileview.cpp. References QString::lower(), and QString::prepend(). Referenced by KFileIconView::setSorting(). |
|
An overloaded method that takes not a QString, but a number as sort criterion. You can use this for file-sizes or dates/times for example. If you use a time_t, you need to cast that to KIO::filesize_t because of ambiguity problems. Definition at line 385 of file kfileview.cpp. References KIO::number(), and QString::rightJustify(). |
The documentation for this class was generated from the following files: