• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KFile

  • sources
  • kde-4.14
  • kdelibs
  • kfile
kdiroperator.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 /* This file is part of the KDE libraries
3  Copyright (C) 1999 Stephan Kulow <coolo@kde.org>
4  2000,2001 Carsten Pfeiffer <pfeiffer@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 #ifndef KDIROPERATOR_H_
22 #define KDIROPERATOR_H_
23 
24 #include <QtGui/QWidget>
25 #include <QtCore/QStack>
26 #include <QtGui/QStyleOptionViewItem>
27 
28 #include <ktoggleaction.h>
29 #include <kcompletion.h>
30 #include <kdirlister.h>
31 #include <kfileitem.h>
32 #include <kfile.h>
33 #include <kfile_export.h>
34 
35 class QAbstractItemView;
36 class QModelIndex;
37 class QProgressBar;
38 
39 class KAction;
40 class KActionCollection;
41 class KActionMenu;
42 class KDirLister;
43 class KPreviewWidgetBase;
44 class KFilePreviewGenerator;
45 
46 namespace KIO
47 {
48 class CopyJob;
49 class DeleteJob;
50 }
51 
101 class KFILE_EXPORT KDirOperator : public QWidget
102 {
103  Q_OBJECT
104 
105 public:
109  enum ActionType
110  {
111  SortActions = 1,
112  ViewActions = 2,
113  NavActions = 4,
114  FileActions = 8,
115  AllActions = 15
116  };
117 
125  explicit KDirOperator(const KUrl& urlName = KUrl(),
126  QWidget *parent = 0);
130  virtual ~KDirOperator();
131 
135  virtual void setShowHiddenFiles(bool s);
136 
140  bool showHiddenFiles() const;
141 
145  void close();
146 
154  void setNameFilter(const QString& filter);
155 
160  QString nameFilter() const;
161 
179  void setMimeFilter(const QStringList& mimetypes);
180 
184  QStringList mimeFilter() const;
185 
206  void setNewFileMenuSupportedMimeTypes(const QStringList& mime);
207 
212  QStringList newFileMenuSupportedMimeTypes() const;
213 
221  void clearFilter();
222 
226  KUrl url() const;
227 
233  virtual void setUrl(const KUrl& url, bool clearforward);
234 
240  void setCurrentItem(const QString& url);
241 
246  void setCurrentItem(const KFileItem& item);
247 
254  void setCurrentItems(const QStringList& urls);
255 
261  void setCurrentItems(const KFileItemList& items);
262 
270  virtual void setView(QAbstractItemView *view);
271 
276  QAbstractItemView* view() const;
277 
282  virtual void setView(KFile::FileView viewKind);
283 
287  void setSorting(QDir::SortFlags);
288 
292  QDir::SortFlags sorting() const;
293 
297  bool isRoot() const;
298 
302  KDirLister* dirLister() const;
303 
308  QProgressBar* progressBar() const;
309 
321  virtual void setMode(KFile::Modes m);
325  KFile::Modes mode() const;
326 
332  virtual void setPreviewWidget(KPreviewWidgetBase *w);
333 
338  KFileItemList selectedItems() const;
339 
343  bool isSelected(const KFileItem &item) const;
344 
349  int numDirs() const;
350 
355  int numFiles() const;
356 
365  KCompletion* completionObject() const;
366 
375  KCompletion* dirCompletionObject() const;
376 
418  KActionCollection* actionCollection() const;
419 
438  virtual void setViewConfig(KConfigGroup& configGroup);
439 
440  /*
441  * @returns the group set by setViewConfig configuration.
442  */
443  KConfigGroup* viewConfigGroup() const;
444 
458  virtual void readConfig(const KConfigGroup& configGroup);
459 
466  virtual void writeConfig(KConfigGroup& configGroup);
467 
477  void setOnlyDoubleClickSelectsFiles(bool enable);
478 
484  bool onlyDoubleClickSelectsFiles() const;
485 
494  virtual bool mkdir(const QString& directory, bool enterDirectory = true);
495 
504  virtual KIO::DeleteJob* del(const KFileItemList& items, QWidget *parent = 0,
505  bool ask = true, bool showProgress = true);
506 
510  void clearHistory();
511 
521  virtual void setEnableDirHighlighting(bool enable);
522 
529  bool dirHighlighting() const;
530 
535  bool dirOnlyMode() const;
536 
537  static bool dirOnlyMode(uint mode);
538 
543  void setupMenu(int whichActions);
544 
549  virtual void setAcceptDrops(bool b);
550 
555  virtual void setDropOptions(int options);
556 
565  virtual KIO::CopyJob* trash(const KFileItemList& items, QWidget *parent,
566  bool ask = true, bool showProgress = true);
567 
572  KFilePreviewGenerator *previewGenerator() const;
573 
580  void setInlinePreviewShown(bool show);
581 
587  QStyleOptionViewItem::Position decorationPosition() const;
588 
594  void setDecorationPosition(QStyleOptionViewItem::Position position);
595 
600  bool isInlinePreviewShown() const;
601 
606  int iconsZoom() const;
607 
614  void setIsSaving(bool isSaving);
615 
621  bool isSaving() const;
622 
623 protected:
633  virtual QAbstractItemView* createView(QWidget *parent, KFile::FileView viewKind);
634 
639  virtual void setDirLister(KDirLister *lister);
640 
641  virtual void resizeEvent(QResizeEvent *event);
642 
643  virtual void keyPressEvent(QKeyEvent * event);
644 
649  void setupActions();
650 
655  void updateSortActions();
656 
661  void updateViewActions();
662 
667  void setupMenu();
668 
676  void prepareCompletionObjects();
677 
683  bool checkPreviewSupport();
684 
688  virtual void activatedMenu(const KFileItem &item, const QPoint &pos);
689 
690  virtual void changeEvent(QEvent *event);
691 
692  virtual bool eventFilter(QObject *watched, QEvent *event);
693 
694 public Q_SLOTS:
698  virtual void back();
699 
703  virtual void forward();
704 
708  virtual void home();
709 
713  virtual void cdUp();
714 
718  void updateDir();
719 
723  virtual void rereadDir();
724 
728  virtual void mkdir();
729 
733  virtual void deleteSelected();
734 
740  void updateSelectionDependentActions();
741 
745  QString makeCompletion(const QString&);
746 
750  QString makeDirCompletion(const QString&);
751 
761  virtual void trashSelected();
762 
768  void setIconsZoom(int value);
769 
770 protected Q_SLOTS:
775  void resetCursor();
776 
781  void pathChanged();
782 
786  virtual void selectDir(const KFileItem &item);
787 
791  void selectFile(const KFileItem &item);
792 
796  void highlightFile(const KFileItem &item);
797 
801  void sortByName();
802 
806  void sortBySize();
807 
811  void sortByDate();
812 
816  void sortByType();
817 
821  void sortReversed();
822 
826  void toggleDirsFirst();
827 
831  void toggleIgnoreCase();
832 
837  void slotCompletionMatch(const QString &match);
838 
839 Q_SIGNALS:
840  void urlEntered(const KUrl&);
841  void updateInformation(int files, int dirs);
842  void completion(const QString&);
843  void finishedLoading();
844 
850  void viewChanged(QAbstractItemView *newView);
851 
857  void fileHighlighted(const KFileItem &item);
858  void dirActivated(const KFileItem &item);
859  void fileSelected(const KFileItem &item);
867  void dropped(const KFileItem &item, QDropEvent *event, const KUrl::List &urls);
868 
877  void contextMenuAboutToShow(const KFileItem& item, QMenu* menu);
878 
885  void currentIconSizeChanged(int size);
886 
887 private:
888  class Private;
889  Private* const d;
890 
891  Q_PRIVATE_SLOT( d, void _k_slotDetailedView() )
892  Q_PRIVATE_SLOT( d, void _k_slotSimpleView() )
893  Q_PRIVATE_SLOT( d, void _k_slotTreeView() )
894  Q_PRIVATE_SLOT( d, void _k_slotDetailedTreeView() )
895  Q_PRIVATE_SLOT( d, void _k_slotToggleHidden(bool) )
896  Q_PRIVATE_SLOT( d, void _k_togglePreview(bool) )
897  Q_PRIVATE_SLOT( d, void _k_toggleInlinePreviews(bool) )
898  Q_PRIVATE_SLOT( d, void _k_slotOpenFileManager() )
899  Q_PRIVATE_SLOT( d, void _k_slotSortByName() )
900  Q_PRIVATE_SLOT( d, void _k_slotSortBySize() )
901  Q_PRIVATE_SLOT( d, void _k_slotSortByDate() )
902  Q_PRIVATE_SLOT( d, void _k_slotSortByType() )
903  Q_PRIVATE_SLOT( d, void _k_slotSortReversed(bool) )
904  Q_PRIVATE_SLOT( d, void _k_slotToggleDirsFirst() )
905  Q_PRIVATE_SLOT( d, void _k_slotToggleIgnoreCase() )
906  Q_PRIVATE_SLOT( d, void _k_slotStarted() )
907  Q_PRIVATE_SLOT( d, void _k_slotProgress(int) )
908  Q_PRIVATE_SLOT( d, void _k_slotShowProgress() )
909  Q_PRIVATE_SLOT( d, void _k_slotIOFinished() )
910  Q_PRIVATE_SLOT( d, void _k_slotCanceled() )
911  Q_PRIVATE_SLOT( d, void _k_slotRedirected(const KUrl&) )
912  Q_PRIVATE_SLOT( d, void _k_slotProperties() )
913  Q_PRIVATE_SLOT( d, void _k_slotActivated(const QModelIndex&) )
914  Q_PRIVATE_SLOT( d, void _k_slotSelectionChanged() )
915  Q_PRIVATE_SLOT( d, void _k_openContextMenu(const QPoint&) )
916  Q_PRIVATE_SLOT( d, void _k_triggerPreview(const QModelIndex&) )
917  Q_PRIVATE_SLOT( d, void _k_showPreview() )
918  Q_PRIVATE_SLOT( d, void _k_slotSplitterMoved(int, int) )
919  Q_PRIVATE_SLOT( d, void _k_assureVisibleSelection() )
920  Q_PRIVATE_SLOT( d, void _k_synchronizeSortingState(int, Qt::SortOrder) )
921  Q_PRIVATE_SLOT( d, void _k_slotChangeDecorationPosition() )
922  Q_PRIVATE_SLOT( d, void _k_slotExpandToUrl(const QModelIndex&) )
923  Q_PRIVATE_SLOT( d, void _k_slotItemsChanged() )
924  Q_PRIVATE_SLOT( d, void _k_slotDirectoryCreated(const KUrl&) )
925 };
926 
927 #endif
kdirlister.h
QProgressBar
QModelIndex
QWidget::close
bool close()
QEvent
QResizeEvent
QWidget
KActionCollection
QDir::SortFlags
typedef SortFlags
QAbstractItemView
back
KAction * back(const QObject *recvr, const char *slot, QObject *parent)
KFilePreviewGenerator
Generates previews for files of an item view.
Definition: kfilepreviewgenerator.h:50
kfile.h
mkdir
int mkdir(const QString &pathname, mode_t)
QPoint
KUrl
del
KGuiItem del()
readConfig
TsConfig readConfig(const QString &fname)
KDirOperator::ActionType
ActionType
The various action types.
Definition: kdiroperator.h:109
QObject
KDirOperator
This widget works as a network transparent filebrowser.
Definition: kdiroperator.h:101
KIO::DeleteJob
QDropEvent
KCompletion
KFileItemList
home
KAction * home(const QObject *recvr, const char *slot, QObject *parent)
QObject::eventFilter
virtual bool eventFilter(QObject *watched, QEvent *event)
QString
QWidget::changeEvent
virtual void changeEvent(QEvent *event)
QStringList
QWidget::setAcceptDrops
void setAcceptDrops(bool on)
kcompletion.h
QMenu
forward
KAction * forward(const QObject *recvr, const char *slot, QObject *parent)
KConfigGroup
KUrl::List
QKeyEvent
KActionMenu
KFile::FileView
FileView
KAction
KPreviewWidgetBase
QWidget::keyPressEvent
virtual void keyPressEvent(QKeyEvent *event)
ktoggleaction.h
KDirLister
QWidget::resizeEvent
virtual void resizeEvent(QResizeEvent *event)
completion
const KShortcut & completion()
kfileitem.h
kfile_export.h
trash
CopyJob * trash(const KUrl &src, JobFlags flags=DefaultFlags)
KFileItem
KIO::CopyJob
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

KDE's Doxygen guidelines are available online.

KFile

Skip menu "KFile"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal