kio Library: kdirlister.h Source File (kio Library)

| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kdirlister.h

    00001 /* This file is part of the KDE project
    00002    Copyright (C) 1999 David Faure <faure@kde.org>
    00003                  2001, 2002, 2004, 2005 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., 59 Temple Place - Suite 330,
    00018    Boston, MA 02111-1307, USA.
    00019 */
    00020
    00021 #ifndef kdirlister_h
    00022 #define kdirlister_h
    00023
    00024 #include "kfileitem.h"
    00025 #include "kdirnotify.h"
    00026
    00027 #include <qstring.h>
    00028 #include <qstringlist.h>
    00029
    00030 #include <kurl.h>
    00031
    00032 namespace KIO { class Job; class ListJob; }
    00033
    00055 class KIO_EXPORT KDirLister : public QObject
    00056 {
    00057   class KDirListerPrivate;
    00058   friend class KDirListerPrivate;
    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( QString nameFilter READ nameFilter WRITE setNameFilter )
    00067   Q_PROPERTY( QStringList mimeFilter READ mimeFilters WRITE setMimeFilter RESET clearMimeFilter )
    00068
    00069 public:
    00075   KDirLister( bool _delayedMimeTypes = false );
    00076
    00080   virtual ~KDirLister();
    00081
    00105   virtual bool openURL( const KURL& _url, bool _keep = false, bool _reload = false );
    00106
    00114   virtual void stop();
    00115
    00125   virtual void stop( const KURL& _url );
    00126
    00132   bool autoUpdate() const;
    00133
    00139   virtual void setAutoUpdate( bool enable );
    00140
    00148   bool autoErrorHandlingEnabled() const;
    00149
    00159   void setAutoErrorHandlingEnabled( bool enable, QWidget *parent );
    00160
    00168   bool showingDotFiles() const;
    00169
    00178   virtual void setShowingDotFiles( bool _showDotFiles );
    00179
    00186   bool dirOnlyMode() const;
    00187
    00193   virtual void setDirOnlyMode( bool dirsOnly );
    00194
    00203   const KURL& url() const;
    00204
    00214   const KURL::List& directories() const;
    00215
    00220   virtual void emitChanges();
    00221
    00233   virtual void updateDirectory( const KURL& _dir );
    00234
    00239   bool isFinished() const;
    00240
    00245   KFileItem *rootItem() const;
    00246
    00252   virtual KFileItem *findByURL( const KURL& _url ) const;
    00253 #ifndef KDE_NO_COMPAT
    00254   KFileItem *find( const KURL& _url ) const;
    00255 #endif
    00256
    00262   virtual KFileItem *findByName( const QString& name ) const;
    00263
    00274   virtual void setNameFilter( const QString &filter );
    00275
    00281   const QString& nameFilter() const;
    00282
    00294   virtual void setMimeFilter( const QStringList &mimeList );
    00295
    00311   void setMimeExcludeFilter(const QStringList &mimeList );
    00312
    00313
    00319   virtual void clearMimeFilter();
    00320
    00325   const QStringList& mimeFilters() const;
    00326
    00333   bool matchesFilter( const QString& name ) const;
    00334
    00342   bool matchesMimeFilter( const QString& mime ) const;
    00343
    00350   void setMainWindow( QWidget *window );
    00351
    00357   QWidget *mainWindow();
    00358
    00363   enum WhichItems
    00364   {
    00365       AllItems = 0,
    00366       FilteredItems = 1
    00367   };
    00368
    00386   KFileItemList items( WhichItems which = FilteredItems ) const;
    00387
    00408   KFileItemList itemsForDir( const KURL& dir,
    00409                              WhichItems which = FilteredItems ) const;
    00410
    00411 signals:
    00421   void started( const KURL& _url );
    00422
    00426   void completed();
    00427
    00434   void completed( const KURL& _url );
    00435
    00439   void canceled();
    00440
    00447   void canceled( const KURL& _url );
    00448
    00455   void redirection( const KURL& _url );
    00456
    00462   void redirection( const KURL& oldUrl, const KURL& newUrl );
    00463
    00468   void clear();
    00469
    00475   void clear( const KURL& _url );
    00476
    00481   void newItems( const KFileItemList& items );
    00482
    00487   void itemsFilteredByMime( const KFileItemList& items );
    00488
    00498   void deleteItem( KFileItem *_fileItem );
    00499
    00505   void refreshItems( const KFileItemList& items );
    00506
    00512   void infoMessage( const QString& msg );
    00513
    00519   void percent( int percent );
    00520
    00525   void totalSize( KIO::filesize_t size );
    00526
    00531   void processedSize( KIO::filesize_t size );
    00532
    00537   void speed( int bytes_per_second );
    00538
    00539 protected:
    00540   enum Changes {
    00541     NONE=0, NAME_FILTER=1, MIME_FILTER=2, DOT_FILES=4, DIR_ONLY_MODE=8
    00542   };
    00543
    00556   virtual bool matchesFilter( const KFileItem * ) const;
    00557
    00570   virtual bool matchesMimeFilter( const KFileItem * ) const;
    00571
    00579   virtual bool doNameFilter( const QString& name, const QPtrList<QRegExp>& filters ) const;
    00580
    00588   virtual bool doMimeFilter( const QString& mime, const QStringList& filters ) const;
    00589
    00593   bool doMimeExcludeFilter( const QString& mimeExclude, const QStringList& filters ) const;
    00594
    00600   virtual bool validURL( const KURL& ) const;
    00601
    00603   virtual void handleError( KIO::Job * );
    00604
    00605 protected:
    00606   virtual void virtual_hook( int id, void *data );
    00607
    00608 private slots:
    00609   void slotInfoMessage( KIO::Job *, const QString& );
    00610   void slotPercent( KIO::Job *, unsigned long );
    00611   void slotTotalSize( KIO::Job *, KIO::filesize_t );
    00612   void slotProcessedSize( KIO::Job *, KIO::filesize_t );
    00613   void slotSpeed( KIO::Job *, unsigned long );
    00614
    00615 private:
    00616   void jobStarted( KIO::ListJob * );
    00617   void connectJob( KIO::ListJob * );
    00618   void jobDone( KIO::ListJob * );
    00619
    00620   uint numJobs();
    00621
    00622 private:
    00623   virtual void addNewItem( const KFileItem *item );
    00624   virtual void addNewItems( const KFileItemList& items );
    00625   /*virtual*/ void aboutToRefreshItem( const KFileItem *item );  // TODO: KDE 4.0 make virtual
    00626   virtual void addRefreshItem( const KFileItem *item );
    00627   virtual void emitItems();
    00628   virtual void emitDeleteItem( KFileItem *item );
    00629
    00630   KDirListerPrivate *d;
    00631 };
    00632
    00633 #endif
    00634

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:23:56 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003