kdirlister.h Source File (kio Library)

| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | 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 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
    00054 class KDirLister : public QObject
    00055 {
    00056   class KDirListerPrivate;
    00057   friend class KDirListerPrivate;
    00058   friend class KDirListerCache;
    00059
    00060   Q_OBJECT
    00061   Q_PROPERTY( bool autoUpdate READ autoUpdate WRITE setAutoUpdate )
    00062   Q_PROPERTY( bool showingDotFiles READ showingDotFiles WRITE setShowingDotFiles )
    00063   Q_PROPERTY( bool dirOnlyMode READ dirOnlyMode WRITE setDirOnlyMode )
    00064   Q_PROPERTY( bool autoErrorHandlingEnabled READ autoErrorHandlingEnabled )
    00065   Q_PROPERTY( QString nameFilter READ nameFilter WRITE setNameFilter )
    00066   Q_PROPERTY( QStringList mimeFilter READ mimeFilters WRITE setMimeFilter RESET clearMimeFilter )
    00067 public:
    00073   KDirLister( bool _delayedMimeTypes = false );
    00074
    00078   virtual ~KDirLister();
    00079
    00102   virtual bool openURL( const KURL& _url, bool _keep = false, bool _reload = false );
    00103
    00111   virtual void stop();
    00112
    00122   virtual void stop( const KURL& _url );
    00123
    00129   bool autoUpdate() const;
    00130
    00136   virtual void setAutoUpdate( bool enable );
    00137
    00145   bool autoErrorHandlingEnabled() const;
    00146
    00156   void setAutoErrorHandlingEnabled( bool enable, QWidget* parent );
    00157
    00165   bool showingDotFiles() const;
    00166
    00175   virtual void setShowingDotFiles( bool _showDotFiles );
    00176
    00183   bool dirOnlyMode() const;
    00184
    00190   virtual void setDirOnlyMode( bool dirsOnly );
    00191
    00201   const KURL& url() const;
    00202
    00207   virtual void emitChanges();
    00208
    00220   virtual void updateDirectory( const KURL& _dir );
    00221
    00226   bool isFinished() const;
    00227
    00232   KFileItem* rootItem() const;
    00233
    00239   virtual KFileItem* findByURL( const KURL& _url ) const;
    00240 #ifndef KDE_NO_COMPAT
    00241   KFileItem* find( const KURL& _url ) const;
    00242 #endif
    00243
    00249   virtual KFileItem* findByName( const QString& name ) const;
    00250
    00261   virtual void setNameFilter( const QString &filter );
    00262
    00268   const QString& nameFilter() const;
    00269
    00281   virtual void setMimeFilter( const QStringList &mimeList );
    00282
    00298   void setMimeExcludeFilter(const QStringList &mimeList );
    00299
    00300
    00306   virtual void clearMimeFilter();
    00307
    00312   const QStringList& mimeFilters() const;
    00313
    00320   bool matchesFilter( const QString& name ) const;
    00321
    00329   bool matchesMimeFilter( const QString& mime ) const;
    00330
    00337   void setMainWindow(QWidget *window);
    00338
    00344   QWidget *mainWindow();
    00345
    00350   enum WhichItems
    00351   {
    00352       AllItems = 0,
    00353       FilteredItems = 1
    00354   };
    00355
    00374   KFileItemList items( WhichItems which = FilteredItems ) const;
    00375
    00396   KFileItemList itemsForDir( const KURL& dir,
    00397                              WhichItems which = FilteredItems ) const;
    00398
    00399 signals:
    00409   void started( const KURL& _url );
    00410
    00414   void completed();
    00415
    00422   void completed( const KURL& _url );
    00423
    00427   void canceled();
    00428
    00435   void canceled( const KURL& _url );
    00436
    00443   void redirection( const KURL& _url );
    00444
    00450   void redirection( const KURL& oldUrl, const KURL& newUrl );
    00451
    00456   void clear();
    00457
    00463   void clear( const KURL& _url );
    00464
    00469   void newItems( const KFileItemList& items );
    00470
    00475   void itemsFilteredByMime( const KFileItemList& items );
    00476
    00486   void deleteItem( KFileItem *_fileItem );
    00487
    00493   void refreshItems( const KFileItemList& items );
    00494
    00500   void infoMessage( const QString& msg );
    00501
    00507   void percent( int percent );
    00508
    00513   void totalSize( KIO::filesize_t size );
    00514
    00519   void processedSize( KIO::filesize_t size );
    00520
    00525   void speed( int bytes_per_second );
    00526
    00527 protected:
    00528   enum Changes {
    00529     NONE=0, NAME_FILTER=1, MIME_FILTER=2, DOT_FILES=4, DIR_ONLY_MODE=8
    00530   };
    00531
    00544   virtual bool matchesFilter( const KFileItem * ) const;
    00545
    00558   virtual bool matchesMimeFilter( const KFileItem * ) const;
    00559
    00567   virtual bool doNameFilter( const QString& name, const QPtrList<QRegExp>& filters ) const;
    00568
    00576   virtual bool doMimeFilter( const QString& mime, const QStringList& filters ) const;
    00577
    00581   bool doMimeExcludeFilter( const QString& mimeExclude, const QStringList& filters ) const;
    00582
    00588   virtual bool validURL( const KURL& ) const;
    00589
    00591   virtual void handleError( KIO::Job* );
    00592
    00593 protected:
    00594   virtual void virtual_hook( int id, void* data );
    00595
    00596 private slots:
    00597   void slotInfoMessage( KIO::Job *, const QString& );
    00598   void slotPercent( KIO::Job *, unsigned long );
    00599   void slotTotalSize( KIO::Job *, KIO::filesize_t );
    00600   void slotProcessedSize( KIO::Job *, KIO::filesize_t );
    00601   void slotSpeed( KIO::Job *, unsigned long );
    00602
    00603 private:
    00604   void jobDone( KIO::ListJob *);
    00605   void jobStarted( KIO::ListJob *);
    00606   uint numJobs();
    00607
    00608 private:
    00609   virtual void addNewItem( const KFileItem *item );
    00610   virtual void addNewItems( const KFileItemList& items );
    00611   virtual void addRefreshItem( const KFileItem *item );
    00612   virtual void emitItems();
    00613   virtual void emitDeleteItem( KFileItem *item );
    00614
    00615   KDirListerPrivate *d;
    00616 };
    00617
    00618 #endif
    00619

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:13:21 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001