KDirOperator Class
A widget for displaying files and browsing directories. More...
Header: | #include <KDirOperator> |
CMake: | find_package(KF6 REQUIRED COMPONENTS KIO) target_link_libraries(mytarget PRIVATE KF6::KIOFileWidgets) |
Inherits: | QWidget |
Public Types
enum | Action { PopupMenu, Up, Back, Forward, Home, …, Properties } |
enum | ActionType { SortActions, ViewActions, NavActions, FileActions, AllActions } |
Public Functions
KDirOperator(const QUrl &urlName = QUrl{}, QWidget *parent = nullptr) | |
(since 5.100) QAction * | action(KDirOperator::Action action) const |
(since 5.100) QList<QAction *> | allActions() const |
void | clearFilter() |
void | clearHistory() |
void | close() |
KCompletion * | completionObject() const |
(since 4.2.3) QStyleOptionViewItem::Position | decorationPosition() const |
virtual KIO::DeleteJob * | del(const KFileItemList &items, QWidget *parent = nullptr, bool ask = true, bool showProgress = true) |
KCompletion * | dirCompletionObject() const |
bool | dirHighlighting() const |
KDirLister * | dirLister() const |
bool | dirOnlyMode() const |
(since 5.62) bool | followNewDirectories() const |
(since 5.62) bool | followSelectedDirectories() const |
(since 5.76) int | iconSize() const |
bool | isInlinePreviewShown() const |
bool | isRoot() const |
bool | isSaving() const |
bool | isSelected(const KFileItem &item) const |
QStringList | mimeFilter() const |
KFile::Modes | mode() const |
QString | nameFilter() const |
QStringList | newFileMenuSupportedMimeTypes() const |
int | numDirs() const |
int | numFiles() const |
bool | onlyDoubleClickSelectsFiles() const |
KFilePreviewGenerator * | previewGenerator() const |
QProgressBar * | progressBar() const |
virtual void | readConfig(const KConfigGroup &configGroup) |
KFileItemList | selectedItems() const |
virtual void | setAcceptDrops(bool b) |
void | setCurrentItem(const KFileItem &item) |
void | setCurrentItem(const QUrl &url) |
void | setCurrentItems(const KFileItemList &items) |
void | setCurrentItems(const QList<QUrl> &urls) |
(since 4.2.3) void | setDecorationPosition(QStyleOptionViewItem::Position position) |
virtual void | setDropOptions(int options) |
virtual void | setEnableDirHighlighting(bool enable) |
(since 5.62) void | setFollowNewDirectories(bool enable) |
(since 5.62) void | setFollowSelectedDirectories(bool enable) |
void | setInlinePreviewShown(bool show) |
void | setIsSaving(bool isSaving) |
void | setMimeFilter(const QStringList &mimetypes) |
virtual void | setMode(KFile::Modes m) |
void | setNameFilter(const QString &filter) |
(since 5.76) void | setNewFileMenuSelectDirWhenAlreadyExist(bool selectOnDirExists) |
void | setNewFileMenuSupportedMimeTypes(const QStringList &mime) |
void | setOnlyDoubleClickSelectsFiles(bool enable) |
virtual void | setPreviewWidget(KPreviewWidgetBase *w) |
virtual void | setShowHiddenFiles(bool s) |
void | setSorting(QDir::SortFlags) |
virtual void | setUrl(const QUrl &url, bool clearforward) |
virtual void | setViewConfig(KConfigGroup &configGroup) |
(since 5.100) void | setViewMode(KFile::FileView viewKind) |
void | setupMenu(int whichActions) |
bool | showHiddenFiles() const |
(since 5.87) void | showOpenWithActions(bool enable) |
QDir::SortFlags | sorting() const |
(since 5.43) QStringList | supportedSchemes() const |
virtual KIO::CopyJob * | trash(const KFileItemList &items, QWidget *parent, bool ask = true, bool showProgress = true) |
QUrl | url() const |
QAbstractItemView * | view() const |
KConfigGroup * | viewConfigGroup() const |
(since 5.0) KFile::FileView | viewMode() const |
virtual void | writeConfig(KConfigGroup &configGroup) |
Public Slots
virtual void | back() |
virtual void | cdUp() |
virtual void | deleteSelected() |
virtual void | forward() |
virtual void | home() |
QString | makeCompletion(const QString &) |
QString | makeDirCompletion(const QString &) |
virtual void | mkdir() |
(since 5.67) void | renameSelected() |
virtual void | rereadDir() |
(since 5.76) void | setIconSize(int value) |
(since 5.43) void | setSupportedSchemes(const QStringList &schemes) |
virtual void | trashSelected() |
void | updateDir() |
void | updateSelectionDependentActions() |
Signals
void | completion(const QString &) |
void | contextMenuAboutToShow(const KFileItem &item, QMenu *menu) |
void | currentIconSizeChanged(int size) |
void | dirActivated(const KFileItem &item) |
void | dropped(const KFileItem &item, QDropEvent *event, const QList<QUrl> &urls) |
void | fileHighlighted(const KFileItem &item) |
void | fileSelected(const KFileItem &item) |
void | finishedLoading() |
(since 5.57) void | keyEnterReturnPressed() |
(since 5.96) void | renamingFinished(const QList<QUrl> &urls) |
void | updateInformation(int files, int dirs) |
void | urlEntered(const QUrl &) |
void | viewChanged(QAbstractItemView *newView) |
Protected Functions
virtual void | activatedMenu(const KFileItem &item, const QPoint &pos) |
bool | checkPreviewSupport() |
virtual QAbstractItemView * | createView(QWidget *parent, KFile::FileView viewKind) |
void | prepareCompletionObjects() |
virtual void | setDirLister(KDirLister *lister) |
void | setupActions() |
void | setupMenu() |
void | updateSortActions() |
void | updateViewActions() |
Protected Slots
void | highlightFile(const KFileItem &item) |
void | pathChanged() |
void | resetCursor() |
virtual void | selectDir(const KFileItem &item) |
void | selectFile(const KFileItem &item) |
void | slotCompletionMatch(const QString &match) |
void | sortByDate() |
void | sortByName() |
void | sortBySize() |
void | sortByType() |
void | sortReversed() |
void | toggleDirsFirst() |
void | toggleIgnoreCase() |
Detailed Description
This widget works as a network transparent filebrowser. You specify a URL to display and this url will be loaded via KDirLister. The user can browse through directories, highlight and select files, delete or rename files.
It supports different views, e.g. a detailed view (see KFileDetailView), a simple icon view (see KFileIconView), a combination of two views, separating directories and files ( KCombiView).
Additionally, a preview view is available (see KFilePreview), which can show either a simple or detailed view and additionally a preview widget (see setPreviewWidget()). KImageFilePreview is one implementation of a preview widget, that displays previews for all supported filetypes utilizing KIO::PreviewJob.
Currently, those classes don't support Drag&Drop out of the box – there you have to use your own view-classes. You can use some DnD-aware views from Björn Sahlström <bjorn@kbear.org> until they will be integrated into this library. See http://devel-home.kde.org/~pfeiffer/DnD-classes.tar.gz
This widget is the one used in the KFileWidget.
Basic usage is like this:
KDirOperator *op = new KDirOperator(QUrl("file:///home/gis"), this); // some signals you might be interested in connect(op, &KDirOperator::urlEntered, this, [this](const QUrl &url) { slotUrlEntered(url); }); connect(op, &KDirOperator::fileHighlighted, this, [this](const KFileItem &item) { slotFileHighlighted(item) }); connect(op, &KDirOperator::fileSelected, this, [this](const KFileItem &item) { slotFileSelected(item) }); connect(op, &KDirOperator::finishedLoading, this, [this]() { slotLoadingFinished(); }; KConfigGroup grp(KSharedConfig::openConfig(),"Your KDiroperator ConfigGroup" ); op->readConfig( &grp); op->setViewMode(KFile::Default);
This will create a childwidget of 'this' showing the directory contents of /home/gis in the default-view. The view is determined by the readConfig() call, which will read the KDirOperator settings, the user left your program with (and which you saved with op->writeConfig()).
Member Type Documentation
enum KDirOperator::Action
Actions provided by KDirOperator that can be accessed from the outside using action()
Constant | Value | Description |
---|---|---|
KDirOperator::PopupMenu | 0 | An ActionMenu presenting a popupmenu with all actions |
KDirOperator::Up | 1 | Changes to the parent directory |
KDirOperator::Back | 2 | Goes back to the previous directory |
KDirOperator::Forward | 3 | Goes forward in the history |
KDirOperator::Home | 4 | Changes to the user's home directory |
KDirOperator::Reload | 5 | Reloads the current directory |
KDirOperator::New | 6 | A KNewFileMenu |
KDirOperator::NewFolder | 7 | Opens a dialog box to create a directory |
KDirOperator::Rename | 8 | |
KDirOperator::Trash | 9 | |
KDirOperator::Delete | 10 | Deletes the selected files/directories |
KDirOperator::SortMenu | 11 | An ActionMenu containing all sort-options |
KDirOperator::SortByName | 12 | Sorts by name |
KDirOperator::SortBySize | 13 | Sorts by size |
KDirOperator::SortByDate | 14 | Sorts by date |
KDirOperator::SortByType | 15 | Sorts by type |
KDirOperator::SortAscending | 16 | Changes sort order to ascending |
KDirOperator::SortDescending | 17 | Changes sort order to descending |
KDirOperator::SortFoldersFirst | 18 | Sorts folders before files |
KDirOperator::SortHiddenFilesLast | 19 | Sorts hidden files last |
KDirOperator::ViewModeMenu | 20 | an ActionMenu containing all actions concerning the view |
KDirOperator::ViewIconsView | 21 | |
KDirOperator::ViewCompactView | 22 | |
KDirOperator::ViewDetailsView | 23 | |
KDirOperator::DecorationMenu | 24 | |
KDirOperator::DecorationAtTop | 25 | |
KDirOperator::DecorationAtLeft | 26 | |
KDirOperator::ShortView | 27 | Shows a simple fileview |
KDirOperator::DetailedView | 28 | Shows a detailed fileview (dates, permissions ,...) |
KDirOperator::TreeView | 29 | |
KDirOperator::DetailedTreeView | 30 | |
KDirOperator::AllowExpansionInDetailsView | 31 | |
KDirOperator::ShowHiddenFiles | 32 | shows hidden files |
KDirOperator::ShowPreviewPanel | 33 | shows a preview next to the fileview |
KDirOperator::ShowPreview | 34 | |
KDirOperator::OpenContainingFolder | 35 | |
KDirOperator::Properties | 36 | Shows a KPropertiesDialog for the selected files |
enum KDirOperator::ActionType
The various action types. These values can be or'd together
Constant | Value |
---|---|
KDirOperator::SortActions | 1 |
KDirOperator::ViewActions | 2 |
KDirOperator::NavActions | 4 |
KDirOperator::FileActions | 8 |
KDirOperator::AllActions | 15 |
Member Function Documentation
[explicit]
KDirOperator::KDirOperator(const QUrl &urlName = QUrl{}, QWidget *parent = nullptr)
Constructs the KDirOperator with no initial view. As the views are configurable, call readConfig() to load the user's configuration and then setView to explicitly set a view.
This constructor doesn't start loading the url, setView will do it.
[since 5.100]
QAction *KDirOperator::action(KDirOperator::Action action) const
Obtain a given action from the KDirOperator's set of actions.
You can e.g. use
dirOperator->action(KDirOperator::Up)->plug(someToolBar);
to add a button into a toolbar, which makes the dirOperator change to its parent directory.
This function was introduced in 5.100.
[virtual protected]
void KDirOperator::activatedMenu(const KFileItem &item, const QPoint &pos)
Called upon right-click to activate the popupmenu.
[since 5.100]
QList<QAction *> KDirOperator::allActions() const
A list of all actions for this KDirOperator.
See action()
This function was introduced in 5.100.
[virtual slot]
void KDirOperator::back()
Goes one step back in the history and opens that url.
[virtual slot]
void KDirOperator::cdUp()
Goes one directory up from the current url.
[protected]
bool KDirOperator::checkPreviewSupport()
Checks if there support from KIO::PreviewJob for the currently shown files, taking mimeFilter() and nameFilter() into account Enables/disables the preview-action accordingly.
void KDirOperator::clearFilter()
Clears both the namefilter and MIME type filter, so that all files and directories will be shown. Call updateDir() to apply it.
See also setMimeFilter and setNameFilter.
void KDirOperator::clearHistory()
Clears the forward and backward history.
void KDirOperator::close()
Stops loading immediately. You don't need to call this, usually.
[signal]
void KDirOperator::completion(const QString &)
KCompletion *KDirOperator::completionObject() const
Returns a KCompletion object, containing all filenames and directories of the current directory/URL. You can use it to insert it into a KLineEdit or KComboBox Note: it will only contain files, after prepareCompletionObjects() has been called. It will be implicitly called from makeCompletion() or makeDirCompletion()
[signal]
void KDirOperator::contextMenuAboutToShow(const KFileItem &item, QMenu *menu)
Emitted just before the context menu is shown, allows users to extend the menu with custom actions.
item the file on which the context menu was invoked
menu the context menu, pre-populated with the file-management actions
[virtual protected]
QAbstractItemView *KDirOperator::createView(QWidget *parent, KFile::FileView viewKind)
A view factory for creating predefined fileviews. Called internally by setView, but you can also call it directly. Reimplement this if you depend on self defined fileviews.
parent is the QWidget to be set as parent
viewKind is the predefined view to be set, note: this can be several ones OR:ed together
Returns the created view
See also KFile::FileView and setView.
[signal]
void KDirOperator::currentIconSizeChanged(int size)
Will notify that the icon size has changed. Since we save the icon size depending on the view type (list view or a different kind of view), a call to setView() can trigger this signal to be emitted.
[since 4.2.3]
QStyleOptionViewItem::Position KDirOperator::decorationPosition() const
Returns the position where icons are shown relative to the labels of file items in the icon view.
This function was introduced in 4.2.3.
See also setDecorationPosition().
[virtual]
KIO::DeleteJob *KDirOperator::del(const KFileItemList &items, QWidget *parent = nullptr, bool ask = true, bool showProgress = true)
Starts and returns a KIO::DeleteJob to delete the given items.
items the list of items to be deleted
parent the parent widget used for the confirmation dialog
ask specifies whether a confirmation dialog should be shown
showProgress passed to the DeleteJob to show a progress dialog
[virtual slot]
void KDirOperator::deleteSelected()
Deletes the currently selected files/directories.
[signal]
void KDirOperator::dirActivated(const KFileItem &item)
KCompletion *KDirOperator::dirCompletionObject() const
Returns a KCompletion object, containing only all directories of the current directory/URL. You can use it to insert it into a KLineEdit or KComboBox Note: it will only contain directories, after prepareCompletionObjects() has been called. It will be implicitly called from makeCompletion() or makeDirCompletion()
bool KDirOperator::dirHighlighting() const
Returns whether the last directory will be made the current item (and hence highlighted) when going up or back in the directory hierarchy
Directories are highlighted by default.
KDirLister *KDirOperator::dirLister() const
Returns the object listing the directory
See also setDirLister().
bool KDirOperator::dirOnlyMode() const
Returns true if we are in directory-only mode, that is, no files are shown.
[signal]
void KDirOperator::dropped(const KFileItem &item, QDropEvent *event, const QList<QUrl> &urls)
Emitted when files are dropped. Dropping files is disabled by default. You need to enable it with setAcceptDrops()
item the item on which the drop occurred or 0.
event the drop event itself.
urls the urls that where dropped.
[signal]
void KDirOperator::fileHighlighted(const KFileItem &item)
Emitted when a file is highlighted or generally the selection changes in multiselection mode. In the latter case, item is a null KFileItem. You can access the selected items with selectedItems().
[signal]
void KDirOperator::fileSelected(const KFileItem &item)
[signal]
void KDirOperator::finishedLoading()
[since 5.62]
bool KDirOperator::followNewDirectories() const
Returns true if setUrl is called on newly created directories, false otherwise. Enabled by default.
This function was introduced in 5.62.
See also setFollowNewDirectories.
[since 5.62]
bool KDirOperator::followSelectedDirectories() const
Returns whether setUrl is called on selected directories when a tree view is used. Enabled by default.
This function was introduced in 5.62.
See also setFollowSelectedDirectories().
[virtual slot]
void KDirOperator::forward()
Goes one step forward in the history and opens that url.
[protected slot]
void KDirOperator::highlightFile(const KFileItem &item)
Emits fileHighlighted(item)
[virtual slot]
void KDirOperator::home()
Enters the home directory.
[since 5.76]
int KDirOperator::iconSize() const
Returns the icon size in pixels, ranged from KIconLoader::SizeSmall (16) to KIconLoader::SizeEnormous (128).
This function was introduced in 5.76.
See also setIconSize().
bool KDirOperator::isInlinePreviewShown() const
Returns whether the inline previews are shown or not.
bool KDirOperator::isRoot() const
Returns true if we are displaying the root directory of the current url
bool KDirOperator::isSaving() const
Returns whether KDirOperator will force a double click to accept.
Note: this is false by default
See also setIsSaving().
bool KDirOperator::isSelected(const KFileItem &item) const
Returns true if item is currently selected, or false otherwise.
[signal, since 5.57]
void KDirOperator::keyEnterReturnPressed()
Triggered when the user hit Enter/Return
This function was introduced in 5.57.
[slot]
QString KDirOperator::makeCompletion(const QString &)
Tries to complete the given string (only completes files).
[slot]
QString KDirOperator::makeDirCompletion(const QString &)
Tries to complete the given string (only completes directories).
QStringList KDirOperator::mimeFilter() const
Returns the current MIME type filter.
See also setMimeFilter().
[virtual slot]
void KDirOperator::mkdir()
Opens a dialog to create a new directory.
KFile::Modes KDirOperator::mode() const
Returns the listing/selection mode.
See also setMode().
QString KDirOperator::nameFilter() const
Returns the current namefilter.
See also setNameFilter.
QStringList KDirOperator::newFileMenuSupportedMimeTypes() const
Returns the current Supported Mimes Types.
See also setNewFileMenuSupportedMimeTypes().
int KDirOperator::numDirs() const
Returns the number of directories in the currently listed url. Returns 0 if there is no view.
int KDirOperator::numFiles() const
Returns the number of files in the currently listed url. Returns 0 if there is no view.
bool KDirOperator::onlyDoubleClickSelectsFiles() const
Returns whether files (not directories) should only be select()ed by double-clicks.
See also setOnlyDoubleClickSelectsFiles.
[protected slot]
void KDirOperator::pathChanged()
Called after setUrl() to load the directory, update the history, etc.
[protected]
void KDirOperator::prepareCompletionObjects()
Synchronizes the completion objects with the entries of the currently listed url.
Automatically called from makeCompletion() and makeDirCompletion()
KFilePreviewGenerator *KDirOperator::previewGenerator() const
Returns the preview generator for the current view.
QProgressBar *KDirOperator::progressBar() const
Returns the progress widget, that is shown during directory listing. You can for example reparent() it to put it into a statusbar.
[virtual]
void KDirOperator::readConfig(const KConfigGroup &configGroup)
Reads the default settings for a view, i.e. the default KFile::FileView. Also reads the sorting and whether hidden files should be shown. Note: the default view will not be set - you have to call
setViewMode( KFile::Default )
to apply it.
See also setView, setViewConfig, and writeConfig.
[slot, since 5.67]
void KDirOperator::renameSelected()
Initiates a rename operation on the currently selected files/directories, prompting the user to choose a new name(s) for the currently selected items
This function was introduced in 5.67.
See also renamingFinished.
[signal, since 5.96]
void KDirOperator::renamingFinished(const QList<QUrl> &urls)
Emitted when renaming selected files has finished.
urls URL list of the renamed files
This function was introduced in 5.96.
[virtual slot]
void KDirOperator::rereadDir()
Re-reads the current url.
[protected slot]
void KDirOperator::resetCursor()
Restores the normal cursor after showing the busy-cursor. Also hides the progressbar.
[virtual protected slot]
void KDirOperator::selectDir(const KFileItem &item)
Enters the directory specified by the given item.
[protected slot]
void KDirOperator::selectFile(const KFileItem &item)
Emits fileSelected( item )
KFileItemList KDirOperator::selectedItems() const
Returns a list of all currently selected items. If there is no view, or there are no selected items, an empty list is returned.
[virtual]
void KDirOperator::setAcceptDrops(bool b)
Reimplemented - allow dropping of files if b is true, defaults to true since 5.59
b true if the widget should allow dropping of files
void KDirOperator::setCurrentItem(const KFileItem &item)
Clears the current selection and attempts to set item as the current item.
void KDirOperator::setCurrentItem(const QUrl &url)
Clears the current selection and attempts to set url the current url file.
void KDirOperator::setCurrentItems(const KFileItemList &items)
Clears the current selection and attempts to set items as the current items.
void KDirOperator::setCurrentItems(const QList<QUrl> &urls)
Clears the current selection and attempts to set urls the current url files.
[since 4.2.3]
void KDirOperator::setDecorationPosition(QStyleOptionViewItem::Position position)
Sets the position where icons shall be shown relative to the labels of file items in the icon view.
This function was introduced in 4.2.3.
See also decorationPosition().
[virtual protected]
void KDirOperator::setDirLister(KDirLister *lister)
Sets a custom KDirLister to list directories. The KDirOperator takes ownership of the given KDirLister.
See also dirLister().
[virtual]
void KDirOperator::setDropOptions(int options)
Sets the options for dropping files. CURRENTLY NOT IMPLEMENTED
[virtual]
void KDirOperator::setEnableDirHighlighting(bool enable)
When using the up or back actions to navigate the directory hierarchy, KDirOperator can highlight the directory that was just left.
For example:
- starting in /a/b/c/, going up to /a/b, "c" will be highlighted
- starting in /a/b/c, going up (twice) to /a, "b" will be highlighted; using the back action to go to /a/b/, "c" will be highlighted
- starting in /a, going to "b", then going to "c", using the back action to go to /a/b/, "c" will be highlighted; using the back action again to go to /a/, "b" will be highlighted
See also dirHighlighting, The, default, is, to, highlight, directories, when, going, and back/up.
[since 5.62]
void KDirOperator::setFollowNewDirectories(bool enable)
Toggles whether setUrl is called on newly created directories.
This function was introduced in 5.62.
See also followNewDirectories().
[since 5.62]
void KDirOperator::setFollowSelectedDirectories(bool enable)
Toggles whether setUrl is called on selected directories when a tree view is used.
This function was introduced in 5.62.
See also followSelectedDirectories().
[slot, since 5.76]
void KDirOperator::setIconSize(int value)
Notifies that the icons size should change. value is the icon size in pixels, ranged from KIconLoader::SizeSmall (16) to KIconLoader::SizeEnormous (128).
This function was introduced in 5.76.
See also iconSize().
void KDirOperator::setInlinePreviewShown(bool show)
Forces the inline previews to be shown or hidden, depending on show.
show Whether to show inline previews or not.
See also isInlinePreviewShown().
void KDirOperator::setIsSaving(bool isSaving)
If the system is set up to trigger items on single click, if isSaving is true, we will force to double click to accept.
Note: this is false by default
See also isSaving().
void KDirOperator::setMimeFilter(const QStringList &mimetypes)
Sets a list of MIME types as filter. Only files of those MIME types will be shown.
Example:
QStringList filter; filter << "text/html" << "image/png" << "inode/directory"; dirOperator->setMimefilter( filter );
Node: Without the MIME type inode/directory, only files would be shown. Call updateDir() to apply it.
See also KDirLister::setMimeFilter and mimeFilter.
[virtual]
void KDirOperator::setMode(KFile::Modes m)
Sets the listing/selection mode for the views, an OR'ed combination of
- File
- Directory
- Files
- ExistingOnly
- LocalOnly
You cannot mix File and Files of course, as the former means single-selection mode, the latter multi-selection.
See also mode().
void KDirOperator::setNameFilter(const QString &filter)
Sets a filter like "*.cpp *.h *.o". Only files matching that filter will be shown.
See also KDirLister::setNameFilter and nameFilter.
[since 5.76]
void KDirOperator::setNewFileMenuSelectDirWhenAlreadyExist(bool selectOnDirExists)
Setting this to true will make a directory get selected when trying to create a new one that has the same name.
This function was introduced in 5.76.
void KDirOperator::setNewFileMenuSupportedMimeTypes(const QStringList &mime)
Only show the files in a given set of MIME types. This is useful in specialized applications (while file managers, on the other hand, want to show all MIME types). Internally uses KNewFileMenu::setSupportedMimeTypes
Example:
QStringList mimeTypes; mimeTypes << "text/html" << "inode/directory"; dirOperator->setNewFileMenuSupportedMimeTypes(mimeTypes);
Note: If the list is empty, all options will be shown. Otherwise, without the MIME type inode/directory, only file options will be shown.
See also KNewFileMenu::setSupportedMimeTypes and newFileMenuSupportedMimeTypes.
void KDirOperator::setOnlyDoubleClickSelectsFiles(bool enable)
This toggles between double/single click file and directory selection mode. When argument is true, files and directories are highlighted with single click and selected (executed) with double click.
NOTE: this currently has no effect.
The default follows the single/double click system setting.
See also onlyDoubleClickSelectsFiles().
[virtual]
void KDirOperator::setPreviewWidget(KPreviewWidgetBase *w)
Sets a preview-widget to be shown next to the file-view.
The ownership of w is transferred to KDirOperator, so don't delete it yourself!
[virtual]
void KDirOperator::setShowHiddenFiles(bool s)
Enables/disables showing hidden files.
See also showHiddenFiles().
void KDirOperator::setSorting(QDir::SortFlags)
Sets the way to sort files and directories.
See also sorting().
[slot, since 5.43]
void KDirOperator::setSupportedSchemes(const QStringList &schemes)
Set the URL schemes that the file widget should allow navigating to.
If the returned list is empty, all schemes are supported. Examples for schemes are "file"
or "ftp"
.
This function was introduced in 5.43.
See also supportedSchemes() and QFileDialog::setSupportedSchemes.
[virtual]
void KDirOperator::setUrl(const QUrl &url, bool clearforward)
Sets a new url to list.
clearforward specifies whether the "forward" history should be cleared.
url the URL to set
See also url().
[virtual]
void KDirOperator::setViewConfig(KConfigGroup &configGroup)
Sets the config object and the to be used group in KDirOperator. This will be used to store the view's configuration. If you don't set this, the views cannot save and restore their configuration.
Usually you call this right after KDirOperator creation so that the view instantiation can make use of it already.
Note that KDirOperator does NOT take ownership of that object (typically it's KSharedConfig::openConfig() anyway.
You must not delete the KConfig or KConfigGroup object (and master config object) before either deleting the KDirOperator or calling setViewConfig(0); or something like that
See also viewConfig and viewConfigGroup.
[since 5.100]
void KDirOperator::setViewMode(KFile::FileView viewKind)
Set the view mode to one of the predefined modes.
This function was introduced in 5.100.
See also viewMode() and KFile::FileView.
[protected]
void KDirOperator::setupActions()
Sets up all the actions. Called from the constructor, you usually better not call this.
[protected]
void KDirOperator::setupMenu()
Sets up the context-menu with all the necessary actions. Called from the constructor, you usually don't need to call this.
void KDirOperator::setupMenu(int whichActions)
Sets up the action menu.
whichActions is an value of OR'd ActionTypes that controls which actions to show in the action menu
bool KDirOperator::showHiddenFiles() const
Returns true when hidden files are shown or false otherwise.
See also setShowHiddenFiles().
[since 5.87]
void KDirOperator::showOpenWithActions(bool enable)
Call with true
to add open-with actions to items in the view. This can be useful when you're attaching an image or text file to an email or uploading an image to some online service, and need to check the contents before going forward.
This function was introduced in 5.87.
[protected slot]
void KDirOperator::slotCompletionMatch(const QString &match)
Tries to make the given match as current item in the view and emits completion( match )
[protected slot]
void KDirOperator::sortByDate()
Changes sorting to sort by date
[protected slot]
void KDirOperator::sortByName()
Changes sorting to sort by name
[protected slot]
void KDirOperator::sortBySize()
Changes sorting to sort by size
[protected slot]
void KDirOperator::sortByType()
Changes sorting to sort by date
[protected slot]
void KDirOperator::sortReversed()
Changes sorting to reverse sorting
QDir::SortFlags KDirOperator::sorting() const
Returns the current way of sorting files and directories
See also setSorting().
[since 5.43]
QStringList KDirOperator::supportedSchemes() const
Returns the URL schemes that the file widget should allow navigating to.
If the returned list is empty, all schemes are supported.
This function was introduced in 5.43.
See also setSupportedSchemes() and QFileDialog::supportedSchemes.
[protected slot]
void KDirOperator::toggleDirsFirst()
Toggles showing directories first / having them sorted like files.
[protected slot]
void KDirOperator::toggleIgnoreCase()
Toggles case sensitive / case insensitive sorting
[virtual]
KIO::CopyJob *KDirOperator::trash(const KFileItemList &items, QWidget *parent, bool ask = true, bool showProgress = true)
Starts and returns a KIO::CopyJob to trash the given items.
items the list of items to be trashed parent the parent widget used for the confirmation dialog ask specifies whether a confirmation dialog should be shown showProgress passed to the CopyJob to show a progress dialog
[virtual slot]
void KDirOperator::trashSelected()
Trashes the currently selected files/directories.
This function used to take activation reason and keyboard modifiers, in order to call deleteSelected() if the user wanted to delete. Instead, call deleteSelected().
FIXME KAction Port: link deleteSelected() up correctly
[slot]
void KDirOperator::updateDir()
to update the view after changing the settings
[signal]
void KDirOperator::updateInformation(int files, int dirs)
[slot]
void KDirOperator::updateSelectionDependentActions()
Enables/disables actions that are selection dependent. Call this e.g. when you are about to show a popup menu using some of KDirOperators actions.
[protected]
void KDirOperator::updateSortActions()
Updates the sorting-related actions to comply with the current sorting
See also sorting.
[protected]
void KDirOperator::updateViewActions()
Updates the view-related actions to comply with the current KFile::FileView
QUrl KDirOperator::url() const
Returns the current url
See also setUrl().
[signal]
void KDirOperator::urlEntered(const QUrl &)
QAbstractItemView *KDirOperator::view() const
Returns the currently used view.
See also setView.
[signal]
void KDirOperator::viewChanged(QAbstractItemView *newView)
Emitted whenever the current fileview is changed, either by an explicit call to setView() or by the user selecting a different view thru the GUI.
KConfigGroup *KDirOperator::viewConfigGroup() const
Returns the group set by setViewConfig configuration.
[since 5.0]
KFile::FileView KDirOperator::viewMode() const
Returns the current view mode.
This function was introduced in 5.0.
See also setViewMode() and KFile::FileView.
[virtual]
void KDirOperator::writeConfig(KConfigGroup &configGroup)
Saves the current settings like sorting, simple or detailed view.
See also readConfig and setViewConfig.