• 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 
00549     void setInlinePreviewShown(bool show);
00550 
00555     bool isInlinePreviewShown() const;
00556 
00561     int iconsZoom() const;
00562 
00569     void setIsSaving(bool isSaving);
00570 
00576     bool isSaving() const;
00577 
00578 protected:
00588     virtual QAbstractItemView* createView(QWidget *parent, KFile::FileView viewKind);
00589 
00594     virtual void setDirLister(KDirLister *lister);
00595 
00596     virtual void resizeEvent(QResizeEvent *event);
00597 
00602     void setupActions();
00603 
00608     void updateSortActions();
00609 
00614     void updateViewActions();
00615 
00620     void setupMenu();
00621 
00629     void prepareCompletionObjects();
00630 
00636     bool checkPreviewSupport();
00637 
00641     virtual void activatedMenu(const KFileItem &item, const QPoint &pos);
00642 
00643     virtual void changeEvent(QEvent *event);
00644 
00645     virtual bool eventFilter(QObject *watched, QEvent *event);
00646 
00647 public Q_SLOTS:
00651     virtual void back();
00652 
00656     virtual void forward();
00657 
00661     virtual void home();
00662 
00666     virtual void cdUp();
00667 
00671     void updateDir();
00672 
00676     virtual void rereadDir();
00677 
00681     virtual void mkdir();
00682 
00686     virtual void deleteSelected();
00687 
00693     void updateSelectionDependentActions();
00694 
00698     QString makeCompletion(const QString&);
00699 
00703     QString makeDirCompletion(const QString&);
00704 
00714     virtual void trashSelected();
00715 
00721     void setIconsZoom(int value);
00722 
00723 protected Q_SLOTS:
00728     void resetCursor();
00729 
00734     void pathChanged();
00735 
00739     virtual void selectDir(const KFileItem &item);
00740 
00744     void selectFile(const KFileItem &item);
00745 
00749     void highlightFile(const KFileItem &item);
00750 
00754     void sortByName();
00755 
00759     void sortBySize();
00760 
00764     void sortByDate();
00765 
00769     void sortByType();
00770 
00774     void sortReversed();
00775 
00779     void toggleDirsFirst();
00780 
00784     void toggleIgnoreCase();
00785 
00790     void slotCompletionMatch(const QString &match);
00791 
00792 Q_SIGNALS:
00793     void urlEntered(const KUrl&);
00794     void updateInformation(int files, int dirs);
00795     void completion(const QString&);
00796     void finishedLoading();
00797 
00803     void viewChanged(QAbstractItemView *newView);
00804 
00810     void fileHighlighted(const KFileItem &item);
00811     void dirActivated(const KFileItem &item);
00812     void fileSelected(const KFileItem &item);
00820     void dropped(const KFileItem &item, QDropEvent *event, const KUrl::List &urls);
00821 
00830     void contextMenuAboutToShow(const KFileItem& item, QMenu* menu);
00831 
00838     void currentIconSizeChanged(int size);
00839 
00840 private:
00841     class Private;
00842     Private* const d;
00843 
00844     Q_PRIVATE_SLOT( d, void _k_slotDetailedView() )
00845     Q_PRIVATE_SLOT( d, void _k_slotSimpleView() )
00846     Q_PRIVATE_SLOT( d, void _k_slotTreeView() )
00847     Q_PRIVATE_SLOT( d, void _k_slotDetailedTreeView() )
00848     Q_PRIVATE_SLOT( d, void _k_slotToggleHidden(bool) )
00849     Q_PRIVATE_SLOT( d, void _k_togglePreview(bool) )
00850     Q_PRIVATE_SLOT( d, void _k_toggleInlinePreviews(bool) )
00851     Q_PRIVATE_SLOT( d, void _k_slotSortByName() )
00852     Q_PRIVATE_SLOT( d, void _k_slotSortBySize() )
00853     Q_PRIVATE_SLOT( d, void _k_slotSortByDate() )
00854     Q_PRIVATE_SLOT( d, void _k_slotSortByType() )
00855     Q_PRIVATE_SLOT( d, void _k_slotSortReversed(bool) )
00856     Q_PRIVATE_SLOT( d, void _k_slotToggleDirsFirst() )
00857     Q_PRIVATE_SLOT( d, void _k_slotToggleIgnoreCase() )
00858     Q_PRIVATE_SLOT( d, void _k_slotStarted() )
00859     Q_PRIVATE_SLOT( d, void _k_slotProgress(int) )
00860     Q_PRIVATE_SLOT( d, void _k_slotShowProgress() )
00861     Q_PRIVATE_SLOT( d, void _k_slotIOFinished() )
00862     Q_PRIVATE_SLOT( d, void _k_slotCanceled() )
00863     Q_PRIVATE_SLOT( d, void _k_slotRedirected(const KUrl&) )
00864     Q_PRIVATE_SLOT( d, void _k_slotProperties() )
00865     Q_PRIVATE_SLOT( d, void _k_slotPressed(const QModelIndex&) )
00866     Q_PRIVATE_SLOT( d, void _k_slotActivated(const QModelIndex&) )
00867     Q_PRIVATE_SLOT( d, void _k_slotDoubleClicked(const QModelIndex&) )
00868     Q_PRIVATE_SLOT( d, void _k_slotSelectionChanged() )
00869     Q_PRIVATE_SLOT( d, void _k_openContextMenu(const QPoint&) )
00870     Q_PRIVATE_SLOT( d, void _k_triggerPreview(const QModelIndex&) )
00871     Q_PRIVATE_SLOT( d, void _k_showPreview() )
00872     Q_PRIVATE_SLOT( d, void _k_slotSplitterMoved(int, int) )
00873     Q_PRIVATE_SLOT( d, void _k_assureVisibleSelection() )
00874     Q_PRIVATE_SLOT( d, void _k_synchronizeSortingState(int, Qt::SortOrder) )
00875     Q_PRIVATE_SLOT( d, void _k_slotChangeDecorationPosition() )
00876     Q_PRIVATE_SLOT( d, void _k_slotExpandToUrl(const QModelIndex&) )
00877 };
00878 
00879 #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
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
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