• Skip to content
  • Skip to link menu
KDE 4.1 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 
00044 namespace KIO
00045 {
00046 class CopyJob;
00047 class DeleteJob;
00048 }
00049 
00099 class KFILE_EXPORT KDirOperator : public QWidget
00100 {
00101     Q_OBJECT
00102 
00103 public:
00107     enum ActionType
00108     {
00109         SortActions =  1,
00110         ViewActions =  2,
00111         NavActions  =  4,
00112         FileActions =  8,
00113         AllActions  = 15
00114     };
00115 
00123     explicit KDirOperator(const KUrl& urlName = KUrl(),
00124                           QWidget *parent = 0);
00128     virtual ~KDirOperator();
00129 
00133     virtual void setShowHiddenFiles(bool s);
00134 
00138     bool showHiddenFiles() const;
00139 
00143     void close();
00144 
00152     void setNameFilter(const QString& filter);
00153 
00158     QString nameFilter() const;
00159 
00177     void setMimeFilter(const QStringList& mimetypes);
00178 
00182     QStringList mimeFilter() const;
00183 
00191     void clearFilter();
00192 
00196     KUrl url() const;
00197 
00203     virtual void setUrl(const KUrl& url, bool clearforward);
00204 
00209     void setCurrentItem(const QString& filename);
00210 
00215     void setCurrentItem(const KFileItem& item);
00216 
00224     virtual void setView(QAbstractItemView *view);
00225 
00230     QAbstractItemView* view() const;
00231 
00236     virtual void setView(KFile::FileView viewKind);
00237 
00241     void setSorting(QDir::SortFlags);
00242 
00246     QDir::SortFlags sorting() const;
00247 
00251     bool isRoot() const;
00252 
00256     KDirLister* dirLister() const;
00257 
00262     QProgressBar* progressBar() const;
00263 
00275     virtual void setMode(KFile::Modes m);
00279     KFile::Modes mode() const;
00280 
00286     virtual void setPreviewWidget(KPreviewWidgetBase *w);
00287 
00292     KFileItemList selectedItems() const;
00293 
00297     bool isSelected(const KFileItem &item) const;
00298 
00303     int numDirs() const;
00304 
00309     int numFiles() const;
00310 
00319     KCompletion* completionObject() const;
00320 
00329     KCompletion* dirCompletionObject() const;
00330 
00372     KActionCollection* actionCollection() const;
00373 
00392     virtual void setViewConfig(KConfigGroup& configGroup);
00393 
00394     /*
00395      * @returns the group set by setViewConfig configuration.
00396      */
00397     KConfigGroup* viewConfigGroup() const;
00398 
00412     virtual void readConfig(const KConfigGroup& configGroup);
00413 
00420     virtual void writeConfig(KConfigGroup& configGroup);
00421 
00432     void setOnlyDoubleClickSelectsFiles(bool enable);
00433 
00439     bool onlyDoubleClickSelectsFiles() const;
00440 
00449     virtual bool mkdir(const QString& directory, bool enterDirectory = true);
00450 
00459     virtual KIO::DeleteJob* del(const KFileItemList& items, QWidget *parent = 0,
00460                                 bool ask = true, bool showProgress = true);
00461 
00465     void clearHistory();
00466 
00476     virtual void setEnableDirHighlighting(bool enable);
00477 
00484     bool dirHighlighting() const;
00485 
00490     bool dirOnlyMode() const;
00491 
00492     static bool dirOnlyMode(uint mode);
00493 
00498     void setupMenu(int whichActions);
00499 
00504     virtual void setAcceptDrops(bool b);
00505 
00510     virtual void setDropOptions(int options);
00511 
00520     virtual KIO::CopyJob* trash(const KFileItemList& items, QWidget *parent,
00521                                 bool ask = true, bool showProgress = true);
00522 
00523 protected:
00533     virtual QAbstractItemView* createView(QWidget *parent, KFile::FileView viewKind);
00534 
00539     virtual void setDirLister(KDirLister *lister);
00540 
00541     virtual void resizeEvent(QResizeEvent *event);
00542 
00547     void setupActions();
00548 
00553     void updateSortActions();
00554 
00559     void updateViewActions();
00560 
00565     void setupMenu();
00566 
00574     void prepareCompletionObjects();
00575 
00581     bool checkPreviewSupport();
00582 
00586     virtual void activatedMenu(const KFileItem &item, const QPoint &pos);
00587 
00588     virtual void changeEvent(QEvent *event);
00589 
00590     virtual bool eventFilter(QObject *watched, QEvent *event);
00591 
00592 public Q_SLOTS:
00596     virtual void back();
00597 
00601     virtual void forward();
00602 
00606     virtual void home();
00607 
00611     virtual void cdUp();
00612 
00616     void updateDir();
00617 
00621     virtual void rereadDir();
00622 
00626     virtual void mkdir();
00627 
00631     virtual void deleteSelected();
00632 
00638     void updateSelectionDependentActions();
00639 
00643     QString makeCompletion(const QString&);
00644 
00648     QString makeDirCompletion(const QString&);
00649 
00659     virtual void trashSelected();
00660 
00661 protected Q_SLOTS:
00666     void resetCursor();
00667 
00672     void pathChanged();
00673 
00677     virtual void selectDir(const KFileItem &item);
00678 
00682     void selectFile(const KFileItem &item);
00683 
00687     void highlightFile(const KFileItem &item);
00688 
00692     void sortByName();
00693 
00697     void sortBySize();
00698 
00702     void sortByDate();
00703 
00707     void sortByType();
00708 
00712     void sortReversed();
00713 
00717     void toggleDirsFirst();
00718 
00722     void toggleIgnoreCase();
00723 
00728     void slotCompletionMatch(const QString &match);
00729 
00730 Q_SIGNALS:
00731     void urlEntered(const KUrl&);
00732     void updateInformation(int files, int dirs);
00733     void completion(const QString&);
00734     void finishedLoading();
00735 
00741     void viewChanged(QAbstractItemView *newView);
00742 
00748     void fileHighlighted(const KFileItem &item);
00749     void dirActivated(const KFileItem &item);
00750     void fileSelected(const KFileItem &item);
00758     void dropped(const KFileItem &item, QDropEvent *event, const KUrl::List &urls);
00759 
00760 private:
00761     class Private;
00762     Private* const d;
00763 
00764     Q_PRIVATE_SLOT( d, void _k_slotDetailedView() )
00765     Q_PRIVATE_SLOT( d, void _k_slotSimpleView() )
00766     Q_PRIVATE_SLOT( d, void _k_slotToggleHidden(bool) )
00767     Q_PRIVATE_SLOT( d, void _k_togglePreview(bool) )
00768     Q_PRIVATE_SLOT( d, void _k_slotSortByName() )
00769     Q_PRIVATE_SLOT( d, void _k_slotSortBySize() )
00770     Q_PRIVATE_SLOT( d, void _k_slotSortByDate() )
00771     Q_PRIVATE_SLOT( d, void _k_slotSortByType() )
00772     Q_PRIVATE_SLOT( d, void _k_slotSortReversed() )
00773     Q_PRIVATE_SLOT( d, void _k_slotToggleDirsFirst() )
00774     Q_PRIVATE_SLOT( d, void _k_slotToggleIgnoreCase() )
00775     Q_PRIVATE_SLOT( d, void _k_slotStarted() )
00776     Q_PRIVATE_SLOT( d, void _k_slotProgress(int) )
00777     Q_PRIVATE_SLOT( d, void _k_slotShowProgress() )
00778     Q_PRIVATE_SLOT( d, void _k_slotIOFinished() )
00779     Q_PRIVATE_SLOT( d, void _k_slotCanceled() )
00780     Q_PRIVATE_SLOT( d, void _k_slotRedirected(const KUrl&) )
00781     Q_PRIVATE_SLOT( d, void _k_slotProperties() )
00782     Q_PRIVATE_SLOT( d, void _k_slotPressed(const QModelIndex&) )
00783     Q_PRIVATE_SLOT( d, void _k_slotClicked(const QModelIndex&) )
00784     Q_PRIVATE_SLOT( d, void _k_slotActivated(const QModelIndex&) )
00785     Q_PRIVATE_SLOT( d, void _k_slotDoubleClicked(const QModelIndex&) )
00786     Q_PRIVATE_SLOT( d, void _k_slotSelectionChanged() )
00787     Q_PRIVATE_SLOT( d, void _k_openContextMenu(const QPoint&) )
00788     Q_PRIVATE_SLOT( d, void _k_triggerPreview(const QModelIndex&) )
00789     Q_PRIVATE_SLOT( d, void _k_showPreview() )
00790     Q_PRIVATE_SLOT( d, void _k_slotSplitterMoved(int, int) )
00791     Q_PRIVATE_SLOT( d, void _k_assureVisibleSelection() )
00792     Q_PRIVATE_SLOT( d, void _k_synchronizeSortingState(int, Qt::SortOrder) )
00793 };
00794 
00795 #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
  • 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