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

KFile

kdiroperator.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 /* This file is part of the KDE libraries
00003     Copyright (C) 1999 Stephan Kulow <coolo@kde.org>
00004     2000,2001 Carsten Pfeiffer <pfeiffer@kde.org>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 #ifndef KDIROPERATOR_H_
00022 #define KDIROPERATOR_H_
00023 
00024 #include <QtGui/QWidget>
00025 #include <QtCore/QStack>
00026 #include <QtGui/QStyleOptionViewItem>
00027 
00028 #include <ktoggleaction.h>
00029 #include <kcompletion.h>
00030 #include <kdirlister.h>
00031 #include <kfileitem.h>
00032 #include <kfile.h>
00033 #include <kfile_export.h>
00034 
00035 class QAbstractItemView;
00036 class QModelIndex;
00037 class QProgressBar;
00038 
00039 class KAction;
00040 class KActionCollection;
00041 class KActionMenu;
00042 class KDirLister;
00043 class KPreviewWidgetBase;
00044 class KFilePreviewGenerator;
00045 
00046 namespace KIO
00047 {
00048 class CopyJob;
00049 class DeleteJob;
00050 }
00051 
00101 class KFILE_EXPORT KDirOperator : public QWidget
00102 {
00103     Q_OBJECT
00104 
00105 public:
00109     enum ActionType
00110     {
00111         SortActions =  1,
00112         ViewActions =  2,
00113         NavActions  =  4,
00114         FileActions =  8,
00115         AllActions  = 15
00116     };
00117 
00125     explicit KDirOperator(const KUrl& urlName = KUrl(),
00126                           QWidget *parent = 0);
00130     virtual ~KDirOperator();
00131 
00135     virtual void setShowHiddenFiles(bool s);
00136 
00140     bool showHiddenFiles() const;
00141 
00145     void close();
00146 
00154     void setNameFilter(const QString& filter);
00155 
00160     QString nameFilter() const;
00161 
00179     void setMimeFilter(const QStringList& mimetypes);
00180 
00184     QStringList mimeFilter() const;
00185 
00206     void setNewFileMenuSupportedMimeTypes(const QStringList& mime);
00207 
00212     QStringList newFileMenuSupportedMimeTypes() const;
00213 
00221     void clearFilter();
00222 
00226     KUrl url() const;
00227 
00233     virtual void setUrl(const KUrl& url, bool clearforward);
00234 
00240     void setCurrentItem(const QString& url);
00241 
00246     void setCurrentItem(const KFileItem& item);
00247 
00254     void setCurrentItems(const QStringList& urls);
00255 
00261     void setCurrentItems(const KFileItemList& items);
00262 
00270     virtual void setView(QAbstractItemView *view);
00271 
00276     QAbstractItemView* view() const;
00277 
00282     virtual void setView(KFile::FileView viewKind);
00283 
00287     void setSorting(QDir::SortFlags);
00288 
00292     QDir::SortFlags sorting() const;
00293 
00297     bool isRoot() const;
00298 
00302     KDirLister* dirLister() const;
00303 
00308     QProgressBar* progressBar() const;
00309 
00321     virtual void setMode(KFile::Modes m);
00325     KFile::Modes mode() const;
00326 
00332     virtual void setPreviewWidget(KPreviewWidgetBase *w);
00333 
00338     KFileItemList selectedItems() const;
00339 
00343     bool isSelected(const KFileItem &item) const;
00344 
00349     int numDirs() const;
00350 
00355     int numFiles() const;
00356 
00365     KCompletion* completionObject() const;
00366 
00375     KCompletion* dirCompletionObject() const;
00376 
00418     KActionCollection* actionCollection() const;
00419 
00438     virtual void setViewConfig(KConfigGroup& configGroup);
00439 
00440     /*
00441      * @returns the group set by setViewConfig configuration.
00442      */
00443     KConfigGroup* viewConfigGroup() const;
00444 
00458     virtual void readConfig(const KConfigGroup& configGroup);
00459 
00466     virtual void writeConfig(KConfigGroup& configGroup);
00467 
00477     void setOnlyDoubleClickSelectsFiles(bool enable);
00478 
00484     bool onlyDoubleClickSelectsFiles() const;
00485 
00494     virtual bool mkdir(const QString& directory, bool enterDirectory = true);
00495 
00504     virtual KIO::DeleteJob* del(const KFileItemList& items, QWidget *parent = 0,
00505                                 bool ask = true, bool showProgress = true);
00506 
00510     void clearHistory();
00511 
00521     virtual void setEnableDirHighlighting(bool enable);
00522 
00529     bool dirHighlighting() const;
00530 
00535     bool dirOnlyMode() const;
00536 
00537     static bool dirOnlyMode(uint mode);
00538 
00543     void setupMenu(int whichActions);
00544 
00549     virtual void setAcceptDrops(bool b);
00550 
00555     virtual void setDropOptions(int options);
00556 
00565     virtual KIO::CopyJob* trash(const KFileItemList& items, QWidget *parent,
00566                                 bool ask = true, bool showProgress = true);
00567 
00572     KFilePreviewGenerator *previewGenerator() const;
00573 
00580     void setInlinePreviewShown(bool show);
00581 
00587     QStyleOptionViewItem::Position decorationPosition() const;
00588 
00594     void setDecorationPosition(QStyleOptionViewItem::Position position);
00595 
00600     bool isInlinePreviewShown() const;
00601 
00606     int iconsZoom() const;
00607 
00614     void setIsSaving(bool isSaving);
00615 
00621     bool isSaving() const;
00622 
00623 protected:
00633     virtual QAbstractItemView* createView(QWidget *parent, KFile::FileView viewKind);
00634 
00639     virtual void setDirLister(KDirLister *lister);
00640 
00641     virtual void resizeEvent(QResizeEvent *event);
00642 
00643     virtual void keyPressEvent(QKeyEvent * event);
00644 
00649     void setupActions();
00650 
00655     void updateSortActions();
00656 
00661     void updateViewActions();
00662 
00667     void setupMenu();
00668 
00676     void prepareCompletionObjects();
00677 
00683     bool checkPreviewSupport();
00684 
00688     virtual void activatedMenu(const KFileItem &item, const QPoint &pos);
00689 
00690     virtual void changeEvent(QEvent *event);
00691 
00692     virtual bool eventFilter(QObject *watched, QEvent *event);
00693 
00694 public Q_SLOTS:
00698     virtual void back();
00699 
00703     virtual void forward();
00704 
00708     virtual void home();
00709 
00713     virtual void cdUp();
00714 
00718     void updateDir();
00719 
00723     virtual void rereadDir();
00724 
00728     virtual void mkdir();
00729 
00733     virtual void deleteSelected();
00734 
00740     void updateSelectionDependentActions();
00741 
00745     QString makeCompletion(const QString&);
00746 
00750     QString makeDirCompletion(const QString&);
00751 
00761     virtual void trashSelected();
00762 
00768     void setIconsZoom(int value);
00769 
00770 protected Q_SLOTS:
00775     void resetCursor();
00776 
00781     void pathChanged();
00782 
00786     virtual void selectDir(const KFileItem &item);
00787 
00791     void selectFile(const KFileItem &item);
00792 
00796     void highlightFile(const KFileItem &item);
00797 
00801     void sortByName();
00802 
00806     void sortBySize();
00807 
00811     void sortByDate();
00812 
00816     void sortByType();
00817 
00821     void sortReversed();
00822 
00826     void toggleDirsFirst();
00827 
00831     void toggleIgnoreCase();
00832 
00837     void slotCompletionMatch(const QString &match);
00838 
00839 Q_SIGNALS:
00840     void urlEntered(const KUrl&);
00841     void updateInformation(int files, int dirs);
00842     void completion(const QString&);
00843     void finishedLoading();
00844 
00850     void viewChanged(QAbstractItemView *newView);
00851 
00857     void fileHighlighted(const KFileItem &item);
00858     void dirActivated(const KFileItem &item);
00859     void fileSelected(const KFileItem &item);
00867     void dropped(const KFileItem &item, QDropEvent *event, const KUrl::List &urls);
00868 
00877     void contextMenuAboutToShow(const KFileItem& item, QMenu* menu);
00878 
00885     void currentIconSizeChanged(int size);
00886 
00887 private:
00888     class Private;
00889     Private* const d;
00890 
00891     Q_PRIVATE_SLOT( d, void _k_slotDetailedView() )
00892     Q_PRIVATE_SLOT( d, void _k_slotSimpleView() )
00893     Q_PRIVATE_SLOT( d, void _k_slotTreeView() )
00894     Q_PRIVATE_SLOT( d, void _k_slotDetailedTreeView() )
00895     Q_PRIVATE_SLOT( d, void _k_slotToggleHidden(bool) )
00896     Q_PRIVATE_SLOT( d, void _k_togglePreview(bool) )
00897     Q_PRIVATE_SLOT( d, void _k_toggleInlinePreviews(bool) )
00898     Q_PRIVATE_SLOT( d, void _k_slotOpenFileManager() )
00899     Q_PRIVATE_SLOT( d, void _k_slotSortByName() )
00900     Q_PRIVATE_SLOT( d, void _k_slotSortBySize() )
00901     Q_PRIVATE_SLOT( d, void _k_slotSortByDate() )
00902     Q_PRIVATE_SLOT( d, void _k_slotSortByType() )
00903     Q_PRIVATE_SLOT( d, void _k_slotSortReversed(bool) )
00904     Q_PRIVATE_SLOT( d, void _k_slotToggleDirsFirst() )
00905     Q_PRIVATE_SLOT( d, void _k_slotToggleIgnoreCase() )
00906     Q_PRIVATE_SLOT( d, void _k_slotStarted() )
00907     Q_PRIVATE_SLOT( d, void _k_slotProgress(int) )
00908     Q_PRIVATE_SLOT( d, void _k_slotShowProgress() )
00909     Q_PRIVATE_SLOT( d, void _k_slotIOFinished() )
00910     Q_PRIVATE_SLOT( d, void _k_slotCanceled() )
00911     Q_PRIVATE_SLOT( d, void _k_slotRedirected(const KUrl&) )
00912     Q_PRIVATE_SLOT( d, void _k_slotProperties() )
00913     Q_PRIVATE_SLOT( d, void _k_slotActivated(const QModelIndex&) )
00914     Q_PRIVATE_SLOT( d, void _k_slotSelectionChanged() )
00915     Q_PRIVATE_SLOT( d, void _k_openContextMenu(const QPoint&) )
00916     Q_PRIVATE_SLOT( d, void _k_triggerPreview(const QModelIndex&) )
00917     Q_PRIVATE_SLOT( d, void _k_showPreview() )
00918     Q_PRIVATE_SLOT( d, void _k_slotSplitterMoved(int, int) )
00919     Q_PRIVATE_SLOT( d, void _k_assureVisibleSelection() )
00920     Q_PRIVATE_SLOT( d, void _k_synchronizeSortingState(int, Qt::SortOrder) )
00921     Q_PRIVATE_SLOT( d, void _k_slotChangeDecorationPosition() )
00922     Q_PRIVATE_SLOT( d, void _k_slotExpandToUrl(const QModelIndex&) )
00923     Q_PRIVATE_SLOT( d, void _k_slotItemsChanged() )
00924     Q_PRIVATE_SLOT( d, void _k_slotDirectoryCreated(const KUrl&) )
00925 };
00926 
00927 #endif

KFile

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • 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
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal