KDE3Support
#include <k3fileview.h>
Public Types | |
enum | DropOptions { AutoOpenDirs = 1 } |
enum | ViewMode { Files = 1, Directories = 2, All = Files | Directories } |
Static Public Member Functions | |
static int | autoOpenDelay () |
static QString | sortingKey (const QString &value, bool isDir, QDir::SortFlags SortFlags) |
static QString | sortingKey (KIO::filesize_t value, bool isDir, QDir::SortFlags SortFlags) |
Protected Attributes | |
K3FileViewSignaler * | sig |
Detailed Description
This class defines an interface to all file views.
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.
A base class for views of the KDE file selector
Definition at line 89 of file k3fileview.h.
Member Enumeration Documentation
Various options for drag and drop support.
These values can be or'd together.
AutoOpenDirs
Automatically open directory after hovering above it for a short while while dragging.
Enumerator | |
---|---|
AutoOpenDirs |
Definition at line 348 of file k3fileview.h.
enum K3FileView::ViewMode |
Enumerator | |
---|---|
Files | |
Directories | |
All |
Definition at line 215 of file k3fileview.h.
Constructor & Destructor Documentation
K3FileView::K3FileView | ( | ) |
Creates a new file view.
Definition at line 110 of file k3fileview.cpp.
|
virtual |
Destroys the file view.
Definition at line 128 of file k3fileview.cpp.
Member Function Documentation
|
virtual |
- Returns
- the view-specific action-collection. Every view should add its actions here (if it has any) to make them available to e.g. the KDirOperator's popup-menu.
Definition at line 443 of file k3fileview.cpp.
void K3FileView::addItemList | ( | const KFileItemList & | list | ) |
Inserts a list of items.
Definition at line 172 of file k3fileview.cpp.
|
static |
delay before auto opening a directory
Definition at line 492 of file k3fileview.cpp.
|
virtual |
Clears the view and all item lists.
Definition at line 203 of file k3fileview.cpp.
|
pure virtual |
Clears any selection, unhighlights everything.
Must be implemented by the view.
|
pure virtual |
pure virtual function, that should be implemented to clear the view.
At this moment the list is already empty
uint K3FileView::count | ( | ) | const |
- Returns
- the number of dirs and files
Definition at line 222 of file k3fileview.cpp.
|
pure virtual |
- Returns
- the "current" KFileItem, e.g. where the cursor is. Returns an null file item when there is no current item (e.g. in an empty view). Subclasses have to implement this.
int K3FileView::dropOptions | ( | ) |
Returns the DND options in effect.
See DropOptions for details.
Definition at line 487 of file k3fileview.cpp.
|
pure virtual |
pure virtual function, that should be implemented to make item i visible, i.e.
by scrolling the view appropriately.
|
pure virtual |
|
virtual |
The derived view must implement this function to add the file in the widget.
Make sure to call this implementation, i.e. K3FileView::insertItem( i );
Definition at line 184 of file k3fileview.cpp.
|
virtual |
Inverts the current selection, i.e.
selects all items, that were up to now not selected and deselects the other.
Definition at line 390 of file k3fileview.cpp.
bool K3FileView::isReversed | ( | ) | const |
Tells whether the current items are in reversed order (shortcut to sorting() & QDir::Reversed).
Definition at line 210 of file k3fileview.cpp.
- Returns
- whether the given item is currently selected. Must be implemented by the view.
KFileItemList K3FileView::items | ( | ) | const |
- Returns
- all items currently available in the current sort-order
Definition at line 349 of file k3fileview.cpp.
|
virtual |
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.
Definition at line 438 of file k3fileview.cpp.
uint K3FileView::numDirs | ( | ) | const |
- Returns
- the number of directories
Definition at line 232 of file k3fileview.cpp.
uint K3FileView::numFiles | ( | ) | const |
- Returns
- the number of files.
Definition at line 227 of file k3fileview.cpp.
bool K3FileView::onlyDoubleClickSelectsFiles | ( | ) | const |
- Returns
- whether files (not directories) should only be select()ed by double-clicks.
- See also
- setOnlyDoubleClickSelectsFiles
Definition at line 363 of file k3fileview.cpp.
|
virtual |
Definition at line 457 of file k3fileview.cpp.
|
virtual |
Removes an item from the list; has to be implemented by the view.
Call K3FileView::removeItem( item ) after removing it.
Definition at line 427 of file k3fileview.cpp.
|
virtual |
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.
Definition at line 380 of file k3fileview.cpp.
KFileItemList K3FileView::selectedItems | ( | ) | const |
- Returns
- all currently highlighted items.
Definition at line 368 of file k3fileview.cpp.
|
virtual |
Definition at line 402 of file k3fileview.cpp.
void K3FileView::setCurrentItem | ( | const QString & | filename | ) |
Sets filename
the current item in the view, if available.
Definition at line 334 of file k3fileview.cpp.
|
pure virtual |
Reimplement this to set item
the current item in the view, e.g.
the item having focus.
|
virtual |
Specify DND options.
See DropOptions for details. All options are disabled by default.
Definition at line 482 of file k3fileview.cpp.
void K3FileView::setOnlyDoubleClickSelectsFiles | ( | bool | enable | ) |
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 359 of file k3fileview.cpp.
|
virtual |
Definition at line 134 of file k3fileview.cpp.
Tells the view that it should highlight the item.
This function must be implemented by the view.
|
virtual |
Definition at line 397 of file k3fileview.cpp.
|
virtual |
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.
- See also
- sortingKey
Definition at line 198 of file k3fileview.cpp.
|
virtual |
Definition at line 407 of file k3fileview.cpp.
void K3FileView::setViewName | ( | const QString & | name | ) |
Sets the name of the view, which could be displayed somewhere.
E.g. "Image Preview".
Definition at line 422 of file k3fileview.cpp.
K3FileViewSignaler * K3FileView::signaler | ( | ) | const |
Definition at line 452 of file k3fileview.cpp.
QDir::SortFlags K3FileView::sorting | ( | ) | const |
Returns the sorting order of the internal list.
Newly added files are added through this sorting.
Definition at line 193 of file k3fileview.cpp.
|
static |
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.
- Parameters
-
value Any string that should be used as sort criterion isDir Tells whether the key is computed for an item representing a directory (directories are usually sorted before files) SortFlags An ORed combination of QDir::SortFlag flags. Currently, the values IgnoreCase, Reversed and DirsFirst are taken into account.
Definition at line 465 of file k3fileview.cpp.
|
static |
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 474 of file k3fileview.cpp.
void K3FileView::sortReversed | ( | ) |
Definition at line 215 of file k3fileview.cpp.
increases the number of dirs and files.
- Returns
- true if the item fits the view mode
Definition at line 154 of file k3fileview.cpp.
|
virtual |
does a repaint of the view.
The default implementation calls
Definition at line 325 of file k3fileview.cpp.
|
virtual |
Definition at line 330 of file k3fileview.cpp.
|
virtual |
Definition at line 412 of file k3fileview.cpp.
QString K3FileView::viewName | ( | ) | const |
- Returns
- the localized name of the view, which could be displayed somewhere, e.g. in a menu, where the user can choose between views.
- See also
- setViewName
Definition at line 417 of file k3fileview.cpp.
|
pure virtual |
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.
QWidget * K3FileView::widget | ( | ) | const |
Returns the widget.
Definition at line 188 of file k3fileview.cpp.
|
virtual |
Definition at line 461 of file k3fileview.cpp.
Member Data Documentation
|
protected |
class to distribute the signals
Definition at line 397 of file k3fileview.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:26:48 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.