• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • 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 
00027 #include <ktoggleaction.h>
00028 #include <kcompletion.h>
00029 #include <kdirlister.h>
00030 #include <kfileitem.h>
00031 #include <kfile.h>
00032 #include <kfile_export.h>
00033 
00034 class QAbstractItemView;
00035 class QModelIndex;
00036 class QProgressBar;
00037 
00038 class KAction;
00039 class KActionCollection;
00040 class KActionMenu;
00041 class KDirLister;
00042 class KPreviewWidgetBase;
00043 class KFilePreviewGenerator;
00044 
00045 namespace KIO
00046 {
00047 class CopyJob;
00048 class DeleteJob;
00049 }
00050 
00100 class KFILE_EXPORT KDirOperator : public QWidget
00101 {
00102     Q_OBJECT
00103 
00104 public:
00108     enum ActionType
00109     {
00110         SortActions =  1,
00111         ViewActions =  2,
00112         NavActions  =  4,
00113         FileActions =  8,
00114         AllActions  = 15
00115     };
00116 
00124     explicit KDirOperator(const KUrl& urlName = KUrl(),
00125                           QWidget *parent = 0);
00129     virtual ~KDirOperator();
00130 
00134     virtual void setShowHiddenFiles(bool s);
00135 
00139     bool showHiddenFiles() const;
00140 
00144     void close();
00145 
00153     void setNameFilter(const QString& filter);
00154 
00159     QString nameFilter() const;
00160 
00178     void setMimeFilter(const QStringList& mimetypes);
00179 
00183     QStringList mimeFilter() const;
00184 
00192     void clearFilter();
00193 
00197     KUrl url() const;
00198 
00204     virtual void setUrl(const KUrl& url, bool clearforward);
00205 
00211     void setCurrentItem(const QString& url);
00212 
00217     void setCurrentItem(const KFileItem& item);
00218 
00225     void setCurrentItems(const QStringList& urls);
00226 
00232     void setCurrentItems(const KFileItemList& items);
00233 
00241     virtual void setView(QAbstractItemView *view);
00242 
00247     QAbstractItemView* view() const;
00248 
00253     virtual void setView(KFile::FileView viewKind);
00254 
00258     void setSorting(QDir::SortFlags);
00259 
00263     QDir::SortFlags sorting() const;
00264 
00268     bool isRoot() const;
00269 
00273     KDirLister* dirLister() const;
00274 
00279     QProgressBar* progressBar() const;
00280 
00292     virtual void setMode(KFile::Modes m);
00296     KFile::Modes mode() const;
00297 
00303     virtual void setPreviewWidget(KPreviewWidgetBase *w);
00304 
00309     KFileItemList selectedItems() const;
00310 
00314     bool isSelected(const KFileItem &item) const;
00315 
00320     int numDirs() const;
00321 
00326     int numFiles() const;
00327 
00336     KCompletion* completionObject() const;
00337 
00346     KCompletion* dirCompletionObject() const;
00347 
00389     KActionCollection* actionCollection() const;
00390 
00409     virtual void setViewConfig(KConfigGroup& configGroup);
00410 
00411     /*
00412      * @returns the group set by setViewConfig configuration.
00413      */
00414     KConfigGroup* viewConfigGroup() const;
00415 
00429     virtual void readConfig(const KConfigGroup& configGroup);
00430 
00437     virtual void writeConfig(KConfigGroup& configGroup);
00438 
00446     void setOnlyDoubleClickSelectsFiles(bool enable);
00447 
00453     bool onlyDoubleClickSelectsFiles() const;
00454 
00463     virtual bool mkdir(const QString& directory, bool enterDirectory = true);
00464 
00473     virtual KIO::DeleteJob* del(const KFileItemList& items, QWidget *parent = 0,
00474                                 bool ask = true, bool showProgress = true);
00475 
00479     void clearHistory();
00480 
00490     virtual void setEnableDirHighlighting(bool enable);
00491 
00498     bool dirHighlighting() const;
00499 
00504     bool dirOnlyMode() const;
00505 
00506     static bool dirOnlyMode(uint mode);
00507 
00512     void setupMenu(int whichActions);
00513 
00518     virtual void setAcceptDrops(bool b);
00519 
00524     virtual void setDropOptions(int options);
00525 
00534     virtual KIO::CopyJob* trash(const KFileItemList& items, QWidget *parent,
00535                                 bool ask = true, bool showProgress = true);
00536 
00541     KFilePreviewGenerator *previewGenerator() const;
00542 
00547     bool isInlinePreviewShown() const;
00548 
00553     int iconsZoom() const;
00554 
00555 protected:
00565     virtual QAbstractItemView* createView(QWidget *parent, KFile::FileView viewKind);
00566 
00571     virtual void setDirLister(KDirLister *lister);
00572 
00573     virtual void resizeEvent(QResizeEvent *event);
00574 
00579     void setupActions();
00580 
00585     void updateSortActions();
00586 
00591     void updateViewActions();
00592 
00597     void setupMenu();
00598 
00606     void prepareCompletionObjects();
00607 
00613     bool checkPreviewSupport();
00614 
00618     virtual void activatedMenu(const KFileItem &item, const QPoint &pos);
00619 
00620     virtual void changeEvent(QEvent *event);
00621 
00622     virtual bool eventFilter(QObject *watched, QEvent *event);
00623 
00624 public Q_SLOTS:
00628     virtual void back();
00629 
00633     virtual void forward();
00634 
00638     virtual void home();
00639 
00643     virtual void cdUp();
00644 
00648     void updateDir();
00649 
00653     virtual void rereadDir();
00654 
00658     virtual void mkdir();
00659 
00663     virtual void deleteSelected();
00664 
00670     void updateSelectionDependentActions();
00671 
00675     QString makeCompletion(const QString&);
00676 
00680     QString makeDirCompletion(const QString&);
00681 
00691     virtual void trashSelected();
00692 
00698     void setIconsZoom(int value);
00699 
00700 protected Q_SLOTS:
00705     void resetCursor();
00706 
00711     void pathChanged();
00712 
00716     virtual void selectDir(const KFileItem &item);
00717 
00721     void selectFile(const KFileItem &item);
00722 
00726     void highlightFile(const KFileItem &item);
00727 
00731     void sortByName();
00732 
00736     void sortBySize();
00737 
00741     void sortByDate();
00742 
00746     void sortByType();
00747 
00751     void sortReversed();
00752 
00756     void toggleDirsFirst();
00757 
00761     void toggleIgnoreCase();
00762 
00767     void slotCompletionMatch(const QString &match);
00768 
00769 Q_SIGNALS:
00770     void urlEntered(const KUrl&);
00771     void updateInformation(int files, int dirs);
00772     void completion(const QString&);
00773     void finishedLoading();
00774 
00780     void viewChanged(QAbstractItemView *newView);
00781 
00787     void fileHighlighted(const KFileItem &item);
00788     void dirActivated(const KFileItem &item);
00789     void fileSelected(const KFileItem &item);
00797     void dropped(const KFileItem &item, QDropEvent *event, const KUrl::List &urls);
00798 
00807     void contextMenuAboutToShow(const KFileItem& item, QMenu* menu);
00808 
00815     void currentIconSizeChanged(int size);
00816 
00817 private:
00818     class Private;
00819     Private* const d;
00820 
00821     Q_PRIVATE_SLOT( d, void _k_slotDetailedView() )
00822     Q_PRIVATE_SLOT( d, void _k_slotSimpleView() )
00823     Q_PRIVATE_SLOT( d, void _k_slotTreeView() )
00824     Q_PRIVATE_SLOT( d, void _k_slotDetailedTreeView() )
00825     Q_PRIVATE_SLOT( d, void _k_slotToggleHidden(bool) )
00826     Q_PRIVATE_SLOT( d, void _k_togglePreview(bool) )
00827     Q_PRIVATE_SLOT( d, void _k_toggleInlinePreviews(bool) )
00828     Q_PRIVATE_SLOT( d, void _k_slotSortByName() )
00829     Q_PRIVATE_SLOT( d, void _k_slotSortBySize() )
00830     Q_PRIVATE_SLOT( d, void _k_slotSortByDate() )
00831     Q_PRIVATE_SLOT( d, void _k_slotSortByType() )
00832     Q_PRIVATE_SLOT( d, void _k_slotSortReversed() )
00833     Q_PRIVATE_SLOT( d, void _k_slotToggleDirsFirst() )
00834     Q_PRIVATE_SLOT( d, void _k_slotToggleIgnoreCase() )
00835     Q_PRIVATE_SLOT( d, void _k_slotStarted() )
00836     Q_PRIVATE_SLOT( d, void _k_slotProgress(int) )
00837     Q_PRIVATE_SLOT( d, void _k_slotShowProgress() )
00838     Q_PRIVATE_SLOT( d, void _k_slotIOFinished() )
00839     Q_PRIVATE_SLOT( d, void _k_slotCanceled() )
00840     Q_PRIVATE_SLOT( d, void _k_slotRedirected(const KUrl&) )
00841     Q_PRIVATE_SLOT( d, void _k_slotProperties() )
00842     Q_PRIVATE_SLOT( d, void _k_slotPressed(const QModelIndex&) )
00843     Q_PRIVATE_SLOT( d, void _k_slotClicked(const QModelIndex&) )
00844     Q_PRIVATE_SLOT( d, void _k_slotActivated(const QModelIndex&) )
00845     Q_PRIVATE_SLOT( d, void _k_slotDoubleClicked(const QModelIndex&) )
00846     Q_PRIVATE_SLOT( d, void _k_slotSelectionChanged() )
00847     Q_PRIVATE_SLOT( d, void _k_openContextMenu(const QPoint&) )
00848     Q_PRIVATE_SLOT( d, void _k_triggerPreview(const QModelIndex&) )
00849     Q_PRIVATE_SLOT( d, void _k_showPreview() )
00850     Q_PRIVATE_SLOT( d, void _k_slotSplitterMoved(int, int) )
00851     Q_PRIVATE_SLOT( d, void _k_assureVisibleSelection() )
00852     Q_PRIVATE_SLOT( d, void _k_synchronizeSortingState(int, Qt::SortOrder) )
00853     Q_PRIVATE_SLOT( d, void _k_slotChangeDecorationPosition() )
00854     Q_PRIVATE_SLOT( d, void _k_slotExpandToUrl(const QModelIndex&) )
00855 };
00856 
00857 #endif

KFile

Skip menu "KFile"
  • Main Page
  • 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
  • KDocTools
  • KFile
  • kformula
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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