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

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

# kfileview.h

    00001 // -*- c++ -*-
    00002 /* This file is part of the KDE libraries
    00003     Copyright (C) 1997 Stephan Kulow <coolo@kde.org>
    00004     Copyright (C) 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., 59 Temple Place - Suite 330,
    00019     Boston, MA 02111-1307, USA.
    00020 */
    00021
    00022 #ifndef KFILEVIEW_H
    00023 #define KFILEVIEW_H
    00024
    00025 class QPoint;
    00026 class KActionCollection;
    00027
    00028 #include <qwidget.h>
    00029
    00030 #include "kfileitem.h"
    00031 #include "kfile.h"
    00032
    00037 class KIO_EXPORT KFileViewSignaler : public QObject
    00038 {
    00039     Q_OBJECT
    00040
    00041 public:
    00046     void activate( const KFileItem *item ) {
    00047         if ( item->isDir() )
    00048             emit dirActivated( item );
    00049         else
    00050             emit fileSelected( item );
    00051     }
    00056     void highlightFile(const KFileItem *i) { emit fileHighlighted(i); }
    00057
    00058     void activateMenu( const KFileItem *i, const QPoint& pos ) {
    00059         emit activatedMenu( i, pos );
    00060     }
    00061
    00062     void changeSorting( QDir::SortSpec sorting ) {
    00063         emit sortingChanged( sorting );
    00064     }
    00065
    00066     void dropURLs(const KFileItem *i, QDropEvent*e, const KURL::List&urls) {
    00067         emit dropped(i, e, urls);
    00068     }
    00069
    00070 signals:
    00071     void dirActivated(const KFileItem*);
    00072
    00073     void sortingChanged( QDir::SortSpec );
    00074
    00079     void fileHighlighted(const KFileItem*);
    00080     void fileSelected(const KFileItem*);
    00081     void activatedMenu( const KFileItem *i, const QPoint& );
    00082     void dropped(const KFileItem *, QDropEvent*, const KURL::List&);
    00083 };
    00084
    00098 class KIO_EXPORT KFileView {
    00099
    00100 public:
    00101     KFileView();
    00102
    00106     virtual ~KFileView();
    00107
    00111     void addItemList(const KFileItemList &list);
    00112
    00118     virtual QWidget *widget() = 0;
    00119
    00123     QWidget *widget() const { return const_cast<KFileView*>(this)->widget(); }
    00124
    00128     void setCurrentItem( const QString &filename );
    00129
    00134     virtual void setCurrentItem( const KFileItem *item ) = 0;
    00135
    00141     virtual KFileItem *currentFileItem() const = 0;
    00142
    00146     virtual void clear();
    00147
    00156     virtual void updateView(bool f = true);
    00157
    00158     virtual void updateView(const KFileItem*);
    00159
    00164     virtual void removeItem(const KFileItem *item);
    00165
    00171     virtual void listingCompleted();
    00172
    00177     QDir::SortSpec sorting() const { return m_sorting; }
    00178
    00193     virtual void setSorting(QDir::SortSpec sort);
    00194
    00199     bool isReversed() const { return (m_sorting & QDir::Reversed); }
    00200
    00201     void sortReversed();
    00202
    00206     uint count() const { return filesNumber + dirsNumber; }
    00207
    00211     uint numFiles() const { return filesNumber; }
    00212
    00216     uint numDirs() const { return dirsNumber; }
    00217
    00218     virtual void setSelectionMode( KFile::SelectionMode sm );
    00219     virtual KFile::SelectionMode selectionMode() const;
    00220
    00221     enum ViewMode {
    00222     Files       = 1,
    00223     Directories = 2,
    00224     All = Files | Directories
    00225     };
    00226     virtual void setViewMode( ViewMode vm );
    00227     virtual ViewMode viewMode() const { return view_mode; }
    00228
    00234     QString viewName() const { return m_viewName; }
    00235
    00240     void setViewName( const QString& name ) { m_viewName = name; }
    00241
    00242     virtual void setParentView(KFileView *parent);
    00243
    00252     virtual void insertItem( KFileItem *i);
    00253
    00258     virtual void clearView() = 0;
    00259
    00264     virtual void ensureItemVisible( const KFileItem *i ) = 0;
    00265
    00270     virtual void clearSelection() = 0;
    00271
    00277     virtual void selectAll();
    00278
    00283     virtual void invertSelection();
    00284
    00289     virtual void setSelected(const KFileItem *, bool enable) = 0;
    00290
    00295     virtual bool isSelected( const KFileItem * ) const = 0;
    00296
    00300     const KFileItemList * selectedItems() const;
    00301
    00305     const KFileItemList * items() const;
    00306
    00307     virtual KFileItem * firstFileItem() const = 0;
    00308     virtual KFileItem * nextItem( const KFileItem * ) const = 0;
    00309     virtual KFileItem * prevItem( const KFileItem * ) const = 0;
    00310
    00321     void setOnlyDoubleClickSelectsFiles( bool enable ) {
    00322     myOnlyDoubleClickSelectsFiles = enable;
    00323     }
    00324
    00330     bool onlyDoubleClickSelectsFiles() const {
    00331     return myOnlyDoubleClickSelectsFiles;
    00332     }
    00333
    00338     bool updateNumbers(const KFileItem *i);
    00339
    00345     virtual KActionCollection * actionCollection() const;
    00346
    00347     KFileViewSignaler * signaler() const { return sig; }
    00348
    00349     virtual void readConfig( KConfig *, const QString& group = QString::null );
    00350     virtual void writeConfig( KConfig *, const QString& group = QString::null);
    00351
    00359     enum DropOptions {
    00360     AutoOpenDirs  = 1
    00361     };
    00367     // KDE 4: Make virtual
    00368     void setDropOptions(int options);
    00369
    00375     int dropOptions();
    00376
    00390     static QString sortingKey( const QString& value, bool isDir, int sortSpec);
    00391
    00398     static QString sortingKey( KIO::filesize_t value, bool isDir,int sortSpec);
    00399
    00404     static int autoOpenDelay();
    00405
    00406 protected:
    00411     KFileViewSignaler *sig;
    00412
    00413 private:
    00414     static QDir::SortSpec defaultSortSpec;
    00415     QDir::SortSpec m_sorting;
    00416     QString m_viewName;
    00417
    00421     uint filesNumber;
    00422     uint dirsNumber;
    00423
    00424     ViewMode view_mode;
    00425     KFile::SelectionMode selection_mode;
    00426
    00427     // never use! It's only guaranteed to contain valid items in the items()
    00428     // method!
    00429     mutable KFileItemList m_itemList;
    00430
    00431     mutable KFileItemList *m_selectedList;
    00432     bool myOnlyDoubleClickSelectsFiles;
    00433
    00434 protected:
    00435     virtual void virtual_hook( int id, void* data );
    00436     /* @internal for virtual_hook */
    00437     enum { VIRTUAL_SET_DROP_OPTIONS = 1 };
    00438     void setDropOptions_impl(int options);
    00439 private:
    00440     class KFileViewPrivate;
    00441     KFileViewPrivate *d;
    00442 };
    00443
    00444 #endif // KFILEINFOLISTWIDGET_H

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:59 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003