org.kde.koala

Class KFileView

public class KFileView extends Object implements QtSupport, KFileViewInterface

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 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

UNKNOWN: A base class for views of the KDE file selector.

Field Summary
static intAll
static intAutoOpenDirs
Various options for drag and drop support.
static intDirectories
static intFiles
static intVIRTUAL_SET_DROP_OPTIONS
Constructor Summary
protected KFileView(Class dummy)
Method Summary
KActionCollectionactionCollection()
voidaddItemList(ArrayList list)
inserts a list of items.
static intautoOpenDelay()
delay before auto opening a directory
voidclear()
Clears the view and all item lists.
voidclearSelection()
Clears any selection, unhighlights everything.
voidclearView()
pure function, that should be implemented to clear the view.
intcount()
KFileItemcurrentFileItem()
intdropOptions()
Returns the DND options in effect.
voidensureItemVisible(KFileItem i)
pure function, that should be implemented to make item i visible, i.e. by scrolling the view appropriately.
KFileItemfirstFileItem()
voidinsertItem(KFileItem i)
The derived view must implement this function to add the file in the widget.
voidinvertSelection()
Inverts the current selection, i.e. selects all items, that were up to now not selected and deselects the other.
booleanisReversed()
Tells whether the current items are in reversed order (shortcut to sorting() & QDir.Reversed).
booleanisSelected(KFileItem arg1)
ArrayListitems()
voidlistingCompleted()
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.
KFileItemnextItem(KFileItem arg1)
intnumDirs()
intnumFiles()
booleanonlyDoubleClickSelectsFiles()
KFileItemprevItem(KFileItem arg1)
voidreadConfig(KConfig arg1, String group)
voidreadConfig(KConfig arg1)
voidremoveItem(KFileItem item)
Removes an item from the list; has to be implemented by the view.
voidselectAll()
Selects all items.
ArrayListselectedItems()
voidsetCurrentItem(String filename)
Sets filename the current item in the view, if available.
voidsetCurrentItem(KFileItem item)
Reimplement this to set item the current item in the view, e.g. the item having focus.
voidsetDropOptions(int options)
Specify DND options.
voidsetOnlyDoubleClickSelectsFiles(boolean enable)
This is a KFileDialog specific hack: we want to select directories with single click, but not files.
voidsetParentView(KFileViewInterface parent)
voidsetSelected(KFileItem arg1, boolean enable)
Tells the view that it should highlight the item.
voidsetSelectionMode(int sm)
voidsetSorting(int sort)
Sets the sorting order of the view.
voidsetViewMode(int vm)
voidsetViewName(String name)
Sets the name of the view, which could be displayed somewhere.
KFileViewSignalersignaler()
intsorting()
Returns the sorting order of the internal list.
static StringsortingKey(String value, boolean isDir, int sortSpec)
This method calculates a String from the given parameters, that is suitable for sorting with e.g.
static StringsortingKey(long value, boolean isDir, int sortSpec)
An overloaded method that takes not a String, but a number as sort criterion.
voidsortReversed()
booleanupdateNumbers(KFileItem i)
increases the number of dirs and files.
voidupdateView(boolean f)
does a repaint of the view.
voidupdateView()
voidupdateView(KFileItem arg1)
intviewMode()
StringviewName()
QWidgetwidget()
a pure function to get a QWidget, that can be added to other widgets.
voidwriteConfig(KConfig arg1, String group)
voidwriteConfig(KConfig arg1)

Field Detail

All

public static final int All

AutoOpenDirs

public static final int AutoOpenDirs
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.
  • UNKNOWN: Various options for drag and drop support.

    Directories

    public static final int Directories

    Files

    public static final int Files

    VIRTUAL_SET_DROP_OPTIONS

    public static final int VIRTUAL_SET_DROP_OPTIONS

    Constructor Detail

    KFileView

    protected KFileView(Class dummy)

    Method Detail

    actionCollection

    public KActionCollection actionCollection()

    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.

    UNKNOWN:

    addItemList

    public void addItemList(ArrayList list)
    inserts a list of items.

    UNKNOWN: inserts a list of items.

    autoOpenDelay

    public static int autoOpenDelay()
    delay before auto opening a directory

    UNKNOWN:

    clear

    public void clear()
    Clears the view and all item lists.

    UNKNOWN: Clears the view and all item lists.

    clearSelection

    public void clearSelection()
    Clears any selection, unhighlights everything. Must be implemented by the view.

    UNKNOWN: Clears any selection, unhighlights everything.

    clearView

    public void clearView()
    pure function, that should be implemented to clear the view. At this moment the list is already empty

    UNKNOWN: pure virtual function, that should be implemented to clear the view.

    count

    public int count()

    Returns: the number of dirs and files

    UNKNOWN:

    currentFileItem

    public KFileItem currentFileItem()

    Returns: the "current" KFileItem, e.g. where the cursor is. Returns 0L when there is no current item (e.g. in an empty view). Subclasses have to implement this.

    UNKNOWN:

    dropOptions

    public int dropOptions()
    Returns the DND options in effect. See DropOptions for details.

    UNKNOWN: Returns the DND options in effect.

    ensureItemVisible

    public void ensureItemVisible(KFileItem i)
    pure function, that should be implemented to make item i visible, i.e. by scrolling the view appropriately.

    UNKNOWN: pure virtual function, that should be implemented to make item i visible, i.

    firstFileItem

    public KFileItem firstFileItem()

    insertItem

    public void insertItem(KFileItem i)
    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 );

    UNKNOWN: The derived view must implement this function to add the file in the widget.

    invertSelection

    public void invertSelection()
    Inverts the current selection, i.e. selects all items, that were up to now not selected and deselects the other.

    UNKNOWN: Inverts the current selection, i.

    isReversed

    public boolean isReversed()
    Tells whether the current items are in reversed order (shortcut to sorting() & QDir.Reversed).

    UNKNOWN: Tells whether the current items are in reversed order (shortcut to sorting() & QDir.Reversed).

    isSelected

    public boolean isSelected(KFileItem arg1)

    Returns: whether the given item is currently selected. Must be implemented by the view.

    UNKNOWN:

    items

    public ArrayList items()

    Returns: all items currently available in the current sort-order

    UNKNOWN:

    listingCompleted

    public void listingCompleted()
    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.

    UNKNOWN: This hook is called when all items of the currently listed directory are listed and inserted into the view, i.

    nextItem

    public KFileItem nextItem(KFileItem arg1)

    numDirs

    public int numDirs()

    Returns: the number of directories

    UNKNOWN:

    numFiles

    public int numFiles()

    Returns: the number of files.

    UNKNOWN:

    onlyDoubleClickSelectsFiles

    public boolean onlyDoubleClickSelectsFiles()

    Returns: whether files (not directories) should only be select()ed by double-clicks.

    See Also: KFileView

    UNKNOWN:

    prevItem

    public KFileItem prevItem(KFileItem arg1)

    readConfig

    public void readConfig(KConfig arg1, String group)

    readConfig

    public void readConfig(KConfig arg1)

    removeItem

    public void removeItem(KFileItem item)
    Removes an item from the list; has to be implemented by the view. Call KFileView.removeItem( item ) after removing it.

    UNKNOWN: Removes an item from the list; has to be implemented by the view.

    selectAll

    public void selectAll()
    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.

    UNKNOWN: Selects all items.

    selectedItems

    public ArrayList selectedItems()

    Returns: all currently highlighted items.

    UNKNOWN:

    setCurrentItem

    public void setCurrentItem(String filename)
    Sets filename the current item in the view, if available.

    UNKNOWN: Sets filename the current item in the view, if available.

    setCurrentItem

    public void setCurrentItem(KFileItem item)
    Reimplement this to set item the current item in the view, e.g. the item having focus.

    UNKNOWN: Reimplement this to set item the current item in the view, e.

    setDropOptions

    public void setDropOptions(int options)
    Specify DND options. See DropOptions for details. All options are disabled by default.

    UNKNOWN: Specify DND options.

    setOnlyDoubleClickSelectsFiles

    public void setOnlyDoubleClickSelectsFiles(boolean 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().

    UNKNOWN: This is a KFileDialog specific hack: we want to select directories with single click, but not files.

    setParentView

    public void setParentView(KFileViewInterface parent)

    setSelected

    public void setSelected(KFileItem arg1, boolean enable)
    Tells the view that it should highlight the item. This function must be implemented by the view.

    UNKNOWN: Tells the view that it should highlight the item.

    setSelectionMode

    public void setSelectionMode(int sm)

    setSorting

    public void setSorting(int sort)
    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: KFileView

    UNKNOWN: Sets the sorting order of the view.

    setViewMode

    public void setViewMode(int vm)

    setViewName

    public void setViewName(String name)
    Sets the name of the view, which could be displayed somewhere. E.g. "Image Preview".

    UNKNOWN: Sets the name of the view, which could be displayed somewhere.

    signaler

    public KFileViewSignaler signaler()

    sorting

    public int sorting()
    Returns the sorting order of the internal list. Newly added files are added through this sorting.

    UNKNOWN: Returns the sorting order of the internal list.

    sortingKey

    public static String sortingKey(String value, boolean isDir, int sortSpec)
    This method calculates a String from the given parameters, that is suitable for sorting with e.g. QIconView or QListView. Their Item-classes usually have a setKey( String ) method or a virtual method String 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) sortSpec An ORed combination of QDir.SortSpec flags. Currently, the values IgnoreCase, Reversed and DirsFirst are taken into account.

    UNKNOWN: This method calculates a String from the given parameters, that is suitable for sorting with e.

    sortingKey

    public static String sortingKey(long value, boolean isDir, int sortSpec)
    An overloaded method that takes not a String, 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.

    UNKNOWN: An overloaded method that takes not a String, but a number as sort criterion.

    sortReversed

    public void sortReversed()

    updateNumbers

    public boolean updateNumbers(KFileItem i)
    increases the number of dirs and files.

    Returns: true if the item fits the view mode

    UNKNOWN: increases the number of dirs and files.

    updateView

    public void updateView(boolean f)
    does a repaint of the view. The default implementation calls
    		 widget().repaint(f)
    		 

    UNKNOWN: does a repaint of the view.

    updateView

    public void updateView()

    updateView

    public void updateView(KFileItem arg1)

    viewMode

    public int viewMode()

    viewName

    public String viewName()

    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: KFileView

    UNKNOWN:

    widget

    public QWidget widget()
    a pure 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.

    UNKNOWN: a pure virtual function to get a QWidget, that can be added to other widgets.

    writeConfig

    public void writeConfig(KConfig arg1, String group)

    writeConfig

    public void writeConfig(KConfig arg1)