KFile
kdiroperator.cpp
Go to the documentation of this file.
536 KToggleAction *previewAction = static_cast<KToggleAction*>(d->actionCollection->action("preview"));
549 const QItemSelection selection = d->proxyModel->mapSelectionToSource(d->itemView->selectionModel()->selection());
599 return static_cast<KFile::FileView>(KFile::Simple | KFile::Detail | KFile::Tree | KFile::DetailTree);
622 KFile::FileView view = static_cast<KFile::FileView>((viewKind & ~allViews()) | KFile::DetailTree);
678 const_cast<QAbstractItemModel*>(index.model())->setData(index, KIcon(item.iconName()), Qt::DecorationRole);
764 KMessageBox::sorry(d->itemView, i18n("A file or folder named %1 already exists.", url.pathOrUrl()));
810 i18np("Do you really want to delete this item?", "Do you really want to delete these %1 items?", items.count()),
868 i18np("translators: not called for n == 1", "Do you really want to trash these %1 items?", items.count()),
1140 Qt::SortOrder tmpSortOrder = (sortOrder() == Qt::AscendingOrder ? Qt::DescendingOrder : Qt::AscendingOrder);
1290 KToggleAction *previewAction = static_cast<KToggleAction*>(d->actionCollection->action("preview"));
1329 const QModelIndex hoveredIndex = d->itemView->indexAt(d->itemView->viewport()->mapFromGlobal(QCursor::pos()));
1336 const QModelIndex focusedIndex = d->itemView->selectionModel() ? d->itemView->selectionModel()->currentIndex()
1353 const QModelIndex hoveredIndex = d->itemView->indexAt(d->itemView->viewport()->mapFromGlobal(QCursor::pos()));
1354 const QModelIndex focusedIndex = d->itemView->selectionModel() ? d->itemView->selectionModel()->currentIndex()
1421 KMimeType::Ptr mt = KMimeType::findByPath(*it1, 0, true /*fast mode, no file contents exist*/);
1445 if (KFile::isDetailView(viewKind) || KFile::isTreeView(viewKind) || KFile::isDetailTreeView(viewKind)) {
1610 connect(d->dirModel, SIGNAL(expand(QModelIndex)), this, SLOT(_k_slotExpandToUrl(QModelIndex)));
1616 const bool previewShown = d->inlinePreviewState == Private::NotForced ? d->showPreviews : previewForcedToTrue;
1620 d->itemView->setIconSize(previewForcedToTrue ? QSize(KIconLoader::SizeHuge, KIconLoader::SizeHuge) : QSize(val, val));
1629 const int zoom = previewForcedToTrue ? (KIconLoader::SizeHuge - KIconLoader::SizeSmall + 1) * 100 / maxSize : d->iconSizeForViewType(view);
1655 connect(d->dirModel, SIGNAL(expand(QModelIndex)), this, SLOT(_k_slotExpandToUrl(QModelIndex)));
1679 connect(d->dirLister, SIGNAL(itemsFilteredByMime(KFileItemList)), SLOT(_k_slotItemsChanged()));
1838 QAction* upAction = d->actionCollection->addAction(KStandardAction::Up, "up", this, SLOT(cdUp()));
1845 QAction* homeAction = d->actionCollection->addAction(KStandardAction::Home, "home", this, SLOT(home()));
1848 KAction* reloadAction = d->actionCollection->addAction(KStandardAction::Redisplay, "reload", this, SLOT(rereadDir()));
1908 connect(d->leftAction, SIGNAL(triggered(bool)), this, SLOT(_k_slotChangeDecorationPosition()));
1984 connect(d->newFileMenu, SIGNAL(directoryCreated(KUrl)), this, SLOT(_k_slotDirectoryCreated(KUrl)));
1999 KActionMenu *sortMenu = static_cast<KActionMenu*>(d->actionCollection->action("sorting menu"));
2134 QStyleOptionViewItem::Position pos = (QStyleOptionViewItem::Position) configGroup.readEntry(QLatin1String("Decoration position"), (int) QStyleOptionViewItem::Left);
2165 KToggleAction *previewAction = static_cast<KToggleAction*>(d->actionCollection->action("preview"));
2365 const bool multiSelectionMode = (itemView->selectionMode() == QAbstractItemView::ExtendedSelection);
2391 if ((preview != 0 && !preview->isHidden()) && index.isValid() && (index.column() == KDirModel::Name)) {
void customContextMenuRequested(const QPoint &pos)
The 'Create New' submenu, for creating files using templates (e.g.
Definition: knewfilemenu.h:54
void setText(const QString &text)
KGuiItem cancel()
bool onlyDoubleClickSelectsFiles() const
Definition: kdiroperator.cpp:2242
QModelIndexList indexes() const
static bool stat(const KUrl &url, KIO::UDSEntry &entry, QWidget *window)
void setPatternSyntax(PatternSyntax syntax)
bool isSelected(const KFileItem &item) const
Definition: kdiroperator.cpp:562
KUrl targetUrl() const
QString i18n(const char *text)
void adjustPath(AdjustPathOption trailing)
virtual int rowCount(const QModelIndex &parent) const =0
KConfigGroup * viewConfigGroup() const
Definition: kdiroperator.cpp:2593
void clear()
static bool isSortByName(const QDir::SortFlags &sort)
void setupMenu()
Sets up the context-menu with all the necessary actions.
Definition: kdiroperator.cpp:1991
QString & append(QChar ch)
void setShortcutContext(Qt::ShortcutContext context)
static bool isSortByDate(const QDir::SortFlags &sort)
Type type() const
void setShortcuts(const QList< QKeySequence > &shortcuts, ShortcutTypes type=ShortcutTypes(ActiveShortcut|DefaultShortcut))
QString directory(const DirectoryOptions &options=IgnoreTrailingSlash) const
typedef SortFlags
void viewChanged(QAbstractItemView *newView)
Emitted whenever the current fileview is changed, either by an explicit call to setView() or by the u...
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const =0
static bool isDetailTreeView(const FileView &view)
Definition: kdiroperator.h:114
bool isDir() const
KActionCollection * actionCollection() const
an accessor to a collection of all available Actions.
Definition: kdiroperator.cpp:593
const QMimeData * mimeData() const
Qt::KeyboardModifiers keyboardModifiers()
void setSelectionMode(QAbstractItemView::SelectionMode mode)
QModelIndex currentIndex() const
virtual void writeConfig(KConfigGroup &configGroup)
Saves the current settings like sorting, simple or detailed view.
Definition: kdiroperator.cpp:2138
void setOnlyDoubleClickSelectsFiles(bool enable)
This toggles between double/single click file and directory selection mode.
Definition: kdiroperator.cpp:2233
Generates previews for files of an item view.
Definition: kfilepreviewgenerator.h:50
QItemSelectionModel * selectionModel() const
virtual void keyPressEvent(QKeyEvent *event)
Definition: kdiroperator.cpp:181
void setCurrentItems(const QStringList &urls)
Clears the current selection and attempts to set urls the current url files.
Definition: kdiroperator.cpp:1737
void setMaximumSize(const QSize &size)
void addAction(QAction *action)
KCompletion * dirCompletionObject() const
Definition: kdiroperator.cpp:588
virtual void forward()
Goes one step forward in the history and opens that url.
Definition: kdiroperator.cpp:1219
void setFocusPolicy(Qt::FocusPolicy policy)
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
QString i18np(const char *sing, const char *plur, const A1 &a1)
int timeout
Default detail view for KDirOperator using custom resizing options and columns.
Definition: kdiroperatordetailview_p.h:32
void setChecked(bool)
Qt::MouseButtons buttons() const
bool isNull() const
QStyle * style() const
const KShortcut & shortcut(StandardShortcut id)
Acts as proxy model for KDirModel to sort and filter KFileItems.
Definition: kdirsortfilterproxymodel.h:50
static void information(QWidget *parent, const QString &text, const QString &caption=QString(), const QString &dontShowAgainName=QString(), Options options=Notify)
static bool isSortBySize(const QDir::SortFlags &sort)
void setIcon(const QIcon &icon)
virtual void setPreviewWidget(KPreviewWidgetBase *w)
Sets a preview-widget to be shown next to the file-view.
Definition: kdiroperator.cpp:520
KStandardDirs * dirs()
int stat(const QString &path, KDE_struct_stat *buf)
void currentIconSizeChanged(int size)
Will notify that the icon size has changed.
QString makeCompletion(const QString &)
Tries to complete the given string (only completes files).
Definition: kdiroperator.cpp:1784
bool cd(const QString &_dir)
void updateSortActions()
Updates the sorting-related actions to comply with the current sorting.
Definition: kdiroperator.cpp:2052
QString makeDirCompletion(const QString &)
Tries to complete the given string (only completes directores).
Definition: kdiroperator.cpp:1795
virtual void wheelEvent(QWheelEvent *e)
QWidget * viewport() const
virtual void setAcceptDrops(bool b)
Reimplemented - allow dropping of files if b is true.
Definition: kdiroperator.cpp:1456
void writeEntry(const QString &key, const QVariant &value, WriteConfigFlags pFlags=Normal)
QString toLocalFile(AdjustPathOption trailing=LeaveTrailingSlash) const
void completion(const QString &)
const QPoint & pos() const
QString currentPath()
static bool mkdir(const KUrl &url, QWidget *window, int permissions=-1)
void acceptProposedAction()
void fileHighlighted(const KFileItem &item)
Emitted when a file is highlighted or generally the selection changes in multiselection mode...
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
bool isParentOf(const KUrl &u) const
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
bool isEmpty() const
QString homePath()
void updateSelectionDependentActions()
Enables/disables actions that are selection dependent.
Definition: kdiroperator.cpp:511
virtual void setUrl(const KUrl &url, bool clearforward)
Sets a new url to list.
Definition: kdiroperator.cpp:1022
bool checkPreviewSupport()
Checks if there support from KIO::PreviewJob for the currently shown files, taking mimeFilter() and n...
Definition: kdiroperator.cpp:1288
static bool isPreviewInfo(const FileView &view)
KGuiItem del()
QString i18nc(const char *ctxt, const char *text)
virtual void setEnableDirHighlighting(bool enable)
When going up in the directory hierarchy, KDirOperator can highlight the directory that was just left...
Definition: kdiroperator.cpp:2306
KSharedConfigPtr config()
int lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
void setPath(const QString &path)
void clear()
ListJob * listDir(const KUrl &url, JobFlags flags=DefaultFlags, bool includeHidden=true)
void setPattern(const QString &pattern)
virtual void setDirLister(KDirLister *lister)
Sets a custom KDirLister to list directories.
Definition: kdiroperator.cpp:1635
void updateViewActions()
Updates the view-related actions to comply with the current KFile::FileView.
Definition: kdiroperator.cpp:2067
QSize size() const
int indexIn(const QString &str, int offset, CaretMode caretMode) const
const char * name() const
bool isValid() const
static bool isSimpleView(const FileView &view)
void addPath(const QString &txt)
int count(const T &value) const
void append(const T &value)
virtual void trashSelected()
Trashes the currently selected files/directories.
Definition: kdiroperator.cpp:917
static bool exists(const KUrl &url, bool source, QWidget *window)
void setSorting(QDir::SortFlags)
Sets the way to sort files and directories.
Definition: kdiroperator.cpp:436
QString & insert(int position, QChar ch)
void installEventFilter(QObject *filterObj)
void toggleIgnoreCase()
Toggles case sensitive / case insensitive sorting.
Definition: kdiroperator.cpp:502
QWidget * topLevelWidget() const
void setLayoutDirection(Qt::LayoutDirection direction)
KGuiItem test()
Qt::Orientation orientation() const
virtual void setView(QAbstractItemView *view)
Sets a new view to be used for showing and browsing files.
Definition: kdiroperator.cpp:1525
Definition: kdiroperator.h:113
void prepareCompletionObjects()
Synchronizes the completion objects with the entries of the currently listed url. ...
Definition: kdiroperator.cpp:1806
bool isEmpty() const
static void sorry(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
void fileSelected(const KFileItem &item)
void setFocusProxy(QWidget *w)
virtual void select(const QModelIndex &index, QFlags< QItemSelectionModel::SelectionFlag > command)
QString trimmed() const
bool sendEvent(QObject *receiver, QEvent *event)
QString pathOrUrl() const
virtual void setDropOptions(int options)
Sets the options for dropping files.
Definition: kdiroperator.cpp:1464
#define ConfigGroup
void setOverrideCursor(const QCursor &cursor)
bool hasSelection() const
QAbstractItemDelegate * itemDelegate() const
QPoint pos() const
KAction * clear(const QObject *recvr, const char *slot, QObject *parent)
void restoreOverrideCursor()
void urlEntered(const KUrl &)
typedef Iterator
virtual bool eventFilter(QObject *watched, QEvent *event)
void setNewFileMenuSupportedMimeTypes(const QStringList &mime)
Only show the files in a given set of mimetypes.
Definition: kdiroperator.cpp:1278
virtual KIO::DeleteJob * del(const KFileItemList &items, QWidget *parent=0, bool ask=true, bool showProgress=true)
Starts and returns a KIO::DeleteJob to delete the given items.
Definition: kdiroperator.cpp:775
T & first()
QString path(AdjustPathOption trailing=LeaveTrailingSlash) const
virtual void setMode(KFile::Modes m)
Sets the listing/selection mode for the views, an OR'ed combination of.
Definition: kdiroperator.cpp:1511
QString iconName() const
#define DefaultDirsFirst
static bool isPreviewContents(const FileView &view)
virtual void changeEvent(QEvent *event)
QStringList mimeTypes(Mode mode=Writing)
KMenu * menu()
void setCurrentItem(const QString &url)
Clears the current selection and attempts to set url the current url file.
Definition: kdiroperator.cpp:1704
void setIconsZoom(int value)
Notifies that the icons size should change.
Definition: kdiroperator.cpp:934
void setAcceptDrops(bool on)
Qt::KeyboardModifiers modifiers() const
void setShortcut(const KShortcut &shortcut, ShortcutTypes type=ShortcutTypes(ActiveShortcut|DefaultShortcut))
iterator end()
KFilePreviewGenerator * previewGenerator() const
Returns the preview generator for the current view.
Definition: kdiroperator.cpp:887
int key() const
bool blockSignals(bool block)
KCompletion * completionObject() const
Definition: kdiroperator.cpp:583
void setSortIndicator(int logicalIndex, Qt::SortOrder order)
virtual bool eventFilter(QObject *watched, QEvent *event)
Definition: kdiroperator.cpp:1320
void flush()
virtual void setShowHiddenFiles(bool s)
Enables/disables showing hidden files.
Definition: kdiroperator.cpp:2598
bool isSaving() const
Returns whether KDirOperator will force a double click to accept.
Definition: kdiroperator.cpp:912
bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType type, QGenericReturnArgument ret, QGenericArgument val0, QGenericArgument val1, QGenericArgument val2, QGenericArgument val3, QGenericArgument val4, QGenericArgument val5, QGenericArgument val6, QGenericArgument val7, QGenericArgument val8, QGenericArgument val9)
virtual QStyleOptionViewItem viewOptions() const
KAction * zoom(const QObject *recvr, const char *slot, QObject *parent)
int delta() const
static bool isSortByType(const QDir::SortFlags &sort)
DeleteJob * del(const KUrl &src, JobFlags flags=DefaultFlags)
void setMimeFilter(const QStringList &mimetypes)
Sets a list of mimetypes as filter.
Definition: kdiroperator.cpp:1267
KDirOperator(const KUrl &urlName=KUrl(), QWidget *parent=0)
Constructs the KDirOperator with no initial view.
Definition: kdiroperator.cpp:371
void slotCompletionMatch(const QString &match)
Tries to make the given match as current item in the view and emits completion( match ) ...
Definition: kdiroperator.cpp:1824
QStringList newFileMenuSupportedMimeTypes() const
Definition: kdiroperator.cpp:1283
virtual KIO::CopyJob * trash(const KFileItemList &items, QWidget *parent, bool ask=true, bool showProgress=true)
Starts and returns a KIO::CopyJob to trash the given items.
Definition: kdiroperator.cpp:837
bool isValid() const
static bool isDetailView(const FileView &view)
virtual void clear()
virtual void selectDir(const KFileItem &item)
Enters the directory specified by the given item.
Definition: kdiroperator.cpp:1683
const QAbstractItemModel * model() const
QString mid(int position, int n) const
bool hasUrls() const
FileView
QPoint pos()
void clearFilter()
Clears both the namefilter and mimetype filter, so that all files and directories will be shown...
Definition: kdiroperator.cpp:1249
void setIsSaving(bool isSaving)
If the system is set up to trigger items on single click, if isSaving is true, we will force to doubl...
Definition: kdiroperator.cpp:907
void pathChanged()
Called after setUrl() to load the directory, update the history, etc.
Definition: kdiroperator.cpp:1167
virtual void mousePressEvent(QMouseEvent *event)
void setActionGroup(QActionGroup *group)
QString name(bool lowerCase=false) const
QAction * addSeparator()
void resetCursor()
Restores the normal cursor after showing the busy-cursor.
Definition: kdiroperator.cpp:464
virtual void back()
Goes one step back in the history and opens that url.
Definition: kdiroperator.cpp:1205
typedef ConstIterator
int height() const
virtual void keyPressEvent(QKeyEvent *event)
virtual bool setViewMode(KFile::FileView viewMode)
Displays either Detail, Tree or DetailTree modes.
Definition: kdiroperatordetailview.cpp:70
int column() const
int length() const
QStringList split(const QString &sep, const QString &str, bool allowEmptyEntries)
static int warningContinueCancelList(QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
virtual void readConfig(const KConfigGroup &configGroup)
Reads the default settings for a view, i.e.
Definition: kdiroperator.cpp:2081
void highlightFile(const KFileItem &item)
Emits fileHighlighted(item)
Definition: kdiroperator.cpp:1695
void setCurrentIndex(const QModelIndex &index, QFlags< QItemSelectionModel::SelectionFlag > command)
int indexOf(const QRegExp &rx, int from) const
virtual QAbstractItemView * createView(QWidget *parent, KFile::FileView viewKind)
A view factory for creating predefined fileviews.
Definition: kdiroperator.cpp:1442
void setGridSize(const QSize &size)
QStyleOptionViewItem::Position decorationPosition() const
Returns the position where icons are shown relative to the labels of file items in the icon view...
Definition: kdiroperator.cpp:2608
Definition: kdiroperator.h:112
QHeaderView * header() const
void contextMenuAboutToShow(const KFileItem &item, QMenu *menu)
Emitted just before the context menu is shown, allows users to extend the menu with custom actions...
virtual void deleteSelected()
Deletes the currently selected files/directories.
Definition: kdiroperator.cpp:829
int find(QChar c, int i, bool cs) const
const QPoint & pos() const
static bool supportsListing(const KUrl &url)
QStringList filter(const QString &str, Qt::CaseSensitivity cs) const
bool isInlinePreviewShown() const
Returns whether the inline previews are shown or not.
Definition: kdiroperator.cpp:897
void expand(const QModelIndex &index)
static QStringList supportedMimeTypes()
#define DefaultSortReversed
bool isLocalFile() const
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setFlow(Flow flow)
void setDecorationPosition(QStyleOptionViewItem::Position position)
Sets the position where icons shall be shown relative to the labels of file items in the icon view...
Definition: kdiroperator.cpp:2613
virtual bool event(QEvent *event)
T readEntry(const QString &key, const T &aDefault) const
bool equals(const KUrl &u, const EqualsOptions &options=0) const
void toggleDirsFirst()
Toggles showing directories first / having them sorted like files.
Definition: kdiroperator.cpp:497
static bool isTreeView(const FileView &view)
const KShortcut & completion()
static int warningContinueCancel(QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
const int kfile_area
iterator begin()
void setEnabled(bool)
int height() const
void setNameFilter(const QString &filter)
Sets a filter like "*.cpp *.h *.o".
Definition: kdiroperator.cpp:1256
CopyJob * trash(const KUrl &src, JobFlags flags=DefaultFlags)
KUrl url() const
QByteArray encodeName(const QString &fileName)
static void error(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
virtual void resizeEvent(QResizeEvent *event)
Definition: kdiroperator.cpp:2206
#define DefaultShowHidden
QUrl fromLocalFile(const QString &localFile)
void setInlinePreviewShown(bool show)
Forces the inline previews to be shown or hidden, depending on show.
Definition: kdiroperator.cpp:892
virtual void setViewConfig(KConfigGroup &configGroup)
Sets the config object and the to be used group in KDirOperator.
Definition: kdiroperator.cpp:2587
virtual void activatedMenu(const KFileItem &item, const QPoint &pos)
Called upon right-click to activate the popupmenu.
Definition: kdiroperator.cpp:1301
Definition: kdiroperator.h:111
QStringList list(const QString &fileClass)
typedef KeyboardModifiers
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:27:26 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:27:26 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.