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

KIO

kdirlister.h

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright (C) 1999 David Faure <faure@kde.org>
00003                  2001, 2002, 2004-2006 Michael Brade <brade@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018    Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef kdirlister_h
00022 #define kdirlister_h
00023 
00024 #include "kfileitem.h"
00025 #include "kdirnotify.h"
00026 
00027 #include <QtCore/QString>
00028 #include <QtCore/QStringList>
00029 
00030 #include <kurl.h>
00031 
00032 class KJob;
00033 namespace KIO { class Job; class ListJob; }
00034 
00057 class KIO_EXPORT KDirLister : public QObject
00058 {
00059   friend class KDirListerCache;
00060 
00061   Q_OBJECT
00062   Q_PROPERTY( bool autoUpdate READ autoUpdate WRITE setAutoUpdate )
00063   Q_PROPERTY( bool showingDotFiles READ showingDotFiles WRITE setShowingDotFiles )
00064   Q_PROPERTY( bool dirOnlyMode READ dirOnlyMode WRITE setDirOnlyMode )
00065   Q_PROPERTY( bool autoErrorHandlingEnabled READ autoErrorHandlingEnabled )
00066   Q_PROPERTY( bool delayedMimeTypes READ delayedMimeTypes WRITE setDelayedMimeTypes )
00067   Q_PROPERTY( QString nameFilter READ nameFilter WRITE setNameFilter )
00068   Q_PROPERTY( QStringList mimeFilter READ mimeFilters WRITE setMimeFilter RESET clearMimeFilter )
00069 
00070 public:
00071   enum OpenUrlFlag
00072   {
00073     NoFlags = 0x0,   
00074 
00075     Keep = 0x1,      
00076 
00077 
00078 
00079 
00080     Reload = 0x2     
00081 
00082 
00083 
00084   };
00085 
00086   Q_DECLARE_FLAGS(OpenUrlFlags, OpenUrlFlag)
00087 
00088   
00091   KDirLister( QObject* parent = 0 );
00092 
00096   virtual ~KDirLister();
00097 
00114   virtual bool openUrl( const KUrl& _url, OpenUrlFlags _flags = NoFlags );
00115 
00123   virtual void stop();
00124 
00134   virtual void stop( const KUrl& _url );
00135 
00140   bool delayedMimeTypes() const;
00141 
00150   void setDelayedMimeTypes( bool delayedMimeTypes );
00151 
00152 
00158   bool autoUpdate() const;
00159 
00165   virtual void setAutoUpdate( bool enable );
00166 
00174   bool autoErrorHandlingEnabled() const;
00175 
00185   void setAutoErrorHandlingEnabled( bool enable, QWidget *parent );
00186 
00194   bool showingDotFiles() const;
00195 
00204   virtual void setShowingDotFiles( bool _showDotFiles );
00205 
00212   bool dirOnlyMode() const;
00213 
00219   virtual void setDirOnlyMode( bool dirsOnly );
00220 
00229   KUrl url() const;
00230 
00239   KUrl::List directories() const;
00240 
00245   virtual void emitChanges();
00246 
00258   virtual void updateDirectory( const KUrl& _dir );
00259 
00264   bool isFinished() const;
00265 
00272   KFileItem rootItem() const;
00273 
00279   virtual KFileItem findByUrl( const KUrl& _url ) const;
00280 
00286   virtual KFileItem findByName( const QString& name ) const;
00287 
00298   virtual void setNameFilter( const QString &filter );
00299 
00305   QString nameFilter() const;
00306 
00318   virtual void setMimeFilter( const QStringList &mimeList );
00319 
00334   void setMimeExcludeFilter(const QStringList &mimeList );
00335 
00336 
00342   virtual void clearMimeFilter();
00343 
00348   QStringList mimeFilters() const;
00349 
00356   bool matchesFilter( const QString& name ) const;
00357 
00365   bool matchesMimeFilter( const QString& mime ) const;
00366 
00372   void setMainWindow( QWidget *window );
00373 
00378   QWidget *mainWindow();
00379 
00384   enum WhichItems
00385   {
00386       AllItems = 0,
00387       FilteredItems = 1
00388   };
00389 
00406   KFileItemList items( WhichItems which = FilteredItems ) const;
00407 
00427   KFileItemList itemsForDir( const KUrl& dir,
00428                              WhichItems which = FilteredItems ) const;
00429 
00430 Q_SIGNALS:
00431 
00441   void started( const KUrl& _url );
00442 
00446   void completed();
00447 
00453   void completed( const KUrl& _url );
00454 
00458   void canceled();
00459 
00465   void canceled( const KUrl& _url );
00466 
00473   void redirection( const KUrl& _url );
00474 
00480   void redirection( const KUrl& oldUrl, const KUrl& newUrl );
00481 
00486   void clear();
00487 
00493   void clear( const KUrl& _url );
00494 
00501   void newItems( const KFileItemList& items );
00502 
00507   void itemsFilteredByMime( const KFileItemList& items );
00508 
00514   void deleteItem( const KFileItem &_fileItem );
00515 
00524   void refreshItems( const QList<QPair<KFileItem, KFileItem> >& items );
00525 
00531   void infoMessage( const QString& msg );
00532 
00538   void percent( int percent );
00539 
00544   void totalSize( KIO::filesize_t size );
00545 
00550   void processedSize( KIO::filesize_t size );
00551 
00556   void speed( int bytes_per_second );
00557 
00558 protected:
00559   enum Changes {
00560     NONE=0, NAME_FILTER=1, MIME_FILTER=2, DOT_FILES=4, DIR_ONLY_MODE=8
00561   };
00562 
00575   virtual bool matchesFilter( const KFileItem& ) const;
00576 
00589   virtual bool matchesMimeFilter( const KFileItem& ) const;
00590 
00598   virtual bool doNameFilter( const QString& name, const QList<QRegExp>& filters ) const;
00599 
00607   virtual bool doMimeFilter( const QString& mime, const QStringList& filters ) const;
00608 
00610   virtual void handleError( KIO::Job * );
00611 
00612 private:
00613   class Private;
00614   Private* const d;
00615   friend class Private;
00616 
00617   Q_PRIVATE_SLOT( d, void _k_slotInfoMessage( KJob*, const QString& ) )
00618   Q_PRIVATE_SLOT( d, void _k_slotPercent( KJob*, unsigned long ) )
00619   Q_PRIVATE_SLOT( d, void _k_slotTotalSize( KJob*, qulonglong ) )
00620   Q_PRIVATE_SLOT( d, void _k_slotProcessedSize( KJob*, qulonglong ) )
00621   Q_PRIVATE_SLOT( d, void _k_slotSpeed( KJob*, unsigned long ) )
00622 };
00623 
00624 Q_DECLARE_OPERATORS_FOR_FLAGS(KDirLister::OpenUrlFlags)
00625 
00626 #endif
00627 

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
  • 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