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

KIO

kdirmodel.h

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2006 David Faure <faure@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 #ifndef KDIRMODEL_H
00020 #define KDIRMODEL_H
00021 
00022 #include <QtCore/QAbstractItemModel>
00023 #include <kio/kio_export.h>
00024 #include <kfileitem.h>
00025 
00026 class KDirLister;
00027 class KDirModelPrivate;
00028 
00047 class KIO_EXPORT KDirModel : public QAbstractItemModel
00048 {
00049     Q_OBJECT
00050 
00051 public:
00055     explicit KDirModel( QObject* parent = 0 );
00056     ~KDirModel();
00057 
00062     void setDirLister( KDirLister* dirLister );
00063 
00067     KDirLister* dirLister() const;
00068 
00072     KFileItem itemForIndex( const QModelIndex& index ) const;
00073 
00078     KDE_DEPRECATED QModelIndex indexForItem( const KFileItem* ) const;
00079 
00083     QModelIndex indexForItem( const KFileItem& ) const;
00084 
00088     QModelIndex indexForUrl(const KUrl& url) const;
00089 
00103     void expandToUrl(const KUrl& url);
00104 
00111     void itemChanged( const QModelIndex& index );
00112 
00113     /***
00114      * Useful "default" columns. Views can use a proxy to have more control over this.
00115      */
00116     enum ModelColumns {
00117         Name = 0,
00118         Size,
00119         ModifiedTime,
00120         Permissions,
00121         Owner,
00122         Group,
00123         Type,
00124         ColumnCount
00125     };
00126 
00129     enum { ChildCountUnknown = -1 };
00130 
00131     enum AdditionalRoles {
00132         // Note: use   printf "0x%08X\n" $(($RANDOM*$RANDOM))
00133         // to define additional roles.
00134         FileItemRole = 0x07A263FF,  
00135         ChildCountRole = 0x2C4D0A40 
00136     };
00137 
00138     enum DropsAllowedFlag {
00139         NoDrops = 0,
00140         DropOnDirectory = 1, 
00141         DropOnAnyFile = 2, 
00142         DropOnLocalExecutable = 4 
00143     };
00144     Q_DECLARE_FLAGS(DropsAllowed, DropsAllowedFlag)
00145 
00146     
00147 
00148     void setDropsAllowed(DropsAllowed dropsAllowed);
00149 
00151     virtual bool canFetchMore ( const QModelIndex & parent ) const;
00153     virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
00155     virtual QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
00157     virtual bool dropMimeData ( const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent );
00159     virtual void fetchMore ( const QModelIndex & parent );
00161     virtual Qt::ItemFlags flags ( const QModelIndex & index ) const;
00163     virtual bool hasChildren ( const QModelIndex & parent = QModelIndex() ) const;
00165     virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
00167     virtual QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
00169     virtual QMimeData * mimeData ( const QModelIndexList & indexes ) const;
00171     virtual QStringList mimeTypes () const;
00173     virtual QModelIndex parent ( const QModelIndex & index ) const;
00175     virtual int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
00178     virtual bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole );
00180     virtual void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder );
00181 
00182 
00193     static KUrl::List simplifiedUrlList( const KUrl::List & urls );
00194 
00206     void requestSequenceIcon(const QModelIndex& index, int sequenceIndex);
00207     
00208 Q_SIGNALS:
00215     void expand(const QModelIndex& index);
00225     void needSequenceIcon(const QModelIndex& index, int sequenceIndex);
00226 
00227 private:
00228     // Make those private, they shouldn't be called by applications
00229     virtual bool insertRows(int , int, const QModelIndex & = QModelIndex());
00230     virtual bool insertColumns(int, int, const QModelIndex & = QModelIndex());
00231     virtual bool removeRows(int, int, const QModelIndex & = QModelIndex());
00232     virtual bool removeColumns(int, int, const QModelIndex & = QModelIndex());
00233 
00234 private:
00235     friend class KDirModelPrivate;
00236     KDirModelPrivate *const d;
00237 
00238     Q_PRIVATE_SLOT( d, void _k_slotNewItems(const KUrl&, const KFileItemList&) )
00239     Q_PRIVATE_SLOT( d, void _k_slotDeleteItems(const KFileItemList&) )
00240     Q_PRIVATE_SLOT( d, void _k_slotRefreshItems(const QList<QPair<KFileItem, KFileItem> >&) )
00241     Q_PRIVATE_SLOT( d, void _k_slotClear() )
00242     Q_PRIVATE_SLOT( d, void _k_slotRedirection(const KUrl&, const KUrl&) )
00243 };
00244 
00245 Q_DECLARE_OPERATORS_FOR_FLAGS(KDirModel::DropsAllowed)
00246 
00247 #endif /* KDIRMODEL_H */

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • 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
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
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